From: cvs2git Date: Thu, 11 Dec 2008 19:44:31 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create tag 'buildscript'. X-Git-Tag: buildscript X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=refs%2Ftags%2Fbuildscript This commit was manufactured by cvs2svn to create tag 'buildscript'. --- cdcf09c40af1419fa42932aae249cb79b69b5daf diff --cc CVSROOT/checkoutlist index a3a6ff75,a3a6ff75,a3a6ff75,a3a6ff75,a3a6ff75,a3a6ff75,a3a6ff75..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/checkoutlist +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------# The "checkoutlist" file is used to support additional version controlled -------# administrative files in $CVSROOT/CVSROOT, such as template files. -------# -------# The first entry on a line is a filename which will be checked out from -------# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -------# The remainder of the line is an error message to use if the file cannot -------# be checked out. -------# -------# File format: -------# -------# [][] -------# -------# comment lines begin with '#' -------cvslog -------cvsprep ------- ------- diff --cc CVSROOT/commitinfo index a2ad9714,a2ad9714,a2ad9714,a2ad9714,a2ad9714,a2ad9714,a2ad9714..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/commitinfo +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 +1,0 @@@@@@@@ -------# The "commitinfo" file is used to control pre-commit checks. -------# The filter on the right is invoked with the repository and a list -------# of files to check. A non-zero exit of the filter program will -------# cause the commit to be aborted. -------# -------# The first entry on a line is a regular expression which is tested -------# against the directory that the change is being committed to, relative -------# to the $CVSROOT. For the first match that is found, then the remainder -------# of the line is the name of the filter to run. -------# -------# Format strings present in the filter will be replaced as follows: -------# %p = path relative to repository -------# %r = repository (path portion of $CVSROOT) -------# %{s} = file name, file name, ... -------# -------# If no format strings are present in the filter string, a default of -------# " %r %s" will be appended to the filter string, but this usage is -------# deprecated. -------# -------# If the repository name does not match any of the regular expressions in this -------# file, the "DEFAULT" line is used, if it is specified. -------# -------# If the name "ALL" appears as a regular expression it is always used -------# in addition to the first matching regex or "DEFAULT". -------#ALL $CVSROOT/CVSROOT/commit_prep -u -r -------DEFAULT $CVSROOT/CVSROOT/cvsprep -- %r/%p diff --cc CVSROOT/config index 6843aa18,6843aa18,6843aa18,6843aa18,6843aa18,6843aa18,6843aa18..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/config +++ /dev/null @@@@@@@@ -1,37 -1,37 -1,37 -1,37 -1,37 -1,37 -1,37 +1,0 @@@@@@@@ -------# Set this to "no" if pserver shouldn't check system users/passwords -------#SystemAuth=no ------- -------# Put CVS lock files in this directory rather than directly in the repository. -------LockDir=/var/lock ------- -------# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -------# level of the new working directory when using the `cvs checkout' -------# command. -------#TopLevelAdmin=no ------- -------# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the -------# history file, or a subset as needed (ie `TMAR' logs all write operations) -------#LogHistory=TOEFWUPCGMAR ------- -------# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg -------# script to change the log message. Set it to `stat' to force CVS to verify -------# that the file has changed before reading it (this can take up to an extra -------# second per directory being committed, so it is not recommended for large -------# repositories. Set it to `never' (the previous CVS behavior) to prevent -------# verifymsg scripts from changing the log message. -------#RereadLogAfterVerify=always ------- -------# Set `UserAdminOptions' to the list of `cvs admin' commands (options) -------# that users not in the `cvsadmin' group are allowed to run. This -------# defaults to `k', or only allowing the changing of the default -------# keyword expansion mode for files for users not in the `cvsadmin' group. -------# This value is ignored if the `cvsadmin' group does not exist. -------# -------# The following string would enable all `cvs admin' commands for all -------# users: -------#UserAdminOptions=aAbceIklLmnNostuU ------- -------# Set `UseNewInfoFmtStrings' to `no' if you must support a legacy system by -------# enabling the deprecated old style info file command line format strings. -------# Be warned that these strings could be disabled in any new version of CVS. -------UseNewInfoFmtStrings=yes diff --cc CVSROOT/cvslog index 373f7cd9,373f7cd9,373f7cd9,373f7cd9,373f7cd9,373f7cd9,373f7cd9..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/CVSROOT/cvslog +++ /dev/null @@@@@@@@ -1,1417 -1,1417 -1,1417 -1,1417 -1,1417 -1,1417 -1,1417 +1,0 @@@@@@@@ -------#!/usr/bin/perl -w -------$ID = q(cvslog,v 1.51 2005/04/16 22:39:39 eagle Exp ); -------# -------# cvslog -- Mail CVS commit notifications. -------# -------# Written by Russ Allbery -------# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 -------# Board of Trustees, Leland Stanford Jr. University -------# -------# This program is free software; you can redistribute it and/or modify it -------# under the same terms as Perl itself. ------- -------############################################################################## -------# Modules and declarations -------############################################################################## ------- -------# The path to the repository. If your platform or CVS implementation doesn't -------# pass the full path to the cvslog script in $0 (or if your cvslog script -------# isn't in the CVSROOT directory of your repository for some reason), you will -------# need to explicitly set $REPOSITORY to the root directory of your repository -------# (the same thing that you would set CVSROOT to). -------($REPOSITORY) = ($0 =~ m%^(.*)/CVSROOT/cvslog$%); -------$REPOSITORY ||= ''; ------- -------require 5.004; ------- -------use Getopt::Long qw(GetOptions); -------use IPC::Open2 qw(open2); -------use POSIX qw(SEEK_SET strftime); ------- -------use strict; -------use vars qw($DEBUG $ID $REPOSITORY); ------- -------# Clean up $0 for errors. -------$0 =~ s%^.*/%%; ------- -------############################################################################## -------# Utility functions -------############################################################################## ------- -------# Given a prefix and a reference to an array, return a list of all strings in -------# that array with the common prefix stripped off. Also strip off any leading -------# ./ if present. -------sub simplify { ------- my ($prefix, $list) = @_; ------- my @stripped = @$list; ------- for (@stripped) { ------- s%^\Q$prefix\E/*%%; ------- s%^\./+%%; ------- } ------- return @stripped; -------} ------- -------# Return the next version for a CVS version, incrementing the last number. -------sub next_version { ------- my $version = shift; ------- my @version = split (/\./, $version); ------- $version[-1]++; ------- return join ('.', @version); -------} ------- -------# Given a directory name, find the corresponding CVS module. We do this by -------# looking in the modules file, finding the last "word" on each line, making -------# sure it contains a / (and is therefore assumed to be a directory), and -------# seeing if it's a prefix of the module path. -------sub find_module { ------- my $module = shift; ------- if (open (MODULES, "$REPOSITORY/CVSROOT/modules")) { ------- local $_; ------- while () { ------- next if /^\s*\#/; ------- next if /^\s*$/; ------- my ($name, @rest) = split; ------- my $path = pop @rest; ------- next unless ($path =~ m%/%); ------- if ($module =~ s%^$path(\Z|/)%%) { ------- $module = '/' . $module if $module; ------- $module = "<$name>$module"; ------- last; ------- } ------- } ------- close MODULES; ------- } ------- return $module; -------} ------- -------############################################################################## -------# Multidirectory commit I/O -------############################################################################## ------- -------# Recalculate the file prefix and module after having loaded a new set of -------# data. We do this by starting with the prefix from the last set of data and -------# then stripping off one directory at a time until we find something that is a -------# common prefix of every affected file. -------sub recalculate_prefix { ------- my $data = shift; ------- my $prefix = $$data{prefix}; ------- for (keys %{ $$data{files} }) { ------- while ($prefix && index ($_, $prefix) != 0) { ------- $prefix =~ s%/*([^/]+)$%%; ------- my $last = $1; ------- $$data{repository} =~ s%/*\Q$last\E$%%; ------- $$data{localpath} =~ s%/*\Q$last\E$%%; ------- } ------- } ------- $$data{prefix} = $prefix; ------- $$data{module} = find_module $prefix; -------} ------- -------# Build the directory in which we'll find our data. -------sub build_tmpdir { ------- my $tmpdir = $ENV{TMPDIR} || '/tmp'; ------- $tmpdir .= '/cvs.' . $< . '.' . getpgrp; ------- return $tmpdir; -------} ------- -------# Delete all of the accumulated data for multidirectory commits. -------sub cleanup_data { ------- my $tmpdir = build_tmpdir; ------- unless (opendir (D, $tmpdir)) { ------- warn "$0: can't open $tmpdir: $!\n"; ------- return; ------- } ------- for (grep { $_ ne '.' && $_ ne '..' } readdir D) { ------- unlink "$tmpdir/$_"; ------- } ------- closedir D; ------- rmdir $tmpdir or warn "$0: can't remove $tmpdir: $!\n"; -------} ------- -------# Read the file containing the last directory noticed by the commitinfo script -------# and return that directory name. -------sub read_lastdir { ------- my $tmpdir = build_tmpdir; ------- my $last; ------- if (!-l $tmpdir && -d _ && (lstat _)[4] == $<) { ------- if (open (LAST, $tmpdir . '/directory')) { ------- $last = ; ------- chomp $last; ------- close LAST; ------- } ------- } ------- return $last; -------} ------- -------# Read in a list of files with revisions, one per line, and fill in the -------# provided hashes. The first one gets the file information put into its files -------# key, and the second gets lists of added, removed, and modified files. -------# Returns success or failure. -------sub read_files { ------- my ($file, $data, $message) = @_; ------- unless (open (FILES, $file)) { ------- warn "$0: can't open $file: $!\n"; ------- return; ------- } ------- my (@added, @removed, @modified); ------- local $_; ------- while () { ------- chomp; ------- my ($name, $old, $new) = /^(.*),([^,]+),([^,]+)$/; ------- next unless $new; ------- $$data{files}{$name} = [ $old, $new ]; ------- if ($old eq 'NONE') { push (@added, $name) } ------- elsif ($new eq 'NONE') { push (@removed, $name) } ------- else { push (@modified, $name) } ------- } ------- close FILES; ------- $$message{added} = [ @added ]; ------- $$message{removed} = [ @removed ]; ------- $$message{modified} = [ @modified ]; ------- return 1; -------} ------- -------# Read in message text from a file and put it in the provided hash. -------sub read_text { ------- my ($file, $message) = @_; ------- my @text; ------- if (open (TEXT, $file)) { ------- @text = ; ------- close TEXT; ------- } ------- $$message{text} = [ @text ]; -------} ------- -------# Given a list of message hashes and a new one, merge the new one into the -------# list. This is done by checking its commit message against the existing ones -------# and merging the list of affected files if a match is found. If a match -------# isn't found, the new message is appended to the end of the list. -------sub merge_message { ------- my ($list, $message) = @_; ------- my $done; ------- for (@$list) { ------- if ("@{ $$_{text} }" eq "@{ $$message{text} }") { ------- push (@{ $$_{added} }, @{ $$message{added} }); ------- push (@{ $$_{removed} }, @{ $$message{removed} }); ------- push (@{ $$_{modified} }, @{ $$message{modified} }); ------- $done = 1; ------- } ------- } ------- push (@$list, $message) unless $done; -------} ------- -------# Read in saved data from previous directories. This involves reading in its -------# affected files and its commit message, merging this with the previous list -------# of affected files and commit messages, and then recalculating the common -------# prefix for all the files and deleting all the data we read in. -------sub read_data { ------- my $data = shift; ------- my $tmpdir = build_tmpdir; ------- $$data{messages} = []; ------- for (my $i = 1; -f "$tmpdir/files.$i"; $i++) { ------- my %message; ------- read_files ("$tmpdir/files.$i", $data, \%message); ------- read_text ("$tmpdir/text.$i", \%message); ------- merge_message ($$data{messages}, \%message); ------- } ------- merge_message ($$data{messages}, $$data{message}); ------- recalculate_prefix ($data); ------- cleanup_data; -------} ------- -------# Save data for the files modified in this invocation to be picked up later. -------sub save_data { ------- my $data = shift; ------- my $tmpdir = build_tmpdir; ------- if (-l $tmpdir || !-d _ || (lstat _)[4] != $<) { ------- warn "$0: invalid directory $tmpdir\n"; ------- return undef; ------- } ------- my $i = 1; ------- $i++ while -f "$tmpdir/files.$i"; ------- unless (open (FILES, "> $tmpdir/files.$i") ------- && open (TEXT, "> $tmpdir/text.$i")) { ------- warn "$0: can't save to $tmpdir/files: $!\n"; ------- return undef; ------- } ------- for (keys %{ $$data{files} }) { ------- my ($old, $new) = @{ $$data{files}{$_} }; ------- print FILES join (',', $_, $old, $new), "\n"; ------- } ------- print TEXT @{ $$data{message}{text} }; ------- unless (close (FILES) && close (TEXT)) { ------- warn "$0: can't save to $tmpdir/files: $!\n"; ------- return undef; ------- } -------} ------- -------############################################################################## -------# Parsing functions -------############################################################################## ------- -------# Split apart the file names that are passed to cvslog. Unfortunately, CVS -------# passes all the affected files as one string rather than as separate -------# arguments, which means that file names that contain spaces and commas pose -------# problems. Returns the path in the repository and then a list of files with -------# attached version information; that list may be just a couple of special-case -------# strings indicating a cvs add of a directory or a cvs import. -------# -------# The complexity here is purely the fault of CVS, which doesn't have a good -------# interface to logging hooks. -------sub split_files { ------- my ($files) = @_; ------- ------- # This ugly hack is here to deal with files at the top level of the ------- # repository; CVS reports those files without including a directory ------- # before the file list. Check to see if what would normally be the ------- # directory name looks more like a file with revisions. ------- my ($root, $rest) = split (' ', $files, 2); ------- if ($rest && $root !~ /(,(\d+(\.\d+)*|NONE)){2}$/) { ------- $files = $rest; ------- } else { ------- $root = '.'; ------- } ------- ------- # Special-case directory adds and imports. ------- if ($files =~ /^- New directory(,NONE,NONE)?$/) { ------- return ($root, 'directory'); ------- } elsif ($files =~ /^- Imported sources(,NONE,NONE)?$/) { ------- return ($root, 'import'); ------- } ------- ------- # Now, split apart $files, which contains just the files, at the spaces ------- # after version information. ------- my @files; ------- while ($files =~ s/^((?:.*?)(?:,(?:\d+(?:\.\d+)*|NONE)){2})( |\z)//) { ------- push (@files, $1); ------- } ------- push (@files, $files) if $files; ------- return ($root, 'commit', @files); -------} ------- -------# Given the summary line passed to the script, parse it into file names and -------# version numbers (if available). Takes the log information hash and adds a -------# key for the type of change (directory, import, or commit) and for commits a -------# hash of file names with values being a list of the previous and the now- -------# current version number. Also finds the module and stores that in the hash. -------# -------# The path in the repository (the first argument) is prepended to all of the -------# file names; we'll pull off the common prefix later. -------sub parse_files { ------- my ($data, @args) = @_; ------- my ($directory, $type, @files); ------- if (@args == 1) { ------- ($directory, $type, @files) = split_files ($args[0]); ------- if ($type eq 'commit') { ------- @files = map { [ /^(.*),([^,]+),([^,]+)$/ ] } @files; ------- } ------- } else { ------- $directory = shift @args; ------- if ($args[0] eq '- New directory') { ------- $type = 'directory'; ------- } elsif ($args[0] eq '- Imported sources') { ------- $type = 'import'; ------- } else { ------- $type = 'commit'; ------- while (@args) { ------- push (@files, [ splice (@args, 0, 3) ]); ------- } ------- } ------- } ------- die "$0: no module given by CVS (no \%{sVv}?)\n" unless $directory; ------- $$data{prefix} = $directory; ------- $$data{module} = find_module $directory; ------- $$data{message}{added} ||= []; ------- $$data{message}{modified} ||= []; ------- $$data{message}{removed} ||= []; ------- if ($type eq 'directory') { ------- $$data{type} = 'directory'; ------- $$data{root} = $directory; ------- } elsif ($type eq 'import') { ------- $$data{type} = 'import'; ------- $$data{root} = $directory; ------- } elsif (!@files) { ------- die "$0: no files given by CVS (no \%{sVv}?)\n"; ------- } else { ------- $$data{type} = 'commit'; ------- my $added = $$data{message}{added}; ------- my $modified = $$data{message}{modified}; ------- my $removed = $$data{message}{removed}; ------- for (@files) { ------- my ($name, $prev, $cur) = @$_; ------- warn "$0: no version numbers given by CVS (no \%{sVv}?)\n" ------- unless defined $cur; ------- $$data{files}{"$directory/$name"} = [ $prev, $cur ]; ------- if ($prev eq 'NONE') { push (@$added, "$directory/$name") } ------- elsif ($cur eq 'NONE') { push (@$removed, "$directory/$name") } ------- else { push (@$modified, "$directory/$name") } ------- } ------- } -------} ------- -------# Parse the header of the CVS log message (containing the path information) -------# and puts the path information into the data hash. -------sub parse_paths { ------- my $data = shift; ------- ------- # The first line of the log message will be "Update of ". ------- my $path = ; ------- print $path if $DEBUG; ------- $path =~ s/^Update of //; ------- $path =~ s/\s*$//; ------- $$data{repository} = $path; ------- ------- # Now comes the path to the local working directory. Grab it and clean it ------- # up, and then ignore the next blank line. ------- local $_ = ; ------- print if $DEBUG; ------- my ($local) = /directory (\S+)/; ------- $$data{localpath} = $local; ------- $_ = ; ------- print if $DEBUG; -------} ------- -------# Extract the tag. We assume that all files will be committed with the same -------# tag; probably not the best assumption, but it seems workable. Note that we -------# ignore all of the file lists, since we build those ourself from the version -------# information (saving the hard challenge of parsing a whitespace-separated -------# list that could contain filenames with whitespace). -------sub parse_filelist { ------- my $data = shift; ------- my ($current, @added, @modified, @removed); ------- local $_; ------- while () { ------- print if $DEBUG; ------- last if /^Log Message/; ------- $$data{tag} = $1, next if /^\s*Tag: (\S+)\s*$/; ------- } -------} ------- -------# Extract the commit message, stripping leading and trailing whitespace. -------sub parse_message { ------- my $data = shift; ------- my @message = ; ------- print @message if $DEBUG; ------- shift @message while (@message && $message[0] =~ /^\s*$/); ------- pop @message while (@message && $message[-1] =~ /^\s*$/); ------- $$data{message}{text} = [ @message ]; -------} ------- -------############################################################################## -------# Formatting functions -------############################################################################## ------- -------# Determine the From header of the message. If CVSUSER is set, we're running -------# from inside a CVS server, and the From header should reflect information -------# from the CVS passwd file. Otherwise, pull the information from the system -------# passwd file. -------sub build_from { ------- my $cvsuser = $ENV{CVSUSER} || scalar (getpwuid $<); ------- my $name = ''; ------- my $address = ''; ------- if ($cvsuser) { ------- if (open (PASSWD, "$REPOSITORY/CVSROOT/passwd")) { ------- local $_; ------- while () { ------- chomp; ------- next unless /:/; ------- my @info = split ':'; ------- if ($info[0] eq $cvsuser) { ------- $name = $info[3]; ------- $address = $info[4]; ------- } ------- } ------- close PASSWD; ------- } ------- $name ||= (getpwnam $cvsuser)[6]; ------- } ------- $address ||= $cvsuser || 'cvs'; ------- $name =~ s/,.*//; ------- if ($name =~ /[^\w ]/) { ------- $name = '"' . $name . '"'; ------- } ------- return "From: " . ($name ? "$name <$address>" : $address) . "\n"; -------} ------- -------# Takes the data hash, a prefix to add to the subject header, and a flag -------# saying whether to give a full list of files no matter how long it is. Form -------# the subject line of our message. Try to keep the subject under 78 -------# characters by just giving a count of files if there are a lot of them. -------sub build_subject { ------- my ($data, $prefix, $long) = @_; ------- $prefix = "Subject: " . $prefix; ------- my $length = 78 - length ($prefix) - length ($$data{module}); ------- $length = 8 if $length < 8; ------- my $subject; ------- if ($$data{type} eq 'directory') { ------- $subject = "[new]"; ------- } elsif ($$data{type} eq 'import') { ------- $subject = "[import]"; ------- } else { ------- my @files = sort keys %{ $$data{files} }; ------- @files = simplify ($$data{prefix}, \@files); ------- my $files = join (' ', @files); ------- $files =~ s/[\n\r]/ /g; ------- if (!$long && length ($files) > $length) { ------- $subject = '(' . @files . (@files > 1 ? " files" : " file") . ')'; ------- } else { ------- $subject = "($files)"; ------- } ------- } ------- if ($$data{module}) { ------- $subject = "$$data{module} $subject"; ------- } ------- if ($$data{tag} && $$data{tag} =~ /[^\d.]/) { ------- $subject = "$$data{tag} $subject"; ------- } ------- return "$prefix$subject\n"; -------} ------- -------# Generate file lists, wrapped at 74 columns, with the right prefix for what -------# type of file they are. -------sub build_filelist { ------- my ($prefix, @files) = @_; ------- local $_ = join (' ', @files); ------- my $output = ''; ------- while (length > 64) { ------- if (s/^(.{0,64})\s+// || s/^(\S+)//) { ------- $output .= (' ' x 10) . $1 . "\n"; ------- } else { ------- last; ------- } ------- } ------- $output .= (' ' x 10) . $_; ------- $output =~ s/\s*$/\n/; ------- $prefix = (' ' x (8 - length ($prefix))) . $prefix; ------- $output =~ s/^ {10}/$prefix: /; ------- return $output; -------} ------- -------# Build the subheader of the report, listing the files changed and some other -------# information about the change. Returns the header as a list. -------sub build_header { ------- my ($data, $showdir, $showauthor) = @_; ------- my $user = $ENV{CVSUSER} || (getpwuid $<)[0] || $<; ------- my $date = strftime ('%A, %B %e, %Y @ %T', localtime time); ------- $date =~ s/ / /; ------- my @header = (" Date: $date\n"); ------- push (@header, " Author: $user\n") if $showauthor; ------- ------- # If the paths are too long, trim them by taking off a leading path ------- # component until the length is under 70 characters. ------- my $path = $$data{repository}; ------- my $local = $$data{localpath}; ------- while (length ($path) > 69) { ------- $path =~ s%^\.\.\.%%; ------- last unless $path =~ s%^/[^/]+%...%; ------- } ------- while (length ($local) > 69) { ------- $local =~ s%^([\w.-]+:)\.\.\.%$1%; ------- last unless $local =~ s%^([\w.-]+:)/[^/]+%$1...%; ------- } ------- ------- if ($showdir) { ------- push (@header, " Tag: $$data{tag}\n") if $$data{tag}; ------- push (@header, "\n", "Update of $path\n", ------- " from $local\n"); ------- } else { ------- push (@header, " Path: $path\n"); ------- push (@header, " Tag: $$data{tag}\n") if $$data{tag}; ------- } ------- return @header; -------} ------- -------# Build a report for a particular commit; this includes the list of affected -------# files and the commit message. Returns the report as a list. Takes the -------# data, the commit message, and a flag saying whether to add version numbers -------# to the file names. -------sub build_message { ------- my ($data, $message, $versions) = @_; ------- my @added = sort @{ $$message{added} }; ------- my @modified = sort @{ $$message{modified} }; ------- my @removed = sort @{ $$message{removed} }; ------- if ($versions) { ------- @added = map { "$_ ($$data{files}{$_}[1])" } @added; ------- @removed = map { "$_ ($$data{files}{$_}[0])" } @removed; ------- @modified = map { ------- print "$_\n"; ------- "$_ ($$data{files}{$_}[0] -> $$data{files}{$_}[1])" ------- } @modified; ------- } ------- @added = simplify ($$data{prefix}, \@added); ------- @modified = simplify ($$data{prefix}, \@modified); ------- @removed = simplify ($$data{prefix}, \@removed); ------- my @message; ------- push (@message, build_filelist ('Added', @added)) if @added; ------- push (@message, build_filelist ('Modified', @modified)) if @modified; ------- push (@message, build_filelist ('Removed', @removed)) if @removed; ------- if (@{ $$message{text} }) { ------- push (@message, "\n") if (@added || @modified || @removed); ------- push (@message, @{ $$message{text} }); ------- } ------- return @message; -------} ------- -------# Builds an array of -r flags to pass to CVS to get diffs between the -------# appropriate versions, given a reference to the %data hash and the name of -------# the file. -------sub build_version_flags { ------- my ($data, $file) = @_; ------- my @versions = @{ $$data{files}{$file} }; ------- return unless $versions[1] && ($versions[0] ne $versions[1]); ------- if ($versions[0] eq 'NONE') { ------- @versions = ('-r', '0.0', '-r', $versions[1]); ------- } elsif ($versions[1] eq 'NONE') { ------- @versions = ('-r', $versions[0], '-r', next_version $versions[0]); ------- } else { ------- @versions = map { ('-r', $_) } @versions; ------- } ------- return @versions; -------} ------- -------# Build cvsweb diff URLs. Right now, this is very specific to cvsweb, but -------# could probably be extended for other web interfaces to CVS. Takes the data -------# hash and the base URL for cvsweb. -------sub build_cvsweb { ------- my ($data, $cvsweb) = @_; ------- my $options = 'f=h'; ------- my @cvsweb = ("Diff URLs:\n"); ------- my $file; ------- for (sort keys %{ $$data{files} }) { ------- my @versions = @{ $$data{files}{$_} }; ------- next unless @versions; ------- my $file = $_; ------- for ($file, @versions) { ------- s{([^a-zA-Z0-9\$_.+!*\'(),/-])} {sprintf "%%%x", ord ($1)}ge; ------- } ------- my $url = "$cvsweb/$file.diff?$options&r1=$versions[0]" ------- . "&r2=$versions[1]\n"; ------- push (@cvsweb, $url); ------- } ------- return @cvsweb; -------} ------- -------# Run a cvs rdiff between the old and new versions and return the output. -------# This is useful for small changes where you want to see the changes in -------# e-mail, but probably creates too large of messages when the changes get -------# bigger. Note that this stores the full diff output in memory. -------sub build_diff { ------- my $data = shift; ------- my @difflines; ------- for my $file (sort keys %{ $$data{files} }) { ------- my @versions = build_version_flags ($data, $file); ------- next unless @versions; ------- my $pid = open (CVS, '-|'); ------- if (!defined $pid) { ------- die "$0: can't fork cvs: $!\n"; ------- } elsif ($pid == 0) { ------- open (STDERR, '>&STDOUT') or die "$0: can't reopen stderr: $!\n"; ------- exec ('cvs', '-fnQq', '-d', $REPOSITORY, 'rdiff', '-u', ------- @versions, $file) or die "$0: can't fork cvs: $!\n"; ------- } else { ------- my @diff = ; ------- close CVS; ------- if ($diff[1] =~ /failed to read diff file header/) { ------- @diff = ($diff[0], "<>\n"); ------- } ------- push (@difflines, @diff); ------- } ------- } ------- return @difflines; -------} ------- -------# Build a summary of the changes by building the patch it represents in /tmp -------# and then running diffstat on it. This gives a basic idea of the order of -------# magnitude of the changes. Takes the data hash and the path to diffstat as -------# arguments. -------sub build_summary { ------- my ($data, $diffstat) = @_; ------- $diffstat ||= 'diffstat'; ------- open2 (\*OUT, \*IN, $diffstat, '-w', '78') ------- or die "$0: can't fork $diffstat: $!\n"; ------- my @binary; ------- for my $file (sort keys %{ $$data{files} }) { ------- my @versions = build_version_flags ($data, $file); ------- next unless @versions; ------- my $pid = open (CVS, '-|'); ------- if (!defined $pid) { ------- die "$0: can't fork cvs: $!\n"; ------- } elsif ($pid == 0) { ------- open (STDERR, '>&STDOUT') or die "$0: can't reopen stderr: $!\n"; ------- exec ('cvs', '-fnQq', '-d', $REPOSITORY, 'rdiff', '-u', ------- @versions, $file) or die "$0: can't fork cvs: $!\n"; ------- } ------- local $_; ------- while () { ------- s%^(\*\*\*|---|\+\+\+) \Q$$data{prefix}\E/*%$1 %; ------- s%^Index: \Q$$data{prefix}\E/*%Index: %; ------- if (/^diff -c/) { s% \Q$$data{prefix}\E/*% %g } ------- if (/: failed to read diff file header/) { ------- my $short = $file; ------- $short =~ s%^\Q$$data{prefix}\E/*%%; ------- my $date = localtime; ------- print IN "Index: $short\n"; ------- print IN "--- $short\t$date\n+++ $short\t$date\n"; ------- print IN "@@ -1,1 +1,1 @@\n+<>\n"; ------- push (@binary, $short); ------- last; ------- } else { ------- print IN $_; ------- } ------- } ------- close CVS; ------- } ------- close IN; ------- my @stats = ; ------- close OUT; ------- my $offset = index ($stats[0], '|'); ------- for my $file (@binary) { ------- @stats = map { ------- s/^( +\Q$file\E +\| +).*/$1<\>/; ------- $_; ------- } @stats; ------- } ------- unshift (@stats, '-' x $offset, "+\n"); ------- return @stats; -------} ------- -------############################################################################## -------# Configuration file handling -------############################################################################## ------- -------# Load defaults from a configuration file, if any. The syntax is keyword -------# colon value, where value may be enclosed in quotes. Returns a list -------# containing the address to which to send all commits (defaults to not sending -------# any message), the base URL for cvsweb (defaults to not including cvsweb -------# URLs), the full path to diffstat (defaults to just "diffstat", meaning the -------# user's path will be searched), the subject prefix, a default host for -------# unqualified e-mail addresses, additional headers to add to the mail message, -------# and the full path to sendmail. -------sub load_config { ------- my $file = $REPOSITORY . '/CVSROOT/cvslog.conf'; ------- my $address = ''; ------- my $cvsweb = ''; ------- my $diffstat = 'diffstat'; ------- my $headers = ''; ------- my $mailhost = ''; ------- my ($sendmail) = grep { -x $_ } qw(/usr/sbin/sendmail /usr/lib/sendmail); ------- $sendmail ||= '/usr/lib/sendmail'; ------- my $subject = 'CVS update of '; ------- if (open (CONFIG, $file)) { ------- local $_; ------- while () { ------- next if /^\s*\#/; ------- next if /^\s*$/; ------- chomp; ------- my ($key, $value) = /^\s*(\S+):\s+(.*)/; ------- unless ($value) { ------- warn "$0:$file:$.: invalid config syntax: $_\n"; ------- next; ------- } ------- $value =~ s/\s+$//; ------- $value =~ s/^\"(.*)\"$/$1/; ------- if (lc $key eq 'address') { $address = $value } ------- elsif (lc $key eq 'cvsweb') { $cvsweb = $value } ------- elsif (lc $key eq 'diffstat') { $diffstat = $value } ------- elsif (lc $key eq 'mailhost') { $mailhost = $value } ------- elsif (lc $key eq 'sendmail') { $sendmail = $value } ------- elsif (lc $key eq 'subject') { $subject = $value } ------- elsif (lc $key eq 'header') { $headers .= $value . "\n" } ------- else { warn "$0:$file:$.: unrecognized config line: $_\n" } ------- } ------- close CONFIG; ------- } ------- return ($address, $cvsweb, $diffstat, $subject, $mailhost, $headers, ------- $sendmail); -------} ------- -------############################################################################## -------# Main routine -------############################################################################## ------- -------# Load the configuration file for defaults. -------my ($address, $cvsweburl, $diffstat, $subject, $mailhost, $headers, $sendmail) ------- = load_config; ------- -------# Parse command-line options. -------my (@addresses, $cvsweb, $diff, $help, $longsubject, $merge, $omitauthor, ------- $showdir, $summary, $version, $versions); -------Getopt::Long::config ('bundling', 'no_ignore_case', 'require_order'); -------GetOptions ('address|a=s' => \@addresses, ------- 'cvsweb|c' => \$cvsweb, ------- 'debug|D' => \$DEBUG, ------- 'diff|d' => \$diff, ------- 'help|h' => \$help, ------- 'include-versions|i' => \$versions, ------- 'long-subject|l' => \$longsubject, ------- 'merge|m' => \$merge, ------- 'omit-author|o' => \$omitauthor, ------- 'show-directory|w' => \$showdir, ------- 'summary|s' => \$summary, ------- 'version|v' => \$version) or exit 1; -------if ($help) { ------- print "Feeding myself to perldoc, please wait....\n"; ------- exec ('perldoc', '-t', $0); -------} elsif ($version) { ------- my @version = split (' ', $ID); ------- shift @version if $ID =~ /^\$Id/; ------- my $version = join (' ', @version[0..2]); ------- $version =~ s/,v\b//; ------- $version =~ s/(\S+)$/($1)/; ------- $version =~ tr%/%-%; ------- print $version, "\n"; ------- exit; -------} -------die "$0: no addresses specified\n" unless ($address || @addresses); -------die "$0: unable to determine the repository path\n" unless $REPOSITORY; -------die "$0: no cvsweb URL specified in the configuration file\n" ------- if $cvsweb && !$cvsweburl; -------my $showauthor = !$omitauthor; ------- -------# Parse the input. -------print "Options: ", join ('|', @ARGV), "\n" if $DEBUG; -------print '-' x 78, "\n" if $DEBUG; -------my %data; -------parse_files (\%data, @ARGV); -------parse_paths (\%data); -------parse_filelist (\%data); -------parse_message (\%data); -------print '-' x 78, "\n" if $DEBUG; ------- -------# Check to see if this is part of a multipart commit. If so, just save the -------# data for later. Otherwise, read in any saved data and add it to our data. -------if ($merge && $data{type} eq 'commit') { ------- my $lastdir = read_lastdir; ------- if ($lastdir && $data{repository} ne $lastdir) { ------- save_data (\%data) and exit 0; ------- # Fall through and send a notification if save_data fails. ------- } else { ------- read_data (\%data); ------- } -------} -------$data{messages} = [ $data{message} ] unless $data{messages}; ------- -------# Exit if there are no addresses to send the message to. -------exit 0 if (!$address && !@addresses); ------- -------# Open our mail program. -------open (MAIL, "| $sendmail -t -oi -oem") ------- or die "$0: can't fork $sendmail: $!\n"; -------my $oldfh = select MAIL; -------$| = 1; -------select $oldfh; ------- -------# Build the mail headers. -------if ($mailhost) { ------- for ($address, @addresses) { ------- if ($_ && !/\@/) { ------- $_ .= '@' . $mailhost unless /\@/; ------- } ------- } -------} -------if (@addresses) { ------- print MAIL "To: ", join (', ', @addresses), "\n"; ------- print MAIL "Cc: $address\n" if $address; -------} else { ------- print MAIL "To: $address\n"; -------} -------print MAIL build_from; -------print MAIL $headers if $headers; -------print MAIL build_subject (\%data, $subject, $longsubject), "\n"; ------- -------# Build the message and write it out. -------print MAIL build_header (\%data, $showdir, $showauthor); -------for (@{ $data{messages} }) { ------- print MAIL "\n", build_message (\%data, $_, $versions); -------} -------if ($data{type} eq 'commit') { ------- print MAIL "\n\n", build_summary (\%data, $diffstat) if $summary; ------- print MAIL "\n\n", build_cvsweb (\%data, $cvsweburl) if $cvsweb; ------- print MAIL "\n\n", build_diff (\%data) if $diff; -------} ------- -------# Make sure sending mail succeeded. -------close MAIL; -------unless ($? == 0) { die "$0: sendmail exit status " . ($? >> 8) . "\n" } -------exit 0; -------__END__ ------- -------############################################################################## -------# Documentation -------############################################################################## ------- -------=head1 NAME ------- -------cvslog - Mail CVS commit notifications ------- -------=head1 SYNOPSIS ------- -------B [B<-cDdhilmosvw>] [B<-a> I
...] %{sVv} ------- -------=head1 REQUIREMENTS ------- -------CVS 1.10 or later, Perl 5.004 or later, diffstat for the B<-s> option, and a -------sendmail command that can accept formatted mail messages for delivery. ------- -------=head1 DESCRIPTION ------- -------B is intended to be run out of CVS's F administrative file. -------It parses the (undocumented) format of CVS's commit notifications, cleans it -------up and reformats it, and mails the notification to one or more e-mail -------addresses. Optionally, a diffstat(1) summary of the changes can be added to -------the notification, and a CVS commit spanning multiple directories can be -------combined into a single notification (by default, CVS generates a separate -------notification for each directory). ------- -------To combine a commit spanning multiple directories into a single notification, -------B needs the help of an additional program run from the F -------administrative file that records the last directory affected by the commit. -------See the description in L<"FILES"> for what files and directories must be -------created. One such suitable program is B by the same author. ------- -------For information on how to add B to your CVS repository, see -------L<"INSTALLATION"> below. B also looks for a configuration file named -------F; for details on the format of that file, see -------L<"CONFIGURATION">. ------- -------The From: header of the mail message sent by B is formed from the user -------making the commit. The contents of the environment variable CVSUSER or the -------name of the user doing the commit if CVSUSER isn't set is looked up in the -------F file in the CVS repository, if present, and the fourth field is used -------as the full name and the fifth as the user's e-mail address. If that user -------isn't found in F, it's looked up in the system password file instead -------to try to find a full name. Otherwise, that user is just used as an e-mail -------address. ------- -------=head1 OPTIONS ------- -------=over 4 ------- -------=item B<-a> I
, B<--address>=I
------- -------Send the commit notification to I
(possibly in addition to the -------address defined in F). This option may occur more than once, -------and all specified addresses will receive a copy of the notification. ------- -------=item B<-c>, B<--cvsweb> ------- -------Append the cvsweb URLs for all the diffs covered in the commit message to -------the message. The base cvsweb URL must be set in the configuration file. -------The file name will be added and the C and C parameters will be -------appended with the appropriate values, along with C to request formatted -------diff output. Currently, the cvsweb URLs are not further configurable. ------- -------=item B<-D>, B<--debug> ------- -------Prints out the information B got from CVS as it works. This option -------is mostly useful for developing B and checking exactly what data CVS -------provides. The first line of output will be the options passed to B, -------separated by C<|>. ------- -------=item B<-d>, B<--diff> ------- -------Append the full diff output for each change to the notification message. -------This is probably only useful if you know that all changes for which -------B is run will be small. Note that the entire diff output is -------temporarily stored in memory, so this could result in excessive memory usage -------in B for very large changes. ------- -------When this option is given, B needs to be able to find B in the -------user's PATH. ------- -------If one of the committed files is binary and this is detected by B, -------B will suppress the diff and replace it with a note that the file is -------binary. ------- -------=item B<-h>, B<--help> ------- -------Print out this documentation (which is done simply by feeding the script to -------C). ------- -------=item B<-i>, B<--include-versions> ------- -------Include version numbers (in parentheses) after the file names in the lists -------of added, removed, and changed files. By default, only the file names are -------given. ------- -------=item B<-l>, B<--long-subject> ------- -------Normally, B will just list the number of changed files rather than the -------complete list of them if the subject would otherwise be too long. This flag -------disables that behavior and includes the full list of modified files in the -------subject header of the mail, no matter how long it is. ------- -------=item B<-m>, B<--merge> ------- -------Merge multidirectory commits into a single notification. This requires that a -------program be run from F to record the last directory affected by the -------commit. Using this option will cause B to temporarily record -------information about a commit in progress in TMPDIR or /tmp; see L<"FILES">. ------- -------=item B<-o>, B<--omit-author> ------- -------Omit the author information from the commit notification. This is useful -------where all commits are done by the same person (so the author information is -------just noise) or where the author information isn't actually available. ------- -------=item B<-s>, B<--summary> ------- -------Append to each commit notification a summary of the changes, produced by -------generating diffs and feeding those diffs to diffstat(1). diffstat(1) must be -------installed to use this option; see also the B configuration parameter -------in L<"CONFIGURATION">. ------- -------When this option is given, B needs to be able to find B in the -------user's PATH. ------- -------If one of the committed files is binary and this is detected by B, -------B will replace the uninformative B line corresponding to -------that file (B will indicate that nothing changed) with a note that -------the file is binary. ------- -------=item B<-v>, B<--version> ------- -------Print out the version of B and exit. ------- -------=item B<-w>, B<--show-directory> ------- -------Show the working directory from which the commit was made. This is usually -------not enlightening and when running CVS in server mode will always be some -------uninteresting directory in /tmp, so the default is to not include this -------information. ------- -------=back ------- -------=head1 CONFIGURATION ------- -------B will look for a configuration file named F in the -------CVSROOT directory of your repository. Absence of this file is not an error; -------it just means that all of the defaults will be used. The syntax of this file -------is one configuration parameter per line in the format: ------- ------- parameter: value ------- -------The value may be enclosed in double-quotes and must be enclosed in -------double-quotes if there is trailing whitespace that should be part of the -------value. There is no way to continue a line; each parameter must be a single -------line. Lines beginning with C<#> are comments. ------- -------The following configuration parameters are supported: ------- -------=over 4 ------- -------=item address ------- -------The address or comma-separated list of addresses to which all commit messages -------should be sent. If this parameter is not given, the default is to send the -------commit message only to those addresses specified with B<-a> options on the -------command line, and there must be at least one B<-a> option on the command line. ------- -------=item cvsweb ------- -------The base URL for cvsweb diffs for this repository. Only used if the B<-c> -------option is given; see the description of that option for more information -------about how the full URL is constructed. ------- -------=item diffstat ------- -------The full path to the diffstat(1) program. If this parameter is not given, the -------default is to look for diffstat(1) on the user's PATH. Only used if the B<-s> -------option is given. ------- -------=item header ------- -------The value should be a valid mail header, such as "X-Ticket: cvs". This header -------will be added to the mail message sent. This configuration parameter may -------occur multiple times, and all of those headers will be added to the message. ------- -------=item mailhost ------- -------The hostname to append to unqualified addresses given on the command line with -------B<-a>. If set, an C<@> and this value will be appended to any address given -------with B<-a> that doesn't contain C<@>. This parameter exists solely to allow -------for shorter lines in the F file. ------- -------=item sendmail ------- -------The full path to the sendmail binary. If not given, this setting defaults to -------either C or C, whichever is found, -------falling back on C. ------- -------=item subject ------- -------The subject prefix to use for the mailed notifications. Appended to this -------prefix will be the module or path in the repository of the affected directory -------and then either a list of files or a count of files depending on the available -------space. The default is C<"CVS update of ">. ------- -------=back ------- -------=head1 INSTALLATION ------- -------Follow these steps to add cvslog to your project: ------- -------=over 4 ------- -------=item 1. ------- -------Check out CVSROOT for your repository (see the CVS manual if you're not sure -------how to do this), copy this script into that directory, change the first line -------to point to your installation of Perl if necessary, and cvs add and commit it. ------- -------=item 2. ------- -------Add a line like: ------- ------- cvslog Unable to check out CVS log notification script cvslog ------- -------to F in CVSROOT and commit it. ------- -------=item 3. ------- -------If needed, create a F file as described above and cvs add and -------commit it. Most installations will probably want to set B
, since the -------most common CVS configuration is a single repository per project with all -------commit notifications sent to the same address. If you don't set B
, -------you'll need to add B<-a> options to every invocation of B in -------F. ------- -------=item 4. ------- -------If you created a F file, add a line like: ------- ------- cvslog.conf Unable to check out cvslog configuration cvslog.conf ------- -------to F in CVSROOT and commit it. ------- -------=item 5. ------- -------Set up your rules in F for those portions of the repository you want -------to send CVS commit notifications for. A good starting rule is: ------- ------- DEFAULT $CVSROOT/CVSROOT/cvslog %{sVv} ------- -------which will send notifications for every commit to your repository that doesn't -------have a separate, more specific rule to the value of B
in -------F. You must always invoke B as $CVSROOT/CVSROOT/cvslog; -------B uses the path it was invoked as to find the root of the repository. -------If you have different portions of your repository that should send -------notifications to different places, you can use a series of rules like: ------- ------- ^foo/ $CVSROOT/CVSROOT/cvslog -a foo-commit %{sVv} ------- ^bar/ $CVSROOT/CVSROOT/cvslog -a bar-commit %{sVv} ------- -------This will send notification of commits to anything in the C directory -------tree in the repository to foo-commit (possibly qualified with B from -------F) and everything in C to bar-commit. No commit -------notifications will be sent for any other commits. The C<%{sVv}> string is -------replaced by CVS with information about the committed files and should always -------be present. ------- -------If you are using CVS version 1.12.6 or later, the format strings for -------F rules have changed. Instead of C<%{sVv}>, use C<-- %p %{sVv}>, -------once you've set UseNewInfoFmtStrings=yes in F. For example: ------- ------- DEFAULT $CVSROOT/CVSROOT/cvslog -- %p %{sVv} ------- -------Any options to B should go before C<-->. See the CVS documentation -------for more details on the new F format. ------- -------=item 6. ------- -------If you want summaries of changes, obtain and compile diffstat and add B<-s> to -------the appropriate lines in F. You may also need to set B in -------F. ------- -------diffstat is at L. ------- -------=item 7. ------- -------If you want merging of multidirectory commits, add B<-m> to the invocations of -------B, copy B into your checked out copy of CVSROOT, change the -------first line of the script if necessary to point to your installation of Perl, -------and cvs add and cvs commit it. Then, a line like: ------- ------- cvsprep Unable to check out CVS log notification script cvsprep ------- -------to F in CVSROOT and commit it. ------- -------See L<"WARNINGS"> for some warnings about the security of multi-directory -------commit merging. ------- -------=item 8. ------- -------If your operating system doesn't pass the full path to the B -------executable to this script when it runs, you'll need to edit the beginning of -------this script and set $REPOSITORY to the correct path to the root of your -------repository. This should not normally be necessary. See the comments in this -------script for additional explanation. ------- -------=back ------- -------=head1 EXAMPLES ------- -------Send all commits under the baz directory to B
defined in -------F: ------- ------- ^baz/ $CVSROOT/CVSROOT/cvslog -msw %{sVv} ------- -------Multidirectory commits will be merged if B is also installed, a -------diffstat(1) summary will be appended to the notification, and the working -------directory from which the files were committed will also be included. This -------line should be put in F. ------- -------See L<"INSTALLATION"> for more examples. ------- -------=head1 DIAGNOSTICS ------- -------=over 4 ------- -------=item can't fork %s: %s ------- -------(Fatal) B was unable to run a program that it wanted to run. This may -------result in no notification being sent or in information missing. Generally -------this means that the program in question was missing or B couldn't find -------it for some reason. ------- -------=item can't open %s: %s ------- -------(Warning) B was unable to open a file. For the modules file, this -------means that B won't do any directory to module mapping. For files -------related to multidirectory commits, this means that B can't gather -------together information about such a commit and will instead send an individual -------notification for the files affected in the current directory. (This means -------that some information may have been lost.) ------- -------=item can't remove %s: %s ------- -------(Warning) B was unable to clean up after itself for some reason, and -------the temporary files from a multidirectory commit have been left behind in -------TMPDIR or F. ------- -------=item can't save to %s: %s ------- -------(Warning) B encountered an error saving information about a -------multidirectory commit and will instead send an individual notification for the -------files affected in the current directory. ------- -------=item invalid directory %s ------- -------(Warning) Something was strange about the given directory when B went -------to use it to store information about a multidirectory commit, so instead a -------separate notification for the affected files in the current directory will be -------sent. This means that the directory was actually a symlink, wasn't a -------directory, or wasn't owned by the right user. ------- -------=item invalid config syntax: %s ------- -------(Warning) The given line in F was syntactically invalid. See -------L<"CONFIGURATION"> for the correct syntax. ------- -------=item no %s given by CVS (no %{sVv}?) ------- -------(Fatal) The arguments CVS passes to B should be the directory within -------the repository that's being changed and a list of files being changed with -------version information for each file. Something in that was missing. This error -------generally means that the invocation of B in F doesn't have -------the magic C<%{sVv}> variable at the end but instead has no variables or some -------other variable like C<%s>, or means that you're using a version of CVS older -------than 1.10. ------- -------=item no addresses specified ------- -------(Fatal) There was no B
parameter in F and no B<-a> -------options on the command line. At least one recipient address must be specified -------for the CVS commit notification. ------- -------=item sendmail exit status %d ------- -------(Fatal) sendmail exited with a non-zero status. This may mean that the -------notification message wasn't sent. ------- -------=item unable to determine the repository path ------- -------(Fatal) B was unable to find the root of your CVS repository from the -------path by which it was invoked. See L<"INSTALLATION"> for hints on how to fix -------this. ------- -------=item unrecognized config line: %s ------- -------(Warning) The given configuration parameter isn't one of the ones that -------B knows about. ------- -------=back ------- -------=head1 FILES ------- -------All files relative to $CVSROOT will be found by looking at the full path -------B was invoked as and pulling off the path before C. -------If this doesn't work on your operating system, you'll need to edit this script -------to set $REPOSITORY. ------- -------=over 4 ------- -------=item $CVSROOT/CVSROOT/cvslog.conf ------- -------Read for configuration directives if it exists. See L<"CONFIGURATION">. ------- -------=item $CVSROOT/CVSROOT/modules ------- -------Read to find the module a given file is part of. Rather than always giving -------the full path relative to $CVSROOT of the changed files, B tries to -------find the module that that directory belongs to and replaces the path of that -------module with the name of the module in angle brackets. Modules are found by -------reading this file, looking at the last white-space-separated word on each -------line, and if it contains a C, checking to see if it is a prefix of the path -------to the files affected by a commit. If so, the first white-space-separated -------word on that line of F is taken to be the affected module. The first -------matching entry is used. ------- -------=item $CVSROOT/CVSROOT/passwd ------- -------Read to find the full name and e-mail address corresponding to a particular -------user. The full name is expected to be the fourth field colon-separated field -------and the e-mail address the fifth. Defaults derived from the system password -------file are used if these are not provided. ------- -------=item TMPDIR/cvs.%d.%d ------- -------Information about multidirectory commits is read from and stored in this -------directory. This script will never create this directory (the helper script -------B that runs from F has to do that), but it will read and -------store information in it and when the commit message is sent, it will delete -------everything in this directory and remove the directory. ------- -------The first %d is the numeric UID of the user running B. The second %d -------is the process group B is part of. The process group is included in -------the directory name so that if you're running a shell that calls setpgrp() (any -------modern shell with job control should), multiple commits won't collide with -------each other even when done from the same shell. ------- -------If TMPDIR isn't set in the environment, F is used for TMPDIR. ------- -------=item TMPDIR/cvs.%d.%d/directory ------- -------B expects this file to contain the name of the final directory -------affected by a multidirectory commit. Each B invocation will save the -------data that it's given until B is invoked for this directory, and then -------all of the saved data will be combined with the data for that directory and -------sent out as a single notification. ------- -------This file must be created by a script such as B run from -------F. If it isn't present, B doesn't attempt to combine -------multidirectory commits, even if B<-m> is used. ------- -------=back ------- -------=head1 ENVIRONMENT ------- -------=over 4 ------- -------=item PATH ------- -------Used to find cvs and diffstat when the B<-s> option is in effect. If the -------B configuration option is set, diffstat isn't searched for on the -------user's PATH, but cvs must always be found on the user's PATH in order for -------diffstat summaries to work. ------- -------=item TMPDIR ------- -------If set, specifies the temporary directory to use instead of F for -------storing information about multidirectory commits. Setting this to some -------private directory is recommended if you're doing CVS commits on a multiuser -------machine with other untrusted users due to the standard troubles with safely -------creating files in F. (Note that other programs besides B also -------use TMPDIR.) ------- -------=back ------- -------=head1 WARNINGS ------- -------Merging multidirectory commits requires creating predictably-named files to -------communicate information between different processes. By default, those files -------are created in F in a directory created for that purpose. While this -------should be reasonably safe on systems that don't allow one to remove -------directories owned by other people in F, since a directory is used rather -------than an individual file and since various sanity checks are made on the -------directory before using it, this is still inherently risky on a multiuser -------machine with a world-writeable F directory if any of the other users -------aren't trusted. ------- -------For this reason, I highly recommend setting TMPDIR to some directory, perhaps -------in your home directory, that only you have access to if you're in that -------situation. Not only will this make B more secure, it may make some of -------the other programs you run somewhat more secure (lots of programs will use the -------value of TMPDIR if set). I really don't trust the security of creating any -------predictably-named files or directories in F and neither should you. ------- -------Multiple separate B invocations in F interact oddly with -------merging of multidirectory commits. The commit notification will be sent to -------the addresses and in the style configured for the last invocation of -------B, even if some of the earlier directories had different notification -------configurations. As a general rule, it's best not to merge multidirectory -------commits that span separate portions of the repository with different -------notification policies. ------- -------B doesn't support using B (which comes with CVS) as a -------F script to provide information about multidirectory commits -------because it writes files directly in F rather than using a subdirectory. ------- -------Some file names simply cannot be supported correctly in CVS versions prior -------to 1.12.6 (with new-style info format strings turned on) because of -------ambiguities in the output from CVS. For example, file names beginning with -------spaces are unlikely to produce the correct output, and file names containing -------newlines will likely result in odd-looking mail messages. ------- -------=head1 BUGS ------- -------There probably should be a way to specify the path to cvs for generating -------summaries and diffs, to turn off the automatic module detection stuff, to -------provide for transformations of the working directory (stripping the domain -------off the hostname, shortening directory paths in AFS), and to configure the -------maximum subject length. The cvsweb support could stand to be more -------customizable. ------- -------Many of the logging scripts out there are based on B, which comes -------with CVS and uses a different output format for multidirectory commits. I -------prefer the one in B, but it would be nice if B could support -------either. ------- -------File names containing spaces may be wrapped at the space in the lists of -------files added, modified, or removed. The lists may also be wrapped in the -------middle of the appended version information if B<-i> is used. ------- -------Multi-directory commit merging may mishandle file names that contain -------embedded newlines even with CVS version 1.12.6 or later due to the file -------format that B uses to save the intermediate data. ------- -------=head1 NOTES ------- -------Some parts of this script are horrible hacks because the entirety of commit -------notification handling in CVS is a horrible, undocumented hack. Better commit -------notification support in CVS proper would be welcome, even if it would make -------this script obsolete. ------- -------=head1 SEE ALSO ------- -------cvs(1), diffstat(1), cvsprep(1). ------- -------diffstat is at L. ------- -------Current versions of this program are available from its web site at -------L. B is available -------from this same location. ------- -------=head1 AUTHOR ------- -------Russ Allbery . ------- -------=head1 COPYRIGHT AND LICENSE ------- -------Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Board of Trustees, Leland -------Stanford Jr. University. ------- -------This program is free software; you can redistribute it and/or modify it -------under the same terms as Perl itself. ------- -------=cut diff --cc CVSROOT/cvsprep index 753f16ab,753f16ab,753f16ab,753f16ab,753f16ab,753f16ab,753f16ab..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/CVSROOT/cvsprep +++ /dev/null @@@@@@@@ -1,185 -1,185 -1,185 -1,185 -1,185 -1,185 -1,185 +1,0 @@@@@@@@ -------#!/usr/bin/perl -------$ID = q(cvsprep,v 1.6 2004/06/12 02:07:09 eagle Exp ); -------# -------# cvsprep -- Prep a multi-directory commit. -------# -------# Written by Russ Allbery -------# Copyright 2001, 2002, 2003, 2004 -------# Board of Trustees, Leland Stanford Jr. University -------# -------# This program is free software; you can redistribute it and/or modify it -------# under the same terms as Perl itself. ------- -------use Getopt::Long qw(GetOptions); -------use vars qw($ID); ------- -------Getopt::Long::config ('require_order'); -------GetOptions ('help|h' => \$help, 'version|v' => \$version) or exit 1; -------if ($help) { ------- print "Feeding myself to perldoc, please wait....\n"; ------- exec ('perldoc', '-t', $0); -------} elsif ($version) { ------- my @version = split (' ', $ID); ------- shift @version if $ID =~ /^\$Id/; ------- my $version = join (' ', @version[0..2]); ------- $version =~ s/,v\b//; ------- $version =~ s/(\S+)$/($1)/; ------- $version =~ tr%/%-%; ------- print $version, "\n"; ------- exit; -------} ------- -------my $directory = shift; -------die "$0: CVS didn't provide a directory\n" unless $directory; -------my $tmp = $ENV{TMPDIR} || '/tmp'; -------$tmp .= '/cvs.' . $< . '.' . getpgrp; -------if (!mkdir ($tmp, 0700)) { ------- if (-l $tmp || !-d _ || (lstat _)[4] != $<) { ------- die "$0: can't create $tmp: $!\n"; ------- } -------} -------open (LOG, "> $tmp/directory") or die "$0: can't create $tmp/directory: $!\n"; -------print LOG "$directory\n"; -------close LOG; -------exit 0; -------__END__ ------- -------=head1 NAME ------- -------cvsprep - Prep for a multi-directory CVS commit ------- -------=head1 SYNOPSIS ------- -------B ------- -------=head1 DESCRIPTION ------- -------This program is designed to run from CVS's F administrative file -------and make a note of the last directorie involved in the commit. It is used to -------support merging of multi-directory CVS commits into a single notification by -------B (B knows to stop merging commits when it sees the -------notification for the final directory recorded by B). ------- -------It should be run from F with something like: ------- ------- DEFAULT $CVSROOT/CVSROOT/cvsprep ------- -------If you are using CVS version 1.12.6 or later, the format strings for -------F rules have changed. This line should instead be: ------- ------- DEFAULT $CVSROOT/CVSROOT/cvsprep -- %r/%p ------- -------once you've set UseNewInfoFmtStrings=yes in F. ------- -------The directory in which the commit is occurring is saved in a file named -------F in a directory in TMPDIR named cvs.., where is -------the UID of the committing user and is the process group of the commit -------process. If TMPDIR is not used, F is used as the parent directory. ------- -------For details on how to install this program as part of a B -------installation, see cvslog(1). ------- -------=head1 OPTIONS ------- -------=over 4 ------- -------=item B<-h>, B<--help> ------- -------Print out this documentation (which is done simply by feeding the script to -------C). ------- -------=item B<-v>, B<--version> ------- -------Print out the version of B and exit. ------- -------=head1 DIAGNOSTICS ------- -------=item can't create %s: %s ------- -------(Fatal) B was unable to create either the directory or the file in -------that directory needed to pass information to B, or the directory -------already exists and is owned by someone other than the current user. The -------directory for this commit won't be recorded, and B will therefore not -------merge this multi-directory commit. ------- -------=item CVS didn't provide a directory ------- -------(Fatal) No directory was given on the B command line. If run out of -------F as described above, CVS should pass the name of the directory in -------which the commit is happening as the first argument to B. ------- -------=back ------- -------=head1 FILES ------- -------=over 4 ------- -------=item TMPDIR/cvs.%d.%d/directory ------- -------B expects this file to contain the name of the final directory -------affected by a multidirectory commit. B creates the parent directory -------and stores its first argument in this file. ------- -------The first %d is the numeric UID of the user running B. The second %d -------is the process group B is part of. The process group is included in -------the directory name so that if you're running a shell that calls setpgrp() (any -------modern shell with job control should), multiple commits won't collide with -------each other even when done from the same shell. ------- -------If TMPDIR isn't set in the environment, F is used for TMPDIR. ------- -------=back ------- -------=head1 ENVIRONMENT ------- -------=over 4 ------- -------=item TMPDIR ------- -------If set, specifies the temporary directory to use instead of F for -------storing information about multidirectory commits. Setting this to some -------private directory is recommended if you're doing CVS commits on a multiuser -------machine with other untrusted users due to the standard troubles with safely -------creating files in F. (Note that other programs besides B also -------use TMPDIR.) ------- -------=back ------- -------=head1 WARNINGS ------- -------B inherently creates directories in TMPDIR (F by default) with -------very predictable names. It creates directories rather than files because this -------should be less risky, but this is still something of a security risk. Because -------of this, I highly recommend that you set TMPDIR to some other directory that -------only you have write access to, such as a subdirectory of your home directory. ------- -------For more warnings, see cvslog(1). ------- -------=head1 NOTES ------- -------This process of noting the final directory of a commit so that B knows -------when to stop merging is a horrible hack. There's just no better way to do it -------given how CVS handles commit notification, which is completely undocumented -------and truly bizarre. ------- -------=head1 SEE ALSO ------- -------cvs(1), cvsprep(1). ------- -------Current versions of this program are available from the cvslog web site at -------L. B is available from -------this same location. ------- -------=head1 AUTHOR ------- -------Russ Allbery . ------- -------=head1 COPYRIGHT AND LICENSE ------- -------Copyright 2001, 2002, 2003, 2004 Board of Trustees, Leland Stanford Jr. -------University. ------- -------This program is free software; you can redistribute it and/or modify it under -------the same terms as Perl itself. ------- -------=cut diff --cc CVSROOT/cvswrappers index e989b754,e989b754,e989b754,e989b754,e989b754,e989b754,e989b754..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/cvswrappers +++ /dev/null @@@@@@@@ -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------# This file affects handling of files based on their names. -------# -------# The -m option specifies whether CVS attempts to merge files. -------# -------# The -k option specifies keyword expansion (e.g. -kb for binary). -------# -------# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -------# -------# wildcard [option value][option value]... -------# -------# where option is one of -------# -f from cvs filter value: path to filter -------# -t to cvs filter value: path to filter -------# -m update methodology value: MERGE or COPY -------# -k expansion mode value: b, o, kkv, &c -------# -------# and value is a single-quote delimited value. -------# For example: -------#*.gif -k 'b' diff --cc CVSROOT/loginfo index b0ef885e,3d6cfc95,3d6cfc95,9df09fe8,9df09fe8,b47c299a,b47c299a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/loginfo +++ /dev/null @@@@@@@@ -1,35 -1,35 -1,35 -1,35 -1,35 -1,35 -1,35 +1,0 @@@@@@@@ -------# The "loginfo" file controls where "cvs commit" log information -------# is sent. The first entry on a line is a regular expression which must match -------# the directory that the change is being made to, relative to the -------# $CVSROOT. If a match is found, then the remainder of the line is a filter -------# program that should expect log information on its standard input. -------# -------# If the repository name does not match any of the regular expressions in this -------# file, the "DEFAULT" line is used, if it is specified. -------# -------# If the name ALL appears as a regular expression it is always used -------# in addition to the first matching regex or DEFAULT. -------# -------# If any format strings are present in the filter, they will be replaced as follows: -------# %p = path relative to repository -------# %r = repository (path portion of $CVSROOT) -------# %{sVv} = attribute list = file name, old version number (pre-checkin), -------# new version number (post-checkin). When either old or new revision is -------# unknown, doesn't exist, or isn't applicable, the string "NONE" will be -------# placed on the command line instead. -------# -------# Note that %{sVv} is a list operator and not all elements are necessary. Thus %{sv} is -------# a legal format string, but will only be replaced with file name and new revision. -------# it also generates multiple arguments for each file being operated upon. i.e. if two -------# files, file1 & file2, are being commited from 1.1 to version 1.1.2.1 and from 1.1.2.2 -------# to 1.1.2.3, respectively, %{sVv} will generate the following six arguments in this -------# order: file1, 1.1, 1.1.2.1, file2, 1.1.2.2, 1.1.2.3. -------# -------# For example: -------#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -------# or -------#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog -------#ALL $CVSROOT/CVSROOT/log_accum -u -s -d -m bdemsky %s -------ALL ( chgrp -R -f cvs $CVSROOT/Robust/. ; chmod -R -f go+rX,o-w $CVSROOT/Robust/. ) - DEFAULT $CVSROOT/CVSROOT/cvslog -m -d -a bdemsky -a adash@uci.edu -a erubow -a william.montaz@ensta.fr -- %p %{sVv} -- DEFAULT $CVSROOT/CVSROOT/cvslog -m -d -a bdemsky -a adash@uci.edu -a erubow -a srsundar@uci.edu -a jjenista@uci.edu -a jzhou1@uci.edu -- %p %{sVv} -- DEFAULT $CVSROOT/CVSROOT/cvslog -m -d -a bdemsky -a adash@uci.edu -a jjenista@uci.edu -a jzhou1@uci.edu -- %p %{sVv} --DEFAULT $CVSROOT/CVSROOT/cvslog -m -d -a bdemsky -a adash@uci.edu -a jjenista@uci.edu -a jzhou1@uci.edu -a nfarrite@uci.edu -- %p %{sVv} ------- diff --cc CVSROOT/modules index cb9e9efc,cb9e9efc,cb9e9efc,cb9e9efc,cb9e9efc,cb9e9efc,cb9e9efc..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/modules +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 +1,0 @@@@@@@@ -------# Three different line formats are valid: -------# key -a aliases... -------# key [options] directory -------# key [options] directory files... -------# -------# Where "options" are composed of: -------# -i prog Run "prog" on "cvs commit" from top-level of module. -------# -o prog Run "prog" on "cvs checkout" of module. -------# -e prog Run "prog" on "cvs export" of module. -------# -t prog Run "prog" on "cvs rtag" of module. -------# -u prog Run "prog" on "cvs update" of module. -------# -d dir Place module in directory "dir" instead of module name. -------# -l Top-level directory only -- do not recurse. -------# -------# NOTE: If you change any of the "Run" options above, you'll have to -------# release and re-checkout any working directories of these modules. -------# -------# And "directory" is a path to a directory relative to $CVSROOT. -------# -------# The "-a" option specifies an alias. An alias is interpreted as if -------# everything on the right of the "-a" had been typed on the command line. -------# -------# You can encode a module within a module by using the special '&' -------# character to interpose another module into the current module. This -------# can be useful for creating a module that consists of many directories -------# spread out over the entire source repository. diff --cc CVSROOT/notify index 196c3ea2,196c3ea2,196c3ea2,196c3ea2,196c3ea2,196c3ea2,196c3ea2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/notify +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------# The "notify" file controls where notifications from watches set by -------# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -------# a regular expression which is tested against the directory that the -------# change is being made to, relative to the $CVSROOT. If it matches, -------# then the remainder of the line is a filter program that should contain -------# one occurrence of %s for the user to notify, and information on its -------# standard input. -------# -------# "ALL" or "DEFAULT" can be used in place of the regular expression. -------# -------# format strings are replaceed as follows: -------# %p = path relative to repository -------# %r = repository (path portion of $CVSROOT) -------# %s = user to notify -------# -------# For example: -------#ALL (echo Committed to %r/%p; cat) |mail %s -s "CVS notification" diff --cc CVSROOT/rcsinfo index 49e59f4d,49e59f4d,49e59f4d,49e59f4d,49e59f4d,49e59f4d,49e59f4d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/rcsinfo +++ /dev/null @@@@@@@@ -1,13 -1,13 -1,13 -1,13 -1,13 -1,13 -1,13 +1,0 @@@@@@@@ -------# The "rcsinfo" file is used to control templates with which the editor -------# is invoked on commit and import. -------# -------# The first entry on a line is a regular expression which is tested -------# against the directory that the change is being made to, relative to the -------# $CVSROOT. For the first match that is found, then the remainder of the -------# line is the name of the file that contains the template. -------# -------# If the repository name does not match any of the regular expressions in this -------# file, the "DEFAULT" line is used, if it is specified. -------# -------# If the name "ALL" appears as a regular expression it is always used -------# in addition to the first matching regex or "DEFAULT". diff --cc CVSROOT/taginfo index 025657c3,025657c3,025657c3,025657c3,025657c3,025657c3,025657c3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/taginfo +++ /dev/null @@@@@@@@ -1,40 -1,40 -1,40 -1,40 -1,40 -1,40 -1,40 +1,0 @@@@@@@@ -------# The "taginfo" file is used to control pre-tag checks. -------# The filter on the right is invoked with the following arguments if no format strings are present: -------# -------# $1 -- tagname -------# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -------# $3 -- tagtype "?" on delete, "T" for branch, "N" for static -------# $4 -- repository -------# $5-> file revision [file revision ...] -------# -------# If any format strings are present in the filter, they will be replaced as follows: -------# %b = branch mode = "?" (delete ops - unknown) | "T" (branch) | "N" (not branch) -------# %o = operation = "add" | "mov" | "del" -------# %p = path relative to repository -------# %r = repository (path portion of $CVSROOT) -------# %t = tagname -------# %{sVv} = attribute list = file name, old version tag will be deleted from, -------# new version tag will be added to (or deleted from, but this feature is -------# deprecated. When either old or new revision is unknown, doesn't exist, -------# or isn't applicable, the string "NONE" will be placed on the command -------# line. -------# -------# Note that %{sVv} is a list operator and not all elements are necessary. Thus %{sV} is -------# a legal format string, but will only be replaced with file name and old revision. -------# it also generates multiple arguments for each file being operated upon. i.e. if two -------# files, file1 & file2, are having a tag moved from version 1.1 to versoin 1.1.2.9, %{sVv} -------# will generate the following six arguments in this order: file1, 1.1, 1.1.2.9, file2, 1.1, -------# 1.1.2.9. -------# -------# A non-zero exit of the filter program will cause the tag to be aborted. -------# -------# The first entry on a line is a regular expression which is tested -------# against the directory that the change is being committed to, relative -------# to the $CVSROOT. For the first match that is found, then the remainder -------# of the line is the name of the filter to run. -------# -------# If the repository name does not match any of the regular expressions in this -------# file, the "DEFAULT" line is used, if it is specified. -------# -------# If the name "ALL" appears as a regular expression it is always used -------# in addition to the first matching regex or "DEFAULT". diff --cc CVSROOT/verifymsg index 165d1cd6,165d1cd6,165d1cd6,165d1cd6,165d1cd6,165d1cd6,165d1cd6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/CVSROOT/verifymsg +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------# The "verifymsg" file is used to allow verification of logging -------# information. It works best when a template (as specified in the -------# rcsinfo file) is provided for the logging procedure. Given a -------# template with locations for, a bug-id number, a list of people who -------# reviewed the code before it can be checked in, and an external -------# process to catalog the differences that were code reviewed, the -------# following test can be applied to the code: -------# -------# Making sure that the entered bug-id number is correct. -------# Validating that the code that was reviewed is indeed the code being -------# checked in (using the bug-id number or a seperate review -------# number to identify this particular code set.). -------# -------# If any of the above test failed, then the commit would be aborted. -------# -------# Format strings present in the filter will be replaced as follows: -------# %p = path relative to repository -------# %r = repository (path portion of $CVSROOT) -------# %l = name of log file to be verified. -------# -------# If no format strings are present in the filter, a default " %l" will -------# be appended to the filter, but this usage is deprecated. -------# -------# Actions such as mailing a copy of the report to each reviewer are -------# better handled by an entry in the loginfo file. -------# -------# One thing that should be noted is the the ALL keyword is not -------# supported. There can be only one entry that matches a given -------# repository. diff --cc Robust/JavaGrammar/COPYING index a43ea212,a43ea212,a43ea212,a43ea212,a43ea212,a43ea212,a43ea212..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/COPYING +++ /dev/null @@@@@@@@ -1,339 -1,339 -1,339 -1,339 -1,339 -1,339 -1,339 +1,0 @@@@@@@@ ------- GNU GENERAL PUBLIC LICENSE ------- Version 2, June 1991 ------- ------- Copyright (C) 1989, 1991 Free Software Foundation, Inc. ------- 675 Mass Ave, Cambridge, MA 02139, USA ------- Everyone is permitted to copy and distribute verbatim copies ------- of this license document, but changing it is not allowed. ------- ------- Preamble ------- ------- The licenses for most software are designed to take away your -------freedom to share and change it. By contrast, the GNU General Public -------License is intended to guarantee your freedom to share and change free -------software--to make sure the software is free for all its users. This -------General Public License applies to most of the Free Software -------Foundation's software and to any other program whose authors commit to -------using it. (Some other Free Software Foundation software is covered by -------the GNU Library General Public License instead.) You can apply it to -------your programs, too. ------- ------- When we speak of free software, we are referring to freedom, not -------price. Our General Public Licenses are designed to make sure that you -------have the freedom to distribute copies of free software (and charge for -------this service if you wish), that you receive source code or can get it -------if you want it, that you can change the software or use pieces of it -------in new free programs; and that you know you can do these things. ------- ------- To protect your rights, we need to make restrictions that forbid -------anyone to deny you these rights or to ask you to surrender the rights. -------These restrictions translate to certain responsibilities for you if you -------distribute copies of the software, or if you modify it. ------- ------- For example, if you distribute copies of such a program, whether -------gratis or for a fee, you must give the recipients all the rights that -------you have. You must make sure that they, too, receive or can get the -------source code. And you must show them these terms so they know their -------rights. ------- ------- We protect your rights with two steps: (1) copyright the software, and -------(2) offer you this license which gives you legal permission to copy, -------distribute and/or modify the software. ------- ------- Also, for each author's protection and ours, we want to make certain -------that everyone understands that there is no warranty for this free -------software. If the software is modified by someone else and passed on, we -------want its recipients to know that what they have is not the original, so -------that any problems introduced by others will not reflect on the original -------authors' reputations. ------- ------- Finally, any free program is threatened constantly by software -------patents. We wish to avoid the danger that redistributors of a free -------program will individually obtain patent licenses, in effect making the -------program proprietary. To prevent this, we have made it clear that any -------patent must be licensed for everyone's free use or not licensed at all. ------- ------- The precise terms and conditions for copying, distribution and -------modification follow. ------- ------- GNU GENERAL PUBLIC LICENSE ------- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ------- ------- 0. This License applies to any program or other work which contains -------a notice placed by the copyright holder saying it may be distributed -------under the terms of this General Public License. The "Program", below, -------refers to any such program or work, and a "work based on the Program" -------means either the Program or any derivative work under copyright law: -------that is to say, a work containing the Program or a portion of it, -------either verbatim or with modifications and/or translated into another -------language. (Hereinafter, translation is included without limitation in -------the term "modification".) Each licensee is addressed as "you". ------- -------Activities other than copying, distribution and modification are not -------covered by this License; they are outside its scope. The act of -------running the Program is not restricted, and the output from the Program -------is covered only if its contents constitute a work based on the -------Program (independent of having been made by running the Program). -------Whether that is true depends on what the Program does. ------- ------- 1. You may copy and distribute verbatim copies of the Program's -------source code as you receive it, in any medium, provided that you -------conspicuously and appropriately publish on each copy an appropriate -------copyright notice and disclaimer of warranty; keep intact all the -------notices that refer to this License and to the absence of any warranty; -------and give any other recipients of the Program a copy of this License -------along with the Program. ------- -------You may charge a fee for the physical act of transferring a copy, and -------you may at your option offer warranty protection in exchange for a fee. ------- ------- 2. You may modify your copy or copies of the Program or any portion -------of it, thus forming a work based on the Program, and copy and -------distribute such modifications or work under the terms of Section 1 -------above, provided that you also meet all of these conditions: ------- ------- a) You must cause the modified files to carry prominent notices ------- stating that you changed the files and the date of any change. ------- ------- b) You must cause any work that you distribute or publish, that in ------- whole or in part contains or is derived from the Program or any ------- part thereof, to be licensed as a whole at no charge to all third ------- parties under the terms of this License. ------- ------- c) If the modified program normally reads commands interactively ------- when run, you must cause it, when started running for such ------- interactive use in the most ordinary way, to print or display an ------- announcement including an appropriate copyright notice and a ------- notice that there is no warranty (or else, saying that you provide ------- a warranty) and that users may redistribute the program under ------- these conditions, and telling the user how to view a copy of this ------- License. (Exception: if the Program itself is interactive but ------- does not normally print such an announcement, your work based on ------- the Program is not required to print an announcement.) ------- -------These requirements apply to the modified work as a whole. If -------identifiable sections of that work are not derived from the Program, -------and can be reasonably considered independent and separate works in -------themselves, then this License, and its terms, do not apply to those -------sections when you distribute them as separate works. But when you -------distribute the same sections as part of a whole which is a work based -------on the Program, the distribution of the whole must be on the terms of -------this License, whose permissions for other licensees extend to the -------entire whole, and thus to each and every part regardless of who wrote it. ------- -------Thus, it is not the intent of this section to claim rights or contest -------your rights to work written entirely by you; rather, the intent is to -------exercise the right to control the distribution of derivative or -------collective works based on the Program. ------- -------In addition, mere aggregation of another work not based on the Program -------with the Program (or with a work based on the Program) on a volume of -------a storage or distribution medium does not bring the other work under -------the scope of this License. ------- ------- 3. You may copy and distribute the Program (or a work based on it, -------under Section 2) in object code or executable form under the terms of -------Sections 1 and 2 above provided that you also do one of the following: ------- ------- a) Accompany it with the complete corresponding machine-readable ------- source code, which must be distributed under the terms of Sections ------- 1 and 2 above on a medium customarily used for software interchange; or, ------- ------- b) Accompany it with a written offer, valid for at least three ------- years, to give any third party, for a charge no more than your ------- cost of physically performing source distribution, a complete ------- machine-readable copy of the corresponding source code, to be ------- distributed under the terms of Sections 1 and 2 above on a medium ------- customarily used for software interchange; or, ------- ------- c) Accompany it with the information you received as to the offer ------- to distribute corresponding source code. (This alternative is ------- allowed only for noncommercial distribution and only if you ------- received the program in object code or executable form with such ------- an offer, in accord with Subsection b above.) ------- -------The source code for a work means the preferred form of the work for -------making modifications to it. For an executable work, complete source -------code means all the source code for all modules it contains, plus any -------associated interface definition files, plus the scripts used to -------control compilation and installation of the executable. However, as a -------special exception, the source code distributed need not include -------anything that is normally distributed (in either source or binary -------form) with the major components (compiler, kernel, and so on) of the -------operating system on which the executable runs, unless that component -------itself accompanies the executable. ------- -------If distribution of executable or object code is made by offering -------access to copy from a designated place, then offering equivalent -------access to copy the source code from the same place counts as -------distribution of the source code, even though third parties are not -------compelled to copy the source along with the object code. ------- ------- 4. You may not copy, modify, sublicense, or distribute the Program -------except as expressly provided under this License. Any attempt -------otherwise to copy, modify, sublicense or distribute the Program is -------void, and will automatically terminate your rights under this License. -------However, parties who have received copies, or rights, from you under -------this License will not have their licenses terminated so long as such -------parties remain in full compliance. ------- ------- 5. You are not required to accept this License, since you have not -------signed it. However, nothing else grants you permission to modify or -------distribute the Program or its derivative works. These actions are -------prohibited by law if you do not accept this License. Therefore, by -------modifying or distributing the Program (or any work based on the -------Program), you indicate your acceptance of this License to do so, and -------all its terms and conditions for copying, distributing or modifying -------the Program or works based on it. ------- ------- 6. Each time you redistribute the Program (or any work based on the -------Program), the recipient automatically receives a license from the -------original licensor to copy, distribute or modify the Program subject to -------these terms and conditions. You may not impose any further -------restrictions on the recipients' exercise of the rights granted herein. -------You are not responsible for enforcing compliance by third parties to -------this License. ------- ------- 7. If, as a consequence of a court judgment or allegation of patent -------infringement or for any other reason (not limited to patent issues), -------conditions are imposed on you (whether by court order, agreement or -------otherwise) that contradict the conditions of this License, they do not -------excuse you from the conditions of this License. If you cannot -------distribute so as to satisfy simultaneously your obligations under this -------License and any other pertinent obligations, then as a consequence you -------may not distribute the Program at all. For example, if a patent -------license would not permit royalty-free redistribution of the Program by -------all those who receive copies directly or indirectly through you, then -------the only way you could satisfy both it and this License would be to -------refrain entirely from distribution of the Program. ------- -------If any portion of this section is held invalid or unenforceable under -------any particular circumstance, the balance of the section is intended to -------apply and the section as a whole is intended to apply in other -------circumstances. ------- -------It is not the purpose of this section to induce you to infringe any -------patents or other property right claims or to contest validity of any -------such claims; this section has the sole purpose of protecting the -------integrity of the free software distribution system, which is -------implemented by public license practices. Many people have made -------generous contributions to the wide range of software distributed -------through that system in reliance on consistent application of that -------system; it is up to the author/donor to decide if he or she is willing -------to distribute software through any other system and a licensee cannot -------impose that choice. ------- -------This section is intended to make thoroughly clear what is believed to -------be a consequence of the rest of this License. ------- ------- 8. If the distribution and/or use of the Program is restricted in -------certain countries either by patents or by copyrighted interfaces, the -------original copyright holder who places the Program under this License -------may add an explicit geographical distribution limitation excluding -------those countries, so that distribution is permitted only in or among -------countries not thus excluded. In such case, this License incorporates -------the limitation as if written in the body of this License. ------- ------- 9. The Free Software Foundation may publish revised and/or new versions -------of the General Public License from time to time. Such new versions will -------be similar in spirit to the present version, but may differ in detail to -------address new problems or concerns. ------- -------Each version is given a distinguishing version number. If the Program -------specifies a version number of this License which applies to it and "any -------later version", you have the option of following the terms and conditions -------either of that version or of any later version published by the Free -------Software Foundation. If the Program does not specify a version number of -------this License, you may choose any version ever published by the Free Software -------Foundation. ------- ------- 10. If you wish to incorporate parts of the Program into other free -------programs whose distribution conditions are different, write to the author -------to ask for permission. For software which is copyrighted by the Free -------Software Foundation, write to the Free Software Foundation; we sometimes -------make exceptions for this. Our decision will be guided by the two goals -------of preserving the free status of all derivatives of our free software and -------of promoting the sharing and reuse of software generally. ------- ------- NO WARRANTY ------- ------- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -------FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -------OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -------PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -------OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -------MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -------TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -------PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -------REPAIR OR CORRECTION. ------- ------- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -------WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -------REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -------INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -------OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -------TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -------YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -------PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -------POSSIBILITY OF SUCH DAMAGES. ------- ------- END OF TERMS AND CONDITIONS ------- ------- Appendix: How to Apply These Terms to Your New Programs ------- ------- If you develop a new program, and you want it to be of the greatest -------possible use to the public, the best way to achieve this is to make it -------free software which everyone can redistribute and change under these terms. ------- ------- To do so, attach the following notices to the program. It is safest -------to attach them to the start of each source file to most effectively -------convey the exclusion of warranty; and each file should have at least -------the "copyright" line and a pointer to where the full notice is found. ------- ------- ------- Copyright (C) 19yy ------- ------- This program is free software; you can redistribute it and/or modify ------- it under the terms of the GNU General Public License as published by ------- the Free Software Foundation; either version 2 of the License, or ------- (at your option) any later version. ------- ------- This program is distributed in the hope that it will be useful, ------- but WITHOUT ANY WARRANTY; without even the implied warranty of ------- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ------- GNU General Public License for more details. ------- ------- You should have received a copy of the GNU General Public License ------- along with this program; if not, write to the Free Software ------- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ------- -------Also add information on how to contact you by electronic and paper mail. ------- -------If the program is interactive, make it output a short notice like this -------when it starts in an interactive mode: ------- ------- Gnomovision version 69, Copyright (C) 19yy name of author ------- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. ------- This is free software, and you are welcome to redistribute it ------- under certain conditions; type `show c' for details. ------- -------The hypothetical commands `show w' and `show c' should show the appropriate -------parts of the General Public License. Of course, the commands you use may -------be called something other than `show w' and `show c'; they could even be -------mouse-clicks or menu items--whatever suits your program. ------- -------You should also get your employer (if you work as a programmer) or your -------school, if any, to sign a "copyright disclaimer" for the program, if -------necessary. Here is a sample; alter the names: ------- ------- Yoyodyne, Inc., hereby disclaims all copyright interest in the program ------- `Gnomovision' (which makes passes at compilers) written by James Hacker. ------- ------- , 1 April 1989 ------- Ty Coon, President of Vice ------- -------This General Public License does not permit incorporating your program into -------proprietary programs. If your program is a subroutine library, you may -------consider it more useful to permit linking proprietary applications with the -------library. If this is what you want to do, use the GNU Library General -------Public License instead of this License. diff --cc Robust/JavaGrammar/Lex/BooleanLiteral.java index 9ff274f2,9ff274f2,9ff274f2,9ff274f2,9ff274f2,9ff274f2,9ff274f2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/BooleanLiteral.java +++ /dev/null @@@@@@@@ -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class BooleanLiteral extends Literal { ------- Boolean val; ------- BooleanLiteral(boolean b) { this.val = new Boolean(b); } ------- ------- Symbol token() { return new Symbol(Sym.BOOLEAN_LITERAL, val); } ------- ------- public String toString() { return "BooleanLiteral <"+val.toString()+">"; } -------} diff --cc Robust/JavaGrammar/Lex/CharacterLiteral.java index d3d8d073,d3d8d073,d3d8d073,d3d8d073,d3d8d073,d3d8d073,d3d8d073..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/CharacterLiteral.java +++ /dev/null @@@@@@@@ -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class CharacterLiteral extends Literal { ------- Character val; ------- CharacterLiteral(char c) { this.val = new Character(c); } ------- ------- Symbol token() { return new Symbol(Sym.CHARACTER_LITERAL, val); } ------- ------- public String toString() { ------- return "CharacterLiteral <"+Token.escape(val.toString())+">"; ------- } -------} diff --cc Robust/JavaGrammar/Lex/Comment.java index 6a0aae4b,6a0aae4b,6a0aae4b,6a0aae4b,6a0aae4b,6a0aae4b,6a0aae4b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Comment.java +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class Comment extends InputElement { ------- private StringBuffer comment = new StringBuffer(); ------- ------- String getComment() { return comment.toString(); } ------- ------- void appendLine(String more) { // 'more' is '\n' terminated. ------- int i=0; ------- ------- // skip leading white space. ------- for (; i ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------class FIFO { ------- java_cup.runtime.Symbol[] backing = new java_cup.runtime.Symbol[10]; ------- int start=0, end=0; ------- final Getter getter; ------- FIFO(Getter getter) { this.getter = getter; } ------- public boolean isEmpty() { return start==end; } ------- private boolean isFull() { ------- return start==end+1 || (start==0 && end==backing.length-1); ------- } ------- private int size() { ------- return ((end= size()) ------- put(getter.next()); ------- int index = start+i; ------- if (index >= backing.length) index -= backing.length; ------- ASSERT(0<= index && index < backing.length); ------- return backing[index]; ------- } ------- abstract static class Getter { ------- abstract java_cup.runtime.Symbol next() ------- throws java.io.IOException; ------- } ------- private static void ASSERT(boolean b) { ------- if (!b) throw new RuntimeException(); ------- } -------} ------- ------- diff --cc Robust/JavaGrammar/Lex/FloatLiteral.java index 8d6adf20,8d6adf20,8d6adf20,8d6adf20,8d6adf20,8d6adf20,8d6adf20..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/FloatLiteral.java +++ /dev/null @@@@@@@@ -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class FloatLiteral extends NumericLiteral { ------- FloatLiteral(float f) { this.val = new Float(f); } ------- ------- Symbol token() { return new Symbol(Sym.FLOATING_POINT_LITERAL, val); } -------} diff --cc Robust/JavaGrammar/Lex/Identifier.java index 1d90994f,1d90994f,1d90994f,1d90994f,1d90994f,1d90994f,1d90994f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Identifier.java +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------public class Identifier extends Token { ------- String identifier; ------- public Identifier(String identifier) { this.identifier=identifier; } ------- ------- public String toString() { return "Identifier <"+identifier+">"; } ------- ------- /* Ben Walter correctly pointed out that ------- * the first released version of this grammar/lexer did not ------- * return the string value of the identifier in the parser token. ------- * Should be fixed now. ;-) ------- */ ------- Symbol token() { return new Symbol(Sym.IDENTIFIER, identifier); } -------} diff --cc Robust/JavaGrammar/Lex/InputElement.java index 11858266,11858266,11858266,11858266,11858266,11858266,11858266..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/InputElement.java +++ /dev/null @@@@@@@@ -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class InputElement {} diff --cc Robust/JavaGrammar/Lex/IntegerLiteral.java index 8c217069,8c217069,8c217069,8c217069,8c217069,8c217069,8c217069..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/IntegerLiteral.java +++ /dev/null @@@@@@@@ -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class IntegerLiteral extends NumericLiteral { ------- IntegerLiteral(int i) { this.val = new Integer(i); } ------- ------- Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } -------} diff --cc Robust/JavaGrammar/Lex/Keyword.java index 94476708,94476708,94476708,94476708,94476708,94476708,94476708..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Keyword.java +++ /dev/null @@@@@@@@ -1,69 -1,69 -1,69 -1,69 -1,69 -1,69 -1,69 +1,0 @@@@@@@@ -------package Lex; ------- -------import java.util.Hashtable; -------import java_cup.runtime.Symbol; ------- -------class Keyword extends Token { ------- String keyword; ------- Keyword(String s) { keyword = s; } ------- ------- Symbol token() { ------- Integer i = (Integer) key_table.get(keyword); ------- return new Symbol(i.intValue()); ------- } ------- public String toString() { return "Keyword <"+keyword+">"; } ------- ------- static private final Hashtable key_table = new Hashtable(); ------- static { ------- key_table.put("abstract", new Integer(Sym.ABSTRACT)); ------- key_table.put("assert", new Integer(Sym.ASSERT)); ------- key_table.put("boolean", new Integer(Sym.BOOLEAN)); ------- key_table.put("break", new Integer(Sym.BREAK)); ------- key_table.put("byte", new Integer(Sym.BYTE)); ------- key_table.put("case", new Integer(Sym.CASE)); ------- key_table.put("catch", new Integer(Sym.CATCH)); ------- key_table.put("char", new Integer(Sym.CHAR)); ------- key_table.put("class", new Integer(Sym.CLASS)); ------- key_table.put("const", new Integer(Sym.CONST)); ------- key_table.put("continue", new Integer(Sym.CONTINUE)); ------- key_table.put("default", new Integer(Sym.DEFAULT)); ------- key_table.put("do", new Integer(Sym.DO)); ------- key_table.put("double", new Integer(Sym.DOUBLE)); ------- key_table.put("else", new Integer(Sym.ELSE)); ------- key_table.put("enum", new Integer(Sym.ENUM)); ------- key_table.put("extends", new Integer(Sym.EXTENDS)); ------- key_table.put("final", new Integer(Sym.FINAL)); ------- key_table.put("finally", new Integer(Sym.FINALLY)); ------- key_table.put("float", new Integer(Sym.FLOAT)); ------- key_table.put("for", new Integer(Sym.FOR)); ------- key_table.put("goto", new Integer(Sym.GOTO)); ------- key_table.put("if", new Integer(Sym.IF)); ------- key_table.put("implements", new Integer(Sym.IMPLEMENTS)); ------- key_table.put("import", new Integer(Sym.IMPORT)); ------- key_table.put("instanceof", new Integer(Sym.INSTANCEOF)); ------- key_table.put("int", new Integer(Sym.INT)); ------- key_table.put("interface", new Integer(Sym.INTERFACE)); ------- key_table.put("long", new Integer(Sym.LONG)); ------- key_table.put("native", new Integer(Sym.NATIVE)); ------- key_table.put("new", new Integer(Sym.NEW)); ------- key_table.put("package", new Integer(Sym.PACKAGE)); ------- key_table.put("private", new Integer(Sym.PRIVATE)); ------- key_table.put("protected", new Integer(Sym.PROTECTED)); ------- key_table.put("public", new Integer(Sym.PUBLIC)); ------- key_table.put("return", new Integer(Sym.RETURN)); ------- key_table.put("short", new Integer(Sym.SHORT)); ------- key_table.put("static", new Integer(Sym.STATIC)); ------- key_table.put("strictfp", new Integer(Sym.STRICTFP)); ------- key_table.put("super", new Integer(Sym.SUPER)); ------- key_table.put("switch", new Integer(Sym.SWITCH)); ------- key_table.put("synchronized", new Integer(Sym.SYNCHRONIZED)); ------- key_table.put("this", new Integer(Sym.THIS)); ------- key_table.put("throw", new Integer(Sym.THROW)); ------- key_table.put("throws", new Integer(Sym.THROWS)); ------- key_table.put("transient", new Integer(Sym.TRANSIENT)); ------- key_table.put("try", new Integer(Sym.TRY)); ------- key_table.put("void", new Integer(Sym.VOID)); ------- key_table.put("volatile", new Integer(Sym.VOLATILE)); ------- key_table.put("while", new Integer(Sym.WHILE)); ------- } -------} diff --cc Robust/JavaGrammar/Lex/Lexer.java index 0be7f9cb,0be7f9cb,0be7f9cb,0be7f9cb,0be7f9cb,0be7f9cb,0be7f9cb..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Lexer.java +++ /dev/null @@@@@@@@ -1,528 -1,528 -1,528 -1,528 -1,528 -1,528 -1,528 +1,0 @@@@@@@@ -------package Lex; ------- -------import java.io.Reader; -------import java.io.LineNumberReader; ------- -------/* Java lexer. ------- * Copyright (C) 2002 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------public class Lexer implements Parse.Lexer { ------- LineNumberReader reader; ------- boolean isJava12; ------- boolean isJava14; ------- boolean isJava15; ------- String line = null; ------- int line_pos = 1; ------- int line_num = 0; ------- LineList lineL = new LineList(-line_pos, null); // sentinel for line #0 ------- ------- public Lexer(Reader reader) { ------- this(reader, 2); // by default, use a Java 1.2-compatible lexer. ------- } ------- public Lexer(Reader reader, int java_minor_version) { ------- this.reader = new LineNumberReader(new EscapedUnicodeReader(reader)); ------- this.isJava12 = java_minor_version >= 2; ------- this.isJava14 = java_minor_version >= 4; ------- this.isJava15 = java_minor_version >= 5; ------- } ------- ------- public java_cup.runtime.Symbol nextToken() throws java.io.IOException { ------- java_cup.runtime.Symbol sym = ------- lookahead==null ? _nextToken() : lookahead.get(); ------- /* Old "smart lexer" hack to parse JSR-14 syntax. New, better, grammar ------- * makes this unnecessary. (Credit to Eric Blake for its discovery.) ------- * ------- if (isJava15 && sym.sym==Sym.LT && shouldBePLT()) ------- sym.sym=Sym.PLT; ------- */ ------- last = sym; ------- return sym; ------- } ------- private boolean shouldBePLT() throws java.io.IOException { ------- // look ahead to see if this LT should be changed to a PLT ------- if (last==null || last.sym!=Sym.IDENTIFIER) ------- return false; ------- if (lookahead==null) lookahead = new FIFO(new FIFO.Getter() { ------- java_cup.runtime.Symbol next() throws java.io.IOException ------- { return _nextToken(); } ------- }); ------- int i=0; ------- // skip past IDENTIFIER (DOT IDENTIFIER)* ------- if (lookahead.peek(i++).sym != Sym.IDENTIFIER) ------- return false; ------- while (lookahead.peek(i).sym == Sym.DOT) { ------- i++; ------- if (lookahead.peek(i++).sym != Sym.IDENTIFIER) ------- return false; ------- } ------- // skip past (LBRACK RBRACK)* ------- while (lookahead.peek(i).sym == Sym.LBRACK) { ------- i++; ------- if (lookahead.peek(i++).sym != Sym.RBRACK) ------- return false; ------- } ------- // now the next sym has to be one of LT GT COMMA EXTENDS IMPLEMENTS ------- switch(lookahead.peek(i).sym) { ------- default: ------- return false; ------- case Sym.LT: ------- case Sym.GT: ------- case Sym.COMMA: ------- case Sym.EXTENDS: ------- case Sym.IMPLEMENTS: ------- return true; ------- } ------- } ------- private java_cup.runtime.Symbol last = null; ------- private FIFO lookahead = null; ------- public java_cup.runtime.Symbol _nextToken() throws java.io.IOException { ------- /* tokens are: ------- * Identifiers/Keywords/true/false/null (start with java letter) ------- * numeric literal (start with number) ------- * character literal (start with single quote) ------- * string (start with double quote) ------- * separator (parens, braces, brackets, semicolon, comma, period) ------- * operator (equals, plus, minus, etc) ------- * whitespace ------- * comment (start with slash) ------- */ ------- InputElement ie; ------- int startpos, endpos; ------- do { ------- startpos = lineL.head + line_pos; ------- ie = getInputElement(); ------- if (ie instanceof DocumentationComment) ------- comment = ((Comment)ie).getComment(); ------- } while (!(ie instanceof Token)); ------- endpos = lineL.head + line_pos - 1; ------- ------- //System.out.println(ie.toString()); // uncomment to debug lexer. ------- java_cup.runtime.Symbol sym = ((Token)ie).token(); ------- // fix up left/right positions. ------- sym.left = startpos; sym.right = endpos; ------- // return token. ------- return sym; ------- } ------- public boolean debug_lex() throws java.io.IOException { ------- InputElement ie = getInputElement(); ------- System.out.println(ie); ------- return !(ie instanceof EOF); ------- } ------- ------- String comment; ------- public String lastComment() { return comment; } ------- public void clearComment() { comment=""; } ------- ------- InputElement getInputElement() throws java.io.IOException { ------- if (line_num == 0) ------- nextLine(); ------- if (line==null) ------- return new EOF(); ------- if (line.length()<=line_pos) { // end of line. ------- nextLine(); ------- if (line==null) ------- return new EOF(); ------- } ------- ------- switch (line.charAt(line_pos)) { ------- ------- // White space: ------- case ' ': // ASCII SP ------- case '\t': // ASCII HT ------- case '\f': // ASCII FF ------- case '\n': // LineTerminator ------- return new WhiteSpace(consume()); ------- ------- // EOF character: ------- case '\020': // ASCII SUB ------- consume(); ------- return new EOF(); ------- ------- // Comment prefix: ------- case '/': ------- return getComment(); ------- ------- // else, a Token ------- default: ------- return getToken(); ------- } ------- } ------- // May get Token instead of Comment. ------- InputElement getComment() throws java.io.IOException { ------- String comment; ------- // line.charAt(line_pos+0) is '/' ------- switch (line.charAt(line_pos+1)) { ------- case '/': // EndOfLineComment ------- comment = line.substring(line_pos+2); ------- line_pos = line.length(); ------- return new EndOfLineComment(comment); ------- case '*': // TraditionalComment or DocumentationComment ------- line_pos += 2; ------- if (line.charAt(line_pos)=='*') { // DocumentationComment ------- return snarfComment(new DocumentationComment()); ------- } else { // TraditionalComment ------- return snarfComment(new TraditionalComment()); ------- } ------- default: // it's a token, not a comment. ------- return getToken(); ------- } ------- } ------- ------- Comment snarfComment(Comment c) throws java.io.IOException { ------- StringBuffer text=new StringBuffer(); ------- while(true) { // Grab CommentTail ------- while (line.charAt(line_pos)!='*') { // Add NotStar to comment. ------- int star_pos = line.indexOf('*', line_pos); ------- if (star_pos<0) { ------- text.append(line.substring(line_pos)); ------- c.appendLine(text.toString()); text.setLength(0); ------- line_pos = line.length(); ------- nextLine(); ------- if (line==null) ------- throw new Error("Unterminated comment at end of file."); ------- } else { ------- text.append(line.substring(line_pos, star_pos)); ------- line_pos=star_pos; ------- } ------- } ------- // At this point, line.charAt(line_pos)=='*' ------- // Grab CommentTailStar starting at line_pos+1. ------- if (line.charAt(line_pos+1)=='/') { // safe because line ends with '\n' ------- c.appendLine(text.toString()); line_pos+=2; return c; ------- } ------- text.append(line.charAt(line_pos++)); // add the '*' ------- } ------- } ------- ------- Token getToken() { ------- // Tokens are: Identifiers, Keywords, Literals, Separators, Operators. ------- switch (line.charAt(line_pos)) { ------- // Separators: (period is a special case) ------- case '(': ------- case ')': ------- case '{': ------- case '}': ------- case '[': ------- case ']': ------- case ';': ------- case ',': ------- return new Separator(consume()); ------- ------- // Operators: ------- case '=': ------- case '>': ------- case '<': ------- case '!': ------- case '~': ------- case '?': ------- case ':': ------- case '&': ------- case '|': ------- case '+': ------- case '-': ------- case '*': ------- case '/': ------- case '^': ------- case '%': ------- return getOperator(); ------- case '\'': ------- return getCharLiteral(); ------- case '\"': ------- return getStringLiteral(); ------- ------- // a period is a special case: ------- case '.': ------- if (Character.digit(line.charAt(line_pos+1),10)!=-1) ------- return getNumericLiteral(); ------- else if (isJava15 && ------- line.charAt(line_pos+1)=='.' && ------- line.charAt(line_pos+2)=='.') { ------- consume(); consume(); consume(); ------- return new Separator('\u2026'); // unicode ellipsis character. ------- } else return new Separator(consume()); ------- default: ------- break; ------- } ------- if (Character.isJavaIdentifierStart(line.charAt(line_pos))) ------- return getIdentifier(); ------- if (Character.isDigit(line.charAt(line_pos))) ------- return getNumericLiteral(); ------- throw new Error("Illegal character on line "+line_num); ------- } ------- ------- static final String[] keywords = new String[] { ------- "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", ------- "class", "const", "continue", "default", "do", "double", "else", "enum", ------- "extends", "final", "finally", "float", "for", "goto", "if", ------- "implements", "import", "instanceof", "int", "interface", "long", ------- "native", "new", "package", "private", "protected", "public", ------- "return", "short", "static", "strictfp", "super", "switch", ------- "synchronized", "this", "throw", "throws", "transient", "try", "void", ------- "volatile", "while" }; ------- Token getIdentifier() { ------- // Get id string. ------- StringBuffer sb = new StringBuffer().append(consume()); ------- ------- if (!Character.isJavaIdentifierStart(sb.charAt(0))) ------- throw new Error("Invalid Java Identifier on line "+line_num); ------- while (Character.isJavaIdentifierPart(line.charAt(line_pos))) ------- sb.append(consume()); ------- String s = sb.toString(); ------- // Now check against boolean literals and null literal. ------- if (s.equals("null")) return new NullLiteral(); ------- if (s.equals("true")) return new BooleanLiteral(true); ------- if (s.equals("false")) return new BooleanLiteral(false); ------- // Check against keywords. ------- // pre-java 1.5 compatibility: ------- if (!isJava15 && s.equals("enum")) return new Identifier(s); ------- // pre-java 1.4 compatibility: ------- if (!isJava14 && s.equals("assert")) return new Identifier(s); ------- // pre-java 1.2 compatibility: ------- if (!isJava12 && s.equals("strictfp")) return new Identifier(s); ------- // use binary search. ------- for (int l=0, r=keywords.length; r > l; ) { ------- int x = (l+r)/2, cmp = s.compareTo(keywords[x]); ------- if (cmp < 0) r=x; else l=x+1; ------- if (cmp== 0) return new Keyword(s); ------- } ------- // not a keyword. ------- return new Identifier(s); ------- } ------- NumericLiteral getNumericLiteral() { ------- int i; ------- // leading decimal indicates float. ------- if (line.charAt(line_pos)=='.') ------- return getFloatingPointLiteral(); ------- // 0x indicates Hex. ------- if (line.charAt(line_pos)=='0' && ------- (line.charAt(line_pos+1)=='x' || ------- line.charAt(line_pos+1)=='X')) { ------- line_pos+=2; return getIntegerLiteral(/*base*/16); ------- } ------- // otherwise scan to first non-numeric ------- for (i=line_pos; Character.digit(line.charAt(i),10)!=-1; ) ------- i++; ------- switch(line.charAt(i)) { // discriminate based on first non-numeric ------- case '.': ------- case 'f': ------- case 'F': ------- case 'd': ------- case 'D': ------- case 'e': ------- case 'E': ------- return getFloatingPointLiteral(); ------- case 'L': ------- case 'l': ------- default: ------- if (line.charAt(line_pos)=='0') ------- return getIntegerLiteral(/*base*/8); ------- return getIntegerLiteral(/*base*/10); ------- } ------- } ------- NumericLiteral getIntegerLiteral(int radix) { ------- long val=0; ------- while (Character.digit(line.charAt(line_pos),radix)!=-1) ------- val = (val*radix) + Character.digit(consume(),radix); ------- if (line.charAt(line_pos) == 'l' || ------- line.charAt(line_pos) == 'L') { ------- consume(); ------- return new LongLiteral(val); ------- } ------- // we compare MAX_VALUE against val/2 to allow constants like ------- // 0xFFFF0000 to get past the test. (unsigned long->signed int) ------- if ((val/2) > Integer.MAX_VALUE || ------- val < Integer.MIN_VALUE) ------- throw new Error("Constant does not fit in integer on line "+line_num); ------- return new IntegerLiteral((int)val); ------- } ------- NumericLiteral getFloatingPointLiteral() { ------- String rep = getDigits(); ------- if (line.charAt(line_pos)=='.') ------- rep+=consume() + getDigits(); ------- if (line.charAt(line_pos)=='e' || ------- line.charAt(line_pos)=='E') { ------- rep+=consume(); ------- if (line.charAt(line_pos)=='+' || ------- line.charAt(line_pos)=='-') ------- rep+=consume(); ------- rep+=getDigits(); ------- } ------- try { ------- switch (line.charAt(line_pos)) { ------- case 'f': ------- case 'F': ------- consume(); ------- return new FloatLiteral(Float.valueOf(rep).floatValue()); ------- case 'd': ------- case 'D': ------- consume(); ------- /* falls through */ ------- default: ------- return new DoubleLiteral(Double.valueOf(rep).doubleValue()); ------- } ------- } catch (NumberFormatException e) { ------- throw new Error("Illegal floating-point on line "+line_num+": "+e); ------- } ------- } ------- String getDigits() { ------- StringBuffer sb = new StringBuffer(); ------- while (Character.digit(line.charAt(line_pos),10)!=-1) ------- sb.append(consume()); ------- return sb.toString(); ------- } ------- ------- Operator getOperator() { ------- char first = consume(); ------- char second= line.charAt(line_pos); ------- ------- switch(first) { ------- // single-character operators. ------- case '~': ------- case '?': ------- case ':': ------- return new Operator(new String(new char[] {first})); ------- // doubled operators ------- case '+': ------- case '-': ------- case '&': ------- case '|': ------- if (first==second) ------- return new Operator(new String(new char[] {first, consume()})); ------- default: ------- break; ------- } ------- // Check for trailing '=' ------- if (second=='=') ------- return new Operator(new String(new char[] {first, consume()})); ------- ------- // Special-case '<<', '>>' and '>>>' ------- if ((first=='<' && second=='<') || // << ------- (first=='>' && second=='>')) { // >> ------- String op = new String(new char[] {first, consume()}); ------- if (first=='>' && line.charAt(line_pos)=='>') // >>> ------- op += consume(); ------- if (line.charAt(line_pos)=='=') // <<=, >>=, >>>= ------- op += consume(); ------- return new Operator(op); ------- } ------- ------- // Otherwise return single operator. ------- return new Operator(new String(new char[] {first})); ------- } ------- ------- CharacterLiteral getCharLiteral() { ------- char firstquote = consume(); ------- char val; ------- switch (line.charAt(line_pos)) { ------- case '\\': ------- val = getEscapeSequence(); ------- break; ------- case '\'': ------- throw new Error("Invalid character literal on line "+line_num); ------- case '\n': ------- throw new Error("Invalid character literal on line "+line_num); ------- default: ------- val = consume(); ------- break; ------- } ------- char secondquote = consume(); ------- if (firstquote != '\'' || secondquote != '\'') ------- throw new Error("Invalid character literal on line "+line_num); ------- return new CharacterLiteral(val); ------- } ------- StringLiteral getStringLiteral() { ------- char openquote = consume(); ------- StringBuffer val = new StringBuffer(); ------- while (line.charAt(line_pos)!='\"') { ------- switch(line.charAt(line_pos)) { ------- case '\\': ------- val.append(getEscapeSequence()); ------- break; ------- case '\n': ------- throw new Error("Invalid string literal on line " + line_num); ------- default: ------- val.append(consume()); ------- break; ------- } ------- } ------- char closequote = consume(); ------- if (openquote != '\"' || closequote != '\"') ------- throw new Error("Invalid string literal on line " + line_num); ------- ------- return new StringLiteral(val.toString().intern()); ------- } ------- ------- char getEscapeSequence() { ------- if (consume() != '\\') ------- throw new Error("Invalid escape sequence on line " + line_num); ------- switch(line.charAt(line_pos)) { ------- case 'b': ------- consume(); return '\b'; ------- case 't': ------- consume(); return '\t'; ------- case 'n': ------- consume(); return '\n'; ------- case 'f': ------- consume(); return '\f'; ------- case 'r': ------- consume(); return '\r'; ------- case '\"': ------- consume(); return '\"'; ------- case '\'': ------- consume(); return '\''; ------- case '\\': ------- consume(); return '\\'; ------- case '0': ------- case '1': ------- case '2': ------- case '3': ------- return (char) getOctal(3); ------- case '4': ------- case '5': ------- case '6': ------- case '7': ------- return (char) getOctal(2); ------- default: ------- throw new Error("Invalid escape sequence on line " + line_num); ------- } ------- } ------- int getOctal(int maxlength) { ------- int i, val=0; ------- for (i=0; i0xFF)) // impossible. ------- throw new Error("Invalid octal escape sequence in line " + line_num); ------- return val; ------- } ------- ------- char consume() { return line.charAt(line_pos++); } ------- void nextLine() throws java.io.IOException { ------- line=reader.readLine(); ------- if (line!=null) line=line+'\n'; ------- lineL = new LineList(lineL.head+line_pos, lineL); // for error reporting ------- line_pos=0; ------- line_num++; ------- } ------- ------- // Deal with error messages. ------- public void errorMsg(String msg, java_cup.runtime.Symbol info) { ------- int n=line_num, c=info.left-lineL.head; ------- for (LineList p = lineL; p!=null; p=p.tail, n--) ------- if (p.head<=info.left) { c=info.left-p.head; break; } ------- System.err.println(msg+" at line "+n); ------- num_errors++; ------- } ------- private int num_errors = 0; ------- public int numErrors() { return num_errors; } ------- ------- class LineList { ------- int head; ------- LineList tail; ------- LineList(int head, LineList tail) { this.head = head; this.tail = tail; } ------- } -------} diff --cc Robust/JavaGrammar/Lex/Literal.java index e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Literal.java +++ /dev/null @@@@@@@@ -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class Literal extends Token { } diff --cc Robust/JavaGrammar/Lex/LongLiteral.java index 4b01d826,4b01d826,4b01d826,4b01d826,4b01d826,4b01d826,4b01d826..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/LongLiteral.java +++ /dev/null @@@@@@@@ -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class LongLiteral extends NumericLiteral { ------- LongLiteral(long l) { this.val = new Long(l); } ------- ------- Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } -------} diff --cc Robust/JavaGrammar/Lex/NullLiteral.java index 2109bba3,2109bba3,2109bba3,2109bba3,2109bba3,2109bba3,2109bba3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/NullLiteral.java +++ /dev/null @@@@@@@@ -1,11 -1,11 -1,11 -1,11 -1,11 -1,11 -1,11 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class NullLiteral extends Literal { ------- NullLiteral() { } ------- ------- Symbol token() { return new Symbol(Sym.NULL_LITERAL); } ------- ------- public String toString() { return "NullLiteral "; } -------} diff --cc Robust/JavaGrammar/Lex/NumericLiteral.java index f67a135a,f67a135a,f67a135a,f67a135a,f67a135a,f67a135a,f67a135a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/NumericLiteral.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class NumericLiteral extends Literal { ------- Number val; ------- ------- public String toString() { return "NumericLiteral <"+val.toString()+">"; } -------} diff --cc Robust/JavaGrammar/Lex/Operator.java index 3d97d6e3,3d97d6e3,3d97d6e3,3d97d6e3,3d97d6e3,3d97d6e3,3d97d6e3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Operator.java +++ /dev/null @@@@@@@@ -1,57 -1,57 -1,57 -1,57 -1,57 -1,57 -1,57 +1,0 @@@@@@@@ -------package Lex; ------- -------import java.util.Hashtable; -------import java_cup.runtime.Symbol; ------- -------class Operator extends Token { ------- String which; ------- Operator(String which) { this.which = which; } ------- ------- public String toString() { return "Operator <"+which+">"; } ------- ------- Symbol token() { ------- Integer i = (Integer) op_table.get(which); ------- return new Symbol(i.intValue()); ------- } ------- ------- static private final Hashtable op_table = new Hashtable(); ------- static { ------- op_table.put("=", new Integer(Sym.EQ)); ------- op_table.put(">", new Integer(Sym.GT)); ------- op_table.put("<", new Integer(Sym.LT)); ------- op_table.put("!", new Integer(Sym.NOT)); ------- op_table.put("~", new Integer(Sym.COMP)); ------- op_table.put("?", new Integer(Sym.QUESTION)); ------- op_table.put(":", new Integer(Sym.COLON)); ------- op_table.put("==", new Integer(Sym.EQEQ)); ------- op_table.put("<=", new Integer(Sym.LTEQ)); ------- op_table.put(">=", new Integer(Sym.GTEQ)); ------- op_table.put("!=", new Integer(Sym.NOTEQ)); ------- op_table.put("&&", new Integer(Sym.ANDAND)); ------- op_table.put("||", new Integer(Sym.OROR)); ------- op_table.put("++", new Integer(Sym.PLUSPLUS)); ------- op_table.put("--", new Integer(Sym.MINUSMINUS)); ------- op_table.put("+", new Integer(Sym.PLUS)); ------- op_table.put("-", new Integer(Sym.MINUS)); ------- op_table.put("*", new Integer(Sym.MULT)); ------- op_table.put("/", new Integer(Sym.DIV)); ------- op_table.put("&", new Integer(Sym.AND)); ------- op_table.put("|", new Integer(Sym.OR)); ------- op_table.put("^", new Integer(Sym.XOR)); ------- op_table.put("%", new Integer(Sym.MOD)); ------- op_table.put("<<", new Integer(Sym.LSHIFT)); ------- op_table.put(">>", new Integer(Sym.RSHIFT)); ------- op_table.put(">>>", new Integer(Sym.URSHIFT)); ------- op_table.put("+=", new Integer(Sym.PLUSEQ)); ------- op_table.put("-=", new Integer(Sym.MINUSEQ)); ------- op_table.put("*=", new Integer(Sym.MULTEQ)); ------- op_table.put("/=", new Integer(Sym.DIVEQ)); ------- op_table.put("&=", new Integer(Sym.ANDEQ)); ------- op_table.put("|=", new Integer(Sym.OREQ)); ------- op_table.put("^=", new Integer(Sym.XOREQ)); ------- op_table.put("%=", new Integer(Sym.MODEQ)); ------- op_table.put("<<=", new Integer(Sym.LSHIFTEQ)); ------- op_table.put(">>=", new Integer(Sym.RSHIFTEQ)); ------- op_table.put(">>>=", new Integer(Sym.URSHIFTEQ)); ------- } -------} diff --cc Robust/JavaGrammar/Lex/Separator.java index b2b2ab2d,b2b2ab2d,b2b2ab2d,b2b2ab2d,b2b2ab2d,b2b2ab2d,b2b2ab2d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Separator.java +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class Separator extends Token { ------- char which; ------- Separator(char which) { this.which = which; } ------- ------- Symbol token() { ------- switch(which) { ------- case '(': return new Symbol(Sym.LPAREN); ------- case ')': return new Symbol(Sym.RPAREN); ------- case '{': return new Symbol(Sym.LBRACE); ------- case '}': return new Symbol(Sym.RBRACE); ------- case '[': return new Symbol(Sym.LBRACK); ------- case ']': return new Symbol(Sym.RBRACK); ------- case ';': return new Symbol(Sym.SEMICOLON); ------- case ',': return new Symbol(Sym.COMMA); ------- case '.': return new Symbol(Sym.DOT); ------- case '\u2026': return new Symbol(Sym.ELLIPSIS); ------- default: ------- throw new Error("Invalid separator."); ------- } ------- } ------- ------- public String toString() { ------- return "Separator <"+which+">"; ------- } -------} diff --cc Robust/JavaGrammar/Lex/StringLiteral.java index cdf4e981,cdf4e981,cdf4e981,cdf4e981,cdf4e981,cdf4e981,cdf4e981..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/StringLiteral.java +++ /dev/null @@@@@@@@ -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; ------- -------class StringLiteral extends Literal { ------- String val; ------- StringLiteral(String s) { this.val = s; } ------- ------- Symbol token() { return new Symbol(Sym.STRING_LITERAL, val); } ------- ------- public String toString() { ------- return "StringLiteral <"+Token.escape(val)+">"; ------- } -------} diff --cc Robust/JavaGrammar/Lex/Token.java index ec3a578d,ec3a578d,ec3a578d,ec3a578d,ec3a578d,ec3a578d,ec3a578d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Lex/Token.java +++ /dev/null @@@@@@@@ -1,21 -1,21 -1,21 -1,21 -1,21 -1,21 -1,21 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class Token extends InputElement { ------- abstract java_cup.runtime.Symbol token(); ------- ------- protected static String escape(String s) { ------- StringBuffer sb = new StringBuffer(); ------- for (int i=0; i"; ------- } -------} diff --cc Robust/JavaGrammar/Main/Main.java index d8233302,d8233302,d8233302,d8233302,d8233302,d8233302,d8233302..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Main/Main.java +++ /dev/null @@@@@@@@ -1,39 -1,39 -1,39 -1,39 -1,39 -1,39 -1,39 +1,0 @@@@@@@@ -------package Main; ------- -------import java.io.Reader; -------import java.io.BufferedReader; -------import java.io.FileReader; ------- -------/* Test skeleton for java parser/lexer. ------- * Copyright (C) 1998 C. Scott Ananian ------- * This is released under the terms of the GPL with NO WARRANTY. ------- * See the file COPYING for more details. ------- */ ------- -------public class Main { ------- public static void main(String args[]) throws Exception { ------- Reader fr = new BufferedReader(new FileReader(args[0])); ------- // the integer in the next line specifies the java minor version. ------- // for example, for a java 1.0 lexer specify '0' ------- // for a java 1.1 lexer specify '1' ------- // etc. ------- // As far as the lexer's concerned, 'strictfp' was added in Java 1.2, ------- // 'assert' in Java 1.4, and we need a "lookahead <" token PLT ------- // to correctly parse Java 1.5. ------- int java_minor_version = 5; ------- if (args.length>1) java_minor_version = Integer.parseInt(args[1]); ------- Lex.Lexer l = new Lex.Lexer(fr, java_minor_version); ------- java_cup.runtime.lr_parser g; ------- switch (java_minor_version) { ------- default: ------- case 5: g = new Parse.Grm15(l); break; ------- case 4: g = new Parse.Grm14(l); break; ------- case 3: ------- case 2: g = new Parse.Grm12(l); break; ------- case 1: g = new Parse.Grm11(l); break; ------- case 0: g = new Parse.Grm10(l); break; ------- } ------- g./*debug_*/parse(); ------- System.exit(l.numErrors()); ------- } -------} diff --cc Robust/JavaGrammar/Makefile index 758243e1,758243e1,758243e1,758243e1,758243e1,758243e1,758243e1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Makefile +++ /dev/null @@@@@@@@ -1,89 -1,89 -1,89 -1,89 -1,89 -1,89 -1,89 +1,0 @@@@@@@@ -------# Makefile to create simple test framework for the java parsers. -------# Copyright (C) 1998 C. Scott Ananian -------# Released under the terms of the GPL with NO WARRANTY. See COPYING. ------- -------# java environment. -------JAVA=java -------JAVAC=javac -------JFLAGS=-g -------#CUPFLAGS=-dump_states ------- -------# list the available java grammar versions -------JAVA_GRAMMARS=10 11 12 14 15 ------- -------all: $(foreach j,$(JAVA_GRAMMARS),Parse/Grm$(j).class) \ ------- Lex/Lex.class Main/Main.class ------- -------# Feed the appropriate CUP specification to javaCUP. -------Parse/Grm%.java Parse/Sym%.java: Parse/java%.cup ------- cd Parse && \ ------- ${JAVA} java_cup.Main ${CUPFLAGS} -parser Grm$* -symbols Sym$* \ ------- < java$*.cup 2>Grm$*.err && tail Grm$*.err ------- -------# Compile the java source for the parser. -------Parse/Grm%.class: Parse/Lexer.java Parse/Grm%.java Parse/Sym%.java ------- ${JAVAC} ${JFLAGS} $^ ------- -------# Make the lexer symbols from the parser symbols. -------Lex/Sym.java: $(foreach j,$(JAVA_GRAMMARS),Parse/Sym$(j).java) -------# verify that these are all identical! ------- @if cat $^ | sed -e 's/Sym[0-9][0-9]/Sym/g' | sort | uniq -c | \ ------- egrep -v '^[ ]*[0-9]*[05] ' | grep -v "^[ ]*[0-9]*[ ]*//"\ ------- ; then \ ------- echo $^ "are not identical;" ;\ ------- echo "we won't be able to build a single lexer for all of these." ;\ ------- exit 1;\ ------- fi -------# now make a generic version. ------- sed -e "s/package Parse/package Lex/" -e "s/Sym10/Sym/g" \ ------- < Parse/Sym10.java > $@ ------- -------# Compile the java source for the (unified) lexer. -------Lex/Lex.class: Lex/*.java Lex/Sym.java ------- ${JAVAC} ${JFLAGS} Lex/*.java ------- -------# Compile the java source for the driver. -------Main/Main.class: Main/Main.java ------- ${JAVAC} ${JFLAGS} Main/*.java ------- -------# run some quick tests. -------test: Parse/Lexer.java Parse/Grm14.java all phony ------- for n in 1 2 3 4 5; do \ ------- ( ${JAVA} Main.Main Parse/Lexer.java $$n && \ ------- ${JAVA} Main.Main Parse/Grm14.java $$n && \ ------- ${JAVA} Main.Main tests/Escape.java) || exit 1; \ ------- done ------- for n in 2 3 4 5; do \ ------- ${JAVA} Main.Main tests/Eric.java $$n || exit 1; \ ------- done ------- ${JAVA} Main.Main tests/TestJSR201.java 5 ------- ${JAVA} Main.Main tests/Test15.java 5 ------- ${JAVA} Main.Main tests/Eric15.java 5 -------# always run the test. -------phony: ------- -------# target to make the distributed files. -------dist: ------- -$(RM) -rf JavaGrammar javagrm.tar.gz javagrm.zip ------- cvs -d `cat CVS/Root` co -A -P JavaGrammar ------- find JavaGrammar -type d -name CVS | xargs $(RM) -rf ------- tar czvf javagrm.tar.gz JavaGrammar ------- zip -r javagrm.zip JavaGrammar ------- cp javagrm.tar.gz `date +javagrm-%d-%b-%Y.tar.gz` ------- cp README javagrm-README.txt ------- $(RM) -rf JavaGrammar -------upload: dist ------- chmod a+r javagrm* ------- scp javagrm* shades.cs.princeton.edu:/u/appel/public_html/modern/java/CUP ------- -------# clean up after ourselves. -------clean: ------- $(RM) Lex/Sym.java \ ------- $(foreach j,$(JAVA_GRAMMARS),Parse/Grm$(j).err) \ ------- $(foreach j,$(JAVA_GRAMMARS),Parse/Grm$(j).java) \ ------- $(foreach j,$(JAVA_GRAMMARS),Parse/Sym$(j).java) \ ------- Parse/parser.java Parse/sym.java \ ------- */*.class ------- -------veryclean: clean ------- $(RM) *~ */*~ javagrm* diff --cc Robust/JavaGrammar/Parse/Lexer.java index 7fbcbd5f,7fbcbd5f,7fbcbd5f,7fbcbd5f,7fbcbd5f,7fbcbd5f,7fbcbd5f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Parse/Lexer.java +++ /dev/null @@@@@@@@ -1,13 -1,13 -1,13 -1,13 -1,13 -1,13 -1,13 +1,0 @@@@@@@@ -------package Parse; ------- -------/* Lexer.java. Copyright (C) 1998 C. Scott Ananian. ------- * This program is free software; see the file COPYING for more details. ------- */ ------- -------public interface Lexer { ------- public java_cup.runtime.Symbol nextToken() throws java.io.IOException; ------- /** report an error */ ------- public void errorMsg(String msg, java_cup.runtime.Symbol info); ------- /** return the number of errors reported */ ------- public int numErrors(); -------} diff --cc Robust/JavaGrammar/Parse/java10.cup index 879210e3,879210e3,879210e3,879210e3,879210e3,879210e3,879210e3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Parse/java10.cup +++ /dev/null @@@@@@@@ -1,825 -1,825 -1,825 -1,825 -1,825 -1,825 -1,825 +1,0 @@@@@@@@ -------package Parse; ------- -------import java_cup.runtime.*; ------- -------/* Java 1.0 parser for CUP. ------- * Copyright (C) 1998 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------parser code {: ------- Lexer lexer; ------- ------- public Grm10(Lexer l) { ------- this(); ------- lexer=l; ------- } ------- ------- public void syntax_error(java_cup.runtime.Symbol current) { ------- report_error("Syntax error (" + current.sym + ")", current); ------- } ------- public void report_error(String message, java_cup.runtime.Symbol info) { ------- lexer.errorMsg(message, info); ------- } -------:}; ------- -------scan with {: return lexer.nextToken(); :}; ------- -------terminal BOOLEAN; // primitive_type -------terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -------terminal FLOAT, DOUBLE; // floating_point_type -------terminal LBRACK, RBRACK; // array_type -------terminal java.lang.String IDENTIFIER; // name -------terminal DOT; // qualified_name -------terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -------terminal PACKAGE; // package_declaration -------terminal IMPORT; // import_declaration -------terminal PUBLIC, PROTECTED, PRIVATE; // modifier -------terminal STATIC; // modifier -------terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -------terminal CLASS; // class_declaration -------terminal EXTENDS; // super -------terminal IMPLEMENTS; // interfaces -------terminal VOID; // method_header -------terminal THROWS; // throws -------terminal THIS, SUPER; // explicit_constructor_invocation -------terminal INTERFACE; // interface_declaration -------terminal IF, ELSE; // if_then_statement, if_then_else_statement -------terminal SWITCH; // switch_statement -------terminal CASE, DEFAULT; // switch_label -------terminal DO, WHILE; // while_statement, do_statement -------terminal FOR; // for_statement -------terminal BREAK; // break_statement -------terminal CONTINUE; // continue_statement -------terminal RETURN; // return_statement -------terminal THROW; // throw_statement -------terminal TRY; // try_statement -------terminal CATCH; // catch_clause -------terminal FINALLY; // finally -------terminal NEW; // class_instance_creation_expression -------terminal PLUSPLUS; // postincrement_expression -------terminal MINUSMINUS; // postdecrement_expression -------terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -------terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -------terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -------terminal EQEQ, NOTEQ; // equality_expression -------terminal AND; // and_expression -------terminal XOR; // exclusive_or_expression -------terminal OR; // inclusive_or_expression -------terminal ANDAND; // conditional_and_expression -------terminal OROR; // conditional_or_expression -------terminal QUESTION; // conditional_expression -------terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -------terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -------terminal ANDEQ, XOREQ, OREQ; // assignment_operator ------- -------terminal java.lang.Number INTEGER_LITERAL; -------terminal java.lang.Number FLOATING_POINT_LITERAL; -------terminal java.lang.Boolean BOOLEAN_LITERAL; -------terminal java.lang.Character CHARACTER_LITERAL; -------terminal java.lang.String STRING_LITERAL; -------terminal NULL_LITERAL; ------- -------// Reserved but unused: -------terminal CONST, GOTO; -------// lexer compatibility with Java 1.2: -------terminal STRICTFP; -------// lexer compatibility with Java 1.4 -------terminal ASSERT; -------// lexer compatibility with Java 1.5 -------terminal ELLIPSIS; -------terminal ENUM; ------- -------// 19.2) The Syntactic Grammar -------non terminal goal; -------// 19.3) Lexical Structure -------non terminal literal; -------// 19.4) Types, Values, and Variables -------non terminal type, primitive_type, numeric_type; -------non terminal integral_type, floating_point_type; -------non terminal reference_type; -------non terminal class_or_interface_type; -------non terminal class_type, interface_type; -------non terminal array_type; -------// 19.5) Names -------non terminal name, simple_name, qualified_name; -------// 19.6) Packages -------non terminal compilation_unit; -------non terminal package_declaration_opt, package_declaration; -------non terminal import_declarations_opt, import_declarations; -------non terminal type_declarations_opt, type_declarations; -------non terminal import_declaration; -------non terminal single_type_import_declaration; -------non terminal type_import_on_demand_declaration; -------non terminal type_declaration; -------// 19.7) Productions used only in the LALR(1) grammar -------non terminal modifiers_opt, modifiers, modifier; -------// 19.8.1) Class Declaration -------non terminal class_declaration, super, super_opt; -------non terminal interfaces, interfaces_opt, interface_type_list; -------non terminal class_body; -------non terminal class_body_declarations, class_body_declarations_opt; -------non terminal class_body_declaration, class_member_declaration; -------// 19.8.2) Field Declarations -------non terminal field_declaration, variable_declarators, variable_declarator; -------non terminal variable_declarator_id, variable_initializer; -------// 19.8.3) Method Declarations -------non terminal method_declaration, method_header, method_declarator; -------non terminal formal_parameter_list_opt, formal_parameter_list; -------non terminal formal_parameter; -------non terminal throws_opt, throws; -------non terminal class_type_list, method_body; -------// 19.8.4) Static Initializers -------non terminal static_initializer; -------// 19.8.5) Constructor Declarations -------non terminal constructor_declaration, constructor_declarator; -------non terminal constructor_body; -------non terminal explicit_constructor_invocation; -------// 19.9.1) Interface Declarations -------non terminal interface_declaration; -------non terminal extends_interfaces_opt, extends_interfaces; -------non terminal interface_body; -------non terminal interface_member_declarations_opt, interface_member_declarations; -------non terminal interface_member_declaration, constant_declaration; -------non terminal abstract_method_declaration; -------// 19.10) Arrays -------non terminal array_initializer; -------non terminal variable_initializers; -------// 19.11) Blocks and Statements -------non terminal block; -------non terminal block_statements_opt, block_statements, block_statement; -------non terminal local_variable_declaration_statement, local_variable_declaration; -------non terminal statement, statement_no_short_if; -------non terminal statement_without_trailing_substatement; -------non terminal empty_statement; -------non terminal labeled_statement, labeled_statement_no_short_if; -------non terminal expression_statement, statement_expression; -------non terminal if_then_statement; -------non terminal if_then_else_statement, if_then_else_statement_no_short_if; -------non terminal switch_statement, switch_block; -------non terminal switch_block_statement_groups; -------non terminal switch_block_statement_group; -------non terminal switch_labels, switch_label; -------non terminal while_statement, while_statement_no_short_if; -------non terminal do_statement; -------non terminal for_statement, for_statement_no_short_if; -------non terminal for_init_opt, for_init; -------non terminal for_update_opt, for_update; -------non terminal statement_expression_list; -------non terminal identifier_opt; -------non terminal break_statement, continue_statement; -------non terminal return_statement, throw_statement; -------non terminal synchronized_statement, try_statement; -------non terminal catches_opt, catches, catch_clause; -------non terminal finally; -------// 19.12) Expressions -------non terminal primary, primary_no_new_array; -------non terminal class_instance_creation_expression; -------non terminal argument_list_opt, argument_list; -------non terminal array_creation_expression; -------non terminal dim_exprs, dim_expr, dims_opt, dims; -------non terminal field_access, method_invocation, array_access; -------non terminal postfix_expression; -------non terminal postincrement_expression, postdecrement_expression; -------non terminal unary_expression, unary_expression_not_plus_minus; -------non terminal preincrement_expression, predecrement_expression; -------non terminal cast_expression; -------non terminal multiplicative_expression, additive_expression; -------non terminal shift_expression, relational_expression, equality_expression; -------non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -------non terminal conditional_and_expression, conditional_or_expression; -------non terminal conditional_expression, assignment_expression; -------non terminal assignment; -------non terminal left_hand_side; -------non terminal assignment_operator; -------non terminal expression_opt, expression; -------non terminal constant_expression; ------- -------start with goal; ------- -------// 19.2) The Syntactic Grammar -------goal ::= compilation_unit ------- ; ------- -------// 19.3) Lexical Structure. -------literal ::= INTEGER_LITERAL ------- | FLOATING_POINT_LITERAL ------- | BOOLEAN_LITERAL ------- | CHARACTER_LITERAL ------- | STRING_LITERAL ------- | NULL_LITERAL ------- ; ------- -------// 19.4) Types, Values, and Variables -------type ::= primitive_type ------- | reference_type ------- ; -------primitive_type ::= ------- numeric_type ------- | BOOLEAN ------- ; -------numeric_type::= integral_type ------- | floating_point_type ------- ; -------integral_type ::= ------- BYTE ------- | SHORT ------- | INT ------- | LONG ------- | CHAR ------- ; -------floating_point_type ::= ------- FLOAT ------- | DOUBLE ------- ; ------- -------reference_type ::= ------- class_or_interface_type ------- | array_type ------- ; -------class_or_interface_type ::= name; ------- -------class_type ::= class_or_interface_type; -------interface_type ::= class_or_interface_type; ------- -------array_type ::= primitive_type LBRACK RBRACK ------- | name LBRACK RBRACK ------- | array_type LBRACK RBRACK ------- ; ------- -------// 19.5) Names -------name ::= simple_name ------- | qualified_name ------- ; -------simple_name ::= IDENTIFIER ------- ; -------qualified_name ::= ------- name DOT IDENTIFIER ------- ; ------- -------// 19.6) Packages -------compilation_unit ::= ------- package_declaration_opt ------- import_declarations_opt ------- type_declarations_opt ------- ; -------package_declaration_opt ::= package_declaration | ; -------import_declarations_opt ::= import_declarations | ; -------type_declarations_opt ::= type_declarations | ; ------- -------import_declarations ::= ------- import_declaration ------- | import_declarations import_declaration ------- ; -------type_declarations ::= ------- type_declaration ------- | type_declarations type_declaration ------- ; -------package_declaration ::= ------- PACKAGE name SEMICOLON ------- ; -------import_declaration ::= ------- single_type_import_declaration ------- | type_import_on_demand_declaration ------- ; -------single_type_import_declaration ::= ------- IMPORT name SEMICOLON ------- ; -------type_import_on_demand_declaration ::= ------- IMPORT name DOT MULT SEMICOLON ------- ; -------type_declaration ::= ------- class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.7) Productions used only in the LALR(1) grammar -------modifiers_opt::= ------- | modifiers ------- ; -------modifiers ::= modifier ------- | modifiers modifier ------- ; -------modifier ::= PUBLIC | PROTECTED | PRIVATE ------- | STATIC ------- | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE ------- ; ------- -------// 19.8) Classes ------- -------// 19.8.1) Class Declaration: -------class_declaration ::= ------- modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- ; -------super ::= EXTENDS class_type ------- ; -------super_opt ::= ------- | super ------- ; -------interfaces ::= IMPLEMENTS interface_type_list ------- ; -------interfaces_opt::= ------- | interfaces ------- ; -------interface_type_list ::= ------- interface_type ------- | interface_type_list COMMA interface_type ------- ; -------class_body ::= LBRACE class_body_declarations_opt RBRACE ------- ; -------class_body_declarations_opt ::= ------- | class_body_declarations ; -------class_body_declarations ::= ------- class_body_declaration ------- | class_body_declarations class_body_declaration ------- ; -------class_body_declaration ::= ------- class_member_declaration ------- | static_initializer ------- | constructor_declaration ------- ; -------class_member_declaration ::= ------- field_declaration ------- | method_declaration ------- | SEMICOLON ------- ; ------- -------// 19.8.2) Field Declarations -------field_declaration ::= ------- modifiers_opt type variable_declarators SEMICOLON ------- ; -------variable_declarators ::= ------- variable_declarator ------- | variable_declarators COMMA variable_declarator ------- ; -------variable_declarator ::= ------- variable_declarator_id ------- | variable_declarator_id EQ variable_initializer ------- ; -------variable_declarator_id ::= ------- IDENTIFIER ------- | variable_declarator_id LBRACK RBRACK ------- ; -------variable_initializer ::= ------- expression ------- | array_initializer ------- ; ------- -------// 19.8.3) Method Declarations -------method_declaration ::= ------- method_header method_body ------- ; -------method_header ::= ------- modifiers_opt type method_declarator throws_opt ------- | modifiers_opt VOID method_declarator throws_opt ------- ; -------method_declarator ::= ------- IDENTIFIER LPAREN formal_parameter_list_opt RPAREN ------- | method_declarator LBRACK RBRACK ------- ; -------formal_parameter_list_opt ::= ------- | formal_parameter_list ------- ; -------formal_parameter_list ::= ------- formal_parameter ------- | formal_parameter_list COMMA formal_parameter ------- ; -------formal_parameter ::= ------- type variable_declarator_id ------- ; -------throws_opt ::= ------- | throws ------- ; -------throws ::= THROWS class_type_list ------- ; -------class_type_list ::= ------- class_type ------- | class_type_list COMMA class_type ------- ; -------method_body ::= block ------- | SEMICOLON ------- ; ------- -------// 19.8.4) Static Initializers -------static_initializer ::= ------- STATIC block ------- ; ------- -------// 19.8.5) Constructor Declarations -------constructor_declaration ::= ------- modifiers_opt constructor_declarator throws_opt ------- constructor_body ------- ; -------constructor_declarator ::= ------- simple_name LPAREN formal_parameter_list_opt RPAREN ------- ; -------constructor_body ::= ------- LBRACE explicit_constructor_invocation ------- block_statements RBRACE ------- | LBRACE explicit_constructor_invocation RBRACE ------- | LBRACE block_statements RBRACE ------- | LBRACE RBRACE ------- ; -------explicit_constructor_invocation ::= ------- THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- ; ------- -------// 19.9) Interfaces ------- -------// 19.9.1) Interface Declarations -------interface_declaration ::= ------- modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt ------- interface_body ------- ; -------extends_interfaces_opt ::= ------- | extends_interfaces ------- ; -------extends_interfaces ::= ------- EXTENDS interface_type ------- | extends_interfaces COMMA interface_type ------- ; -------interface_body ::= ------- LBRACE interface_member_declarations_opt RBRACE ------- ; -------interface_member_declarations_opt ::= ------- | interface_member_declarations ------- ; -------interface_member_declarations ::= ------- interface_member_declaration ------- | interface_member_declarations interface_member_declaration ------- ; -------interface_member_declaration ::= ------- constant_declaration ------- | abstract_method_declaration ------- | SEMICOLON ------- ; -------constant_declaration ::= ------- field_declaration ------- ; -------abstract_method_declaration ::= ------- method_header SEMICOLON ------- ; ------- -------// 19.10) Arrays -------array_initializer ::= ------- LBRACE variable_initializers COMMA RBRACE ------- | LBRACE variable_initializers RBRACE ------- | LBRACE COMMA RBRACE ------- | LBRACE RBRACE ------- ; -------variable_initializers ::= ------- variable_initializer ------- | variable_initializers COMMA variable_initializer ------- ; ------- -------// 19.11) Blocks and Statements -------block ::= LBRACE block_statements_opt RBRACE ------- ; -------block_statements_opt ::= ------- | block_statements ------- ; -------block_statements ::= ------- block_statement ------- | block_statements block_statement ------- ; -------block_statement ::= ------- local_variable_declaration_statement ------- | statement ------- ; -------local_variable_declaration_statement ::= ------- local_variable_declaration SEMICOLON ------- ; -------local_variable_declaration ::= ------- type variable_declarators ------- ; -------statement ::= statement_without_trailing_substatement ------- | labeled_statement ------- | if_then_statement ------- | if_then_else_statement ------- | while_statement ------- | for_statement ------- ; -------statement_no_short_if ::= ------- statement_without_trailing_substatement ------- | labeled_statement_no_short_if ------- | if_then_else_statement_no_short_if ------- | while_statement_no_short_if ------- | for_statement_no_short_if ------- ; -------statement_without_trailing_substatement ::= ------- block ------- | empty_statement ------- | expression_statement ------- | switch_statement ------- | do_statement ------- | break_statement ------- | continue_statement ------- | return_statement ------- | synchronized_statement ------- | throw_statement ------- | try_statement ------- ; -------empty_statement ::= ------- SEMICOLON ------- ; -------labeled_statement ::= ------- IDENTIFIER COLON statement ------- ; -------labeled_statement_no_short_if ::= ------- IDENTIFIER COLON statement_no_short_if ------- ; -------expression_statement ::= ------- statement_expression SEMICOLON ------- ; -------statement_expression ::= ------- assignment ------- | preincrement_expression ------- | predecrement_expression ------- | postincrement_expression ------- | postdecrement_expression ------- | method_invocation ------- | class_instance_creation_expression ------- ; -------if_then_statement ::= ------- IF LPAREN expression RPAREN statement ------- ; -------if_then_else_statement ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement ------- ; -------if_then_else_statement_no_short_if ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement_no_short_if ------- ; -------switch_statement ::= ------- SWITCH LPAREN expression RPAREN switch_block ------- ; -------switch_block ::= ------- LBRACE switch_block_statement_groups switch_labels RBRACE ------- | LBRACE switch_block_statement_groups RBRACE ------- | LBRACE switch_labels RBRACE ------- | LBRACE RBRACE ------- ; -------switch_block_statement_groups ::= ------- switch_block_statement_group ------- | switch_block_statement_groups switch_block_statement_group ------- ; -------switch_block_statement_group ::= ------- switch_labels block_statements ------- ; -------switch_labels ::= ------- switch_label ------- | switch_labels switch_label ------- ; -------switch_label ::= ------- CASE constant_expression COLON ------- | DEFAULT COLON ------- ; ------- -------while_statement ::= ------- WHILE LPAREN expression RPAREN statement ------- ; -------while_statement_no_short_if ::= ------- WHILE LPAREN expression RPAREN statement_no_short_if ------- ; -------do_statement ::= ------- DO statement WHILE LPAREN expression RPAREN SEMICOLON ------- ; -------for_statement ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement ------- ; -------for_statement_no_short_if ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement_no_short_if ------- ; -------for_init_opt ::= ------- | for_init ------- ; -------for_init ::= statement_expression_list ------- | local_variable_declaration ------- ; -------for_update_opt ::= ------- | for_update ------- ; -------for_update ::= statement_expression_list ------- ; -------statement_expression_list ::= ------- statement_expression ------- | statement_expression_list COMMA statement_expression ------- ; ------- -------identifier_opt ::= ------- | IDENTIFIER ------- ; ------- -------break_statement ::= ------- BREAK identifier_opt SEMICOLON ------- ; ------- -------continue_statement ::= ------- CONTINUE identifier_opt SEMICOLON ------- ; -------return_statement ::= ------- RETURN expression_opt SEMICOLON ------- ; -------throw_statement ::= ------- THROW expression SEMICOLON ------- ; -------synchronized_statement ::= ------- SYNCHRONIZED LPAREN expression RPAREN block ------- ; -------try_statement ::= ------- TRY block catches ------- | TRY block catches_opt finally ------- ; -------catches_opt ::= ------- | catches ------- ; -------catches ::= catch_clause ------- | catches catch_clause ------- ; -------catch_clause ::= ------- CATCH LPAREN formal_parameter RPAREN block ------- ; -------finally ::= FINALLY block ------- ; ------- -------// 19.12) Expressions -------primary ::= primary_no_new_array ------- | array_creation_expression ------- ; -------primary_no_new_array ::= ------- literal ------- | THIS ------- | LPAREN expression RPAREN ------- | class_instance_creation_expression ------- | field_access ------- | method_invocation ------- | array_access ------- ; -------class_instance_creation_expression ::= ------- NEW class_type LPAREN argument_list_opt RPAREN ------- ; -------argument_list_opt ::= ------- | argument_list ------- ; -------argument_list ::= ------- expression ------- | argument_list COMMA expression ------- ; -------array_creation_expression ::= ------- NEW primitive_type dim_exprs dims_opt ------- | NEW class_or_interface_type dim_exprs dims_opt ------- ; -------dim_exprs ::= dim_expr ------- | dim_exprs dim_expr ------- ; -------dim_expr ::= LBRACK expression RBRACK ------- ; -------dims_opt ::= ------- | dims ------- ; -------dims ::= LBRACK RBRACK ------- | dims LBRACK RBRACK ------- ; -------field_access ::= ------- primary DOT IDENTIFIER ------- | SUPER DOT IDENTIFIER ------- ; -------method_invocation ::= ------- name LPAREN argument_list_opt RPAREN ------- | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- ; -------array_access ::= ------- name LBRACK expression RBRACK ------- | primary_no_new_array LBRACK expression RBRACK ------- ; -------postfix_expression ::= ------- primary ------- | name ------- | postincrement_expression ------- | postdecrement_expression ------- ; -------postincrement_expression ::= ------- postfix_expression PLUSPLUS ------- ; -------postdecrement_expression ::= ------- postfix_expression MINUSMINUS ------- ; -------unary_expression ::= ------- preincrement_expression ------- | predecrement_expression ------- | PLUS unary_expression ------- | MINUS unary_expression ------- | unary_expression_not_plus_minus ------- ; -------preincrement_expression ::= ------- PLUSPLUS unary_expression ------- ; -------predecrement_expression ::= ------- MINUSMINUS unary_expression ------- ; -------unary_expression_not_plus_minus ::= ------- postfix_expression ------- | COMP unary_expression ------- | NOT unary_expression ------- | cast_expression ------- ; -------cast_expression ::= ------- LPAREN primitive_type dims_opt RPAREN unary_expression ------- | LPAREN expression RPAREN unary_expression_not_plus_minus ------- | LPAREN name dims RPAREN unary_expression_not_plus_minus ------- ; -------multiplicative_expression ::= ------- unary_expression ------- | multiplicative_expression MULT unary_expression ------- | multiplicative_expression DIV unary_expression ------- | multiplicative_expression MOD unary_expression ------- ; -------additive_expression ::= ------- multiplicative_expression ------- | additive_expression PLUS multiplicative_expression ------- | additive_expression MINUS multiplicative_expression ------- ; -------shift_expression ::= ------- additive_expression ------- | shift_expression LSHIFT additive_expression ------- | shift_expression RSHIFT additive_expression ------- | shift_expression URSHIFT additive_expression ------- ; -------relational_expression ::= ------- shift_expression ------- | relational_expression LT shift_expression ------- | relational_expression GT shift_expression ------- | relational_expression LTEQ shift_expression ------- | relational_expression GTEQ shift_expression ------- | relational_expression INSTANCEOF reference_type ------- ; -------equality_expression ::= ------- relational_expression ------- | equality_expression EQEQ relational_expression ------- | equality_expression NOTEQ relational_expression ------- ; -------and_expression ::= ------- equality_expression ------- | and_expression AND equality_expression ------- ; -------exclusive_or_expression ::= ------- and_expression ------- | exclusive_or_expression XOR and_expression ------- ; -------inclusive_or_expression ::= ------- exclusive_or_expression ------- | inclusive_or_expression OR exclusive_or_expression ------- ; -------conditional_and_expression ::= ------- inclusive_or_expression ------- | conditional_and_expression ANDAND inclusive_or_expression ------- ; -------conditional_or_expression ::= ------- conditional_and_expression ------- | conditional_or_expression OROR conditional_and_expression ------- ; -------conditional_expression ::= ------- conditional_or_expression ------- | conditional_or_expression QUESTION expression ------- COLON conditional_expression ------- ; -------assignment_expression ::= ------- conditional_expression ------- | assignment ------- ; -------assignment ::= left_hand_side assignment_operator assignment_expression ------- ; -------left_hand_side ::= ------- name ------- | field_access ------- | array_access ------- ; -------assignment_operator ::= ------- EQ ------- | MULTEQ ------- | DIVEQ ------- | MODEQ ------- | PLUSEQ ------- | MINUSEQ ------- | LSHIFTEQ ------- | RSHIFTEQ ------- | URSHIFTEQ ------- | ANDEQ ------- | XOREQ ------- | OREQ ------- ; -------expression_opt ::= ------- | expression ------- ; -------expression ::= assignment_expression ------- ; -------constant_expression ::= ------- expression ------- ; diff --cc Robust/JavaGrammar/Parse/java11.cup index 5d62ab08,5d62ab08,5d62ab08,5d62ab08,5d62ab08,5d62ab08,5d62ab08..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Parse/java11.cup +++ /dev/null @@@@@@@@ -1,862 -1,862 -1,862 -1,862 -1,862 -1,862 -1,862 +1,0 @@@@@@@@ -------package Parse; ------- -------import java_cup.runtime.*; ------- -------/* Java 1.1 parser for CUP. ------- * Copyright (C) 1998-2003 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------/* -------JDK 1.1 Features added: ------- instance initializers ------- anonymous array expressions. ------- class literals. ------- blank finals; final local variables. ------- inner classes: ------- block ::= class/interface decl ------- primary_no_new_array ::= class_name DOT THIS ------- class_instance_creation_expresion ::= ... ------- explicit_constructor_invocation ::= ... -------*/ -------parser code {: ------- Lexer lexer; ------- ------- public Grm11(Lexer l) { ------- this(); ------- lexer=l; ------- } ------- ------- public void syntax_error(java_cup.runtime.Symbol current) { ------- report_error("Syntax error (" + current.sym + ")", current); ------- } ------- public void report_error(String message, java_cup.runtime.Symbol info) { ------- lexer.errorMsg(message, info); ------- } -------:}; ------- -------scan with {: return lexer.nextToken(); :}; ------- -------terminal BOOLEAN; // primitive_type -------terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -------terminal FLOAT, DOUBLE; // floating_point_type -------terminal LBRACK, RBRACK; // array_type -------terminal java.lang.String IDENTIFIER; // name -------terminal DOT; // qualified_name -------terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -------terminal PACKAGE; // package_declaration -------terminal IMPORT; // import_declaration -------terminal PUBLIC, PROTECTED, PRIVATE; // modifier -------terminal STATIC; // modifier -------terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -------terminal CLASS; // class_declaration -------terminal EXTENDS; // super -------terminal IMPLEMENTS; // interfaces -------terminal VOID; // method_header -------terminal THROWS; // throws -------terminal THIS, SUPER; // explicit_constructor_invocation -------terminal INTERFACE; // interface_declaration -------terminal IF, ELSE; // if_then_statement, if_then_else_statement -------terminal SWITCH; // switch_statement -------terminal CASE, DEFAULT; // switch_label -------terminal DO, WHILE; // while_statement, do_statement -------terminal FOR; // for_statement -------terminal BREAK; // break_statement -------terminal CONTINUE; // continue_statement -------terminal RETURN; // return_statement -------terminal THROW; // throw_statement -------terminal TRY; // try_statement -------terminal CATCH; // catch_clause -------terminal FINALLY; // finally -------terminal NEW; // class_instance_creation_expression -------terminal PLUSPLUS; // postincrement_expression -------terminal MINUSMINUS; // postdecrement_expression -------terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -------terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -------terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -------terminal EQEQ, NOTEQ; // equality_expression -------terminal AND; // and_expression -------terminal XOR; // exclusive_or_expression -------terminal OR; // inclusive_or_expression -------terminal ANDAND; // conditional_and_expression -------terminal OROR; // conditional_or_expression -------terminal QUESTION; // conditional_expression -------terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -------terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -------terminal ANDEQ, XOREQ, OREQ; // assignment_operator ------- -------terminal java.lang.Number INTEGER_LITERAL; -------terminal java.lang.Number FLOATING_POINT_LITERAL; -------terminal java.lang.Boolean BOOLEAN_LITERAL; -------terminal java.lang.Character CHARACTER_LITERAL; -------terminal java.lang.String STRING_LITERAL; -------terminal NULL_LITERAL; ------- -------// Reserved but unused: -------terminal CONST, GOTO; -------// lexer compatibility with Java 1.2: -------terminal STRICTFP; -------// lexer compatibility with Java 1.4 -------terminal ASSERT; -------// lexer compatibility with Java 1.5 -------terminal ELLIPSIS; -------terminal ENUM; ------- -------// 19.2) The Syntactic Grammar -------non terminal goal; -------// 19.3) Lexical Structure -------non terminal literal; -------// 19.4) Types, Values, and Variables -------non terminal type, primitive_type, numeric_type; -------non terminal integral_type, floating_point_type; -------non terminal reference_type; -------non terminal class_or_interface_type; -------non terminal class_type, interface_type; -------non terminal array_type; -------// 19.5) Names -------non terminal name, simple_name, qualified_name; -------// 19.6) Packages -------non terminal compilation_unit; -------non terminal package_declaration_opt, package_declaration; -------non terminal import_declarations_opt, import_declarations; -------non terminal type_declarations_opt, type_declarations; -------non terminal import_declaration; -------non terminal single_type_import_declaration; -------non terminal type_import_on_demand_declaration; -------non terminal type_declaration; -------// 19.7) Productions used only in the LALR(1) grammar -------non terminal modifiers_opt, modifiers, modifier; -------// 19.8.1) Class Declaration -------non terminal class_declaration, super, super_opt; -------non terminal interfaces, interfaces_opt, interface_type_list; -------non terminal class_body; -------non terminal class_body_declarations, class_body_declarations_opt; -------non terminal class_body_declaration, class_member_declaration; -------// 19.8.2) Field Declarations -------non terminal field_declaration, variable_declarators, variable_declarator; -------non terminal variable_declarator_id, variable_initializer; -------// 19.8.3) Method Declarations -------non terminal method_declaration, method_header, method_declarator; -------non terminal formal_parameter_list_opt, formal_parameter_list; -------non terminal formal_parameter; -------non terminal throws_opt, throws; -------non terminal class_type_list, method_body; -------// 19.8.4) Static Initializers -------non terminal static_initializer; -------// 19.8.5) Constructor Declarations -------non terminal constructor_declaration, constructor_declarator; -------non terminal constructor_body; -------non terminal explicit_constructor_invocation; -------// 19.9.1) Interface Declarations -------non terminal interface_declaration; -------non terminal extends_interfaces_opt, extends_interfaces; -------non terminal interface_body; -------non terminal interface_member_declarations_opt, interface_member_declarations; -------non terminal interface_member_declaration, constant_declaration; -------non terminal abstract_method_declaration; -------// 19.10) Arrays -------non terminal array_initializer; -------non terminal variable_initializers; -------// 19.11) Blocks and Statements -------non terminal block; -------non terminal block_statements_opt, block_statements, block_statement; -------non terminal local_variable_declaration_statement, local_variable_declaration; -------non terminal statement, statement_no_short_if; -------non terminal statement_without_trailing_substatement; -------non terminal empty_statement; -------non terminal labeled_statement, labeled_statement_no_short_if; -------non terminal expression_statement, statement_expression; -------non terminal if_then_statement; -------non terminal if_then_else_statement, if_then_else_statement_no_short_if; -------non terminal switch_statement, switch_block; -------non terminal switch_block_statement_groups; -------non terminal switch_block_statement_group; -------non terminal switch_labels, switch_label; -------non terminal while_statement, while_statement_no_short_if; -------non terminal do_statement; -------non terminal for_statement, for_statement_no_short_if; -------non terminal for_init_opt, for_init; -------non terminal for_update_opt, for_update; -------non terminal statement_expression_list; -------non terminal identifier_opt; -------non terminal break_statement, continue_statement; -------non terminal return_statement, throw_statement; -------non terminal synchronized_statement, try_statement; -------non terminal catches_opt, catches, catch_clause; -------non terminal finally; -------// 19.12) Expressions -------non terminal primary, primary_no_new_array; -------non terminal class_instance_creation_expression; -------non terminal argument_list_opt, argument_list; -------non terminal array_creation_expression; -------non terminal dim_exprs, dim_expr, dims_opt, dims; -------non terminal field_access, method_invocation, array_access; -------non terminal postfix_expression; -------non terminal postincrement_expression, postdecrement_expression; -------non terminal unary_expression, unary_expression_not_plus_minus; -------non terminal preincrement_expression, predecrement_expression; -------non terminal cast_expression; -------non terminal multiplicative_expression, additive_expression; -------non terminal shift_expression, relational_expression, equality_expression; -------non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -------non terminal conditional_and_expression, conditional_or_expression; -------non terminal conditional_expression, assignment_expression; -------non terminal assignment; -------non terminal left_hand_side; -------non terminal assignment_operator; -------non terminal expression_opt, expression; -------non terminal constant_expression; ------- -------start with goal; ------- -------// 19.2) The Syntactic Grammar -------goal ::= compilation_unit ------- ; ------- -------// 19.3) Lexical Structure. -------literal ::= INTEGER_LITERAL ------- | FLOATING_POINT_LITERAL ------- | BOOLEAN_LITERAL ------- | CHARACTER_LITERAL ------- | STRING_LITERAL ------- | NULL_LITERAL ------- ; ------- -------// 19.4) Types, Values, and Variables -------type ::= primitive_type ------- | reference_type ------- ; -------primitive_type ::= ------- numeric_type ------- | BOOLEAN ------- ; -------numeric_type::= integral_type ------- | floating_point_type ------- ; -------integral_type ::= ------- BYTE ------- | SHORT ------- | INT ------- | LONG ------- | CHAR ------- ; -------floating_point_type ::= ------- FLOAT ------- | DOUBLE ------- ; ------- -------reference_type ::= ------- class_or_interface_type ------- | array_type ------- ; -------class_or_interface_type ::= name; ------- -------class_type ::= class_or_interface_type; -------interface_type ::= class_or_interface_type; ------- -------array_type ::= primitive_type dims ------- | name dims ------- ; ------- -------// 19.5) Names -------name ::= simple_name ------- | qualified_name ------- ; -------simple_name ::= IDENTIFIER ------- ; -------qualified_name ::= ------- name DOT IDENTIFIER ------- ; ------- -------// 19.6) Packages -------compilation_unit ::= ------- package_declaration_opt ------- import_declarations_opt ------- type_declarations_opt ------- ; -------package_declaration_opt ::= package_declaration | ; -------import_declarations_opt ::= import_declarations | ; -------type_declarations_opt ::= type_declarations | ; ------- -------import_declarations ::= ------- import_declaration ------- | import_declarations import_declaration ------- ; -------type_declarations ::= ------- type_declaration ------- | type_declarations type_declaration ------- ; -------package_declaration ::= ------- PACKAGE name SEMICOLON ------- ; -------import_declaration ::= ------- single_type_import_declaration ------- | type_import_on_demand_declaration ------- ; -------single_type_import_declaration ::= ------- IMPORT name SEMICOLON ------- ; -------type_import_on_demand_declaration ::= ------- IMPORT name DOT MULT SEMICOLON ------- ; -------type_declaration ::= ------- class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.7) Productions used only in the LALR(1) grammar -------modifiers_opt::= ------- | modifiers ------- ; -------modifiers ::= modifier ------- | modifiers modifier ------- ; -------modifier ::= PUBLIC | PROTECTED | PRIVATE ------- | STATIC ------- | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE ------- ; ------- -------// 19.8) Classes ------- -------// 19.8.1) Class Declaration: -------class_declaration ::= ------- modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- ; -------super ::= EXTENDS class_type ------- ; -------super_opt ::= ------- | super ------- ; -------interfaces ::= IMPLEMENTS interface_type_list ------- ; -------interfaces_opt::= ------- | interfaces ------- ; -------interface_type_list ::= ------- interface_type ------- | interface_type_list COMMA interface_type ------- ; -------class_body ::= LBRACE class_body_declarations_opt RBRACE ------- ; -------class_body_declarations_opt ::= ------- | class_body_declarations ; -------class_body_declarations ::= ------- class_body_declaration ------- | class_body_declarations class_body_declaration ------- ; -------class_body_declaration ::= ------- class_member_declaration ------- | static_initializer ------- | constructor_declaration ------- | block ------- ; -------class_member_declaration ::= ------- field_declaration ------- | method_declaration ------- /* repeat the prod for 'class_declaration' here: */ ------- | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.8.2) Field Declarations -------field_declaration ::= ------- modifiers_opt type variable_declarators SEMICOLON ------- ; -------variable_declarators ::= ------- variable_declarator ------- | variable_declarators COMMA variable_declarator ------- ; -------variable_declarator ::= ------- variable_declarator_id ------- | variable_declarator_id EQ variable_initializer ------- ; -------variable_declarator_id ::= ------- IDENTIFIER ------- | variable_declarator_id LBRACK RBRACK ------- ; -------variable_initializer ::= ------- expression ------- | array_initializer ------- ; ------- -------// 19.8.3) Method Declarations -------method_declaration ::= ------- method_header method_body ------- ; -------method_header ::= ------- modifiers_opt type method_declarator throws_opt ------- | modifiers_opt VOID method_declarator throws_opt ------- ; -------method_declarator ::= ------- IDENTIFIER LPAREN formal_parameter_list_opt RPAREN ------- | method_declarator LBRACK RBRACK ------- ; -------formal_parameter_list_opt ::= ------- | formal_parameter_list ------- ; -------formal_parameter_list ::= ------- formal_parameter ------- | formal_parameter_list COMMA formal_parameter ------- ; -------formal_parameter ::= ------- type variable_declarator_id ------- | FINAL type variable_declarator_id ------- ; -------throws_opt ::= ------- | throws ------- ; -------throws ::= THROWS class_type_list ------- ; -------class_type_list ::= ------- class_type ------- | class_type_list COMMA class_type ------- ; -------method_body ::= block ------- | SEMICOLON ------- ; ------- -------// 19.8.4) Static Initializers -------static_initializer ::= ------- STATIC block ------- ; ------- -------// 19.8.5) Constructor Declarations -------constructor_declaration ::= ------- modifiers_opt constructor_declarator throws_opt ------- constructor_body ------- ; -------constructor_declarator ::= ------- simple_name LPAREN formal_parameter_list_opt RPAREN ------- ; -------constructor_body ::= ------- LBRACE explicit_constructor_invocation ------- block_statements RBRACE ------- | LBRACE explicit_constructor_invocation RBRACE ------- | LBRACE block_statements RBRACE ------- | LBRACE RBRACE ------- ; -------explicit_constructor_invocation ::= ------- THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- ; ------- -------// 19.9) Interfaces ------- -------// 19.9.1) Interface Declarations -------interface_declaration ::= ------- modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt ------- interface_body ------- ; -------extends_interfaces_opt ::= ------- | extends_interfaces ------- ; -------extends_interfaces ::= ------- EXTENDS interface_type ------- | extends_interfaces COMMA interface_type ------- ; -------interface_body ::= ------- LBRACE interface_member_declarations_opt RBRACE ------- ; -------interface_member_declarations_opt ::= ------- | interface_member_declarations ------- ; -------interface_member_declarations ::= ------- interface_member_declaration ------- | interface_member_declarations interface_member_declaration ------- ; -------interface_member_declaration ::= ------- constant_declaration ------- | abstract_method_declaration ------- | class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; -------constant_declaration ::= ------- field_declaration ------- // need to semantically check that modifiers of field declaration ------- // include only PUBLIC, STATIC, or FINAL. Other modifiers are ------- // disallowed. ------- ; -------abstract_method_declaration ::= ------- method_header SEMICOLON ------- ; ------- -------// 19.10) Arrays -------array_initializer ::= ------- LBRACE variable_initializers COMMA RBRACE ------- | LBRACE variable_initializers RBRACE ------- | LBRACE COMMA RBRACE ------- | LBRACE RBRACE ------- ; -------variable_initializers ::= ------- variable_initializer ------- | variable_initializers COMMA variable_initializer ------- ; ------- -------// 19.11) Blocks and Statements -------block ::= LBRACE block_statements_opt RBRACE ------- ; -------block_statements_opt ::= ------- | block_statements ------- ; -------block_statements ::= ------- block_statement ------- | block_statements block_statement ------- ; -------block_statement ::= ------- local_variable_declaration_statement ------- | statement ------- | class_declaration ------- | interface_declaration ------- ; -------local_variable_declaration_statement ::= ------- local_variable_declaration SEMICOLON ------- ; -------local_variable_declaration ::= ------- type variable_declarators ------- | FINAL type variable_declarators ------- ; -------statement ::= statement_without_trailing_substatement ------- | labeled_statement ------- | if_then_statement ------- | if_then_else_statement ------- | while_statement ------- | for_statement ------- ; -------statement_no_short_if ::= ------- statement_without_trailing_substatement ------- | labeled_statement_no_short_if ------- | if_then_else_statement_no_short_if ------- | while_statement_no_short_if ------- | for_statement_no_short_if ------- ; -------statement_without_trailing_substatement ::= ------- block ------- | empty_statement ------- | expression_statement ------- | switch_statement ------- | do_statement ------- | break_statement ------- | continue_statement ------- | return_statement ------- | synchronized_statement ------- | throw_statement ------- | try_statement ------- ; -------empty_statement ::= ------- SEMICOLON ------- ; -------labeled_statement ::= ------- IDENTIFIER COLON statement ------- ; -------labeled_statement_no_short_if ::= ------- IDENTIFIER COLON statement_no_short_if ------- ; -------expression_statement ::= ------- statement_expression SEMICOLON ------- ; -------statement_expression ::= ------- assignment ------- | preincrement_expression ------- | predecrement_expression ------- | postincrement_expression ------- | postdecrement_expression ------- | method_invocation ------- | class_instance_creation_expression ------- ; -------if_then_statement ::= ------- IF LPAREN expression RPAREN statement ------- ; -------if_then_else_statement ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement ------- ; -------if_then_else_statement_no_short_if ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement_no_short_if ------- ; -------switch_statement ::= ------- SWITCH LPAREN expression RPAREN switch_block ------- ; -------switch_block ::= ------- LBRACE switch_block_statement_groups switch_labels RBRACE ------- | LBRACE switch_block_statement_groups RBRACE ------- | LBRACE switch_labels RBRACE ------- | LBRACE RBRACE ------- ; -------switch_block_statement_groups ::= ------- switch_block_statement_group ------- | switch_block_statement_groups switch_block_statement_group ------- ; -------switch_block_statement_group ::= ------- switch_labels block_statements ------- ; -------switch_labels ::= ------- switch_label ------- | switch_labels switch_label ------- ; -------switch_label ::= ------- CASE constant_expression COLON ------- | DEFAULT COLON ------- ; ------- -------while_statement ::= ------- WHILE LPAREN expression RPAREN statement ------- ; -------while_statement_no_short_if ::= ------- WHILE LPAREN expression RPAREN statement_no_short_if ------- ; -------do_statement ::= ------- DO statement WHILE LPAREN expression RPAREN SEMICOLON ------- ; -------for_statement ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement ------- ; -------for_statement_no_short_if ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement_no_short_if ------- ; -------for_init_opt ::= ------- | for_init ------- ; -------for_init ::= statement_expression_list ------- | local_variable_declaration ------- ; -------for_update_opt ::= ------- | for_update ------- ; -------for_update ::= statement_expression_list ------- ; -------statement_expression_list ::= ------- statement_expression ------- | statement_expression_list COMMA statement_expression ------- ; ------- -------identifier_opt ::= ------- | IDENTIFIER ------- ; ------- -------break_statement ::= ------- BREAK identifier_opt SEMICOLON ------- ; ------- -------continue_statement ::= ------- CONTINUE identifier_opt SEMICOLON ------- ; -------return_statement ::= ------- RETURN expression_opt SEMICOLON ------- ; -------throw_statement ::= ------- THROW expression SEMICOLON ------- ; -------synchronized_statement ::= ------- SYNCHRONIZED LPAREN expression RPAREN block ------- ; -------try_statement ::= ------- TRY block catches ------- | TRY block catches_opt finally ------- ; -------catches_opt ::= ------- | catches ------- ; -------catches ::= catch_clause ------- | catches catch_clause ------- ; -------catch_clause ::= ------- CATCH LPAREN formal_parameter RPAREN block ------- ; -------finally ::= FINALLY block ------- ; ------- -------// 19.12) Expressions -------primary ::= primary_no_new_array ------- | array_creation_expression ------- ; -------primary_no_new_array ::= ------- literal ------- | THIS ------- | LPAREN expression RPAREN ------- | class_instance_creation_expression ------- | field_access ------- | method_invocation ------- | array_access ------- | primitive_type DOT CLASS ------- | VOID DOT CLASS ------- | array_type DOT CLASS ------- | name DOT CLASS ------- | name DOT THIS ------- ; -------class_instance_creation_expression ::= ------- NEW class_type LPAREN argument_list_opt RPAREN ------- | NEW class_type LPAREN argument_list_opt RPAREN class_body ------- | primary DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN ------- | primary DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN class_body ------- ; -------argument_list_opt ::= ------- | argument_list ------- ; -------argument_list ::= ------- expression ------- | argument_list COMMA expression ------- ; -------array_creation_expression ::= ------- NEW primitive_type dim_exprs dims_opt ------- | NEW class_or_interface_type dim_exprs dims_opt ------- | NEW primitive_type dims array_initializer ------- | NEW class_or_interface_type dims array_initializer ------- ; -------dim_exprs ::= dim_expr ------- | dim_exprs dim_expr ------- ; -------dim_expr ::= LBRACK expression RBRACK ------- ; -------dims_opt ::= ------- | dims ------- ; -------dims ::= LBRACK RBRACK ------- | dims LBRACK RBRACK ------- ; -------field_access ::= ------- primary DOT IDENTIFIER ------- | SUPER DOT IDENTIFIER ------- ; -------method_invocation ::= ------- name LPAREN argument_list_opt RPAREN ------- | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- ; -------array_access ::= ------- name LBRACK expression RBRACK ------- | primary_no_new_array LBRACK expression RBRACK ------- ; -------postfix_expression ::= ------- primary ------- | name ------- | postincrement_expression ------- | postdecrement_expression ------- ; -------postincrement_expression ::= ------- postfix_expression PLUSPLUS ------- ; -------postdecrement_expression ::= ------- postfix_expression MINUSMINUS ------- ; -------unary_expression ::= ------- preincrement_expression ------- | predecrement_expression ------- | PLUS unary_expression ------- | MINUS unary_expression ------- | unary_expression_not_plus_minus ------- ; -------preincrement_expression ::= ------- PLUSPLUS unary_expression ------- ; -------predecrement_expression ::= ------- MINUSMINUS unary_expression ------- ; -------unary_expression_not_plus_minus ::= ------- postfix_expression ------- | COMP unary_expression ------- | NOT unary_expression ------- | cast_expression ------- ; -------cast_expression ::= ------- LPAREN primitive_type dims_opt RPAREN unary_expression ------- | LPAREN expression RPAREN unary_expression_not_plus_minus ------- | LPAREN name dims RPAREN unary_expression_not_plus_minus ------- ; -------multiplicative_expression ::= ------- unary_expression ------- | multiplicative_expression MULT unary_expression ------- | multiplicative_expression DIV unary_expression ------- | multiplicative_expression MOD unary_expression ------- ; -------additive_expression ::= ------- multiplicative_expression ------- | additive_expression PLUS multiplicative_expression ------- | additive_expression MINUS multiplicative_expression ------- ; -------shift_expression ::= ------- additive_expression ------- | shift_expression LSHIFT additive_expression ------- | shift_expression RSHIFT additive_expression ------- | shift_expression URSHIFT additive_expression ------- ; -------relational_expression ::= ------- shift_expression ------- | relational_expression LT shift_expression ------- | relational_expression GT shift_expression ------- | relational_expression LTEQ shift_expression ------- | relational_expression GTEQ shift_expression ------- | relational_expression INSTANCEOF reference_type ------- ; -------equality_expression ::= ------- relational_expression ------- | equality_expression EQEQ relational_expression ------- | equality_expression NOTEQ relational_expression ------- ; -------and_expression ::= ------- equality_expression ------- | and_expression AND equality_expression ------- ; -------exclusive_or_expression ::= ------- and_expression ------- | exclusive_or_expression XOR and_expression ------- ; -------inclusive_or_expression ::= ------- exclusive_or_expression ------- | inclusive_or_expression OR exclusive_or_expression ------- ; -------conditional_and_expression ::= ------- inclusive_or_expression ------- | conditional_and_expression ANDAND inclusive_or_expression ------- ; -------conditional_or_expression ::= ------- conditional_and_expression ------- | conditional_or_expression OROR conditional_and_expression ------- ; -------conditional_expression ::= ------- conditional_or_expression ------- | conditional_or_expression QUESTION expression ------- COLON conditional_expression ------- ; -------assignment_expression ::= ------- conditional_expression ------- | assignment ------- ; -------assignment ::= left_hand_side assignment_operator assignment_expression ------- ; -------left_hand_side ::= ------- name ------- | field_access ------- | array_access ------- ; -------assignment_operator ::= ------- EQ ------- | MULTEQ ------- | DIVEQ ------- | MODEQ ------- | PLUSEQ ------- | MINUSEQ ------- | LSHIFTEQ ------- | RSHIFTEQ ------- | URSHIFTEQ ------- | ANDEQ ------- | XOREQ ------- | OREQ ------- ; -------expression_opt ::= ------- | expression ------- ; -------expression ::= assignment_expression ------- ; -------constant_expression ::= ------- expression ------- ; diff --cc Robust/JavaGrammar/Parse/java12.cup index 3601be80,3601be80,3601be80,3601be80,3601be80,3601be80,3601be80..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Parse/java12.cup +++ /dev/null @@@@@@@@ -1,874 -1,874 -1,874 -1,874 -1,874 -1,874 -1,874 +1,0 @@@@@@@@ -------package Parse; ------- -------import java_cup.runtime.*; ------- -------/* Java 1.2 parser for CUP. ------- * Copyright (C) 1998-2003 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------/* -------JDK 1.2 Features added: ------- strictfp modifier. ------- explicit_constructor_invocation ::= ... ------- | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON ; ------- field_access ::= ... ------- | name DOT SUPER DOT IDENTIFIER ; ------- method_invocation ::= ... ------- | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ; ------- parenthesized expression, plain identifiers qualifying instance ------- creation and explicit constructors, and array creation expression ------- fixes from JLS2 (thanks to Eric Blake for pointing these out) -------*/ -------parser code {: ------- Lexer lexer; ------- ------- public Grm12(Lexer l) { ------- this(); ------- lexer=l; ------- } ------- ------- public void syntax_error(java_cup.runtime.Symbol current) { ------- report_error("Syntax error (" + current.sym + ")", current); ------- } ------- public void report_error(String message, java_cup.runtime.Symbol info) { ------- lexer.errorMsg(message, info); ------- } -------:}; ------- -------scan with {: return lexer.nextToken(); :}; ------- -------terminal BOOLEAN; // primitive_type -------terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -------terminal FLOAT, DOUBLE; // floating_point_type -------terminal LBRACK, RBRACK; // array_type -------terminal java.lang.String IDENTIFIER; // name -------terminal DOT; // qualified_name -------terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -------terminal PACKAGE; // package_declaration -------terminal IMPORT; // import_declaration -------terminal PUBLIC, PROTECTED, PRIVATE; // modifier -------terminal STATIC; // modifier -------terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -------terminal CLASS; // class_declaration -------terminal EXTENDS; // super -------terminal IMPLEMENTS; // interfaces -------terminal VOID; // method_header -------terminal THROWS; // throws -------terminal THIS, SUPER; // explicit_constructor_invocation -------terminal INTERFACE; // interface_declaration -------terminal IF, ELSE; // if_then_statement, if_then_else_statement -------terminal SWITCH; // switch_statement -------terminal CASE, DEFAULT; // switch_label -------terminal DO, WHILE; // while_statement, do_statement -------terminal FOR; // for_statement -------terminal BREAK; // break_statement -------terminal CONTINUE; // continue_statement -------terminal RETURN; // return_statement -------terminal THROW; // throw_statement -------terminal TRY; // try_statement -------terminal CATCH; // catch_clause -------terminal FINALLY; // finally -------terminal NEW; // class_instance_creation_expression -------terminal PLUSPLUS; // postincrement_expression -------terminal MINUSMINUS; // postdecrement_expression -------terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -------terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -------terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -------terminal EQEQ, NOTEQ; // equality_expression -------terminal AND; // and_expression -------terminal XOR; // exclusive_or_expression -------terminal OR; // inclusive_or_expression -------terminal ANDAND; // conditional_and_expression -------terminal OROR; // conditional_or_expression -------terminal QUESTION; // conditional_expression -------terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -------terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -------terminal ANDEQ, XOREQ, OREQ; // assignment_operator ------- -------terminal java.lang.Number INTEGER_LITERAL; -------terminal java.lang.Number FLOATING_POINT_LITERAL; -------terminal java.lang.Boolean BOOLEAN_LITERAL; -------terminal java.lang.Character CHARACTER_LITERAL; -------terminal java.lang.String STRING_LITERAL; -------terminal NULL_LITERAL; ------- -------// Reserved but unused: -------terminal CONST, GOTO; -------// strictfp keyword, new in Java 1.2 -------terminal STRICTFP; -------// lexer compatibility with Java 1.4 -------terminal ASSERT; -------// lexer compatibility with Java 1.5 -------terminal ELLIPSIS; -------terminal ENUM; ------- -------// 19.2) The Syntactic Grammar -------non terminal goal; -------// 19.3) Lexical Structure -------non terminal literal; -------// 19.4) Types, Values, and Variables -------non terminal type, primitive_type, numeric_type; -------non terminal integral_type, floating_point_type; -------non terminal reference_type; -------non terminal class_or_interface_type; -------non terminal class_type, interface_type; -------non terminal array_type; -------// 19.5) Names -------non terminal name, simple_name, qualified_name; -------// 19.6) Packages -------non terminal compilation_unit; -------non terminal package_declaration_opt, package_declaration; -------non terminal import_declarations_opt, import_declarations; -------non terminal type_declarations_opt, type_declarations; -------non terminal import_declaration; -------non terminal single_type_import_declaration; -------non terminal type_import_on_demand_declaration; -------non terminal type_declaration; -------// 19.7) Productions used only in the LALR(1) grammar -------non terminal modifiers_opt, modifiers, modifier; -------// 19.8.1) Class Declaration -------non terminal class_declaration, super, super_opt; -------non terminal interfaces, interfaces_opt, interface_type_list; -------non terminal class_body; -------non terminal class_body_declarations, class_body_declarations_opt; -------non terminal class_body_declaration, class_member_declaration; -------// 19.8.2) Field Declarations -------non terminal field_declaration, variable_declarators, variable_declarator; -------non terminal variable_declarator_id, variable_initializer; -------// 19.8.3) Method Declarations -------non terminal method_declaration, method_header, method_declarator; -------non terminal formal_parameter_list_opt, formal_parameter_list; -------non terminal formal_parameter; -------non terminal throws_opt, throws; -------non terminal class_type_list, method_body; -------// 19.8.4) Static Initializers -------non terminal static_initializer; -------// 19.8.5) Constructor Declarations -------non terminal constructor_declaration, constructor_declarator; -------non terminal constructor_body; -------non terminal explicit_constructor_invocation; -------// 19.9.1) Interface Declarations -------non terminal interface_declaration; -------non terminal extends_interfaces_opt, extends_interfaces; -------non terminal interface_body; -------non terminal interface_member_declarations_opt, interface_member_declarations; -------non terminal interface_member_declaration, constant_declaration; -------non terminal abstract_method_declaration; -------// 19.10) Arrays -------non terminal array_initializer; -------non terminal variable_initializers; -------// 19.11) Blocks and Statements -------non terminal block; -------non terminal block_statements_opt, block_statements, block_statement; -------non terminal local_variable_declaration_statement, local_variable_declaration; -------non terminal statement, statement_no_short_if; -------non terminal statement_without_trailing_substatement; -------non terminal empty_statement; -------non terminal labeled_statement, labeled_statement_no_short_if; -------non terminal expression_statement, statement_expression; -------non terminal if_then_statement; -------non terminal if_then_else_statement, if_then_else_statement_no_short_if; -------non terminal switch_statement, switch_block; -------non terminal switch_block_statement_groups; -------non terminal switch_block_statement_group; -------non terminal switch_labels, switch_label; -------non terminal while_statement, while_statement_no_short_if; -------non terminal do_statement; -------non terminal for_statement, for_statement_no_short_if; -------non terminal for_init_opt, for_init; -------non terminal for_update_opt, for_update; -------non terminal statement_expression_list; -------non terminal identifier_opt; -------non terminal break_statement, continue_statement; -------non terminal return_statement, throw_statement; -------non terminal synchronized_statement, try_statement; -------non terminal catches_opt, catches, catch_clause; -------non terminal finally; -------// 19.12) Expressions -------non terminal primary, primary_no_new_array; -------non terminal class_instance_creation_expression; -------non terminal argument_list_opt, argument_list; -------non terminal array_creation_init, array_creation_uninit; -------non terminal dim_exprs, dim_expr, dims_opt, dims; -------non terminal field_access, method_invocation, array_access; -------non terminal postfix_expression; -------non terminal postincrement_expression, postdecrement_expression; -------non terminal unary_expression, unary_expression_not_plus_minus; -------non terminal preincrement_expression, predecrement_expression; -------non terminal cast_expression; -------non terminal multiplicative_expression, additive_expression; -------non terminal shift_expression, relational_expression, equality_expression; -------non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -------non terminal conditional_and_expression, conditional_or_expression; -------non terminal conditional_expression, assignment_expression; -------non terminal assignment; -------non terminal assignment_operator; -------non terminal expression_opt, expression; -------non terminal constant_expression; ------- -------start with goal; ------- -------// 19.2) The Syntactic Grammar -------goal ::= compilation_unit ------- ; ------- -------// 19.3) Lexical Structure. -------literal ::= INTEGER_LITERAL ------- | FLOATING_POINT_LITERAL ------- | BOOLEAN_LITERAL ------- | CHARACTER_LITERAL ------- | STRING_LITERAL ------- | NULL_LITERAL ------- ; ------- -------// 19.4) Types, Values, and Variables -------type ::= primitive_type ------- | reference_type ------- ; -------primitive_type ::= ------- numeric_type ------- | BOOLEAN ------- ; -------numeric_type::= integral_type ------- | floating_point_type ------- ; -------integral_type ::= ------- BYTE ------- | SHORT ------- | INT ------- | LONG ------- | CHAR ------- ; -------floating_point_type ::= ------- FLOAT ------- | DOUBLE ------- ; ------- -------reference_type ::= ------- class_or_interface_type ------- | array_type ------- ; -------class_or_interface_type ::= name; ------- -------class_type ::= class_or_interface_type; -------interface_type ::= class_or_interface_type; ------- -------array_type ::= primitive_type dims ------- | name dims ------- ; ------- -------// 19.5) Names -------name ::= simple_name ------- | qualified_name ------- ; -------simple_name ::= IDENTIFIER ------- ; -------qualified_name ::= ------- name DOT IDENTIFIER ------- ; ------- -------// 19.6) Packages -------compilation_unit ::= ------- package_declaration_opt ------- import_declarations_opt ------- type_declarations_opt ------- ; -------package_declaration_opt ::= package_declaration | ; -------import_declarations_opt ::= import_declarations | ; -------type_declarations_opt ::= type_declarations | ; ------- -------import_declarations ::= ------- import_declaration ------- | import_declarations import_declaration ------- ; -------type_declarations ::= ------- type_declaration ------- | type_declarations type_declaration ------- ; -------package_declaration ::= ------- PACKAGE name SEMICOLON ------- ; -------import_declaration ::= ------- single_type_import_declaration ------- | type_import_on_demand_declaration ------- ; -------single_type_import_declaration ::= ------- IMPORT name SEMICOLON ------- ; -------type_import_on_demand_declaration ::= ------- IMPORT name DOT MULT SEMICOLON ------- ; -------type_declaration ::= ------- class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.7) Productions used only in the LALR(1) grammar -------modifiers_opt::= ------- | modifiers ------- ; -------modifiers ::= modifier ------- | modifiers modifier ------- ; -------modifier ::= PUBLIC | PROTECTED | PRIVATE ------- | STATIC ------- | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE ------- | STRICTFP // note that semantic analysis must check that the ------- // context of the modifier allows strictfp. ------- ; ------- -------// 19.8) Classes ------- -------// 19.8.1) Class Declaration: -------class_declaration ::= ------- modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- ; -------super ::= EXTENDS class_type ------- ; -------super_opt ::= ------- | super ------- ; -------interfaces ::= IMPLEMENTS interface_type_list ------- ; -------interfaces_opt::= ------- | interfaces ------- ; -------interface_type_list ::= ------- interface_type ------- | interface_type_list COMMA interface_type ------- ; -------class_body ::= LBRACE class_body_declarations_opt RBRACE ------- ; -------class_body_declarations_opt ::= ------- | class_body_declarations ; -------class_body_declarations ::= ------- class_body_declaration ------- | class_body_declarations class_body_declaration ------- ; -------class_body_declaration ::= ------- class_member_declaration ------- | static_initializer ------- | constructor_declaration ------- | block ------- ; -------class_member_declaration ::= ------- field_declaration ------- | method_declaration ------- /* repeat the prod for 'class_declaration' here: */ ------- | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.8.2) Field Declarations -------field_declaration ::= ------- modifiers_opt type variable_declarators SEMICOLON ------- ; -------variable_declarators ::= ------- variable_declarator ------- | variable_declarators COMMA variable_declarator ------- ; -------variable_declarator ::= ------- variable_declarator_id ------- | variable_declarator_id EQ variable_initializer ------- ; -------variable_declarator_id ::= ------- IDENTIFIER ------- | variable_declarator_id LBRACK RBRACK ------- ; -------variable_initializer ::= ------- expression ------- | array_initializer ------- ; ------- -------// 19.8.3) Method Declarations -------method_declaration ::= ------- method_header method_body ------- ; -------method_header ::= ------- modifiers_opt type method_declarator throws_opt ------- | modifiers_opt VOID method_declarator throws_opt ------- ; -------method_declarator ::= ------- IDENTIFIER LPAREN formal_parameter_list_opt RPAREN ------- | method_declarator LBRACK RBRACK // deprecated ------- // be careful; the above production also allows 'void foo() []' ------- ; -------formal_parameter_list_opt ::= ------- | formal_parameter_list ------- ; -------formal_parameter_list ::= ------- formal_parameter ------- | formal_parameter_list COMMA formal_parameter ------- ; -------formal_parameter ::= ------- type variable_declarator_id ------- | FINAL type variable_declarator_id ------- ; -------throws_opt ::= ------- | throws ------- ; -------throws ::= THROWS class_type_list ------- ; -------class_type_list ::= ------- class_type ------- | class_type_list COMMA class_type ------- ; -------method_body ::= block ------- | SEMICOLON ------- ; ------- -------// 19.8.4) Static Initializers -------static_initializer ::= ------- STATIC block ------- ; ------- -------// 19.8.5) Constructor Declarations -------constructor_declaration ::= ------- modifiers_opt constructor_declarator throws_opt ------- constructor_body ------- ; -------constructor_declarator ::= ------- simple_name LPAREN formal_parameter_list_opt RPAREN ------- ; -------constructor_body ::= ------- LBRACE explicit_constructor_invocation ------- block_statements RBRACE ------- | LBRACE explicit_constructor_invocation RBRACE ------- | LBRACE block_statements RBRACE ------- | LBRACE RBRACE ------- ; -------explicit_constructor_invocation ::= ------- THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | name DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- ; ------- -------// 19.9) Interfaces ------- -------// 19.9.1) Interface Declarations -------interface_declaration ::= ------- modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt ------- interface_body ------- ; -------extends_interfaces_opt ::= ------- | extends_interfaces ------- ; -------extends_interfaces ::= ------- EXTENDS interface_type ------- | extends_interfaces COMMA interface_type ------- ; -------interface_body ::= ------- LBRACE interface_member_declarations_opt RBRACE ------- ; -------interface_member_declarations_opt ::= ------- | interface_member_declarations ------- ; -------interface_member_declarations ::= ------- interface_member_declaration ------- | interface_member_declarations interface_member_declaration ------- ; -------interface_member_declaration ::= ------- constant_declaration ------- | abstract_method_declaration ------- | class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; -------constant_declaration ::= ------- field_declaration ------- // need to semantically check that modifiers of field declaration ------- // include only PUBLIC, STATIC, or FINAL. Other modifiers are ------- // disallowed. ------- ; -------abstract_method_declaration ::= ------- method_header SEMICOLON ------- ; ------- -------// 19.10) Arrays -------array_initializer ::= ------- LBRACE variable_initializers COMMA RBRACE ------- | LBRACE variable_initializers RBRACE ------- | LBRACE COMMA RBRACE ------- | LBRACE RBRACE ------- ; -------variable_initializers ::= ------- variable_initializer ------- | variable_initializers COMMA variable_initializer ------- ; ------- -------// 19.11) Blocks and Statements -------block ::= LBRACE block_statements_opt RBRACE ------- ; -------block_statements_opt ::= ------- | block_statements ------- ; -------block_statements ::= ------- block_statement ------- | block_statements block_statement ------- ; -------block_statement ::= ------- local_variable_declaration_statement ------- | statement ------- | class_declaration ------- | interface_declaration ------- ; -------local_variable_declaration_statement ::= ------- local_variable_declaration SEMICOLON ------- ; -------local_variable_declaration ::= ------- type variable_declarators ------- | FINAL type variable_declarators ------- ; -------statement ::= statement_without_trailing_substatement ------- | labeled_statement ------- | if_then_statement ------- | if_then_else_statement ------- | while_statement ------- | for_statement ------- ; -------statement_no_short_if ::= ------- statement_without_trailing_substatement ------- | labeled_statement_no_short_if ------- | if_then_else_statement_no_short_if ------- | while_statement_no_short_if ------- | for_statement_no_short_if ------- ; -------statement_without_trailing_substatement ::= ------- block ------- | empty_statement ------- | expression_statement ------- | switch_statement ------- | do_statement ------- | break_statement ------- | continue_statement ------- | return_statement ------- | synchronized_statement ------- | throw_statement ------- | try_statement ------- ; -------empty_statement ::= ------- SEMICOLON ------- ; -------labeled_statement ::= ------- IDENTIFIER COLON statement ------- ; -------labeled_statement_no_short_if ::= ------- IDENTIFIER COLON statement_no_short_if ------- ; -------expression_statement ::= ------- statement_expression SEMICOLON ------- ; -------statement_expression ::= ------- assignment ------- | preincrement_expression ------- | predecrement_expression ------- | postincrement_expression ------- | postdecrement_expression ------- | method_invocation ------- | class_instance_creation_expression ------- ; -------if_then_statement ::= ------- IF LPAREN expression RPAREN statement ------- ; -------if_then_else_statement ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement ------- ; -------if_then_else_statement_no_short_if ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement_no_short_if ------- ; -------switch_statement ::= ------- SWITCH LPAREN expression RPAREN switch_block ------- ; -------switch_block ::= ------- LBRACE switch_block_statement_groups switch_labels RBRACE ------- | LBRACE switch_block_statement_groups RBRACE ------- | LBRACE switch_labels RBRACE ------- | LBRACE RBRACE ------- ; -------switch_block_statement_groups ::= ------- switch_block_statement_group ------- | switch_block_statement_groups switch_block_statement_group ------- ; -------switch_block_statement_group ::= ------- switch_labels block_statements ------- ; -------switch_labels ::= ------- switch_label ------- | switch_labels switch_label ------- ; -------switch_label ::= ------- CASE constant_expression COLON ------- | DEFAULT COLON ------- ; ------- -------while_statement ::= ------- WHILE LPAREN expression RPAREN statement ------- ; -------while_statement_no_short_if ::= ------- WHILE LPAREN expression RPAREN statement_no_short_if ------- ; -------do_statement ::= ------- DO statement WHILE LPAREN expression RPAREN SEMICOLON ------- ; -------for_statement ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement ------- ; -------for_statement_no_short_if ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement_no_short_if ------- ; -------for_init_opt ::= ------- | for_init ------- ; -------for_init ::= statement_expression_list ------- | local_variable_declaration ------- ; -------for_update_opt ::= ------- | for_update ------- ; -------for_update ::= statement_expression_list ------- ; -------statement_expression_list ::= ------- statement_expression ------- | statement_expression_list COMMA statement_expression ------- ; ------- -------identifier_opt ::= ------- | IDENTIFIER ------- ; ------- -------break_statement ::= ------- BREAK identifier_opt SEMICOLON ------- ; ------- -------continue_statement ::= ------- CONTINUE identifier_opt SEMICOLON ------- ; -------return_statement ::= ------- RETURN expression_opt SEMICOLON ------- ; -------throw_statement ::= ------- THROW expression SEMICOLON ------- ; -------synchronized_statement ::= ------- SYNCHRONIZED LPAREN expression RPAREN block ------- ; -------try_statement ::= ------- TRY block catches ------- | TRY block catches_opt finally ------- ; -------catches_opt ::= ------- | catches ------- ; -------catches ::= catch_clause ------- | catches catch_clause ------- ; -------catch_clause ::= ------- CATCH LPAREN formal_parameter RPAREN block ------- ; -------finally ::= FINALLY block ------- ; ------- -------// 19.12) Expressions -------primary ::= primary_no_new_array ------- | array_creation_init ------- | array_creation_uninit ------- ; -------primary_no_new_array ::= ------- literal ------- | THIS ------- | LPAREN expression RPAREN ------- | class_instance_creation_expression ------- | field_access ------- | method_invocation ------- | array_access ------- | primitive_type DOT CLASS ------- | VOID DOT CLASS ------- | array_type DOT CLASS ------- | name DOT CLASS ------- | name DOT THIS ------- ; -------class_instance_creation_expression ::= ------- NEW class_or_interface_type LPAREN argument_list_opt RPAREN ------- | NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body ------- | primary DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN ------- | primary DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN class_body ------- | name DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN ------- | name DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN class_body ------- ; -------argument_list_opt ::= ------- | argument_list ------- ; -------argument_list ::= ------- expression ------- | argument_list COMMA expression ------- ; -------array_creation_uninit ::= ------- NEW primitive_type dim_exprs dims_opt ------- | NEW class_or_interface_type dim_exprs dims_opt ------- ; -------array_creation_init ::= ------- NEW primitive_type dims array_initializer ------- | NEW class_or_interface_type dims array_initializer ------- ; -------dim_exprs ::= dim_expr ------- | dim_exprs dim_expr ------- ; -------dim_expr ::= LBRACK expression RBRACK ------- ; -------dims_opt ::= ------- | dims ------- ; -------dims ::= LBRACK RBRACK ------- | dims LBRACK RBRACK ------- ; -------field_access ::= ------- primary DOT IDENTIFIER ------- | SUPER DOT IDENTIFIER ------- | name DOT SUPER DOT IDENTIFIER ------- ; -------method_invocation ::= ------- name LPAREN argument_list_opt RPAREN ------- | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- ; -------array_access ::= ------- name LBRACK expression RBRACK ------- | primary_no_new_array LBRACK expression RBRACK ------- | array_creation_init LBRACK expression RBRACK ------- ; -------postfix_expression ::= ------- primary ------- | name ------- | postincrement_expression ------- | postdecrement_expression ------- ; -------postincrement_expression ::= ------- postfix_expression PLUSPLUS ------- ; -------postdecrement_expression ::= ------- postfix_expression MINUSMINUS ------- ; -------unary_expression ::= ------- preincrement_expression ------- | predecrement_expression ------- | PLUS unary_expression ------- | MINUS unary_expression ------- | unary_expression_not_plus_minus ------- ; -------preincrement_expression ::= ------- PLUSPLUS unary_expression ------- ; -------predecrement_expression ::= ------- MINUSMINUS unary_expression ------- ; -------unary_expression_not_plus_minus ::= ------- postfix_expression ------- | COMP unary_expression ------- | NOT unary_expression ------- | cast_expression ------- ; -------cast_expression ::= ------- LPAREN primitive_type dims_opt RPAREN unary_expression ------- | LPAREN expression RPAREN unary_expression_not_plus_minus ------- | LPAREN name dims RPAREN unary_expression_not_plus_minus ------- ; -------multiplicative_expression ::= ------- unary_expression ------- | multiplicative_expression MULT unary_expression ------- | multiplicative_expression DIV unary_expression ------- | multiplicative_expression MOD unary_expression ------- ; -------additive_expression ::= ------- multiplicative_expression ------- | additive_expression PLUS multiplicative_expression ------- | additive_expression MINUS multiplicative_expression ------- ; -------shift_expression ::= ------- additive_expression ------- | shift_expression LSHIFT additive_expression ------- | shift_expression RSHIFT additive_expression ------- | shift_expression URSHIFT additive_expression ------- ; -------relational_expression ::= ------- shift_expression ------- | relational_expression LT shift_expression ------- | relational_expression GT shift_expression ------- | relational_expression LTEQ shift_expression ------- | relational_expression GTEQ shift_expression ------- | relational_expression INSTANCEOF reference_type ------- ; -------equality_expression ::= ------- relational_expression ------- | equality_expression EQEQ relational_expression ------- | equality_expression NOTEQ relational_expression ------- ; -------and_expression ::= ------- equality_expression ------- | and_expression AND equality_expression ------- ; -------exclusive_or_expression ::= ------- and_expression ------- | exclusive_or_expression XOR and_expression ------- ; -------inclusive_or_expression ::= ------- exclusive_or_expression ------- | inclusive_or_expression OR exclusive_or_expression ------- ; -------conditional_and_expression ::= ------- inclusive_or_expression ------- | conditional_and_expression ANDAND inclusive_or_expression ------- ; -------conditional_or_expression ::= ------- conditional_and_expression ------- | conditional_or_expression OROR conditional_and_expression ------- ; -------conditional_expression ::= ------- conditional_or_expression ------- | conditional_or_expression QUESTION expression ------- COLON conditional_expression ------- ; -------assignment_expression ::= ------- conditional_expression ------- | assignment ------- ; -------// semantic check necessary here to ensure a valid left-hand side. -------// allowing a parenthesized variable here on the lhs was introduced in -------// JLS 2; thanks to Eric Blake for pointing this out. -------assignment ::= postfix_expression assignment_operator assignment_expression ------- ; -------assignment_operator ::= ------- EQ ------- | MULTEQ ------- | DIVEQ ------- | MODEQ ------- | PLUSEQ ------- | MINUSEQ ------- | LSHIFTEQ ------- | RSHIFTEQ ------- | URSHIFTEQ ------- | ANDEQ ------- | XOREQ ------- | OREQ ------- ; -------expression_opt ::= ------- | expression ------- ; -------expression ::= assignment_expression ------- ; -------constant_expression ::= ------- expression ------- ; diff --cc Robust/JavaGrammar/Parse/java14.cup index c7fcfae0,c7fcfae0,c7fcfae0,c7fcfae0,c7fcfae0,c7fcfae0,c7fcfae0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Parse/java14.cup +++ /dev/null @@@@@@@@ -1,877 -1,877 -1,877 -1,877 -1,877 -1,877 -1,877 +1,0 @@@@@@@@ -------package Parse; ------- -------import java_cup.runtime.*; ------- -------/* Java 1.4 parser for CUP. ------- * Copyright (C) 2002-2003 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------/* -------JDK 1.4 Features added: ------- assertion statement. ------- statement_without_trailing_substatement ::= ... ------- | assert_statement ; ------- assert_statement ::= ------- ASSERT expression SEMICOLON ------- | ASSERT expression COLON expression SEMICOLON ------- ; -------*/ -------parser code {: ------- Lexer lexer; ------- ------- public Grm14(Lexer l) { ------- this(); ------- lexer=l; ------- } ------- ------- public void syntax_error(java_cup.runtime.Symbol current) { ------- report_error("Syntax error (" + current.sym + ")", current); ------- } ------- public void report_error(String message, java_cup.runtime.Symbol info) { ------- lexer.errorMsg(message, info); ------- } -------:}; ------- -------scan with {: return lexer.nextToken(); :}; ------- -------terminal BOOLEAN; // primitive_type -------terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -------terminal FLOAT, DOUBLE; // floating_point_type -------terminal LBRACK, RBRACK; // array_type -------terminal java.lang.String IDENTIFIER; // name -------terminal DOT; // qualified_name -------terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -------terminal PACKAGE; // package_declaration -------terminal IMPORT; // import_declaration -------terminal PUBLIC, PROTECTED, PRIVATE; // modifier -------terminal STATIC; // modifier -------terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -------terminal CLASS; // class_declaration -------terminal EXTENDS; // super -------terminal IMPLEMENTS; // interfaces -------terminal VOID; // method_header -------terminal THROWS; // throws -------terminal THIS, SUPER; // explicit_constructor_invocation -------terminal INTERFACE; // interface_declaration -------terminal IF, ELSE; // if_then_statement, if_then_else_statement -------terminal SWITCH; // switch_statement -------terminal CASE, DEFAULT; // switch_label -------terminal DO, WHILE; // while_statement, do_statement -------terminal FOR; // for_statement -------terminal BREAK; // break_statement -------terminal CONTINUE; // continue_statement -------terminal RETURN; // return_statement -------terminal THROW; // throw_statement -------terminal TRY; // try_statement -------terminal CATCH; // catch_clause -------terminal FINALLY; // finally -------terminal NEW; // class_instance_creation_expression -------terminal PLUSPLUS; // postincrement_expression -------terminal MINUSMINUS; // postdecrement_expression -------terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -------terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -------terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -------terminal EQEQ, NOTEQ; // equality_expression -------terminal AND; // and_expression -------terminal XOR; // exclusive_or_expression -------terminal OR; // inclusive_or_expression -------terminal ANDAND; // conditional_and_expression -------terminal OROR; // conditional_or_expression -------terminal QUESTION; // conditional_expression -------terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -------terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -------terminal ANDEQ, XOREQ, OREQ; // assignment_operator ------- -------terminal java.lang.Number INTEGER_LITERAL; -------terminal java.lang.Number FLOATING_POINT_LITERAL; -------terminal java.lang.Boolean BOOLEAN_LITERAL; -------terminal java.lang.Character CHARACTER_LITERAL; -------terminal java.lang.String STRING_LITERAL; -------terminal NULL_LITERAL; ------- -------// Reserved but unused: -------terminal CONST, GOTO; -------// strictfp keyword, new in Java 1.2 -------terminal STRICTFP; -------// assert keyword, new in Java 1.4 -------terminal ASSERT; // assert_statement -------// lexer compatibility with Java 1.5 -------terminal ELLIPSIS; -------terminal ENUM; ------- -------// 19.2) The Syntactic Grammar -------non terminal goal; -------// 19.3) Lexical Structure -------non terminal literal; -------// 19.4) Types, Values, and Variables -------non terminal type, primitive_type, numeric_type; -------non terminal integral_type, floating_point_type; -------non terminal reference_type; -------non terminal class_or_interface_type; -------non terminal class_type, interface_type; -------non terminal array_type; -------// 19.5) Names -------non terminal name, simple_name, qualified_name; -------// 19.6) Packages -------non terminal compilation_unit; -------non terminal package_declaration_opt, package_declaration; -------non terminal import_declarations_opt, import_declarations; -------non terminal type_declarations_opt, type_declarations; -------non terminal import_declaration; -------non terminal single_type_import_declaration; -------non terminal type_import_on_demand_declaration; -------non terminal type_declaration; -------// 19.7) Productions used only in the LALR(1) grammar -------non terminal modifiers_opt, modifiers, modifier; -------// 19.8.1) Class Declaration -------non terminal class_declaration, super, super_opt; -------non terminal interfaces, interfaces_opt, interface_type_list; -------non terminal class_body; -------non terminal class_body_declarations, class_body_declarations_opt; -------non terminal class_body_declaration, class_member_declaration; -------// 19.8.2) Field Declarations -------non terminal field_declaration, variable_declarators, variable_declarator; -------non terminal variable_declarator_id, variable_initializer; -------// 19.8.3) Method Declarations -------non terminal method_declaration, method_header, method_declarator; -------non terminal formal_parameter_list_opt, formal_parameter_list; -------non terminal formal_parameter; -------non terminal throws_opt, throws; -------non terminal class_type_list, method_body; -------// 19.8.4) Static Initializers -------non terminal static_initializer; -------// 19.8.5) Constructor Declarations -------non terminal constructor_declaration, constructor_declarator; -------non terminal constructor_body; -------non terminal explicit_constructor_invocation; -------// 19.9.1) Interface Declarations -------non terminal interface_declaration; -------non terminal extends_interfaces_opt, extends_interfaces; -------non terminal interface_body; -------non terminal interface_member_declarations_opt, interface_member_declarations; -------non terminal interface_member_declaration, constant_declaration; -------non terminal abstract_method_declaration; -------// 19.10) Arrays -------non terminal array_initializer; -------non terminal variable_initializers; -------// 19.11) Blocks and Statements -------non terminal block; -------non terminal block_statements_opt, block_statements, block_statement; -------non terminal local_variable_declaration_statement, local_variable_declaration; -------non terminal statement, statement_no_short_if; -------non terminal statement_without_trailing_substatement; -------non terminal empty_statement; -------non terminal labeled_statement, labeled_statement_no_short_if; -------non terminal expression_statement, statement_expression; -------non terminal if_then_statement; -------non terminal if_then_else_statement, if_then_else_statement_no_short_if; -------non terminal switch_statement, switch_block; -------non terminal switch_block_statement_groups; -------non terminal switch_block_statement_group; -------non terminal switch_labels, switch_label; -------non terminal while_statement, while_statement_no_short_if; -------non terminal do_statement; -------non terminal for_statement, for_statement_no_short_if; -------non terminal for_init_opt, for_init; -------non terminal for_update_opt, for_update; -------non terminal statement_expression_list; -------non terminal identifier_opt; -------non terminal break_statement, continue_statement; -------non terminal return_statement, throw_statement; -------non terminal synchronized_statement, try_statement; -------non terminal catches_opt, catches, catch_clause; -------non terminal finally; -------non terminal assert_statement; -------// 19.12) Expressions -------non terminal primary, primary_no_new_array; -------non terminal class_instance_creation_expression; -------non terminal argument_list_opt, argument_list; -------non terminal array_creation_init, array_creation_uninit; -------non terminal dim_exprs, dim_expr, dims_opt, dims; -------non terminal field_access, method_invocation, array_access; -------non terminal postfix_expression; -------non terminal postincrement_expression, postdecrement_expression; -------non terminal unary_expression, unary_expression_not_plus_minus; -------non terminal preincrement_expression, predecrement_expression; -------non terminal cast_expression; -------non terminal multiplicative_expression, additive_expression; -------non terminal shift_expression, relational_expression, equality_expression; -------non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -------non terminal conditional_and_expression, conditional_or_expression; -------non terminal conditional_expression, assignment_expression; -------non terminal assignment; -------non terminal assignment_operator; -------non terminal expression_opt, expression; -------non terminal constant_expression; ------- -------start with goal; ------- -------// 19.2) The Syntactic Grammar -------goal ::= compilation_unit ------- ; ------- -------// 19.3) Lexical Structure. -------literal ::= INTEGER_LITERAL ------- | FLOATING_POINT_LITERAL ------- | BOOLEAN_LITERAL ------- | CHARACTER_LITERAL ------- | STRING_LITERAL ------- | NULL_LITERAL ------- ; ------- -------// 19.4) Types, Values, and Variables -------type ::= primitive_type ------- | reference_type ------- ; -------primitive_type ::= ------- numeric_type ------- | BOOLEAN ------- ; -------numeric_type::= integral_type ------- | floating_point_type ------- ; -------integral_type ::= ------- BYTE ------- | SHORT ------- | INT ------- | LONG ------- | CHAR ------- ; -------floating_point_type ::= ------- FLOAT ------- | DOUBLE ------- ; ------- -------reference_type ::= ------- class_or_interface_type ------- | array_type ------- ; -------class_or_interface_type ::= name; ------- -------class_type ::= class_or_interface_type; -------interface_type ::= class_or_interface_type; ------- -------array_type ::= primitive_type dims ------- | name dims ------- ; ------- -------// 19.5) Names -------name ::= simple_name ------- | qualified_name ------- ; -------simple_name ::= IDENTIFIER ------- ; -------qualified_name ::= ------- name DOT IDENTIFIER ------- ; ------- -------// 19.6) Packages -------compilation_unit ::= ------- package_declaration_opt ------- import_declarations_opt ------- type_declarations_opt ------- ; -------package_declaration_opt ::= package_declaration | ; -------import_declarations_opt ::= import_declarations | ; -------type_declarations_opt ::= type_declarations | ; ------- -------import_declarations ::= ------- import_declaration ------- | import_declarations import_declaration ------- ; -------type_declarations ::= ------- type_declaration ------- | type_declarations type_declaration ------- ; -------package_declaration ::= ------- PACKAGE name SEMICOLON ------- ; -------import_declaration ::= ------- single_type_import_declaration ------- | type_import_on_demand_declaration ------- ; -------single_type_import_declaration ::= ------- IMPORT name SEMICOLON ------- ; -------type_import_on_demand_declaration ::= ------- IMPORT name DOT MULT SEMICOLON ------- ; -------type_declaration ::= ------- class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.7) Productions used only in the LALR(1) grammar -------modifiers_opt::= ------- | modifiers ------- ; -------modifiers ::= modifier ------- | modifiers modifier ------- ; -------modifier ::= PUBLIC | PROTECTED | PRIVATE ------- | STATIC ------- | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE ------- | STRICTFP // note that semantic analysis must check that the ------- // context of the modifier allows strictfp. ------- ; ------- -------// 19.8) Classes ------- -------// 19.8.1) Class Declaration: -------class_declaration ::= ------- modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- ; -------super ::= EXTENDS class_type ------- ; -------super_opt ::= ------- | super ------- ; -------interfaces ::= IMPLEMENTS interface_type_list ------- ; -------interfaces_opt::= ------- | interfaces ------- ; -------interface_type_list ::= ------- interface_type ------- | interface_type_list COMMA interface_type ------- ; -------class_body ::= LBRACE class_body_declarations_opt RBRACE ------- ; -------class_body_declarations_opt ::= ------- | class_body_declarations ; -------class_body_declarations ::= ------- class_body_declaration ------- | class_body_declarations class_body_declaration ------- ; -------class_body_declaration ::= ------- class_member_declaration ------- | static_initializer ------- | constructor_declaration ------- | block ------- ; -------class_member_declaration ::= ------- field_declaration ------- | method_declaration ------- /* repeat the prod for 'class_declaration' here: */ ------- | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.8.2) Field Declarations -------field_declaration ::= ------- modifiers_opt type variable_declarators SEMICOLON ------- ; -------variable_declarators ::= ------- variable_declarator ------- | variable_declarators COMMA variable_declarator ------- ; -------variable_declarator ::= ------- variable_declarator_id ------- | variable_declarator_id EQ variable_initializer ------- ; -------variable_declarator_id ::= ------- IDENTIFIER ------- | variable_declarator_id LBRACK RBRACK ------- ; -------variable_initializer ::= ------- expression ------- | array_initializer ------- ; ------- -------// 19.8.3) Method Declarations -------method_declaration ::= ------- method_header method_body ------- ; -------method_header ::= ------- modifiers_opt type method_declarator throws_opt ------- | modifiers_opt VOID method_declarator throws_opt ------- ; -------method_declarator ::= ------- IDENTIFIER LPAREN formal_parameter_list_opt RPAREN ------- | method_declarator LBRACK RBRACK // deprecated ------- // be careful; the above production also allows 'void foo() []' ------- ; -------formal_parameter_list_opt ::= ------- | formal_parameter_list ------- ; -------formal_parameter_list ::= ------- formal_parameter ------- | formal_parameter_list COMMA formal_parameter ------- ; -------formal_parameter ::= ------- type variable_declarator_id ------- | FINAL type variable_declarator_id ------- ; -------throws_opt ::= ------- | throws ------- ; -------throws ::= THROWS class_type_list ------- ; -------class_type_list ::= ------- class_type ------- | class_type_list COMMA class_type ------- ; -------method_body ::= block ------- | SEMICOLON ------- ; ------- -------// 19.8.4) Static Initializers -------static_initializer ::= ------- STATIC block ------- ; ------- -------// 19.8.5) Constructor Declarations -------constructor_declaration ::= ------- modifiers_opt constructor_declarator throws_opt ------- constructor_body ------- ; -------constructor_declarator ::= ------- simple_name LPAREN formal_parameter_list_opt RPAREN ------- ; -------constructor_body ::= ------- LBRACE explicit_constructor_invocation ------- block_statements RBRACE ------- | LBRACE explicit_constructor_invocation RBRACE ------- | LBRACE block_statements RBRACE ------- | LBRACE RBRACE ------- ; -------explicit_constructor_invocation ::= ------- THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- ; ------- -------// 19.9) Interfaces ------- -------// 19.9.1) Interface Declarations -------interface_declaration ::= ------- modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt ------- interface_body ------- ; -------extends_interfaces_opt ::= ------- | extends_interfaces ------- ; -------extends_interfaces ::= ------- EXTENDS interface_type ------- | extends_interfaces COMMA interface_type ------- ; -------interface_body ::= ------- LBRACE interface_member_declarations_opt RBRACE ------- ; -------interface_member_declarations_opt ::= ------- | interface_member_declarations ------- ; -------interface_member_declarations ::= ------- interface_member_declaration ------- | interface_member_declarations interface_member_declaration ------- ; -------interface_member_declaration ::= ------- constant_declaration ------- | abstract_method_declaration ------- | class_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; -------constant_declaration ::= ------- field_declaration ------- // need to semantically check that modifiers of field declaration ------- // include only PUBLIC, STATIC, or FINAL. Other modifiers are ------- // disallowed. ------- ; -------abstract_method_declaration ::= ------- method_header SEMICOLON ------- ; ------- -------// 19.10) Arrays -------array_initializer ::= ------- LBRACE variable_initializers COMMA RBRACE ------- | LBRACE variable_initializers RBRACE ------- | LBRACE COMMA RBRACE ------- | LBRACE RBRACE ------- ; -------variable_initializers ::= ------- variable_initializer ------- | variable_initializers COMMA variable_initializer ------- ; ------- -------// 19.11) Blocks and Statements -------block ::= LBRACE block_statements_opt RBRACE ------- ; -------block_statements_opt ::= ------- | block_statements ------- ; -------block_statements ::= ------- block_statement ------- | block_statements block_statement ------- ; -------block_statement ::= ------- local_variable_declaration_statement ------- | statement ------- | class_declaration ------- | interface_declaration ------- ; -------local_variable_declaration_statement ::= ------- local_variable_declaration SEMICOLON ------- ; -------local_variable_declaration ::= ------- type variable_declarators ------- | FINAL type variable_declarators ------- ; -------statement ::= statement_without_trailing_substatement ------- | labeled_statement ------- | if_then_statement ------- | if_then_else_statement ------- | while_statement ------- | for_statement ------- ; -------statement_no_short_if ::= ------- statement_without_trailing_substatement ------- | labeled_statement_no_short_if ------- | if_then_else_statement_no_short_if ------- | while_statement_no_short_if ------- | for_statement_no_short_if ------- ; -------statement_without_trailing_substatement ::= ------- block ------- | empty_statement ------- | expression_statement ------- | switch_statement ------- | do_statement ------- | break_statement ------- | continue_statement ------- | return_statement ------- | synchronized_statement ------- | throw_statement ------- | try_statement ------- | assert_statement ------- ; -------empty_statement ::= ------- SEMICOLON ------- ; -------labeled_statement ::= ------- IDENTIFIER COLON statement ------- ; -------labeled_statement_no_short_if ::= ------- IDENTIFIER COLON statement_no_short_if ------- ; -------expression_statement ::= ------- statement_expression SEMICOLON ------- ; -------statement_expression ::= ------- assignment ------- | preincrement_expression ------- | predecrement_expression ------- | postincrement_expression ------- | postdecrement_expression ------- | method_invocation ------- | class_instance_creation_expression ------- ; -------if_then_statement ::= ------- IF LPAREN expression RPAREN statement ------- ; -------if_then_else_statement ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement ------- ; -------if_then_else_statement_no_short_if ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement_no_short_if ------- ; -------switch_statement ::= ------- SWITCH LPAREN expression RPAREN switch_block ------- ; -------switch_block ::= ------- LBRACE switch_block_statement_groups switch_labels RBRACE ------- | LBRACE switch_block_statement_groups RBRACE ------- | LBRACE switch_labels RBRACE ------- | LBRACE RBRACE ------- ; -------switch_block_statement_groups ::= ------- switch_block_statement_group ------- | switch_block_statement_groups switch_block_statement_group ------- ; -------switch_block_statement_group ::= ------- switch_labels block_statements ------- ; -------switch_labels ::= ------- switch_label ------- | switch_labels switch_label ------- ; -------switch_label ::= ------- CASE constant_expression COLON ------- | DEFAULT COLON ------- ; ------- -------while_statement ::= ------- WHILE LPAREN expression RPAREN statement ------- ; -------while_statement_no_short_if ::= ------- WHILE LPAREN expression RPAREN statement_no_short_if ------- ; -------do_statement ::= ------- DO statement WHILE LPAREN expression RPAREN SEMICOLON ------- ; -------for_statement ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement ------- ; -------for_statement_no_short_if ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement_no_short_if ------- ; -------for_init_opt ::= ------- | for_init ------- ; -------for_init ::= statement_expression_list ------- | local_variable_declaration ------- ; -------for_update_opt ::= ------- | for_update ------- ; -------for_update ::= statement_expression_list ------- ; -------statement_expression_list ::= ------- statement_expression ------- | statement_expression_list COMMA statement_expression ------- ; ------- -------identifier_opt ::= ------- | IDENTIFIER ------- ; ------- -------break_statement ::= ------- BREAK identifier_opt SEMICOLON ------- ; ------- -------continue_statement ::= ------- CONTINUE identifier_opt SEMICOLON ------- ; -------return_statement ::= ------- RETURN expression_opt SEMICOLON ------- ; -------throw_statement ::= ------- THROW expression SEMICOLON ------- ; -------synchronized_statement ::= ------- SYNCHRONIZED LPAREN expression RPAREN block ------- ; -------try_statement ::= ------- TRY block catches ------- | TRY block catches_opt finally ------- ; -------catches_opt ::= ------- | catches ------- ; -------catches ::= catch_clause ------- | catches catch_clause ------- ; -------catch_clause ::= ------- CATCH LPAREN formal_parameter RPAREN block ------- ; -------finally ::= FINALLY block ------- ; -------assert_statement ::= ------- ASSERT expression SEMICOLON ------- | ASSERT expression COLON expression SEMICOLON ------- ; ------- -------// 19.12) Expressions -------primary ::= primary_no_new_array ------- | array_creation_init ------- | array_creation_uninit ------- ; -------primary_no_new_array ::= ------- literal ------- | THIS ------- | LPAREN expression RPAREN ------- | class_instance_creation_expression ------- | field_access ------- | method_invocation ------- | array_access ------- | primitive_type DOT CLASS ------- | VOID DOT CLASS ------- | array_type DOT CLASS ------- | name DOT CLASS ------- | name DOT THIS ------- ; -------class_instance_creation_expression ::= ------- NEW class_or_interface_type LPAREN argument_list_opt RPAREN ------- | NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body ------- | primary DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN ------- | primary DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN class_body ------- | name DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN ------- | name DOT NEW IDENTIFIER ------- LPAREN argument_list_opt RPAREN class_body ------- ; -------argument_list_opt ::= ------- | argument_list ------- ; -------argument_list ::= ------- expression ------- | argument_list COMMA expression ------- ; -------array_creation_uninit ::= ------- NEW primitive_type dim_exprs dims_opt ------- | NEW class_or_interface_type dim_exprs dims_opt ------- ; -------array_creation_init ::= ------- NEW primitive_type dims array_initializer ------- | NEW class_or_interface_type dims array_initializer ------- ; -------dim_exprs ::= dim_expr ------- | dim_exprs dim_expr ------- ; -------dim_expr ::= LBRACK expression RBRACK ------- ; -------dims_opt ::= ------- | dims ------- ; -------dims ::= LBRACK RBRACK ------- | dims LBRACK RBRACK ------- ; -------field_access ::= ------- primary DOT IDENTIFIER ------- | SUPER DOT IDENTIFIER ------- | name DOT SUPER DOT IDENTIFIER ------- ; -------method_invocation ::= ------- name LPAREN argument_list_opt RPAREN ------- | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- ; -------array_access ::= ------- name LBRACK expression RBRACK ------- | primary_no_new_array LBRACK expression RBRACK ------- | array_creation_init LBRACK expression RBRACK ------- ; -------postfix_expression ::= ------- primary ------- | name ------- | postincrement_expression ------- | postdecrement_expression ------- ; -------postincrement_expression ::= ------- postfix_expression PLUSPLUS ------- ; -------postdecrement_expression ::= ------- postfix_expression MINUSMINUS ------- ; -------unary_expression ::= ------- preincrement_expression ------- | predecrement_expression ------- | PLUS unary_expression ------- | MINUS unary_expression ------- | unary_expression_not_plus_minus ------- ; -------preincrement_expression ::= ------- PLUSPLUS unary_expression ------- ; -------predecrement_expression ::= ------- MINUSMINUS unary_expression ------- ; -------unary_expression_not_plus_minus ::= ------- postfix_expression ------- | COMP unary_expression ------- | NOT unary_expression ------- | cast_expression ------- ; -------cast_expression ::= ------- LPAREN primitive_type dims_opt RPAREN unary_expression ------- | LPAREN expression RPAREN unary_expression_not_plus_minus ------- | LPAREN name dims RPAREN unary_expression_not_plus_minus ------- ; -------multiplicative_expression ::= ------- unary_expression ------- | multiplicative_expression MULT unary_expression ------- | multiplicative_expression DIV unary_expression ------- | multiplicative_expression MOD unary_expression ------- ; -------additive_expression ::= ------- multiplicative_expression ------- | additive_expression PLUS multiplicative_expression ------- | additive_expression MINUS multiplicative_expression ------- ; -------shift_expression ::= ------- additive_expression ------- | shift_expression LSHIFT additive_expression ------- | shift_expression RSHIFT additive_expression ------- | shift_expression URSHIFT additive_expression ------- ; -------relational_expression ::= ------- shift_expression ------- | relational_expression LT shift_expression ------- | relational_expression GT shift_expression ------- | relational_expression LTEQ shift_expression ------- | relational_expression GTEQ shift_expression ------- | relational_expression INSTANCEOF reference_type ------- ; -------equality_expression ::= ------- relational_expression ------- | equality_expression EQEQ relational_expression ------- | equality_expression NOTEQ relational_expression ------- ; -------and_expression ::= ------- equality_expression ------- | and_expression AND equality_expression ------- ; -------exclusive_or_expression ::= ------- and_expression ------- | exclusive_or_expression XOR and_expression ------- ; -------inclusive_or_expression ::= ------- exclusive_or_expression ------- | inclusive_or_expression OR exclusive_or_expression ------- ; -------conditional_and_expression ::= ------- inclusive_or_expression ------- | conditional_and_expression ANDAND inclusive_or_expression ------- ; -------conditional_or_expression ::= ------- conditional_and_expression ------- | conditional_or_expression OROR conditional_and_expression ------- ; -------conditional_expression ::= ------- conditional_or_expression ------- | conditional_or_expression QUESTION expression ------- COLON conditional_expression ------- ; -------assignment_expression ::= ------- conditional_expression ------- | assignment ------- ; -------// semantic check necessary here to ensure a valid left-hand side. -------// allowing a parenthesized variable here on the lhs was introduced in -------// JLS 2; thanks to Eric Blake for pointing this out. -------assignment ::= postfix_expression assignment_operator assignment_expression ------- ; -------assignment_operator ::= ------- EQ ------- | MULTEQ ------- | DIVEQ ------- | MODEQ ------- | PLUSEQ ------- | MINUSEQ ------- | LSHIFTEQ ------- | RSHIFTEQ ------- | URSHIFTEQ ------- | ANDEQ ------- | XOREQ ------- | OREQ ------- ; -------expression_opt ::= ------- | expression ------- ; -------expression ::= assignment_expression ------- ; -------constant_expression ::= ------- expression ------- ; diff --cc Robust/JavaGrammar/Parse/java15.cup index d005d945,d005d945,d005d945,d005d945,d005d945,d005d945,d005d945..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/Parse/java15.cup +++ /dev/null @@@@@@@@ -1,1355 -1,1355 -1,1355 -1,1355 -1,1355 -1,1355 -1,1355 +1,0 @@@@@@@@ -------package Parse; ------- -------import java_cup.runtime.*; ------- -------/* Java 1.5 (JSR-14 + JSR-201) parser for CUP. ------- * (Well, Java 1.5 as of 28 Jul 2003; it may change before official release) ------- * Copyright (C) 2003 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------/* -------JSR-14 Features added: -------* parameterized types, including corrections from the spec released ------- with the 2.2 prototype of the JSR-14 compiler. Arrays of parameterized ------- types bounded by wildcards are slated to be added to Java 1.5 (although ------- they are not supported by the 2.2 prototype); this grammar supports them. ------- "Wildcard" types are supported as of the 28 jul 2003 release. ------- -------JSR-201 Features added: -------* no changes for autoboxing -------* new-style for: ------- foreach_statement ::= ------- FOR LPAREN type variable_declarator_id COLON expression RPAREN ------- statement ------- // must check that first IDENTIFIER is 'each' and second IDENTIFIER ------- // is 'in' -- CSA extension; not (yet?) officially adopted ------- | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER ------- expression RPAREN statement ------- ; ------- foreach_statement_no_short_if ::= ------- FOR LPAREN type variable_declarator_id COLON expression RPAREN ------- statement_no_short_if ------- // must check that first IDENTIFIER is 'each' and second IDENTIFIER ------- // is 'in' -- CSA extension; not (yet?) officially adopted ------- | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER ------- expression RPAREN statement_no_short_if ------- ; ------- statement ::= ... ------- | foreach_statement ; ------- statement_no_short_if ::= ... ------- | foreach_statement_no_short_if ; ------- -------* static import: ------- static_single_type_import_declaration ::= ------- IMPORT STATIC name SEMICOLON ------- ; ------- static_type_import_on_demand_declaration ::= ------- IMPORT STATIC name DOT MULT SEMICOLON ------- ; ------- import_declaration ::= ... ------- | static_single_type_import_declaration ------- | static_type_import_on_demand_declaration ------- ; -------* varargs: ------- formal_parameter ::= ... ------- | type ELLIPSIS IDENTIFIER ------- | FINAL type ELLIPSIS IDENTIFIER ------- ; -------* enum: ------- enum_declaration ::= ------- modifiers_opt ENUM IDENTIFIER interfaces_opt enum_body ------- ; ------- enum_body ::= ------- LBRACE enum_constants_opt enum_body_declarations_opt RBRACE ------- ; ------- enum_constants_opt ::= ------- | enum_constants ------- ; ------- enum_constants ::= ------- enum_constant ------- | enum_constants COMMA enum_constant ------- ; ------- enum_constant ::= ------- IDENTIFIER enum_arguments_opt ------- | IDENTIFIER enum_arguments_opt class_body ------- ; ------- enum_arguments_opt ::= ------- | LPAREN argument_list_opt RPAREN ------- ; ------- enum_body_declarations_opt ::= ------- | SEMICOLON class_body_declarations_opt ------- ; -------*/ -------parser code {: ------- Lexer lexer; ------- ------- public Grm15(Lexer l) { ------- this(); ------- lexer=l; ------- } ------- ------- public void syntax_error(java_cup.runtime.Symbol current) { ------- report_error("Syntax error (" + current.sym + ")", current); ------- } ------- public void report_error(String message, java_cup.runtime.Symbol info) { ------- lexer.errorMsg(message, info); ------- } -------:}; ------- -------scan with {: return lexer.nextToken(); :}; ------- -------terminal BOOLEAN; // primitive_type -------terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -------terminal FLOAT, DOUBLE; // floating_point_type -------terminal LBRACK, RBRACK; // array_type -------terminal java.lang.String IDENTIFIER; // name -------terminal DOT; // qualified_name -------terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -------terminal PACKAGE; // package_declaration -------terminal IMPORT; // import_declaration -------terminal PUBLIC, PROTECTED, PRIVATE; // modifier -------terminal STATIC; // modifier -------terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -------terminal CLASS; // class_declaration -------terminal EXTENDS; // super -------terminal IMPLEMENTS; // interfaces -------terminal VOID; // method_header -------terminal THROWS; // throws -------terminal THIS, SUPER; // explicit_constructor_invocation -------terminal INTERFACE; // interface_declaration -------terminal IF, ELSE; // if_then_statement, if_then_else_statement -------terminal SWITCH; // switch_statement -------terminal CASE, DEFAULT; // switch_label -------terminal DO, WHILE; // while_statement, do_statement -------terminal FOR; // for_statement -------terminal BREAK; // break_statement -------terminal CONTINUE; // continue_statement -------terminal RETURN; // return_statement -------terminal THROW; // throw_statement -------terminal TRY; // try_statement -------terminal CATCH; // catch_clause -------terminal FINALLY; // finally -------terminal NEW; // class_instance_creation_expression -------terminal PLUSPLUS; // postincrement_expression -------terminal MINUSMINUS; // postdecrement_expression -------terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -------terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -------terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -------terminal EQEQ, NOTEQ; // equality_expression -------terminal AND; // and_expression -------terminal XOR; // exclusive_or_expression -------terminal OR; // inclusive_or_expression -------terminal ANDAND; // conditional_and_expression -------terminal OROR; // conditional_or_expression -------terminal QUESTION; // conditional_expression -------terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -------terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -------terminal ANDEQ, XOREQ, OREQ; // assignment_operator ------- -------terminal java.lang.Number INTEGER_LITERAL; -------terminal java.lang.Number FLOATING_POINT_LITERAL; -------terminal java.lang.Boolean BOOLEAN_LITERAL; -------terminal java.lang.Character CHARACTER_LITERAL; -------terminal java.lang.String STRING_LITERAL; -------terminal NULL_LITERAL; ------- -------// Reserved but unused: -------terminal CONST, GOTO; -------// strictfp keyword, new in Java 1.2 -------terminal STRICTFP; -------// assert keyword, new in Java 1.4 -------terminal ASSERT; // assert_statement -------// ellipsis token for varargs, new in Java 1.5 (JSR-201) -------terminal ELLIPSIS; -------// enum keyword, new in Java 1.5 (JSR-201) -------terminal ENUM; ------- -------// 19.2) The Syntactic Grammar -------non terminal goal; -------// 19.3) Lexical Structure -------non terminal literal; -------// 19.4) Types, Values, and Variables -------non terminal type, primitive_type, numeric_type; -------non terminal integral_type, floating_point_type; -------non terminal reference_type; -------non terminal class_or_interface_type; -------non terminal class_type, interface_type; -------non terminal array_type; -------// 19.5) Names -------non terminal name, simple_name, qualified_name; -------// 19.6) Packages -------non terminal compilation_unit; -------non terminal package_declaration_opt, package_declaration; -------non terminal import_declarations_opt, import_declarations; -------non terminal type_declarations_opt, type_declarations; -------non terminal import_declaration; -------non terminal single_type_import_declaration; -------non terminal type_import_on_demand_declaration; -------non terminal static_single_type_import_declaration; -------non terminal static_type_import_on_demand_declaration; -------non terminal type_declaration; -------// 19.7) Productions used only in the LALR(1) grammar -------non terminal modifiers_opt, modifiers, modifier; -------// 19.8.1) Class Declaration -------non terminal class_declaration, super, super_opt; -------non terminal interfaces, interfaces_opt, interface_type_list; -------non terminal class_body, class_body_opt; -------non terminal class_body_declarations, class_body_declarations_opt; -------non terminal class_body_declaration, class_member_declaration; -------// JSR-201) Enum Declaration -------non terminal enum_declaration; -------non terminal enum_body, enum_constants_opt, enum_constants, enum_constant; -------non terminal enum_arguments_opt, enum_body_declarations_opt; -------// 19.8.2) Field Declarations -------non terminal field_declaration, variable_declarators, variable_declarator; -------non terminal variable_declarator_id, variable_initializer; -------// 19.8.3) Method Declarations -------non terminal method_declaration, method_header, method_declarator; -------non terminal formal_parameter_list_opt, formal_parameter_list; -------non terminal formal_parameter; -------non terminal throws_opt, throws; -------non terminal class_type_list, method_body; -------// 19.8.4) Static Initializers -------non terminal static_initializer; -------// 19.8.5) Constructor Declarations -------non terminal constructor_declaration, constructor_declarator; -------non terminal constructor_body; -------non terminal explicit_constructor_invocation; -------// 19.9.1) Interface Declarations -------non terminal interface_declaration; -------non terminal extends_interfaces_opt, extends_interfaces; -------non terminal interface_body; -------non terminal interface_member_declarations_opt, interface_member_declarations; -------non terminal interface_member_declaration, constant_declaration; -------non terminal abstract_method_declaration; -------// 19.10) Arrays -------non terminal array_initializer; -------non terminal variable_initializers; -------// 19.11) Blocks and Statements -------non terminal block; -------non terminal block_statements_opt, block_statements, block_statement; -------non terminal local_variable_declaration_statement, local_variable_declaration; -------non terminal statement, statement_no_short_if; -------non terminal statement_without_trailing_substatement; -------non terminal empty_statement; -------non terminal labeled_statement, labeled_statement_no_short_if; -------non terminal expression_statement, statement_expression; -------non terminal if_then_statement; -------non terminal if_then_else_statement, if_then_else_statement_no_short_if; -------non terminal switch_statement, switch_block; -------non terminal switch_block_statement_groups; -------non terminal switch_block_statement_group; -------non terminal switch_labels, switch_label; -------non terminal while_statement, while_statement_no_short_if; -------non terminal do_statement; -------non terminal foreach_statement, foreach_statement_no_short_if; -------non terminal for_statement, for_statement_no_short_if; -------non terminal for_init_opt, for_init; -------non terminal for_update_opt, for_update; -------non terminal statement_expression_list; -------non terminal identifier_opt; -------non terminal break_statement, continue_statement; -------non terminal return_statement, throw_statement; -------non terminal synchronized_statement, try_statement; -------non terminal catches_opt, catches, catch_clause; -------non terminal finally; -------non terminal assert_statement; -------// 19.12) Expressions -------non terminal primary, primary_no_new_array; -------non terminal class_instance_creation_expression; -------non terminal argument_list_opt, argument_list; -------non terminal array_creation_init, array_creation_uninit; -------non terminal dim_exprs, dim_expr, dims_opt, dims; -------non terminal field_access, method_invocation, array_access; -------non terminal postfix_expression; -------non terminal postincrement_expression, postdecrement_expression; -------non terminal unary_expression, unary_expression_not_plus_minus; -------non terminal preincrement_expression, predecrement_expression; -------non terminal cast_expression; -------non terminal multiplicative_expression, additive_expression; -------non terminal shift_expression, relational_expression, equality_expression; -------non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -------non terminal conditional_and_expression, conditional_or_expression; -------non terminal conditional_expression, assignment_expression; -------non terminal assignment; -------non terminal assignment_operator; -------non terminal expression_opt, expression; -------non terminal constant_expression; -------// JSR-14 2.1) Type Syntax 2.3) Handling Consecutive Type Brackets -------non terminal class_or_interface; -------non terminal type_variable; -------non terminal type_arguments, type_arguments_opt; -------non terminal type_argument_list; -------non terminal type_argument_list_1, reference_type_1; -------non terminal type_argument_list_2, reference_type_2; -------non terminal type_argument_list_3, reference_type_3; -------// JSR-14 2.2) Parameterized Type Declarations 2.3) Handling Consecutive... -------non terminal type_parameters, type_parameters_opt; -------non terminal type_parameter, type_parameter_list; -------non terminal type_parameter_1, type_parameter_list_1; -------non terminal type_bound, type_bound_opt; -------non terminal type_bound_1; -------non terminal additional_bound_list, additional_bound_list_opt; -------non terminal additional_bound_list_1; -------non terminal additional_bound; -------non terminal additional_bound_1; -------non terminal wildcard, wildcard_1, wildcard_2, wildcard_3; -------non terminal type_argument, type_argument_1, type_argument_2, type_argument_3; -------// not mentioned in JSR-14: need to reduce the precedence of instanceof -------// Alternatively, you can tweak the relational_expression production a little. -------non terminal instanceof_expression; -------//// expressions which are Not a Name -------non terminal postfix_expression_nn; -------non terminal unary_expression_nn; -------non terminal unary_expression_not_plus_minus_nn; -------non terminal multiplicative_expression_nn; -------non terminal additive_expression_nn; -------non terminal shift_expression_nn; -------non terminal relational_expression_nn; -------non terminal instanceof_expression_nn; -------non terminal equality_expression_nn; -------non terminal and_expression_nn; -------non terminal exclusive_or_expression_nn; -------non terminal inclusive_or_expression_nn; -------non terminal conditional_and_expression_nn; -------non terminal conditional_or_expression_nn; -------non terminal conditional_expression_nn; -------non terminal assignment_expression_nn; -------non terminal expression_nn; ------- -------start with goal; ------- -------// 19.2) The Syntactic Grammar -------goal ::= compilation_unit ------- ; ------- -------// 19.3) Lexical Structure. -------literal ::= INTEGER_LITERAL ------- | FLOATING_POINT_LITERAL ------- | BOOLEAN_LITERAL ------- | CHARACTER_LITERAL ------- | STRING_LITERAL ------- | NULL_LITERAL ------- ; ------- -------// 19.4) Types, Values, and Variables -------type ::= primitive_type ------- | reference_type ------- ; -------primitive_type ::= ------- numeric_type ------- | BOOLEAN ------- ; -------numeric_type::= integral_type ------- | floating_point_type ------- ; -------integral_type ::= ------- BYTE ------- | SHORT ------- | INT ------- | LONG ------- | CHAR ------- ; -------floating_point_type ::= ------- FLOAT ------- | DOUBLE ------- ; ------- -------reference_type ::= ------- class_or_interface_type -------/* note that the 'type_variable' production will come out of the grammar ------- * as a 'class_or_interface_type' with a 'simple_name'. The semantic ------- * checker will have to resolve whether this is a class name or a type ------- * variable */ ------- | array_type ------- ; -------type_variable ::= ------- IDENTIFIER ------- ; -------class_or_interface ::= ------- name ------- | class_or_interface LT type_argument_list_1 DOT name ------- ; -------class_or_interface_type ::= ------- class_or_interface ------- | class_or_interface LT type_argument_list_1 ------- ; ------- -------class_type ::= class_or_interface_type; -------interface_type ::= class_or_interface_type; ------- -------array_type ::= primitive_type dims ------- // we have class_or_interface_type here even though only unbounded ------- // wildcards are really allowed in the parameterization. ------- // we have to expand this to avoid lookahead problems. ------- | name dims ------- | class_or_interface LT type_argument_list_1 DOT name dims ------- | class_or_interface LT type_argument_list_1 dims ------- ; ------- -------type_arguments_opt ::= type_arguments | ; ------- -------type_arguments ::= ------- LT type_argument_list_1 ------- ; -------wildcard ::= QUESTION ------- | QUESTION EXTENDS reference_type ------- | QUESTION SUPER reference_type ------- ; -------wildcard_1 ::= QUESTION GT ------- | QUESTION EXTENDS reference_type_1 ------- | QUESTION SUPER reference_type_1 ------- ; -------wildcard_2 ::= QUESTION RSHIFT ------- | QUESTION EXTENDS reference_type_2 ------- | QUESTION SUPER reference_type_2 ------- ; -------wildcard_3 ::= QUESTION URSHIFT ------- | QUESTION EXTENDS reference_type_3 ------- | QUESTION SUPER reference_type_3 ------- ; -------reference_type_1 ::= ------- reference_type GT ------- | class_or_interface LT type_argument_list_2 ------- ; -------reference_type_2 ::= ------- reference_type RSHIFT ------- | class_or_interface LT type_argument_list_3 ------- ; -------reference_type_3 ::= ------- reference_type URSHIFT ------- ; -------type_argument_list ::= ------- type_argument ------- | type_argument_list COMMA type_argument ------- ; -------type_argument_list_1 ::= ------- type_argument_1 ------- | type_argument_list COMMA type_argument_1 ------- ; -------type_argument_list_2 ::= ------- type_argument_2 ------- | type_argument_list COMMA type_argument_2 ------- ; -------type_argument_list_3 ::= ------- type_argument_3 ------- | type_argument_list COMMA type_argument_3 ------- ; -------type_argument ::= ------- reference_type ------- | wildcard ------- ; -------type_argument_1 ::= ------- reference_type_1 ------- | wildcard_1 ------- ; -------type_argument_2 ::= ------- reference_type_2 ------- | wildcard_2 ------- ; -------type_argument_3 ::= ------- reference_type_3 ------- | wildcard_3 ------- ; ------- -------// 19.5) Names -------name ::= simple_name ------- | qualified_name ------- ; -------simple_name ::= IDENTIFIER ------- ; -------qualified_name ::= ------- name DOT IDENTIFIER ------- ; ------- -------// 19.6) Packages -------compilation_unit ::= ------- package_declaration_opt ------- import_declarations_opt ------- type_declarations_opt ------- ; -------package_declaration_opt ::= package_declaration | ; -------import_declarations_opt ::= import_declarations | ; -------type_declarations_opt ::= type_declarations | ; ------- -------import_declarations ::= ------- import_declaration ------- | import_declarations import_declaration ------- ; -------type_declarations ::= ------- type_declaration ------- | type_declarations type_declaration ------- ; -------package_declaration ::= ------- PACKAGE name SEMICOLON ------- ; -------import_declaration ::= ------- single_type_import_declaration ------- | type_import_on_demand_declaration ------- | static_single_type_import_declaration ------- | static_type_import_on_demand_declaration ------- ; -------single_type_import_declaration ::= ------- IMPORT name SEMICOLON ------- ; -------static_single_type_import_declaration ::= ------- IMPORT STATIC name SEMICOLON ------- ; -------type_import_on_demand_declaration ::= ------- IMPORT name DOT MULT SEMICOLON ------- ; -------static_type_import_on_demand_declaration ::= ------- IMPORT STATIC name DOT MULT SEMICOLON ------- ; -------type_declaration ::= ------- class_declaration ------- | enum_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// 19.7) Productions used only in the LALR(1) grammar -------modifiers_opt::= ------- | modifiers ------- ; -------modifiers ::= modifier ------- | modifiers modifier ------- ; -------modifier ::= PUBLIC | PROTECTED | PRIVATE ------- | STATIC ------- | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE ------- | STRICTFP // note that semantic analysis must check that the ------- // context of the modifier allows strictfp. ------- ; ------- -------// 19.8) Classes ------- -------// 19.8.1) Class Declaration: -------class_declaration ::= ------- modifiers_opt CLASS IDENTIFIER type_parameters_opt ------- super_opt interfaces_opt class_body ------- ; -------super ::= EXTENDS class_type ------- ; -------super_opt ::= ------- | super ------- ; -------interfaces ::= IMPLEMENTS interface_type_list ------- ; -------interfaces_opt::= ------- | interfaces ------- ; -------interface_type_list ::= ------- interface_type ------- | interface_type_list COMMA interface_type ------- ; -------class_body ::= LBRACE class_body_declarations_opt RBRACE ------- ; -------class_body_opt ::= ------- | class_body ; -------class_body_declarations_opt ::= ------- | class_body_declarations ; -------class_body_declarations ::= ------- class_body_declaration ------- | class_body_declarations class_body_declaration ------- ; -------class_body_declaration ::= ------- class_member_declaration ------- | static_initializer ------- | constructor_declaration ------- | block ------- ; -------class_member_declaration ::= ------- field_declaration ------- | method_declaration ------- /* repeat the prod for 'class_declaration' here: */ ------- | modifiers_opt CLASS IDENTIFIER type_parameters_opt super_opt interfaces_opt class_body ------- | enum_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; ------- -------// JSR-201) Enum Declaration -------enum_declaration ::= ------- modifiers_opt ENUM IDENTIFIER interfaces_opt enum_body ------- ; -------enum_body ::= ------- LBRACE enum_constants_opt enum_body_declarations_opt RBRACE ------- ; -------enum_constants_opt ::= ------- | enum_constants ------- ; -------enum_constants ::= ------- enum_constant ------- | enum_constants COMMA enum_constant ------- ; -------enum_constant ::= ------- IDENTIFIER enum_arguments_opt ------- | IDENTIFIER enum_arguments_opt class_body ------- ; -------enum_arguments_opt ::= ------- | LPAREN argument_list_opt RPAREN ------- ; -------enum_body_declarations_opt ::= ------- | SEMICOLON class_body_declarations_opt ------- ; ------- -------// 19.8.2) Field Declarations -------field_declaration ::= ------- modifiers_opt type variable_declarators SEMICOLON ------- ; -------variable_declarators ::= ------- variable_declarator ------- | variable_declarators COMMA variable_declarator ------- ; -------variable_declarator ::= ------- variable_declarator_id ------- | variable_declarator_id EQ variable_initializer ------- ; -------variable_declarator_id ::= ------- IDENTIFIER ------- | variable_declarator_id LBRACK RBRACK ------- ; -------variable_initializer ::= ------- expression ------- | array_initializer ------- ; ------- -------// 19.8.3) Method Declarations -------method_declaration ::= ------- method_header method_body ------- ; -------method_header ::= ------- // have to expand type_parameters_opt here so that we don't ------- // force an early decision of whether this is a field_declaration ------- // or a method_declaration (the type_parameters_opt would have to ------- // be reduced when we see the 'type' if this was a method declaration, ------- // but it might still turn out to be a field declaration). ------- modifiers_opt type method_declarator throws_opt ------- | modifiers_opt LT type_parameter_list_1 type method_declarator throws_opt ------- | modifiers_opt VOID method_declarator throws_opt ------- | modifiers_opt LT type_parameter_list_1 VOID method_declarator throws_opt ------- ; -------method_declarator ::= ------- IDENTIFIER LPAREN formal_parameter_list_opt RPAREN ------- | method_declarator LBRACK RBRACK // deprecated ------- // be careful; the above production also allows 'void foo() []' ------- ; -------formal_parameter_list_opt ::= ------- | formal_parameter_list ------- ; -------formal_parameter_list ::= ------- formal_parameter ------- | formal_parameter_list COMMA formal_parameter ------- ; -------formal_parameter ::= ------- type variable_declarator_id ------- | FINAL type variable_declarator_id ------- // careful, productions below allow varargs in non-final positions. ------- | type ELLIPSIS IDENTIFIER ------- | FINAL type ELLIPSIS IDENTIFIER ------- ; -------throws_opt ::= ------- | throws ------- ; -------throws ::= THROWS class_type_list ------- ; -------class_type_list ::= ------- class_type ------- | class_type_list COMMA class_type ------- ; -------method_body ::= block ------- | SEMICOLON ------- ; ------- -------// 19.8.4) Static Initializers -------static_initializer ::= ------- STATIC block ------- ; ------- -------// 19.8.5) Constructor Declarations -------constructor_declaration ::= ------- modifiers_opt constructor_declarator ------- throws_opt constructor_body ------- | modifiers_opt LT type_parameter_list_1 constructor_declarator ------- throws_opt constructor_body ------- ; -------constructor_declarator ::= ------- simple_name LPAREN formal_parameter_list_opt RPAREN ------- ; -------constructor_body ::= ------- LBRACE explicit_constructor_invocation ------- block_statements RBRACE ------- | LBRACE explicit_constructor_invocation RBRACE ------- | LBRACE block_statements RBRACE ------- | LBRACE RBRACE ------- ; -------explicit_constructor_invocation ::= ------- THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | type_arguments THIS LPAREN argument_list_opt RPAREN SEMICOLON ------- | SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | type_arguments SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | primary DOT type_arguments SUPER ------- LPAREN argument_list_opt RPAREN SEMICOLON ------- | name DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- | name DOT type_arguments SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------- ; ------- -------// 19.9) Interfaces ------- -------// 19.9.1) Interface Declarations -------interface_declaration ::= ------- modifiers_opt INTERFACE IDENTIFIER type_parameters_opt ------- extends_interfaces_opt interface_body ------- ; -------extends_interfaces_opt ::= ------- | extends_interfaces ------- ; -------extends_interfaces ::= ------- EXTENDS interface_type ------- | extends_interfaces COMMA interface_type ------- ; -------interface_body ::= ------- LBRACE interface_member_declarations_opt RBRACE ------- ; -------interface_member_declarations_opt ::= ------- | interface_member_declarations ------- ; -------interface_member_declarations ::= ------- interface_member_declaration ------- | interface_member_declarations interface_member_declaration ------- ; -------interface_member_declaration ::= ------- constant_declaration ------- | abstract_method_declaration ------- | class_declaration ------- | enum_declaration ------- | interface_declaration ------- | SEMICOLON ------- ; -------constant_declaration ::= ------- field_declaration ------- // need to semantically check that modifiers of field declaration ------- // include only PUBLIC, STATIC, or FINAL. Other modifiers are ------- // disallowed. ------- ; -------abstract_method_declaration ::= ------- method_header SEMICOLON ------- ; ------- -------// 19.10) Arrays -------array_initializer ::= ------- LBRACE variable_initializers COMMA RBRACE ------- | LBRACE variable_initializers RBRACE ------- | LBRACE COMMA RBRACE ------- | LBRACE RBRACE ------- ; -------variable_initializers ::= ------- variable_initializer ------- | variable_initializers COMMA variable_initializer ------- ; ------- -------// 19.11) Blocks and Statements -------block ::= LBRACE block_statements_opt RBRACE ------- ; -------block_statements_opt ::= ------- | block_statements ------- ; -------block_statements ::= ------- block_statement ------- | block_statements block_statement ------- ; -------block_statement ::= ------- local_variable_declaration_statement ------- | statement ------- | class_declaration ------- | enum_declaration ------- | interface_declaration ------- ; -------local_variable_declaration_statement ::= ------- local_variable_declaration SEMICOLON ------- ; -------/* jikes expands 'type' in production for local_variable_declaration to ------- * avoid reduce-reduce conflict: given 'name [' the grammar can't decide ------- * whether this is going to be a type (starting the local_variable_declaration) ------- * or an array access expression. */ -------local_variable_declaration ::= ------- type variable_declarators ------- // you may want to accept 'modifiers' here instead of just FINAL ------- // to produce better error messages. ------- | FINAL type variable_declarators ------- ; -------statement ::= statement_without_trailing_substatement ------- | labeled_statement ------- | if_then_statement ------- | if_then_else_statement ------- | while_statement ------- | for_statement ------- | foreach_statement ------- ; -------statement_no_short_if ::= ------- statement_without_trailing_substatement ------- | labeled_statement_no_short_if ------- | if_then_else_statement_no_short_if ------- | while_statement_no_short_if ------- | for_statement_no_short_if ------- | foreach_statement_no_short_if ------- ; -------statement_without_trailing_substatement ::= ------- block ------- | empty_statement ------- | expression_statement ------- | switch_statement ------- | do_statement ------- | break_statement ------- | continue_statement ------- | return_statement ------- | synchronized_statement ------- | throw_statement ------- | try_statement ------- | assert_statement ------- ; -------empty_statement ::= ------- SEMICOLON ------- ; -------labeled_statement ::= ------- IDENTIFIER COLON statement ------- ; -------labeled_statement_no_short_if ::= ------- IDENTIFIER COLON statement_no_short_if ------- ; -------expression_statement ::= ------- statement_expression SEMICOLON ------- ; -------statement_expression ::= ------- assignment ------- | preincrement_expression ------- | predecrement_expression ------- | postincrement_expression ------- | postdecrement_expression ------- | method_invocation ------- | class_instance_creation_expression ------- ; -------if_then_statement ::= ------- IF LPAREN expression RPAREN statement ------- ; -------if_then_else_statement ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement ------- ; -------if_then_else_statement_no_short_if ::= ------- IF LPAREN expression RPAREN statement_no_short_if ------- ELSE statement_no_short_if ------- ; -------switch_statement ::= ------- SWITCH LPAREN expression RPAREN switch_block ------- ; -------switch_block ::= ------- LBRACE switch_block_statement_groups switch_labels RBRACE ------- | LBRACE switch_block_statement_groups RBRACE ------- | LBRACE switch_labels RBRACE ------- | LBRACE RBRACE ------- ; -------switch_block_statement_groups ::= ------- switch_block_statement_group ------- | switch_block_statement_groups switch_block_statement_group ------- ; -------switch_block_statement_group ::= ------- switch_labels block_statements ------- ; -------switch_labels ::= ------- switch_label ------- | switch_labels switch_label ------- ; -------switch_label ::= ------- CASE constant_expression COLON ------- | DEFAULT COLON ------- ; ------- -------while_statement ::= ------- WHILE LPAREN expression RPAREN statement ------- ; -------while_statement_no_short_if ::= ------- WHILE LPAREN expression RPAREN statement_no_short_if ------- ; -------do_statement ::= ------- DO statement WHILE LPAREN expression RPAREN SEMICOLON ------- ; -------foreach_statement ::= ------- FOR LPAREN type variable_declarator_id COLON expression RPAREN ------- statement ------- // must check that first IDENTIFIER is 'each' and second IDENTIFIER ------- // is 'in' ------- | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER ------- expression RPAREN statement ------- ; -------foreach_statement_no_short_if ::= ------- FOR LPAREN type variable_declarator_id COLON expression RPAREN ------- statement_no_short_if ------- // must check that first IDENTIFIER is 'each' and second IDENTIFIER ------- // is 'in' ------- | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER ------- expression RPAREN statement_no_short_if ------- ; -------for_statement ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement ------- ; -------for_statement_no_short_if ::= ------- FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON ------- for_update_opt RPAREN statement_no_short_if ------- ; -------for_init_opt ::= ------- | for_init ------- ; -------for_init ::= statement_expression_list ------- | local_variable_declaration ------- ; -------for_update_opt ::= ------- | for_update ------- ; -------for_update ::= statement_expression_list ------- ; -------statement_expression_list ::= ------- statement_expression ------- | statement_expression_list COMMA statement_expression ------- ; ------- -------identifier_opt ::= ------- | IDENTIFIER ------- ; ------- -------break_statement ::= ------- BREAK identifier_opt SEMICOLON ------- ; ------- -------continue_statement ::= ------- CONTINUE identifier_opt SEMICOLON ------- ; -------return_statement ::= ------- RETURN expression_opt SEMICOLON ------- ; -------throw_statement ::= ------- THROW expression SEMICOLON ------- ; -------synchronized_statement ::= ------- SYNCHRONIZED LPAREN expression RPAREN block ------- ; -------try_statement ::= ------- TRY block catches ------- | TRY block catches_opt finally ------- ; -------catches_opt ::= ------- | catches ------- ; -------catches ::= catch_clause ------- | catches catch_clause ------- ; -------catch_clause ::= ------- CATCH LPAREN formal_parameter RPAREN block ------- ; -------finally ::= FINALLY block ------- ; -------assert_statement ::= ------- ASSERT expression SEMICOLON ------- | ASSERT expression COLON expression SEMICOLON ------- ; ------- -------// 19.12) Expressions -------primary ::= primary_no_new_array ------- | array_creation_init ------- | array_creation_uninit ------- ; -------primary_no_new_array ::= ------- literal ------- | THIS ------- | LPAREN name RPAREN ------- | LPAREN expression_nn RPAREN ------- | class_instance_creation_expression ------- | field_access ------- | method_invocation ------- | array_access ------- | name DOT THIS ------- | VOID DOT CLASS ------- // "Type DOT CLASS", but expanded ------- | primitive_type DOT CLASS ------- | primitive_type dims DOT CLASS ------- | name DOT CLASS ------- | name dims DOT CLASS -------// the following two productions are part of the expansion of -------// 'type DOT CLASS' but are not actually allowed, as they involve params. -------// [see msg from Neal Gafter <3F219367.3070903@sun.com> 25-jul-2003] -------// | class_or_interface type_arguments DOT name dims DOT CLASS -------// | class_or_interface LT type_argument_list_1 dims DOT CLASS ------- ; -------// grammar distributed with prototype 2.2 is in error; the following is correct -------// [ Neal Gafter, <3F2577E0.3090008@sun.com> ] -------class_instance_creation_expression ::= ------- NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body_opt ------- | NEW type_arguments class_or_interface_type LPAREN argument_list_opt RPAREN class_body_opt ------- | primary DOT NEW type_arguments_opt IDENTIFIER type_arguments_opt ------- LPAREN argument_list_opt RPAREN class_body_opt ------- | name DOT NEW type_arguments_opt IDENTIFIER type_arguments_opt ------- LPAREN argument_list_opt RPAREN class_body_opt ------- ; -------argument_list_opt ::= ------- | argument_list ------- ; -------argument_list ::= ------- expression ------- | argument_list COMMA expression ------- ; -------array_creation_uninit ::= ------- NEW primitive_type dim_exprs dims_opt ------- | NEW class_or_interface_type dim_exprs dims_opt ------- ; -------array_creation_init ::= ------- NEW primitive_type dims array_initializer ------- | NEW class_or_interface_type dims array_initializer ------- ; -------dim_exprs ::= dim_expr ------- | dim_exprs dim_expr ------- ; -------dim_expr ::= LBRACK expression RBRACK ------- ; -------dims_opt ::= ------- | dims ------- ; -------dims ::= LBRACK RBRACK ------- | dims LBRACK RBRACK ------- ; -------field_access ::= ------- primary DOT IDENTIFIER ------- | SUPER DOT IDENTIFIER ------- | name DOT SUPER DOT IDENTIFIER ------- ; -------method_invocation ::= ------- name LPAREN argument_list_opt RPAREN -------// the following production appeared in the prototype 2.2 spec, but it -------// introduces ambiguities in the grammar (consider the expression -------// A((B)E()); -------// which could be either an invocation on E or two boolean comparisons). -------// Neal Gafter has assured me that this production should be removed -------// from the grammar. <3F256C06.7000600@sun.com> -------// | type_arguments name LPAREN argument_list_opt RPAREN ------- | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | primary DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN ------- | name DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN ------- | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | SUPER DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN ------- | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- | name DOT SUPER DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN ------- ; -------array_access ::= ------- name LBRACK expression RBRACK ------- | primary_no_new_array LBRACK expression RBRACK ------- | array_creation_init LBRACK expression RBRACK ------- ; -------postfix_expression ::= ------- primary ------- | name ------- | postincrement_expression ------- | postdecrement_expression ------- ; -------postincrement_expression ::= ------- postfix_expression PLUSPLUS ------- ; -------postdecrement_expression ::= ------- postfix_expression MINUSMINUS ------- ; -------unary_expression ::= ------- preincrement_expression ------- | predecrement_expression ------- | PLUS unary_expression ------- | MINUS unary_expression ------- | unary_expression_not_plus_minus ------- ; -------preincrement_expression ::= ------- PLUSPLUS unary_expression ------- ; -------predecrement_expression ::= ------- MINUSMINUS unary_expression ------- ; -------unary_expression_not_plus_minus ::= ------- postfix_expression ------- | COMP unary_expression ------- | NOT unary_expression ------- | cast_expression ------- ; -------// This parsing technique was discovered by Eric Blake -------// We solving grammar ambiguities with between parenthesized less-than -------// relational operations and type casts with a slightly-more-complicated -------// cast_expression production. -------// Illustrative example: LPAREN name LT name ... -------// is this going to be a cast_expression or a relational_expression? -------// canonically, this production is: -------// cast_expression ::= LPAREN type RPAREN unary_expression_not_plus_minus -------cast_expression ::= ------- LPAREN primitive_type dims_opt RPAREN unary_expression ------- | LPAREN name RPAREN unary_expression_not_plus_minus ------- | LPAREN name dims RPAREN unary_expression_not_plus_minus ------- | LPAREN name LT type_argument_list_1 dims_opt RPAREN ------- unary_expression_not_plus_minus ------- | LPAREN name LT type_argument_list_1 DOT ------- class_or_interface_type dims_opt RPAREN ------- unary_expression_not_plus_minus ------- ; -------multiplicative_expression ::= ------- unary_expression ------- | multiplicative_expression MULT unary_expression ------- | multiplicative_expression DIV unary_expression ------- | multiplicative_expression MOD unary_expression ------- ; -------additive_expression ::= ------- multiplicative_expression ------- | additive_expression PLUS multiplicative_expression ------- | additive_expression MINUS multiplicative_expression ------- ; -------shift_expression ::= ------- additive_expression ------- | shift_expression LSHIFT additive_expression ------- | shift_expression RSHIFT additive_expression ------- | shift_expression URSHIFT additive_expression ------- ; -------relational_expression ::= ------- shift_expression ------- | relational_expression LT shift_expression ------- | relational_expression GT shift_expression ------- | relational_expression LTEQ shift_expression ------- | relational_expression GTEQ shift_expression ------- ; -------// we lower the precendence of instanceof to resolve a grammar ambiguity. -------// semantics are unchanged, since relational expressions do not operate -------// on boolean. Eric Blake had a different solution here, where he -------// used the production 'shift_expression LT shift_expression' to solve -------// the same problem. -------instanceof_expression ::= ------- relational_expression ------- | instanceof_expression INSTANCEOF reference_type ------- ; -------equality_expression ::= ------- instanceof_expression ------- | equality_expression EQEQ instanceof_expression ------- | equality_expression NOTEQ instanceof_expression ------- ; -------and_expression ::= ------- equality_expression ------- | and_expression AND equality_expression ------- ; -------exclusive_or_expression ::= ------- and_expression ------- | exclusive_or_expression XOR and_expression ------- ; -------inclusive_or_expression ::= ------- exclusive_or_expression ------- | inclusive_or_expression OR exclusive_or_expression ------- ; -------conditional_and_expression ::= ------- inclusive_or_expression ------- | conditional_and_expression ANDAND inclusive_or_expression ------- ; -------conditional_or_expression ::= ------- conditional_and_expression ------- | conditional_or_expression OROR conditional_and_expression ------- ; -------conditional_expression ::= ------- conditional_or_expression ------- | conditional_or_expression QUESTION expression ------- COLON conditional_expression ------- ; -------assignment_expression ::= ------- conditional_expression ------- | assignment ------- ; -------// semantic check necessary here to ensure a valid left-hand side. -------// allowing a parenthesized variable here on the lhs was introduced in -------// JLS 2; thanks to Eric Blake for pointing this out. -------assignment ::= postfix_expression assignment_operator assignment_expression ------- ; -------assignment_operator ::= ------- EQ ------- | MULTEQ ------- | DIVEQ ------- | MODEQ ------- | PLUSEQ ------- | MINUSEQ ------- | LSHIFTEQ ------- | RSHIFTEQ ------- | URSHIFTEQ ------- | ANDEQ ------- | XOREQ ------- | OREQ ------- ; -------expression_opt ::= ------- | expression ------- ; -------expression ::= assignment_expression ------- ; -------// note that this constraint must be enforced during semantic checking -------// 'constant_expression' should include enumerated constants. -------constant_expression ::= ------- expression ------- ; ------- -------// JLS-14 productions. -------type_parameters_opt ::= type_parameters | ; -------type_parameters ::= ------- LT type_parameter_list_1 ------- ; -------type_parameter_list ::= ------- type_parameter_list COMMA type_parameter ------- | type_parameter ------- ; -------type_parameter_list_1 ::= ------- type_parameter_1 ------- | type_parameter_list COMMA type_parameter_1 ------- ; -------type_parameter ::= ------- type_variable type_bound_opt ------- ; -------type_parameter_1 ::= ------- type_variable GT ------- | type_variable type_bound_1 ------- ; -------type_bound_opt ::= type_bound | ; -------type_bound ::= ------- EXTENDS reference_type additional_bound_list_opt ------- ; -------type_bound_1 ::= ------- EXTENDS reference_type_1 ------- | EXTENDS reference_type additional_bound_list_1 ------- ; -------additional_bound_list_opt ::= additional_bound_list | ; -------additional_bound_list ::= ------- additional_bound additional_bound_list ------- | additional_bound ------- ; -------additional_bound_list_1 ::= ------- additional_bound additional_bound_list_1 ------- | additional_bound_1 ------- ; -------additional_bound ::= ------- AND interface_type ------- ; -------additional_bound_1 ::= ------- AND reference_type_1 ------- ; -------////////////////////////////////////////////// -------// the following productions are copied from the standard ones, but -------// 'name' all alone is not allowed. The '_nn' stands for 'not name'. -------// we also expand the productions so that they recursively depend on the -------// '_nn' forms of their left hand side, then adding a new production -------// with 'name' explicit on the left-hand side. -------// this allows us to postpone the decision whether '(x)' is an expression -------// or a type-cast until we can see enough right context to make the proper -------// choice. -------postfix_expression_nn ::= ------- primary ------- // the 'name' production was removed here. ------- | postincrement_expression ------- | postdecrement_expression ------- ; -------unary_expression_nn ::= ------- preincrement_expression ------- | predecrement_expression ------- | PLUS unary_expression ------- | MINUS unary_expression ------- | unary_expression_not_plus_minus_nn ------- ; -------unary_expression_not_plus_minus_nn ::= ------- postfix_expression_nn ------- | COMP unary_expression ------- | NOT unary_expression ------- | cast_expression ------- ; -------multiplicative_expression_nn ::= ------- unary_expression_nn ------- | name MULT unary_expression ------- | multiplicative_expression_nn MULT unary_expression ------- | name DIV unary_expression ------- | multiplicative_expression_nn DIV unary_expression ------- | name MOD unary_expression ------- | multiplicative_expression_nn MOD unary_expression ------- ; -------additive_expression_nn ::= ------- multiplicative_expression_nn ------- | name PLUS multiplicative_expression ------- | additive_expression_nn PLUS multiplicative_expression ------- | name MINUS multiplicative_expression ------- | additive_expression_nn MINUS multiplicative_expression ------- ; -------shift_expression_nn ::= ------- additive_expression_nn ------- | name LSHIFT additive_expression ------- | shift_expression_nn LSHIFT additive_expression ------- | name RSHIFT additive_expression ------- | shift_expression_nn RSHIFT additive_expression ------- | name URSHIFT additive_expression ------- | shift_expression_nn URSHIFT additive_expression ------- ; -------relational_expression_nn ::= ------- shift_expression_nn ------- // note that we've tweaked the productions for LT/GT to disallow ------- // a 3-Apr-1998 ------- [revised 12-apr-2002] ------- [revised 28-jul-2003] ------- -------UPDATE: Fixed a lexer bug: '5.2' is a double, not a float. Thanks to -------Ben Walter for spotting this. ------- ------- -- C. Scott Ananian 14-Jul-1998 ------- -------UPDATE: Fixed a couple of minor bugs. -------1) Lex.EscapedUnicodeReader wasn't actually parsing unicode escape sequences ------- properly because we didn't implement read(char[], int, int). -------2) Grammar fixes: int[].class, Object[].class and all array class ------- literals were not being parsed. Also special void.class literal ------- inadvertantly omitted from the grammar. -------Both these problems have been fixed. ------- ------- -- C. Scott Ananian 11-Feb-1999 ------- -------UPDATE: Fixed another lexer bug: Large integer constants such as -------0xFFFF0000 were being incorrectly flagged as 'too large for an int'. -------Also, by the Java Language Specification, "\477" is a valid string -------literal (it is the same as "\0477": the character '\047' followed by -------the character '7'). The lexer handles this case correctly now. ------- -------Created java12.cup with grammar updated to Java 1.2. Features -------added include the 'strictfp' keyword and the various new inner class -------features at http://java.sun.com/docs/books/jls/nested-class-clarify.html. ------- -------Also added slightly better position/error reporting to all parsers. ------- ------- -- C. Scott Ananian 11-Feb-1999 ------- -------UPDATE: fixed some buglets with symbol/error position reporting. ------- ------- -- C. Scott Ananian 13-Sep-1999 ------- -------UPDATE: multi-line comments were causing incorrect character position -------reporting. If you were using the character-position-to-line-number -------code in Lexer, you would never have noticed this problem. Thanks to -------William Young for pointing this out. ------- ------- -- C. Scott Ananian 27-Oct-1999 ------- -------UPDATE: extended grammar to handle the 'assert' statement added in -------Java 1.4. Also fixed an oversight: a single SEMICOLON is a valid -------ClassBodyDeclaration; this was added to allow trailing semicolons -------uniformly on class declarations. This wasn't part of the original -------JLS, but was revised in to conform with the actual behavior of the -------javac compiler. I've added this to all the grammars from 1.0-1.4 -------to conform to javac behavior; let me know if you've got a good -------reason why this production shouldn't be in early grammars. ------- -------Also futzed with the Makefile some to allow building a 'universal' -------driver which will switch between java 1.0/1.1/1.2/1.4 on demand. -------This helps me test the separate grammars; maybe you'll find a -------use for this behavior too. ------- ------- -- C. Scott Ananian 10-Apr-2002 ------- -------NEW: added a grammar for the JSR-14 "Adding Generics to the Java -------Programming Language" Java variant. Calling this java15.cup, since -------this JSR currently seems to be destined for inclusion in Java 1.5. -------This grammar is very very tricky! I need to use a lexer trick to -------handle type casts to parameterized types, which otherwise do not -------seem to be LALR(1). ------- -- C. Scott Ananian 12-Apr-2002 ------- -------UPDATE: various bug fixes to all grammars, in reponse to bugs reported -------by Eric Blake and others. ------- a) TWEAK: added 'String' type to IDENTIFIER terminal to match Number types ------- given to numeric literals. (all grammars) ------- b) BUG FIX: added SEMICOLON production to interface_member_declaration to ------- allow optional trailing semicolons, in accordance with the JLS (for ------- java 1.2-and-later grammars) and Sun practice (for earlier grammars). ------- The 10-Apr-2002 release did not address this problem completely, due ------- to an oversight. (all grammars) ------- c) BUG FIX: '.this(...);' is not a legal production; ------- '.super(...);' and '.new (...' ought to be. ------- In particular, plain identifiers ought to be able to qualify instance ------- creation and explicit constructor invocation. ------- (fix due to Eric Blake; java 1.2 grammar and following) ------- d) BUG FIX: parenthesized variables on the left-hand-side of an assignment ------- ought to be legal, according to JLS2. For example, this code is ------- legal: ------- class Foo { void m(int i) { (i) = 1; } } ------- (fix due to Eric Blake; java 1.2 grammar and following) ------- e) BUG FIX: array access of anonymous arrays ought to be legal, according ------- to JLS2. For example, this is legal code: ------- class Foo { int i = new int[]{0}[0]; } ------- (fix due to Eric Blake; java 1.2 grammar and following) ------- f) BUG FIX: nested parameterized types ought to be legal, for example: ------- class A { class B { } A.B c; } ------- (bug found by Eric Blake; jsr-14 grammar only) ------- g) TWEAK: test cases were added for these issues. ------- -------In addition, it should be clarified that the 'java15.cup' grammar is -------really only for java 1.4 + jsr-14; recent developments at Sun indicate -------that "Java 1.5" is likely to include several additional language changes -------in addition to JSR-14 parameterized types; see JSR-201 for more details. -------I will endeavor to add these features to 'java15.cup' as soon as their -------syntax is nailed down. ------- -- C. Scott Ananian 13-Apr-2003 ------- -------UPDATE: Updated the 'java15.cup' grammar to match the latest specifications -------(and their corrections) for Java 1.5. This grammar matches the 2.2 -------prototype of JSR-14 + JSR-201 capabilities, with some corrections for -------mistakes in the released specification and expected future features of -------Java 1.5 (in particular, arrays of parameterized types bounded by -------wildcards). Reimplemented java15.cup to use a refactoring originally -------due to Eric Blake which eliminates our previous need for "lexer lookahead" -------(see release notes for 12-April-2002). Added new 'enum' and '...' tokens -------to the lexer to accomodate Java 1.5. New test cases added for the -------additional language features. ------- -- C. Scott Ananian 28-Jul-2003 diff --cc Robust/JavaGrammar/tests/Eric.java index 04f074b6,04f074b6,04f074b6,04f074b6,04f074b6,04f074b6,04f074b6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/tests/Eric.java +++ /dev/null @@@@@@@@ -1,45 -1,45 -1,45 -1,45 -1,45 -1,45 -1,45 +1,0 @@@@@@@@ -------/** Some valid java code from Eric Blake. Some of these constructions ------- * broke previous versions of the grammars. These should all compile ------- * with any JLS2 javac, as well as parse correctly (no syntax errors) ------- * using the java12.cup/java14.cup/java15.cup grammars in this package. */ -------class Eric { ------- // parenthesized variables on the left-hand-size of assignments ------- // are legal according to JLS 2. See comments on jikes bug 105 ------- // http://www-124.ibm.com/developerworks/bugs/?func=detailbug&bug_id=105&group_id=10 ------- // for more details. According to Eric Blake: ------- // The 2nd edition JLS is weak on this point - the grammar ------- // in 15.26 prohibits assignments to parenthesized ------- // variables, but earlier in 15.8.5 it states that a ------- // parenthesized variable is still a variable (in JLS1, a ------- // parenthesized variable was a value), and the intent of ------- // assignment is that a variable appear on the left hand ------- // side. Also, the grammar in chapter 18 (if you can call ------- // it such, because of its numerous typos and ambiguities) ------- // permits assignment to parenthesized variables. ------- void m(int i) { ------- (i) = 1; ------- } ------- // array access of an initialized array creation is legal; see Sun ------- // bugs 4091602, 4321177: ------- // http://developer.java.sun.com/developer/bugParade/bugs/4091602.html ------- // http://developer.java.sun.com/developer/bugParade/bugs/4321177.html ------- // Eric Blake says: ------- // Again, the body of the JLS prohibits this, but chapter 18 permits it. ------- int i = new int[]{0}[0]; ------- int j = new char[] { 'O', 'K' }.length; ------- ------- // plain identifiers can qualify instance creation and explicit ------- // constructors; see Sun bug 4750181: ------- // http://developer.java.sun.com/developer/bugParade/bugs/4750181.html ------- // Eric Blake says: ------- // Sun admits the grammars between the earlier chapters and ------- // chapter 18 are incompatible, so they are not sure whether ------- // things like "identifier.new name()" should be legal or ------- // not. Chapter 18 treats identifiers as primaries, and javac ------- // compiles them. ------- class B { }; ------- B b; ------- void foo(Eric e) { ------- e.b = e.new B(); ------- } -------} diff --cc Robust/JavaGrammar/tests/Eric15.java index b7cb8e39,b7cb8e39,b7cb8e39,b7cb8e39,b7cb8e39,b7cb8e39,b7cb8e39..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/tests/Eric15.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------/** Some valid java code from Eric Blake. This should compile ------- * with any JSR-14 javac, as well as parse correctly (no syntax errors) ------- * using the java15.cup grammar in this package. */ -------class Eric15 { ------- class B { } ------- Eric15.B c; -------} diff --cc Robust/JavaGrammar/tests/Escape.java index d84332e2,d84332e2,d84332e2,d84332e2,d84332e2,d84332e2,d84332e2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/tests/Escape.java +++ /dev/null @@@@@@@@ -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 +1,0 @@@@@@@@ -------class Escape { ------- String s = "\477"; // this literal is valid, but.. -------// char c = '\477'; // this literal is invalid. -------} diff --cc Robust/JavaGrammar/tests/Test15.java index a12d240a,a12d240a,a12d240a,a12d240a,a12d240a,a12d240a,a12d240a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/tests/Test15.java +++ /dev/null @@@@@@@@ -1,72 -1,72 -1,72 -1,72 -1,72 -1,72 -1,72 +1,0 @@@@@@@@ -------/** A valid JSR-14 Java program, which illustrates some corner-cases in ------- * the 'smart lexer' lookahead implementation of the grammar. It should ------- * compile correctly using a JSR-14 javac, as well as parse correctly ------- * (no syntax errors) using the java15.cup grammar in this package. */ -------public class Test15 { ------- Test15(T t) { } ------- int a = 1, b = 2; ------- C c1 = new C(), c2 = new C(), c3 = new C(); ------- C cc2 = c2; ------- C cc3 = c3; ------- boolean d = a < b, e = a < b; ------- int f[] = new int[5]; ------- boolean g = a < f[1]; ------- boolean h = ( a < f[1] ); ------- Object i0 = (A) cc3; ------- Object i = ( A < B[] > ) cc3; ------- Object j = ( A < B > ) cc2; ------- Object k = ( A < A < B[] > >) null; ------- Object kk= ( A < A < B[] >>) null; ------- Test15.H hh = null; ------- { ------- Test15.H hhh = null; ------- for (boolean l=a m = c1; ------- if (m instanceof C) ------- a=a; ------- for (boolean n = m instanceof C, ------- o = a; ------- cc3 instanceof C; ------- n = m instanceof C, ------- o = a) ------- b=b; ------- for (;m instanceof C;) ------- a=a; ------- if (a < b >> 1) ------- ; ------- Object o1 = new A>(), ------- o2 = new A>>(), ------- o3 = new A>>>(); ------- ------- // new, "explicit parameter" version of method invocation. ------- A aa = Test15.>foo(); ------- /* although the spec says this should work: ------- A aa_ = >foo(); ------- * Neal Gafter has assured me that this is a bug in the spec. ------- * Type arguments are only valid after a dot. */ ------- ------- // "explicit parameters" with constructor invocations. ------- new K("xh"); // prototype 2.2 chokes on this. ------- this.new K("xh"); ------- } ------- ------- static class A { T t; } ------- static class B { } ------- static class C extends A { } ------- static class D { } ------- static class E> { } ------- static interface F { } ------- // wildcard bounds. ------- static class G { A a; A> b; } ------- class H { } ------- static class I extends A { } ------- static class J extends A { } ------- class K { K(T t) { Test15.foo(); } } ------- ------- static T foo() { return null; } -------} diff --cc Robust/JavaGrammar/tests/TestJSR201.java index 57368fba,57368fba,57368fba,57368fba,57368fba,57368fba,57368fba..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/JavaGrammar/tests/TestJSR201.java +++ /dev/null @@@@@@@@ -1,104 -1,104 -1,104 -1,104 -1,104 -1,104 -1,104 +1,0 @@@@@@@@ -------import static java.lang.Math.*; // gratuitous test of static import -------import static java.lang.System.out; // ditto -------import java.util.*; -------class TestJSR201 { ------- enum Color { red, green, blue ; }; ------- public static void main(String... args/* varargs */) { ------- /* for each on multi-dimensional array */ ------- int[][] iaa = new int[10][10]; ------- for (int ia[] : iaa) { ------- for (int i : ia) ------- out.print(i); // use static import. ------- out.println(); ------- } ------- /** alternate syntax: */ ------- for each (int ia[] in iaa) ------- for each (int i in ia) { ------- out.println(i); ------- } ------- /* */ ------- for (Color c : Color.VALUES) { ------- switch(c) { ------- case Color.red: out.print("R"); break; ------- case Color.green: out.print("G"); break; ------- case Color.blue: out.print("B"); break; ------- default: assert false; ------- } ------- } ------- out.println(); ------- } ------- // complex enum declaration, from JSR-201 ------- public static enum Coin { ------- penny(1), nickel(5), dime(10), quarter(25); ------- Coin(int value) { this.value = value; } ------- private final int value; ------- public int value() { return value; } ------- } ------- public static class Card implements Comparable, java.io.Serializable { ------- public enum Rank { deuce, three, four, five, six, seven, eight, nine, ------- ten, jack, queen, king, ace } ------- public enum Suit { clubs, diamonds, hearts, spades } ------- ------- private final Rank rank; ------- private final Suit suit; ------- ------- private Card(Rank rank, Suit suit) { ------- if (rank == null || suit == null) ------- throw new NullPointerException(rank + ", " + suit); ------- this.rank = rank; ------- this.suit = suit; ------- } ------- ------- public Rank rank() { return rank; } ------- public Suit suit() { return suit; } ------- ------- public String toString() { return rank + " of " + suit; } ------- ------- public int compareTo(Object o) { ------- Card c = (Card)o; ------- int rankCompare = rank.compareTo(c.rank); ------- return rankCompare != 0 ? rankCompare : suit.compareTo(c.suit); ------- } ------- ------- private static List sortedDeck = new ArrayList(52); ------- /* BROKEN IN PROTOTYPE 2.0 */ ------- static { ------- for (Rank rank : Rank.VALUES) ------- for (Suit suit : Suit.VALUES) ------- sortedDeck.add(new Card(rank, suit)); ------- } ------- /* */ ------- // Returns a shuffled deck ------- public static List newDeck() { ------- List result = new ArrayList(sortedDeck); ------- Collections.shuffle(result); ------- return result; ------- } ------- } ------- // sophisticated example: ------- public static abstract enum Operation { ------- plus { ------- double eval(double x, double y) { return x + y; } ------- }, ------- minus { ------- double eval(double x, double y) { return x - y; } ------- }, ------- times { ------- double eval(double x, double y) { return x * y; } ------- }, ------- divided_by { ------- double eval(double x, double y) { return x / y; } ------- }; ------- ------- // Perform arithmetic operation represented by this constant ------- abstract double eval(double x, double y); ------- ------- public static void main(String args[]) { ------- double x = Double.parseDouble(args[0]); ------- double y = Double.parseDouble(args[1]); ------- ------- for (Operation op : VALUES) ------- out.println(x + " " + op + " " + y + " = " + op.eval(x, y)); ------- } ------- } -------} diff --cc Robust/cup/CHANGELOG index 5365a357,5365a357,5365a357,5365a357,5365a357,5365a357,5365a357..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/CHANGELOG +++ /dev/null @@@@@@@@ -1,313 -1,313 -1,313 -1,313 -1,313 -1,313 -1,313 +1,0 @@@@@@@@ -------CUP version 0.10k is a maintenance release. ------- -------CUP will now accept a filename on the command-line if it is the last -------argument and does not start with "-". This allows better GUI -------integration. Some unix-isms in end-of-line handling have been fixed, -------too; thanks to Jean Vaucher for the tip. ------- -------The java_cup.runtime.Scanner interface has been refined to allow -------the scanner to return null to signal EOF. JLex and JFlex users will -------like this, as it means they can use the default scanner EOF behavior. ------- -------Bruce Hutton , Zerksis Umrigar , -------and Vladimir Antonevich all sent bug -------reports touching on erroneous error recovery in the parser runtime. -------Dr. Hutton provided the fixes that I've adopted; Zerksis sent a very -------helpful CUP-vs-bison test case. If you're in a position to notice -------correct/incorrect error recovery and this release works better for you -------than previous ones, thank them --- and send me email so I know whether -------we've quashed this bug for good. ------- -------Klaus Georg Barthelmann caught an -------oversight in the constructors for java_cup.runtime.Symbol. I've also -------taken an obsolete constructor allowing specification of a start state -------for some symbol to package-scope; if this causes anyone backwards -------compatibility problems, email me and I will consider changing it back. ------- -------C. Scott Ananian -------Laboratory for Computer Science -------Massachusetts Institute of Technology -------Jul-24-1999 [CSA] ------------------------------------------------------------------------------- -------CUP version 0.10j adds new features. ------- -------A "-version" command-line option is now accepted, which prints out the -------working version of CUP and halts. This allows automatic version-checking, -------for those applications which require it. ------- -------Broadened the CUP input grammar to allow CUP reserved words in package and -------import statements, and in (non)terminal labels. In addition, semicolons -------after 'action code', 'parser code', 'init code', and 'scan with' sections -------have been made optional (if language noise annoys you). Also, these four -------sections may now appear in any order, instead of the strict ordering -------previously required. Finally, you can now spell 'non-terminal' as either -------"non terminal" (old way) *or* "nonterminal" without upsetting CUP. -------[Flexibility requested by Stefan Kahrs ] -------[Package and import reserved word issues noted by Frank Rehberger, ------- Brandon Schendel, and Bernie Honeisen, among others.] ------- -------Clarified the parse table dumps generated by the -dump* options. ------- -------I have added code to lr_parser to detect illegal Symbol recycling by the -------scanner and to throw an Error in this case. The scanner must return -------a fresh Symbol object on each invocation, because these objects are -------tagged with parse state and added to the parse stack. Object sharing -------does evil things to the parser; don't do it (you won't get away with it). -------[Symbol recycling problems reported by Ken Arnold ] ------- -------Improved scanner interface, designed by David MacMahon . -------The new java_cup.runtime.Scanner interface is used by the default -------implementation of lr_parser.scan(). See the manual for more details. -------Old parsers will work with the new runtime, but parsers generated with -------0.10j will not work with the runtime from earlier versions unless you -------specify the (new) "-noscanner" option. ------- -------C. Scott Ananian -------Laboratory for Computer Science -------Massachusetts Institute of Technology -------Jul-24-1999 [CSA] ------------------------------------------------------------------------------- -------CUP version 0.10i is a maintenance release. ------- -------A one-off bug in the parser error-recovery code has been caught and corrected -------by Chris Harris . ------- -------The fields in the emitted symbol class have been made public, rather than -------package scope, since the class already was public. ------- -------The issues formerly addressed in Appendix D (accessing parser methods/fields -------from the action class) have been partially addressed by adding a new -------private final field named 'parser' to the action object that points to -------the parser object. THIS INTRODUCES A POTENTIAL INCOMPATIBILITY if you had -------previously defined a field named 'parser' in the 'action code {: ... :}' -------portion of your grammar. The solution is to rename your field. ------- -------Finally, incorporated Jako Andras' suggestions to make CUP more friendly -------to makefiles. ------- -------A reminder: please submit bug-fixes or feature-additions as *patches*, not -------complete archives. Your patch will have a greater chance of integration -------into the distribution if you package each feature or fix as a separate patch, -------instead of lumping everything together and leaving it to me to figure out -------what you've changed and why. ------- -------C. Scott Ananian -------Laboratory for Computer Science -------Massachusetts Institute of Technology -------Feb-18-1999 [CSA] ------------------------------------------------------------------------------- -------CUP version 0.10h is a maintenance release. ------- -------Starting with this version, CUP encodes the various parser tables as strings -------to get around java's 64k method-size limitation. This allows larger -------parse tables and thus more complicated grammars. ------- -------Furthermore, a long-standing buglet that would cause CUP to occasionally -------generate "Attempt to construct a duplicate state" internal errors has been -------fixed. ------- -------Another contributed Microsoft-compatible makefile has also been added -------to the distribution. ------- -------C. Scott Ananian -------Laboratory for Computer Science -------Massachusetts Institute of Technology -------Feb-10-1999 [CSA] ------------------------------------------------------------------------------- -------CUP version 0.10g contains bug fixes, added functionality, and -------performance improvements. Thanks to Matthias Zenger, Peter Selinger, -------Jaroslaw Kachinarz, Ian Davis and others for contributions. ------- -------- New command line option '-interface' added. This causes JavaCUP to ------- emit an *interface* with the symbol constants, instead of a ------- *class*. Without the command-line flag, behavior is identical to ------- v0.10f and before: the symbols are emitted as a class. -------- (minor) Added toString() method to java_cup.runtime.Symbol and ------- modified the debugging parser to use it. This allows you to ------- override toString() to allow a more intelligible debugging parse. -------- The CUP grammar has been extended to allow one to declare array types ------- for javaCUP terminals and non-terminals. Matthias Zenger first ------- suggested this feature; Peter Selinger was the first to show the ------- right way to do it. -------- The symbols prefixed with CUP$ now have the parser class file name ------- added to the prefix as well, to allow more than one parser object ------- per package. Thanks to Jaroslaw Kachniarz for pointing out this ------- problem. -------- Fixed bug that prevented one from invoking the parser multiple times. ------- To quote Ian Davis, who found and diagnosed the bug: ------- Repeat invocations of the same instantiation of lr_parser.java to parse ------- distinct input statements fail for the simple reason that the stack is ------- not emptied at start of parsing, but the stack offset is reset to 0. ------- This has been fixed. -------- Fixed bug with implicit start productions not receiving a RESULT. -------- Fixed bug with RESULT assignments that are not right-most in the ------- production. -------- Updated documentation. ------- -------Known issues: -------- All known bugs have been fixed. -------- The java_cup.runtime.SymbolStack / java_cup.runtime.intStack ------- performance hack originally suggested by Matthias Zenger has been ------- postponed to the next release. By eliminating typecasts and ------- synchronized methods, a substantial performance improvement can be ------- obtained. Backwards-compatibility issues have forced the postponement ------- of the code merge. ------- -------C. Scott Ananian -------Laboratory for Computer Science -------Massachusetts Institute of Technology -------3/24/98 [CSA] ------------------------------------------------------------------------------- -------CUP version 0.10f is a maintenance release. The code has been cleaned up -------for JDK 1.1 functionality. No major functionality has been added; any bugs -------in 0.10e are still in 0.10f. ------- -------- Removed trailing semicolons from class definitions which upset strict ------- compilers (not Sun's javac, for some reason). -------- Changed 'PrintStream's to 'PrintWriter's to eliminate deprecation ------- warnings. ------- -------As of this release, the javaCUP code is being maintained by -------C. Scott Ananian. Suggestions and bug-fixes should be sent to -------cananian@alumni.princeton.edu. ------- -------Known issues: ------- -------- Precedence bug: rules unmarked by precedence information are treated ------- as if they had existing, but very low, precedence. This can mask ------- parser conflicts. -------- Efficiency hack: java.util.Stack will be replaced in the next ------- release with a special-purpose stack to eliminate ------- performance-robbing type-casts. -------- It has been suggested that the symbol *class* should be an ------- *interface* instead. This will be a command-line option in the next ------- release. ------- -------C. Scott Ananian -------Laboratory for Computer Science -------Massachusetts Institute of Technology -------12/21/97 [CSA] ------------------------------------------------------------------------------- -------CUP version 0.10e contains a few bug fixes from 0.10a ------- -------- %prec directive now works correctly ------- fixed by cananian@princeton.edu -------- Shift reduce conflicts are now correctly reported ------- fixed by danwang@cs.princeton.edu -------- Error with reporting the positon of the error token also fixed ------- fixed by cananian@princeton.edu -------- INSTALL script now has a slightly more complex test. -------- foo.java.diff included for changes from previous release -------- Fixed more bugs with reporting of shift reduce conflicts. ------- fixed by danwang@cs.princeton.edu -------- Fixed bug introduced by previous fix patches from ------- Added '\r' as a whitespace character for the lexer suggested by ------- (dladd@spyglass.com) -------- Fixed botched relase -------Daniel Wang -------Department of Computer Science -------Princeton University ------- -------Last updated: 9/12/97 [DW] ------------------------------------------------------------------------------- -------Changes and Additions to CUP v0.9e ------- -------CUP version 0.10a is a major overhaul of CUP. The changes are severe, -------meaning no backwards compatibility to older versions. ------- -------Here are the changes: ------- -------1. CUP now interfaces with the lexer in a completely different -------manner. In the previous releases, a new class was used for every -------distinct type of terminal. This release, however, uses only one class: -------The Symbol class. The Symbol class has three instance variables which -------are significant to the parser when passing information from the lexer. -------The first is the value instance variable. This variable contains the -------value of that terminal. It is of the type declared as the terminal type -------in the parser specification file. The second two are the instance -------variables left and right. They should be filled with the int value of -------where in the input file, character-wise, that terminal was found. ------- -------2. Terminal and non-nonterminal declarations now can be declared in two -------different ways to indicate the values of the terminals or non-terminals. -------The previous declarations of the form ------- -------terminal {classname} {terminal} [, terminal ...]; ------- -------still works. The classname, however indicates the type of the value of -------the terminal or non-terminal, and does not indicate the type of object -------placed on the parse stack. ------- -------A declaration, such as: ------- -------terminal {terminal} [, terminal ...]; ------- -------indicates the terminals in the list hold no value. ------- -------3. CUP doesn't use the Symbol class for just terminals, but for all -------non-terminals as well. When a production reduces to a non-terminal, a -------new Symbol is created, and the value field is filled with the value of -------that non-terminal. The user must know that the terminal and non terminal -------declarations specify a type corresponding to the type of the value field -------for the symbol representing that terminal or non-terminal. ------- -------4. Label references do not refer to the object on the parse stack, as in -------the old CUP, but rather to the value of the value instance variable of -------the Symbol that represents that terminal or non-terminal. Hence, -------references to terminal and non-terminal values is direct, as opposed to -------the old CUP, where the labels referred to objects containing the value -------of the terminal or non-terminal. ------- -------5. The RESULT variable refers directly to the value of the non-terminal -------to which a rule reduces, rather than to the object on the parse stack. -------Hence, RESULT is of the same type the non-terminal to which it reduces, -------as declared in the non terminal declaration. Again, the reference is -------direct, rather than to something that will contain the data. ------- -------6. For every label, two more variables are declared, which are the label -------plus left or the label plus right. These correspond to the left and -------right locations in the input stream to which that terminal or -------non-terminal came from. These values are propagated from the input -------terminals, so that the starting non-terminal should have a left value of -------0 and a right value of the location of the last character read. ------- -------7. A call to parse() or debug_parse() return a Symbol. This Symbol is -------of the start non-terminal, so the value field contains the final RESULT -------assignment. ------- -------8. CUP now has precedenced terminals. a new declaration section, -------occurring between the terminal and non-terminal declarations and the -------grammar specifies the precedence and associativity of rules. The -------declarations are of the form: ------- -------precedence {left| right | nonassoc} terminal[, terminal ...]; -------... ------- -------The terminals are assigned a precedence, where terminals on the same -------line have equal precedences, and the precedence declarations farther -------down the list of precedence declarations have higher precedence. left, -------right and nonassoc specify the associativity of these terminals. left -------associativity corresponds to a reduce on conflict, right to a shift on -------conflict, and nonassoc to an error on conflict. Hence, ambiguous -------grammars may now be used. For a better explanation, see the manual. ------- -------9. Finally the new CUP adds contextual precedence. A production may be -------declare as followed: ------- -------lhs ::= {right hand side list of terminals, non-terminals and actions} ------- %prec {terminal}; ------- -------this production would then have a precedence equal to the terminal -------specified after the "%prec". Hence, shift/reduce conflicts can be -------contextually resolved. Note that the "%prec terminal" part comes after -------all actions strings. It does not come before the last action string. ------- -------For more information read the manual, found in manual.html ------- -------Frank Flannery -------Department of Computer Science -------Princeton University ------- -------Last updated: 7/3/96 [FF] ------- ------- diff --cc Robust/cup/INSTALL index 49708521,49708521,49708521,49708521,49708521,49708521,49708521..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/cup/INSTALL +++ /dev/null @@@@@@@@ -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 +1,0 @@@@@@@@ -------#!/bin/csh -f -------# -------# Cup install and test script -------# Scott Hudson 8/31/95 -------# -------# Last revision 7/3/96 (for v0.10a) -------# By Frank Flannery -------# -------# Last revision 11/16/96 (for v0.10b) -------# By Daniel Wang -------# -------# Updated version number 7/24/99 for 0.10k -------# By C. Scott Ananian -------echo -------echo "================================" -------echo "Installing and testing Cup v0.10k" -------echo "================================" -------echo ------- -------# check for this directory in CLASSPATH -------# -------set cwd = `pwd` -------set c_path = `printenv CLASSPATH` -------if ($c_path !~ "*$cwd*") then ------- echo " " ------- echo "WARNING:" ------- echo "WARNING: The current directory does not appear in your CLASSPATH" ------- echo "WARNING: it will be added for this install/test only" ------- echo "WARNING:" ------- echo " " ------- setenv CLASSPATH $cwd':'$c_path ------- echo "CLASSPATH now set to " ------- printenv CLASSPATH -------endif ------- -------# change to the demo directory -------# -------echo " " -------echo "changing to simple_calc subdirectory..." -------echo "cd java_cup/simple_calc" -------cd java_cup/simple_calc ------- -------# remove old copies of parser.java and sym.java -------# -------echo " " -------echo "removing any old copies of parser.java and sym.java..." -------echo "rm -f parser.java sym.java" -------rm -f parser.java sym.java ------- -------# compile java_cup and run it against the demo program -------# the -cs (for "checksource") option here will force the -------# java_cup and java_cup.runtime source to be compiled prior -------# to running it. -------# -------echo " " -------echo "compiling java_cup then generating demo program..." -------echo "java -cs java_cup.Main < parser.cup" -------java -cs java_cup.Main < parser.cup ------- -------# make sure parser.java and sym.java now exist -------# -------if ( ! -e parser.java) then ------- echo " " ------- echo "ERROR: for some reason parser.java was not created" ------- echo "ERROR: install was not successful" ------- exit 1 -------endif -------if ( ! -e sym.java) then ------- echo " " ------- echo "ERROR: for some reason sym.java was not created" ------- echo "ERROR: install was not successful" ------- exit 1 -------endif ------- -------# run the demo -------# again, the -cs option will cause compilation of all the parts -------# of the demo program (including parser.java and sym.java that -------# should have been generated in the previous step). -------# -------echo "removing old test results..." -------echo "rm -f test_results" -------rm -f test_results -------echo " " -------echo "executing the demo program..." -------echo "echo '1*-2+2;' | java -cs java_cup.simple_calc.Main >& test_results" -------echo '1*-2+2;' | java -cs java_cup.simple_calc.Main >& test_results ------- -------# compare with standard results -------# -------set res = `tail -1 test_results` -------if ("$res" !~ "= 0") then ------- echo "ERROR: test program produced the wrong results" ------- echo "ERROR: output was:" ------- cat test_results ------- echo "ERROR: install was not successful" ------- rm -f test_results ------- exit 2 -------endif ------- -------# all is well -------# -------rm -f test_results -------echo " " -------echo "==============================" -------echo "Install and test was successful" -------echo "==============================" -------exit 0 diff --cc Robust/cup/INSTALL.QUICK index bf708b67,bf708b67,bf708b67,bf708b67,bf708b67,bf708b67,bf708b67..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/INSTALL.QUICK +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------This is a quick installation guide for the CUP system. -------For most people, the following steps will suffice: ------- ------- 1) extract the java_cup files somewhere, and ensure that ------- the extraction directory is in your classpath. ------- ------- This will ensure that java_cup.Main properly refers to the ------- Main class in the java_cup subdirectory of this release. ------- ------- 2) compile java_cup and its runtime system. ------- From the installation directory: ------- javac java_cup/*.java java_cup/runtime/*.java ------- -------That's it! Read the manual now. ------- --Scott ------- -------24-Mar-1998 diff --cc Robust/cup/LICENSE index f3f0299f,f3f0299f,f3f0299f,f3f0299f,f3f0299f,f3f0299f,f3f0299f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/LICENSE +++ /dev/null @@@@@@@@ -1,20 -1,20 -1,20 -1,20 -1,20 -1,20 -1,20 +1,0 @@@@@@@@ -------CUP PARSER GENERATOR COPYRIGHT NOTICE, LICENSE AND DISCLAIMER. ------- -------Copyright 1996 by Scott Hudson, Frank Flannery, C. Scott Ananian ------- -------Permission to use, copy, modify, and distribute this software and its -------documentation for any purpose and without fee is hereby granted, -------provided that the above copyright notice appear in all copies and that -------both the copyright notice and this permission notice and warranty -------disclaimer appear in supporting documentation, and that the names of -------the authors or their employers not be used in advertising or publicity -------pertaining to distribution of the software without specific, written -------prior permission. ------- -------The authors and their employers disclaim all warranties with regard to -------this software, including all implied warranties of merchantability and -------fitness. In no event shall the authors or their employers be liable -------for any special, indirect or consequential damages or any damages -------whatsoever resulting from loss of use, data or profits, whether in an -------action of contract, negligence or other tortious action, arising out of -------or in connection with the use or performance of this software. diff --cc Robust/cup/README index 58bacd79,58bacd79,58bacd79,58bacd79,58bacd79,58bacd79,58bacd79..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/README +++ /dev/null @@@@@@@@ -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 +1,0 @@@@@@@@ -------This directory contains the CUP v0.10k release in source form. You should -------find the following files and subdirectories in this release: ------- ------- README This file. ------- INSTALL.QUICK Quick installation instruction. ------- CHANGELOG A brief overview of the changes in v0.10k ------- java_cup A subdirectory containing CUP, runtime, and test sources. ------- cup_logo.gif A logo image used by the manual. ------- manual.html A user's manual in HTML format. (OLD) ------- INSTALL A shell script to install and test the system ------- -------To get started quickly, read INSTALL.QUICK. If you are on a Windows -------platform, you might want to look in the winnt subdirectory. -------For complete installation information, keep reading. ------- -------To install the release, copy the contents of this directory (if you -------haven't done so already) into a "classes" directory accessible to the -------java interpreter (i.e., a directory that is listed in the colon -------separated list of directories in your CLASSPATH environment variable). -------Note: if you have an older version of the system already accessible -------from your CLASSPATH you will want to temporarily remove it to avoid -------conflicts. ------- -------Once files have been copied to an appropriate location, you should be able to -------both compile and test the system by executing the INSTALL shell script -------(sorry, but non Unix users are still on their own). Again, be sure that -------you have placed these sources in a directory listed in your CLASSPATH -------environment variable (or changed your CLASSPATH to include this directory). ------- -------A manual page that explains the operation and use of the system can be found -------in manual.html and from the CUP home page mentioned below. ------- -------Bug reports regarding the installation -------process or the system as a whole should be sent to ------- with "JavaCUP" in the subject. ------- -------The CUP home page where the latest information regarding CUP can be found -------(e.g., new releases) is: ------- ------- http://www.cs.princeton.edu/~appel/modern/java/CUP/ ------- -------Enjoy, ------- -------Scott Hudson -------Graphics, Visualization, and Usability Center -------Georgia Institute of Technology ------- -------Last updated: 23-Jul-1999 [CSA] diff --cc Robust/cup/cup_logo.gif index 6d25eda4,6d25eda4,6d25eda4,6d25eda4,6d25eda4,6d25eda4,6d25eda4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/gnuwin/README index 53a94987,53a94987,53a94987,53a94987,53a94987,53a94987,53a94987..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/gnuwin/README +++ /dev/null @@@@@@@@ -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 +1,0 @@@@@@@@ -------Date: Fri, 05 Feb 1999 17:11:08 -0600 -------From: jon miner -------To: cananian@alumni.princeton.edu -------Subject: Makefile for NT/DOS ------- -------I've made (hah) a Makefile for java_cup that will install and test java_cup -------on NT/9x/DOS with GNU Make... ------- -------You (should) find it attached. ------- -------thanks, ------- -------jon ------- -------------------------------------------------------------------- -------Date: Sun, 07 Feb 1999 17:30:33 -0600 -------From: Jon Miner -------To: C. Scott Ananian -------Subject: Re: Makefile for NT/DOS ------- -------The Makefile included is for Microsoft's (I think) Nmake... it doesn't -------jive with just plain old GNU make (At least not on my machine..) Also, the -------Makefile I wrote _should_ (I haven't tested it, though) work (with minor -------changes) on Un*x and WinTel machines... ------- -------thanks, ------- -------jon ------- -------[The makefile has been included in this directory. -- CSA 24-Mar-1998 ] diff --cc Robust/cup/gnuwin/makefile index 30f00d21,30f00d21,30f00d21,30f00d21,30f00d21,30f00d21,30f00d21..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/gnuwin/makefile +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 +1,0 @@@@@@@@ -------SIMPLEDIR=SIMPLE~1 -------# SIMPLEDIR=simple_calc -------RM=del -------# RM=rm -------JAVA=java -------JAVAOPTS= -------JAVAC=javac -------JAVACOPTS=-verbose ------- ------- -------test: java_cup\\Main.class java_cup\\$(SIMPLEDIR)\\Main.class ------- echo "1*-2+2;" | $(JAVA) $(JAVAOPTS) java_cup.simple_calc.Main ------- ------- echo 'If the line above says "= 0" everything is OK.' ------- ------- -------java_cup\\Main.class: ------- $(JAVAC) $(JAVACOPTS) java_cup\\Main.java ------- -------java_cup\\$(SIMPLEDIR)\\Main.class: ------- cd java_cup ------- cd $(SIMPLEDIR) ------- echo $(RM) parser.java ------- echo $(RM) sym.java ------- $(JAVA) $(JAVAOPTS) java_cup.Main < parser.cup ------- $(JAVAC) $(JAVACOPTS) Main.java diff --cc Robust/cup/java_cup/CUP$parser$actions.class index 79416853,79416853,79416853,79416853,79416853,79416853,79416853..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/Main.class index fb7c7644,fb7c7644,fb7c7644,fb7c7644,fb7c7644,fb7c7644,fb7c7644..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/Main.java index 50811b53,50811b53,50811b53,50811b53,50811b53,50811b53,50811b53..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/Main.java +++ /dev/null @@@@@@@@ -1,854 -1,854 -1,854 -1,854 -1,854 -1,854 -1,854 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.Enumeration; -------import java.io.*; ------- -------/** This class serves as the main driver for the JavaCup system. ------- * It accepts user options and coordinates overall control flow. ------- * The main flow of control includes the following activities: ------- *
    ------- *
  • Parse user supplied arguments and options. ------- *
  • Open output files. ------- *
  • Parse the specification from standard input. ------- *
  • Check for unused terminals, non-terminals, and productions. ------- *
  • Build the state machine, tables, etc. ------- *
  • Output the generated code. ------- *
  • Close output files. ------- *
  • Print a summary if requested. ------- *
------- * ------- * Options to the main program include:
------- *
-package name ------- *
specify package generated classes go in [default none] ------- *
-parser name ------- *
specify parser class name [default "parser"] ------- *
-symbols name ------- *
specify name for symbol constant class [default "sym"] ------- *
-interface ------- *
emit symbol constant interface, rather than class ------- *
-nonterms ------- *
put non terminals in symbol constant class ------- *
-expect # ------- *
number of conflicts expected/allowed [default 0] ------- *
-compact_red ------- *
compact tables by defaulting to most frequent reduce ------- *
-nowarn ------- *
don't warn about useless productions, etc. ------- *
-nosummary ------- *
don't print the usual summary of parse states, etc. ------- *
-progress ------- *
print messages to indicate progress of the system ------- *
-time ------- *
print time usage summary ------- *
-dump_grammar ------- *
produce a dump of the symbols and grammar ------- *
-dump_states ------- *
produce a dump of parse state machine ------- *
-dump_tables ------- *
produce a dump of the parse tables ------- *
-dump ------- *
produce a dump of all of the above ------- *
-debug ------- *
turn on debugging messages within JavaCup ------- *
-nopositions ------- *
don't generate the positions code ------- *
-noscanner ------- *
don't refer to java_cup.runtime.Scanner in the parser ------- * (for compatibility with old runtimes) ------- *
-version ------- *
print version information for JavaCUP and halt. ------- *
------- * ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ ------- -------public class Main { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- /** Only constructor is private, so we do not allocate any instances of this ------- class. */ ------- private Main() { } ------- ------- /*-------------------------*/ ------- /* Options set by the user */ ------- /*-------------------------*/ ------- /** User option -- do we print progress messages. */ ------- protected static boolean print_progress = true; ------- /** User option -- do we produce a dump of the state machine */ ------- protected static boolean opt_dump_states = false; ------- /** User option -- do we produce a dump of the parse tables */ ------- protected static boolean opt_dump_tables = false; ------- /** User option -- do we produce a dump of the grammar */ ------- protected static boolean opt_dump_grammar = false; ------- /** User option -- do we show timing information as a part of the summary */ ------- protected static boolean opt_show_timing = false; ------- /** User option -- do we run produce extra debugging messages */ ------- protected static boolean opt_do_debug = false; ------- /** User option -- do we compact tables by making most common reduce the ------- default action */ ------- protected static boolean opt_compact_red = false; ------- /** User option -- should we include non terminal symbol numbers in the ------- symbol constant class. */ ------- protected static boolean include_non_terms = false; ------- /** User option -- do not print a summary. */ ------- protected static boolean no_summary = false; ------- /** User option -- number of conflicts to expect */ ------- protected static int expect_conflicts = 0; ------- ------- /* frankf added this 6/18/96 */ ------- /** User option -- should generator generate code for left/right values? */ ------- protected static boolean lr_values = true; ------- ------- /** User option -- should symbols be put in a class or an interface? [CSA]*/ ------- protected static boolean sym_interface = false; ------- ------- /** User option -- should generator suppress references to ------- * java_cup.runtime.Scanner for compatibility with old runtimes? */ ------- protected static boolean suppress_scanner = false; ------- ------- /*----------------------------------------------------------------------*/ ------- /* Timing data (not all of these time intervals are mutually exclusive) */ ------- /*----------------------------------------------------------------------*/ ------- /** Timing data -- when did we start */ ------- protected static long start_time = 0; ------- /** Timing data -- when did we end preliminaries */ ------- protected static long prelim_end = 0; ------- /** Timing data -- when did we end parsing */ ------- protected static long parse_end = 0; ------- /** Timing data -- when did we end checking */ ------- protected static long check_end = 0; ------- /** Timing data -- when did we end dumping */ ------- protected static long dump_end = 0; ------- /** Timing data -- when did we end state and table building */ ------- protected static long build_end = 0; ------- /** Timing data -- when did we end nullability calculation */ ------- protected static long nullability_end = 0; ------- /** Timing data -- when did we end first set calculation */ ------- protected static long first_end = 0; ------- /** Timing data -- when did we end state machine construction */ ------- protected static long machine_end = 0; ------- /** Timing data -- when did we end table construction */ ------- protected static long table_end = 0; ------- /** Timing data -- when did we end checking for non-reduced productions */ ------- protected static long reduce_check_end = 0; ------- /** Timing data -- when did we finish emitting code */ ------- protected static long emit_end = 0; ------- /** Timing data -- when were we completely done */ ------- protected static long final_time = 0; ------- ------- /* Additional timing information is also collected in emit */ ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Main Program ------------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The main driver for the system. ------- * @param argv an array of strings containing command line arguments. ------- */ ------- public static void main(String argv[]) ------- throws internal_error, java.io.IOException, java.lang.Exception ------- { ------- boolean did_output = false; ------- ------- start_time = System.currentTimeMillis(); ------- ------- /* process user options and arguments */ ------- parse_args(argv); ------- ------- /* frankf 6/18/96 ------- hackish, yes, but works */ ------- emit.set_lr_values(lr_values); ------- /* open output files */ ------- if (print_progress) System.err.println("Opening files..."); ------- /* use a buffered version of standard input */ ------- input_file = new BufferedInputStream(System.in); ------- ------- prelim_end = System.currentTimeMillis(); ------- ------- /* parse spec into internal data structures */ ------- if (print_progress) ------- System.err.println("Parsing specification from standard input..."); ------- parse_grammar_spec(); ------- ------- parse_end = System.currentTimeMillis(); ------- ------- /* don't proceed unless we are error free */ ------- if (lexer.error_count == 0) ------- { ------- /* check for unused bits */ ------- if (print_progress) System.err.println("Checking specification..."); ------- check_unused(); ------- ------- check_end = System.currentTimeMillis(); ------- ------- /* build the state machine and parse tables */ ------- if (print_progress) System.err.println("Building parse tables..."); ------- build_parser(); ------- ------- build_end = System.currentTimeMillis(); ------- ------- /* output the generated code, if # of conflicts permits */ ------- if (lexer.error_count != 0) { ------- // conflicts! don't emit code, don't dump tables. ------- opt_dump_tables = false; ------- } else { // everything's okay, emit parser. ------- if (print_progress) System.err.println("Writing parser..."); ------- open_files(); ------- emit_parser(); ------- did_output = true; ------- } ------- } ------- /* fix up the times to make the summary easier */ ------- emit_end = System.currentTimeMillis(); ------- ------- /* do requested dumps */ ------- if (opt_dump_grammar) dump_grammar(); ------- if (opt_dump_states) dump_machine(); ------- if (opt_dump_tables) dump_tables(); ------- ------- dump_end = System.currentTimeMillis(); ------- ------- /* close input/output files */ ------- if (print_progress) System.err.println("Closing files..."); ------- close_files(); ------- ------- /* produce a summary if desired */ ------- if (!no_summary) emit_summary(did_output); ------- ------- /* If there were errors during the run, ------- * exit with non-zero status (makefile-friendliness). --CSA */ ------- if (lexer.error_count != 0) ------- System.exit(100); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Print a "usage message" that described possible command line options, ------- * then exit. ------- * @param message a specific error message to preface the usage message by. ------- */ ------- protected static void usage(String message) ------- { ------- System.err.println(); ------- System.err.println(message); ------- System.err.println(); ------- System.err.println( -------"Usage: " + version.program_name + " [options] [filename]\n" + -------" and expects a specification file on standard input if no filename is given.\n" + -------" Legal options include:\n" + -------" -package name specify package generated classes go in [default none]\n" + -------" -parser name specify parser class name [default \"parser\"]\n" + -------" -symbols name specify name for symbol constant class [default \"sym\"]\n"+ -------" -interface put symbols in an interface, rather than a class\n" + -------" -nonterms put non terminals in symbol constant class\n" + -------" -expect # number of conflicts expected/allowed [default 0]\n" + -------" -compact_red compact tables by defaulting to most frequent reduce\n" + -------" -nowarn don't warn about useless productions, etc.\n" + -------" -nosummary don't print the usual summary of parse states, etc.\n" + -------" -nopositions don't propagate the left and right token position values\n" + -------" -noscanner don't refer to java_cup.runtime.Scanner\n" + -------" -progress print messages to indicate progress of the system\n" + -------" -time print time usage summary\n" + -------" -dump_grammar produce a human readable dump of the symbols and grammar\n"+ -------" -dump_states produce a dump of parse state machine\n"+ -------" -dump_tables produce a dump of the parse tables\n"+ -------" -dump produce a dump of all of the above\n"+ -------" -version print the version information for CUP and exit\n" ------- ); ------- System.exit(1); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Parse command line options and arguments to set various user-option ------- * flags and variables. ------- * @param argv the command line arguments to be parsed. ------- */ ------- protected static void parse_args(String argv[]) ------- { ------- int len = argv.length; ------- int i; ------- ------- /* parse the options */ ------- for (i=0; i= len || argv[i].startsWith("-") || ------- argv[i].endsWith(".cup")) ------- usage("-package must have a name argument"); ------- ------- /* record the name */ ------- emit.package_name = argv[i]; ------- } ------- else if (argv[i].equals("-parser")) ------- { ------- /* must have an arg */ ------- if (++i >= len || argv[i].startsWith("-") || ------- argv[i].endsWith(".cup")) ------- usage("-parser must have a name argument"); ------- ------- /* record the name */ ------- emit.parser_class_name = argv[i]; ------- } ------- else if (argv[i].equals("-symbols")) ------- { ------- /* must have an arg */ ------- if (++i >= len || argv[i].startsWith("-") || ------- argv[i].endsWith(".cup")) ------- usage("-symbols must have a name argument"); ------- ------- /* record the name */ ------- emit.symbol_const_class_name = argv[i]; ------- } ------- else if (argv[i].equals("-nonterms")) ------- { ------- include_non_terms = true; ------- } ------- else if (argv[i].equals("-expect")) ------- { ------- /* must have an arg */ ------- if (++i >= len || argv[i].startsWith("-") || ------- argv[i].endsWith(".cup")) ------- usage("-expect must have a name argument"); ------- ------- /* record the number */ ------- try { ------- expect_conflicts = Integer.parseInt(argv[i]); ------- } catch (NumberFormatException e) { ------- usage("-expect must be followed by a decimal integer"); ------- } ------- } ------- else if (argv[i].equals("-compact_red")) opt_compact_red = true; ------- else if (argv[i].equals("-nosummary")) no_summary = true; ------- else if (argv[i].equals("-nowarn")) emit.nowarn = true; ------- else if (argv[i].equals("-dump_states")) opt_dump_states = true; ------- else if (argv[i].equals("-dump_tables")) opt_dump_tables = true; ------- else if (argv[i].equals("-progress")) print_progress = true; ------- else if (argv[i].equals("-dump_grammar")) opt_dump_grammar = true; ------- else if (argv[i].equals("-dump")) ------- opt_dump_states = opt_dump_tables = opt_dump_grammar = true; ------- else if (argv[i].equals("-time")) opt_show_timing = true; ------- else if (argv[i].equals("-debug")) opt_do_debug = true; ------- /* frankf 6/18/96 */ ------- else if (argv[i].equals("-nopositions")) lr_values = false; ------- /* CSA 12/21/97 */ ------- else if (argv[i].equals("-interface")) sym_interface = true; ------- /* CSA 23-Jul-1999 */ ------- else if (argv[i].equals("-noscanner")) suppress_scanner = true; ------- /* CSA 23-Jul-1999 */ ------- else if (argv[i].equals("-version")) { ------- System.out.println(version.title_str); ------- System.exit(1); ------- } ------- /* CSA 24-Jul-1999; suggestion by Jean Vaucher */ ------- else if (!argv[i].startsWith("-") && i==len-1) { ------- /* use input from file. */ ------- try { ------- System.setIn(new FileInputStream(argv[i])); ------- } catch (java.io.FileNotFoundException e) { ------- usage("Unable to open \"" + argv[i] +"\" for input"); ------- } ------- } ------- else ------- { ------- usage("Unrecognized option \"" + argv[i] + "\""); ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /*-------*/ ------- /* Files */ ------- /*-------*/ ------- ------- /** Input file. This is a buffered version of System.in. */ ------- protected static BufferedInputStream input_file; ------- ------- /** Output file for the parser class. */ ------- protected static PrintWriter parser_class_file; ------- ------- /** Output file for the symbol constant class. */ ------- protected static PrintWriter symbol_class_file; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Open various files used by the system. */ ------- protected static void open_files() ------- { ------- File fil; ------- String out_name; ------- ------- /* open each of the output files */ ------- ------- /* parser class */ ------- out_name = emit.parser_class_name + ".java"; ------- fil = new File(out_name); ------- try { ------- parser_class_file = new PrintWriter( ------- new BufferedOutputStream(new FileOutputStream(fil), 4096)); ------- } catch(Exception e) { ------- System.err.println("Can't open \"" + out_name + "\" for output"); ------- System.exit(3); ------- } ------- ------- /* symbol constants class */ ------- out_name = emit.symbol_const_class_name + ".java"; ------- fil = new File(out_name); ------- try { ------- symbol_class_file = new PrintWriter( ------- new BufferedOutputStream(new FileOutputStream(fil), 4096)); ------- } catch(Exception e) { ------- System.err.println("Can't open \"" + out_name + "\" for output"); ------- System.exit(4); ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Close various files used by the system. */ ------- protected static void close_files() throws java.io.IOException ------- { ------- if (input_file != null) input_file.close(); ------- if (parser_class_file != null) parser_class_file.close(); ------- if (symbol_class_file != null) symbol_class_file.close(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Parse the grammar specification from standard input. This produces ------- * sets of terminal, non-terminals, and productions which can be accessed ------- * via static variables of the respective classes, as well as the setting ------- * of various variables (mostly in the emit class) for small user supplied ------- * items such as the code to scan with. ------- */ ------- protected static void parse_grammar_spec() throws java.lang.Exception ------- { ------- parser parser_obj; ------- ------- /* create a parser and parse with it */ ------- parser_obj = new parser(); ------- try { ------- if (opt_do_debug) ------- parser_obj.debug_parse(); ------- else ------- parser_obj.parse(); ------- } catch (Exception e) ------- { ------- /* something threw an exception. catch it and emit a message so we ------- have a line number to work with, then re-throw it */ ------- lexer.emit_error("Internal error: Unexpected exception"); ------- throw e; ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Check for unused symbols. Unreduced productions get checked when ------- * tables are created. ------- */ ------- protected static void check_unused() ------- { ------- terminal term; ------- non_terminal nt; ------- ------- /* check for unused terminals */ ------- for (Enumeration t = terminal.all(); t.hasMoreElements(); ) ------- { ------- term = (terminal)t.nextElement(); ------- ------- /* don't issue a message for EOF */ ------- if (term == terminal.EOF) continue; ------- ------- /* or error */ ------- if (term == terminal.error) continue; ------- ------- /* is this one unused */ ------- if (term.use_count() == 0) ------- { ------- /* count it and warn if we are doing warnings */ ------- emit.unused_term++; ------- if (!emit.nowarn) ------- { ------- System.err.println("Warning: Terminal \"" + term.name() + ------- "\" was declared but never used"); ------- lexer.warning_count++; ------- } ------- } ------- } ------- ------- /* check for unused non terminals */ ------- for (Enumeration n = non_terminal.all(); n.hasMoreElements(); ) ------- { ------- nt = (non_terminal)n.nextElement(); ------- ------- /* is this one unused */ ------- if (nt.use_count() == 0) ------- { ------- /* count and warn if we are doing warnings */ ------- emit.unused_term++; ------- if (!emit.nowarn) ------- { ------- System.err.println("Warning: Non terminal \"" + nt.name() + ------- "\" was declared but never used"); ------- lexer.warning_count++; ------- } ------- } ------- } ------- ------- } ------- ------- /* . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- /* . . Internal Results of Generating the Parser . .*/ ------- /* . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Start state in the overall state machine. */ ------- protected static lalr_state start_state; ------- ------- /** Resulting parse action table. */ ------- protected static parse_action_table action_table; ------- ------- /** Resulting reduce-goto table. */ ------- protected static parse_reduce_table reduce_table; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Build the (internal) parser from the previously parsed specification. ------- * This includes:
    ------- *
  • Computing nullability of non-terminals. ------- *
  • Computing first sets of non-terminals and productions. ------- *
  • Building the viable prefix recognizer machine. ------- *
  • Filling in the (internal) parse tables. ------- *
  • Checking for unreduced productions. ------- *
------- */ ------- protected static void build_parser() throws internal_error ------- { ------- /* compute nullability of all non terminals */ ------- if (opt_do_debug || print_progress) ------- System.err.println(" Computing non-terminal nullability..."); ------- non_terminal.compute_nullability(); ------- ------- nullability_end = System.currentTimeMillis(); ------- ------- /* compute first sets of all non terminals */ ------- if (opt_do_debug || print_progress) ------- System.err.println(" Computing first sets..."); ------- non_terminal.compute_first_sets(); ------- ------- first_end = System.currentTimeMillis(); ------- ------- /* build the LR viable prefix recognition machine */ ------- if (opt_do_debug || print_progress) ------- System.err.println(" Building state machine..."); ------- start_state = lalr_state.build_machine(emit.start_production); ------- ------- machine_end = System.currentTimeMillis(); ------- ------- /* build the LR parser action and reduce-goto tables */ ------- if (opt_do_debug || print_progress) ------- System.err.println(" Filling in tables..."); ------- action_table = new parse_action_table(); ------- reduce_table = new parse_reduce_table(); ------- for (Enumeration st = lalr_state.all(); st.hasMoreElements(); ) ------- { ------- lalr_state lst = (lalr_state)st.nextElement(); ------- lst.build_table_entries( ------- action_table, reduce_table); ------- } ------- ------- table_end = System.currentTimeMillis(); ------- ------- /* check and warn for non-reduced productions */ ------- if (opt_do_debug || print_progress) ------- System.err.println(" Checking for non-reduced productions..."); ------- action_table.check_reductions(); ------- ------- reduce_check_end = System.currentTimeMillis(); ------- ------- /* if we have more conflicts than we expected issue a message and die */ ------- if (emit.num_conflicts > expect_conflicts) ------- { ------- System.err.println("*** More conflicts encountered than expected " + ------- "-- parser generation aborted"); ------- lexer.error_count++; // indicate the problem. ------- // we'll die on return, after clean up. ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Call the emit routines necessary to write out the generated parser. */ ------- protected static void emit_parser() throws internal_error ------- { ------- emit.symbols(symbol_class_file, include_non_terms, sym_interface); ------- emit.parser(parser_class_file, action_table, reduce_table, ------- start_state.index(), emit.start_production, opt_compact_red, ------- suppress_scanner); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Helper routine to optionally return a plural or non-plural ending. ------- * @param val the numerical value determining plurality. ------- */ ------- protected static String plural(int val) ------- { ------- if (val == 1) ------- return ""; ------- else ------- return "s"; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit a long summary message to standard error (System.err) which ------- * summarizes what was found in the specification, how many states were ------- * produced, how many conflicts were found, etc. A detailed timing ------- * summary is also produced if it was requested by the user. ------- * @param output_produced did the system get far enough to generate code. ------- */ ------- protected static void emit_summary(boolean output_produced) ------- { ------- final_time = System.currentTimeMillis(); ------- ------- if (no_summary) return; ------- ------- System.err.println("------- " + version.title_str + ------- " Parser Generation Summary -------"); ------- ------- /* error and warning count */ ------- System.err.println(" " + lexer.error_count + " error" + ------- plural(lexer.error_count) + " and " + lexer.warning_count + ------- " warning" + plural(lexer.warning_count)); ------- ------- /* basic stats */ ------- System.err.print(" " + terminal.number() + " terminal" + ------- plural(terminal.number()) + ", "); ------- System.err.print(non_terminal.number() + " non-terminal" + ------- plural(non_terminal.number()) + ", and "); ------- System.err.println(production.number() + " production" + ------- plural(production.number()) + " declared, "); ------- System.err.println(" producing " + lalr_state.number() + ------- " unique parse states."); ------- ------- /* unused symbols */ ------- System.err.println(" " + emit.unused_term + " terminal" + ------- plural(emit.unused_term) + " declared but not used."); ------- System.err.println(" " + emit.unused_non_term + " non-terminal" + ------- plural(emit.unused_term) + " declared but not used."); ------- ------- /* productions that didn't reduce */ ------- System.err.println(" " + emit.not_reduced + " production" + ------- plural(emit.not_reduced) + " never reduced."); ------- ------- /* conflicts */ ------- System.err.println(" " + emit.num_conflicts + " conflict" + ------- plural(emit.num_conflicts) + " detected" + ------- " (" + expect_conflicts + " expected)."); ------- ------- /* code location */ ------- if (output_produced) ------- System.err.println(" Code written to \"" + emit.parser_class_name + ------- ".java\", and \"" + emit.symbol_const_class_name + ".java\"."); ------- else ------- System.err.println(" No code produced."); ------- ------- if (opt_show_timing) show_times(); ------- ------- System.err.println( ------- "---------------------------------------------------- (" + ------- version.version_str + ")"); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce the optional timing summary as part of an overall summary. */ ------- protected static void show_times() ------- { ------- long total_time = final_time - start_time; ------- ------- System.err.println(". . . . . . . . . . . . . . . . . . . . . . . . . "); ------- System.err.println(" Timing Summary"); ------- System.err.println(" Total time " ------- + timestr(final_time-start_time, total_time)); ------- System.err.println(" Startup " ------- + timestr(prelim_end-start_time, total_time)); ------- System.err.println(" Parse " ------- + timestr(parse_end-prelim_end, total_time) ); ------- if (check_end != 0) ------- System.err.println(" Checking " ------- + timestr(check_end-parse_end, total_time)); ------- if (check_end != 0 && build_end != 0) ------- System.err.println(" Parser Build " ------- + timestr(build_end-check_end, total_time)); ------- if (nullability_end != 0 && check_end != 0) ------- System.err.println(" Nullability " ------- + timestr(nullability_end-check_end, total_time)); ------- if (first_end != 0 && nullability_end != 0) ------- System.err.println(" First sets " ------- + timestr(first_end-nullability_end, total_time)); ------- if (machine_end != 0 && first_end != 0) ------- System.err.println(" State build " ------- + timestr(machine_end-first_end, total_time)); ------- if (table_end != 0 && machine_end != 0) ------- System.err.println(" Table build " ------- + timestr(table_end-machine_end, total_time)); ------- if (reduce_check_end != 0 && table_end != 0) ------- System.err.println(" Checking " ------- + timestr(reduce_check_end-table_end, total_time)); ------- if (emit_end != 0 && build_end != 0) ------- System.err.println(" Code Output " ------- + timestr(emit_end-build_end, total_time)); ------- if (emit.symbols_time != 0) ------- System.err.println(" Symbols " ------- + timestr(emit.symbols_time, total_time)); ------- if (emit.parser_time != 0) ------- System.err.println(" Parser class " ------- + timestr(emit.parser_time, total_time)); ------- if (emit.action_code_time != 0) ------- System.err.println(" Actions " ------- + timestr(emit.action_code_time, total_time)); ------- if (emit.production_table_time != 0) ------- System.err.println(" Prod table " ------- + timestr(emit.production_table_time, total_time)); ------- if (emit.action_table_time != 0) ------- System.err.println(" Action tab " ------- + timestr(emit.action_table_time, total_time)); ------- if (emit.goto_table_time != 0) ------- System.err.println(" Reduce tab " ------- + timestr(emit.goto_table_time, total_time)); ------- ------- System.err.println(" Dump Output " ------- + timestr(dump_end-emit_end, total_time)); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Helper routine to format a decimal based display of seconds and ------- * percentage of total time given counts of milliseconds. Note: this ------- * is broken for use with some instances of negative time (since we don't ------- * use any negative time here, we let if be for now). ------- * @param time_val the value being formatted (in ms). ------- * @param total_time total time percentages are calculated against (in ms). ------- */ ------- protected static String timestr(long time_val, long total_time) ------- { ------- boolean neg; ------- long ms = 0; ------- long sec = 0; ------- long percent10; ------- String pad; ------- ------- /* work with positives only */ ------- neg = time_val < 0; ------- if (neg) time_val = -time_val; ------- ------- /* pull out seconds and ms */ ------- ms = time_val % 1000; ------- sec = time_val / 1000; ------- ------- /* construct a pad to blank fill seconds out to 4 places */ ------- if (sec < 10) ------- pad = " "; ------- else if (sec < 100) ------- pad = " "; ------- else if (sec < 1000) ------- pad = " "; ------- else ------- pad = ""; ------- ------- /* calculate 10 times the percentage of total */ ------- percent10 = (time_val*1000)/total_time; ------- ------- /* build and return the output string */ ------- return (neg ? "-" : "") + pad + sec + "." + ------- ((ms%1000)/100) + ((ms%100)/10) + (ms%10) + "sec" + ------- " (" + percent10/10 + "." + percent10%10 + "%)"; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a human readable dump of the grammar. */ ------- public static void dump_grammar() throws internal_error ------- { ------- System.err.println("===== Terminals ====="); ------- for (int tidx=0, cnt=0; tidx < terminal.number(); tidx++, cnt++) ------- { ------- System.err.print("["+tidx+"]"+terminal.find(tidx).name()+" "); ------- if ((cnt+1) % 5 == 0) System.err.println(); ------- } ------- System.err.println(); ------- System.err.println(); ------- ------- System.err.println("===== Non terminals ====="); ------- for (int nidx=0, cnt=0; nidx < non_terminal.number(); nidx++, cnt++) ------- { ------- System.err.print("["+nidx+"]"+non_terminal.find(nidx).name()+" "); ------- if ((cnt+1) % 5 == 0) System.err.println(); ------- } ------- System.err.println(); ------- System.err.println(); ------- ------- ------- System.err.println("===== Productions ====="); ------- for (int pidx=0; pidx < production.number(); pidx++) ------- { ------- production prod = production.find(pidx); ------- System.err.print("["+pidx+"] "+prod.lhs().the_symbol().name() + " ::= "); ------- for (int i=0; i ------- * ------- * Three classes are produced by this code: ------- *
------- *
symbol constant class ------- *
this contains constant declarations for each terminal (and ------- * optionally each non-terminal). ------- *
action class ------- *
this non-public class contains code to invoke all the user actions ------- * that were embedded in the parser specification. ------- *
parser class ------- *
the specialized parser class consisting primarily of some user ------- * supplied general and initialization code, and the parse tables. ------- *

------- * ------- * Three parse tables are created as part of the parser class: ------- *

------- *
production table ------- *
lists the LHS non terminal number, and the length of the RHS of ------- * each production. ------- *
action table ------- *
for each state of the parse machine, gives the action to be taken ------- * (shift, reduce, or error) under each lookahead symbol.
------- *
reduce-goto table ------- *
when a reduce on a given production is taken, the parse stack is ------- * popped back a number of elements corresponding to the RHS of the ------- * production. This reveals a prior state, which we transition out ------- * of under the LHS non terminal symbol for the production (as if we ------- * had seen the LHS symbol rather than all the symbols matching the ------- * RHS). This table is indexed by non terminal numbers and indicates ------- * how to make these transitions. ------- *

------- * ------- * In addition to the method interface, this class maintains a series of ------- * public global variables and flags indicating how misc. parts of the code ------- * and other output is to be produced, and counting things such as number of ------- * conflicts detected (see the source code and public variables below for ------- * more details).

------- * ------- * This class is "static" (contains only static data and methods).

------- * ------- * @see java_cup.main ------- * @version last update: 11/25/95 ------- * @author Scott Hudson ------- */ ------- -------/* Major externally callable routines here include: ------- symbols - emit the symbol constant class ------- parser - emit the parser class ------- ------- In addition the following major internal routines are provided: ------- emit_package - emit a package declaration ------- emit_action_code - emit the class containing the user's actions ------- emit_production_table - emit declaration and init for the production table ------- do_action_table - emit declaration and init for the action table ------- do_reduce_table - emit declaration and init for the reduce-goto table ------- ------- Finally, this class uses a number of public instance variables to communicate ------- optional parameters and flags used to control how code is generated, ------- as well as to report counts of various things (such as number of conflicts ------- detected). These include: ------- ------- prefix - a prefix string used to prefix names that would ------- otherwise "pollute" someone else's name space. ------- package_name - name of the package emitted code is placed in ------- (or null for an unnamed package. ------- symbol_const_class_name - name of the class containing symbol constants. ------- parser_class_name - name of the class for the resulting parser. ------- action_code - user supplied declarations and other code to be ------- placed in action class. ------- parser_code - user supplied declarations and other code to be ------- placed in parser class. ------- init_code - user supplied code to be executed as the parser ------- is being initialized. ------- scan_code - user supplied code to get the next Symbol. ------- start_production - the start production for the grammar. ------- import_list - list of imports for use with action class. ------- num_conflicts - number of conflicts detected. ------- nowarn - true if we are not to issue warning messages. ------- not_reduced - count of number of productions that never reduce. ------- unused_term - count of unused terminal symbols. ------- unused_non_term - count of unused non terminal symbols. ------- *_time - a series of symbols indicating how long various ------- sub-parts of code generation took (used to produce ------- optional time reports in main). -------*/ ------- -------public class emit { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Only constructor is private so no instances can be created. */ ------- private emit() { } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Static (Class) Variables ------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The prefix placed on names that pollute someone else's name space. */ ------- public static String prefix = "CUP$"; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Package that the resulting code goes into (null is used for unnamed). */ ------- public static String package_name = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Name of the generated class for symbol constants. */ ------- public static String symbol_const_class_name = "sym"; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Name of the generated parser class. */ ------- public static String parser_class_name = "parser"; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** User declarations for direct inclusion in user action class. */ ------- public static String action_code = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** User declarations for direct inclusion in parser class. */ ------- public static String parser_code = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** User code for user_init() which is called during parser initialization. */ ------- public static String init_code = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** User code for scan() which is called to get the next Symbol. */ ------- public static String scan_code = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The start production of the grammar. */ ------- public static production start_production = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** List of imports (Strings containing class names) to go with actions. */ ------- public static Stack import_list = new Stack(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Number of conflict found while building tables. */ ------- public static int num_conflicts = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Do we skip warnings? */ ------- public static boolean nowarn = false; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of the number on non-reduced productions found. */ ------- public static int not_reduced = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of unused terminals. */ ------- public static int unused_term = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of unused non terminals. */ ------- public static int unused_non_term = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /* Timing values used to produce timing report in main.*/ ------- ------- /** Time to produce symbol constant class. */ ------- public static long symbols_time = 0; ------- ------- /** Time to produce parser class. */ ------- public static long parser_time = 0; ------- ------- /** Time to produce action code class. */ ------- public static long action_code_time = 0; ------- ------- /** Time to produce the production table. */ ------- public static long production_table_time = 0; ------- ------- /** Time to produce the action table. */ ------- public static long action_table_time = 0; ------- ------- /** Time to produce the reduce-goto table. */ ------- public static long goto_table_time = 0; ------- ------- /* frankf 6/18/96 */ ------- protected static boolean _lr_values; ------- ------- /** whether or not to emit code for left and right values */ ------- public static boolean lr_values() {return _lr_values;} ------- protected static void set_lr_values(boolean b) { _lr_values = b;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Build a string with the standard prefix. ------- * @param str string to prefix. ------- */ ------- protected static String pre(String str) { ------- return prefix + parser_class_name + "$" + str; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit a package spec if the user wants one. ------- * @param out stream to produce output on. ------- */ ------- protected static void emit_package(PrintWriter out) ------- { ------- /* generate a package spec if we have a name for one */ ------- if (package_name != null) { ------- out.println("package " + package_name + ";"); out.println(); ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit code for the symbol constant class, optionally including non terms, ------- * if they have been requested. ------- * @param out stream to produce output on. ------- * @param emit_non_terms do we emit constants for non terminals? ------- * @param sym_interface should we emit an interface, rather than a class? ------- */ ------- public static void symbols(PrintWriter out, ------- boolean emit_non_terms, boolean sym_interface) ------- { ------- terminal term; ------- non_terminal nt; ------- String class_or_interface = (sym_interface)?"interface":"class"; ------- ------- long start_time = System.currentTimeMillis(); ------- ------- /* top of file */ ------- out.println(); ------- out.println("//----------------------------------------------------"); ------- out.println("// The following code was generated by " + ------- version.title_str); ------- out.println("// " + new Date()); ------- out.println("//----------------------------------------------------"); ------- out.println(); ------- emit_package(out); ------- ------- /* class header */ ------- out.println("/** CUP generated " + class_or_interface + ------- " containing symbol constants. */"); ------- out.println("public " + class_or_interface + " " + ------- symbol_const_class_name + " {"); ------- ------- out.println(" /* terminals */"); ------- ------- /* walk over the terminals */ /* later might sort these */ ------- for (Enumeration e = terminal.all(); e.hasMoreElements(); ) ------- { ------- term = (terminal)e.nextElement(); ------- ------- /* output a constant decl for the terminal */ ------- out.println(" public static final int " + term.name() + " = " + ------- term.index() + ";"); ------- } ------- ------- /* do the non terminals if they want them (parser doesn't need them) */ ------- if (emit_non_terms) ------- { ------- out.println(); ------- out.println(" /* non terminals */"); ------- ------- /* walk over the non terminals */ /* later might sort these */ ------- for (Enumeration e = non_terminal.all(); e.hasMoreElements(); ) ------- { ------- nt = (non_terminal)e.nextElement(); ------- ------- /* output a constant decl for the terminal */ ------- out.println(" static final int " + nt.name() + " = " + ------- nt.index() + ";"); ------- } ------- } ------- ------- /* end of class */ ------- out.println("}"); ------- out.println(); ------- ------- symbols_time = System.currentTimeMillis() - start_time; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit code for the non-public class holding the actual action code. ------- * @param out stream to produce output on. ------- * @param start_prod the start production of the grammar. ------- */ ------- protected static void emit_action_code(PrintWriter out, production start_prod) ------- throws internal_error ------- { ------- production prod; ------- ------- long start_time = System.currentTimeMillis(); ------- ------- /* class header */ ------- out.println(); ------- out.println( ------- "/** Cup generated class to encapsulate user supplied action code.*/" ------- ); ------- out.println("class " + pre("actions") + " {"); ------- ------- /* user supplied code */ ------- if (action_code != null) ------- { ------- out.println(); ------- out.println(action_code); ------- } ------- ------- /* field for parser object */ ------- out.println(" private final "+parser_class_name+" parser;"); ------- ------- /* constructor */ ------- out.println(); ------- out.println(" /** Constructor */"); ------- out.println(" " + pre("actions") + "("+parser_class_name+" parser) {"); ------- out.println(" this.parser = parser;"); ------- out.println(" }"); ------- ------- /* action method head */ ------- out.println(); ------- out.println(" /** Method with the actual generated action code. */"); ------- out.println(" public final java_cup.runtime.Symbol " + ------- pre("do_action") + "("); ------- out.println(" int " + pre("act_num,")); ------- out.println(" java_cup.runtime.lr_parser " + pre("parser,")); ------- out.println(" java.util.Stack " + pre("stack,")); ------- out.println(" int " + pre("top)")); ------- out.println(" throws java.lang.Exception"); ------- out.println(" {"); ------- ------- /* declaration of result symbol */ ------- /* New declaration!! now return Symbol ------- 6/13/96 frankf */ ------- out.println(" /* Symbol object for return from actions */"); ------- out.println(" java_cup.runtime.Symbol " + pre("result") + ";"); ------- out.println(); ------- ------- /* switch top */ ------- out.println(" /* select the action based on the action number */"); ------- out.println(" switch (" + pre("act_num") + ")"); ------- out.println(" {"); ------- ------- /* emit action code for each production as a separate case */ ------- for (Enumeration p = production.all(); p.hasMoreElements(); ) ------- { ------- prod = (production)p.nextElement(); ------- ------- /* case label */ ------- out.println(" /*. . . . . . . . . . . . . . . . . . . .*/"); ------- out.println(" case " + prod.index() + ": // " + ------- prod.to_simple_string()); ------- ------- /* give them their own block to work in */ ------- out.println(" {"); ------- ------- /* create the result symbol */ ------- /*make the variable RESULT which will point to the new Symbol (see below) ------- and be changed by action code ------- 6/13/96 frankf */ ------- out.println(" " + prod.lhs().the_symbol().stack_type() + ------- " RESULT = null;"); ------- ------- /* Add code to propagate RESULT assignments that occur in ------- * action code embedded in a production (ie, non-rightmost ------- * action code). 24-Mar-1998 CSA ------- */ ------- for (int i=0; ireduce_goto table. */"); ------- out.println(" protected static final short[][] _reduce_table = "); ------- out.print (" unpackFromStrings("); ------- do_table_as_string(out, reduce_goto_table); ------- out.println(");"); ------- ------- /* do the public accessor method */ ------- out.println(); ------- out.println(" /** Access to reduce_goto table. */"); ------- out.println(" public short[][] reduce_table() {return _reduce_table;}"); ------- out.println(); ------- ------- goto_table_time = System.currentTimeMillis() - start_time; ------- } ------- ------- // print a string array encoding the given short[][] array. ------- protected static void do_table_as_string(PrintWriter out, short[][] sa) { ------- out.println("new String[] {"); ------- out.print(" \""); ------- int nchar=0, nbytes=0; ------- nbytes+=do_escaped(out, (char)(sa.length>>16)); ------- nchar =do_newline(out, nchar, nbytes); ------- nbytes+=do_escaped(out, (char)(sa.length&0xFFFF)); ------- nchar =do_newline(out, nchar, nbytes); ------- for (int i=0; i>16)); ------- nchar =do_newline(out, nchar, nbytes); ------- nbytes+=do_escaped(out, (char)(sa[i].length&0xFFFF)); ------- nchar =do_newline(out, nchar, nbytes); ------- for (int j=0; j 65500) { out.println("\", "); out.print(" \""); } ------- else if (nchar > 11) { out.println("\" +"); out.print(" \""); } ------- else return nchar+1; ------- return 0; ------- } ------- // output an escape sequence for the given character code. ------- protected static int do_escaped(PrintWriter out, char c) { ------- StringBuffer escape = new StringBuffer(); ------- if (c <= 0xFF) { ------- escape.append(Integer.toOctalString(c)); ------- while(escape.length() < 3) escape.insert(0, '0'); ------- } else { ------- escape.append(Integer.toHexString(c)); ------- while(escape.length() < 4) escape.insert(0, '0'); ------- escape.insert(0, 'u'); ------- } ------- escape.insert(0, '\\'); ------- out.print(escape.toString()); ------- ------- // return number of bytes this takes up in UTF-8 encoding. ------- if (c == 0) return 2; ------- if (c >= 0x01 && c <= 0x7F) return 1; ------- if (c >= 0x80 && c <= 0x7FF) return 2; ------- return 3; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit the parser subclass with embedded tables. ------- * @param out stream to produce output on. ------- * @param action_table internal representation of the action table. ------- * @param reduce_table internal representation of the reduce-goto table. ------- * @param start_st start state of the parse machine. ------- * @param start_prod start production of the grammar. ------- * @param compact_reduces do we use most frequent reduce as default? ------- * @param suppress_scanner should scanner be suppressed for compatibility? ------- */ ------- public static void parser( ------- PrintWriter out, ------- parse_action_table action_table, ------- parse_reduce_table reduce_table, ------- int start_st, ------- production start_prod, ------- boolean compact_reduces, ------- boolean suppress_scanner) ------- throws internal_error ------- { ------- long start_time = System.currentTimeMillis(); ------- ------- /* top of file */ ------- out.println(); ------- out.println("//----------------------------------------------------"); ------- out.println("// The following code was generated by " + ------- version.title_str); ------- out.println("// " + new Date()); ------- out.println("//----------------------------------------------------"); ------- out.println(); ------- emit_package(out); ------- ------- /* user supplied imports */ ------- for (int i = 0; i < import_list.size(); i++) ------- out.println("import " + import_list.elementAt(i) + ";"); ------- ------- /* class header */ ------- out.println(); ------- out.println("/** "+version.title_str+" generated parser."); ------- out.println(" * @version " + new Date()); ------- out.println(" */"); ------- out.println("public class " + parser_class_name + ------- " extends java_cup.runtime.lr_parser {"); ------- ------- /* constructors [CSA/davidm, 24-jul-99] */ ------- out.println(); ------- out.println(" /** Default constructor. */"); ------- out.println(" public " + parser_class_name + "() {super();}"); ------- if (!suppress_scanner) { ------- out.println(); ------- out.println(" /** Constructor which sets the default scanner. */"); ------- out.println(" public " + parser_class_name + ------- "(java_cup.runtime.Scanner s) {super(s);}"); ------- } ------- ------- /* emit the various tables */ ------- emit_production_table(out); ------- do_action_table(out, action_table, compact_reduces); ------- do_reduce_table(out, reduce_table); ------- ------- /* instance of the action encapsulation class */ ------- out.println(" /** Instance of action encapsulation class. */"); ------- out.println(" protected " + pre("actions") + " action_obj;"); ------- out.println(); ------- ------- /* action object initializer */ ------- out.println(" /** Action encapsulation object initializer. */"); ------- out.println(" protected void init_actions()"); ------- out.println(" {"); ------- out.println(" action_obj = new " + pre("actions") + "(this);"); ------- out.println(" }"); ------- out.println(); ------- ------- /* access to action code */ ------- out.println(" /** Invoke a user supplied parse action. */"); ------- out.println(" public java_cup.runtime.Symbol do_action("); ------- out.println(" int act_num,"); ------- out.println(" java_cup.runtime.lr_parser parser,"); ------- out.println(" java.util.Stack stack,"); ------- out.println(" int top)"); ------- out.println(" throws java.lang.Exception"); ------- out.println(" {"); ------- out.println(" /* call code in generated class */"); ------- out.println(" return action_obj." + pre("do_action(") + ------- "act_num, parser, stack, top);"); ------- out.println(" }"); ------- out.println(""); ------- ------- ------- /* method to tell the parser about the start state */ ------- out.println(" /** Indicates start state. */"); ------- out.println(" public int start_state() {return " + start_st + ";}"); ------- ------- /* method to indicate start production */ ------- out.println(" /** Indicates start production. */"); ------- out.println(" public int start_production() {return " + ------- start_production.index() + ";}"); ------- out.println(); ------- ------- /* methods to indicate EOF and error symbol indexes */ ------- out.println(" /** EOF Symbol index. */"); ------- out.println(" public int EOF_sym() {return " + terminal.EOF.index() + ------- ";}"); ------- out.println(); ------- out.println(" /** error Symbol index. */"); ------- out.println(" public int error_sym() {return " + terminal.error.index() + ------- ";}"); ------- out.println(); ------- ------- /* user supplied code for user_init() */ ------- if (init_code != null) ------- { ------- out.println(); ------- out.println(" /** User initialization code. */"); ------- out.println(" public void user_init() throws java.lang.Exception"); ------- out.println(" {"); ------- out.println(init_code); ------- out.println(" }"); ------- } ------- ------- /* user supplied code for scan */ ------- if (scan_code != null) ------- { ------- out.println(); ------- out.println(" /** Scan to get the next Symbol. */"); ------- out.println(" public java_cup.runtime.Symbol scan()"); ------- out.println(" throws java.lang.Exception"); ------- out.println(" {"); ------- out.println(scan_code); ------- out.println(" }"); ------- } ------- ------- /* user supplied code */ ------- if (parser_code != null) ------- { ------- out.println(); ------- out.println(parser_code); ------- } ------- ------- /* end of class */ ------- out.println("}"); ------- ------- /* put out the action code class */ ------- emit_action_code(out, start_prod); ------- ------- parser_time = System.currentTimeMillis() - start_time; ------- } ------- ------- /*-----------------------------------------------------------*/ -------} diff --cc Robust/cup/java_cup/internal_error.class index 77c69e14,77c69e14,77c69e14,77c69e14,77c69e14,77c69e14,77c69e14..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/internal_error.java index 4d3e7c2c,4d3e7c2c,4d3e7c2c,4d3e7c2c,4d3e7c2c,4d3e7c2c,4d3e7c2c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/internal_error.java +++ /dev/null @@@@@@@@ -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** Exception subclass for reporting internal errors in JavaCup. */ -------public class internal_error extends Exception ------- { ------- /** Constructor with a message */ ------- public internal_error(String msg) ------- { ------- super(msg); ------- } ------- ------- /** Method called to do a forced error exit on an internal error ------- for cases when we can't actually throw the exception. */ ------- public void crash() ------- { ------- System.err.println("JavaCUP Fatal Internal Error Detected"); ------- System.err.println(getMessage()); ------- printStackTrace(); ------- System.exit(-1); ------- } ------- } diff --cc Robust/cup/java_cup/lalr_item.class index 275e77ee,275e77ee,275e77ee,275e77ee,275e77ee,275e77ee,275e77ee..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/lalr_item.java index fe920544,fe920544,fe920544,fe920544,fe920544,fe920544,fe920544..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/lalr_item.java +++ /dev/null @@@@@@@@ -1,330 -1,330 -1,330 -1,330 -1,330 -1,330 -1,330 +1,0 @@@@@@@@ -------package java_cup; ------- -------import java.util.Stack; -------import java.util.Enumeration; ------- -------/** This class represents an LALR item. Each LALR item consists of ------- * a production, a "dot" at a position within that production, and ------- * a set of lookahead symbols (terminal). (The first two of these parts ------- * are provide by the super class). An item is designed to represent a ------- * configuration that the parser may be in. For example, an item of the ------- * form:

------- *    [A ::= B * C d E  , {a,b,c}]
------- *  
------- * indicates that the parser is in the middle of parsing the production
------- *    A ::= B C d E
------- *  
------- * that B has already been parsed, and that we will expect to see a lookahead ------- * of either a, b, or c once the complete RHS of this production has been ------- * found.

------- * ------- * Items may initially be missing some items from their lookahead sets. ------- * Links are maintained from each item to the set of items that would need ------- * to be updated if symbols are added to its lookahead set. During ------- * "lookahead propagation", we add symbols to various lookahead sets and ------- * propagate these changes across these dependency links as needed. ------- * ------- * @see java_cup.lalr_item_set ------- * @see java_cup.lalr_state ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class lalr_item extends lr_item_core { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param prod the production for the item. ------- * @param pos the position of the "dot" within the production. ------- * @param look the set of lookahead symbols. ------- */ ------- public lalr_item(production prod, int pos, terminal_set look) ------- throws internal_error ------- { ------- super(prod, pos); ------- _lookahead = look; ------- _propagate_items = new Stack(); ------- needs_propagation = true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with default position (dot at start). ------- * @param prod the production for the item. ------- * @param look the set of lookahead symbols. ------- */ ------- public lalr_item(production prod, terminal_set look) throws internal_error ------- { ------- this(prod,0,look); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with default position and empty lookahead set. ------- * @param prod the production for the item. ------- */ ------- public lalr_item(production prod) throws internal_error ------- { ------- this(prod,0,new terminal_set()); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The lookahead symbols of the item. */ ------- protected terminal_set _lookahead; ------- ------- /** The lookahead symbols of the item. */ ------- public terminal_set lookahead() {return _lookahead;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Links to items that the lookahead needs to be propagated to. */ ------- protected Stack _propagate_items; ------- ------- /** Links to items that the lookahead needs to be propagated to */ ------- public Stack propagate_items() {return _propagate_items;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Flag to indicate that this item needs to propagate its lookahead ------- * (whether it has changed or not). ------- */ ------- protected boolean needs_propagation; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add a new item to the set of items we propagate to. */ ------- public void add_propagate(lalr_item prop_to) ------- { ------- _propagate_items.push(prop_to); ------- needs_propagation = true; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Propagate incoming lookaheads through this item to others need to ------- * be changed. ------- * @params incoming symbols to potentially be added to lookahead of this item. ------- */ ------- public void propagate_lookaheads(terminal_set incoming) throws internal_error ------- { ------- boolean change = false; ------- ------- /* if we don't need to propagate, then bail out now */ ------- if (!needs_propagation && (incoming == null || incoming.empty())) ------- return; ------- ------- /* if we have null incoming, treat as an empty set */ ------- if (incoming != null) ------- { ------- /* add the incoming to the lookahead of this item */ ------- change = lookahead().add(incoming); ------- } ------- ------- /* if we changed or need it anyway, propagate across our links */ ------- if (change || needs_propagation) ------- { ------- /* don't need to propagate again */ ------- needs_propagation = false; ------- ------- /* propagate our lookahead into each item we are linked to */ ------- for (int i = 0; i < propagate_items().size(); i++) ------- ((lalr_item)propagate_items().elementAt(i)) ------- .propagate_lookaheads(lookahead()); ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce the new lalr_item that results from shifting the dot one position ------- * to the right. ------- */ ------- public lalr_item shift() throws internal_error ------- { ------- lalr_item result; ------- ------- /* can't shift if we have dot already at the end */ ------- if (dot_at_end()) ------- throw new internal_error("Attempt to shift past end of an lalr_item"); ------- ------- /* create the new item w/ the dot shifted by one */ ------- result = new lalr_item(the_production(), dot_pos()+1, ------- new terminal_set(lookahead())); ------- ------- /* change in our lookahead needs to be propagated to this item */ ------- add_propagate(result); ------- ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Calculate lookahead representing symbols that could appear after the ------- * symbol that the dot is currently in front of. Note: this routine must ------- * not be invoked before first sets and nullability has been calculated ------- * for all non terminals. ------- */ ------- public terminal_set calc_lookahead(terminal_set lookahead_after) ------- throws internal_error ------- { ------- terminal_set result; ------- int pos; ------- production_part part; ------- symbol sym; ------- ------- /* sanity check */ ------- if (dot_at_end()) ------- throw new internal_error( ------- "Attempt to calculate a lookahead set with a completed item"); ------- ------- /* start with an empty result */ ------- result = new terminal_set(); ------- ------- /* consider all nullable symbols after the one to the right of the dot */ ------- for (pos = dot_pos()+1; pos < the_production().rhs_length(); pos++) ------- { ------- part = the_production().rhs(pos); ------- ------- /* consider what kind of production part it is -- skip actions */ ------- if (!part.is_action()) ------- { ------- sym = ((symbol_part)part).the_symbol(); ------- ------- /* if its a terminal add it in and we are done */ ------- if (!sym.is_non_term()) ------- { ------- result.add((terminal)sym); ------- return result; ------- } ------- else ------- { ------- /* otherwise add in first set of the non terminal */ ------- result.add(((non_terminal)sym).first_set()); ------- ------- /* if its nullable we continue adding, if not, we are done */ ------- if (!((non_terminal)sym).nullable()) ------- return result; ------- } ------- } ------- } ------- ------- /* if we get here everything past the dot was nullable ------- we add in the lookahead for after the production and we are done */ ------- result.add(lookahead_after); ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if everything from the symbol one beyond the dot all the ------- * way to the end of the right hand side is nullable. This would indicate ------- * that the lookahead of this item must be included in the lookaheads of ------- * all items produced as a closure of this item. Note: this routine should ------- * not be invoked until after first sets and nullability have been ------- * calculated for all non terminals. ------- */ ------- public boolean lookahead_visible() throws internal_error ------- { ------- production_part part; ------- symbol sym; ------- ------- /* if the dot is at the end, we have a problem, but the cleanest thing ------- to do is just return true. */ ------- if (dot_at_end()) return true; ------- ------- /* walk down the rhs and bail if we get a non-nullable symbol */ ------- for (int pos = dot_pos() + 1; pos < the_production().rhs_length(); pos++) ------- { ------- part = the_production().rhs(pos); ------- ------- /* skip actions */ ------- if (!part.is_action()) ------- { ------- sym = ((symbol_part)part).the_symbol(); ------- ------- /* if its a terminal we fail */ ------- if (!sym.is_non_term()) return false; ------- ------- /* if its not nullable we fail */ ------- if (!((non_terminal)sym).nullable()) return false; ------- } ------- } ------- ------- /* if we get here its all nullable */ ------- return true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison -- here we only require the cores to be equal since ------- * we need to do sets of items based only on core equality (ignoring ------- * lookahead sets). ------- */ ------- public boolean equals(lalr_item other) ------- { ------- if (other == null) return false; ------- return super.equals(other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof lalr_item)) ------- return false; ------- else ------- return equals((lalr_item)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return a hash code -- here we only hash the core since we only test core ------- * matching in LALR items. ------- */ ------- public int hashCode() ------- { ------- return super.hashCode(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to string. */ ------- public String toString() ------- { ------- String result = ""; ------- ------- // additional output for debugging: ------- // result += "(" + obj_hash() + ")"; ------- result += "["; ------- result += super.toString(); ------- result += ", "; ------- if (lookahead() != null) ------- { ------- result += "{"; ------- for (int t = 0; t < terminal.number(); t++) ------- if (lookahead().contains(t)) ------- result += terminal.find(t).name() + " "; ------- result += "}"; ------- } ------- else ------- result += "NULL LOOKAHEAD!!"; ------- result += "]"; ------- ------- // additional output for debugging: ------- // result += " -> "; ------- // for (int i = 0; i ------- * ------- * This class provides fairly conventional set oriented operations (union, ------- * sub/super-set tests, etc.), as well as an LALR "closure" operation (see ------- * compute_closure()). ------- * ------- * @see java_cup.lalr_item ------- * @see java_cup.lalr_state ------- * @version last updated: 3/6/96 ------- * @author Scott Hudson ------- */ ------- -------public class lalr_item_set { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Constructor for an empty set. */ ------- public lalr_item_set() { } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor for cloning from another set. ------- * @param other indicates set we should copy from. ------- */ ------- public lalr_item_set(lalr_item_set other) ------- throws internal_error ------- { ------- not_null(other); ------- _all = (Hashtable)other._all.clone(); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** A hash table to implement the set. We store the items using themselves ------- * as keys. ------- */ ------- protected Hashtable _all = new Hashtable(11); ------- ------- /** Access to all elements of the set. */ ------- public Enumeration all() {return _all.elements();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Cached hashcode for this set. */ ------- protected Integer hashcode_cache = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Size of the set */ ------- public int size() {return _all.size();} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Set Operation Methods ---------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Does the set contain a particular item? ------- * @param itm the item in question. ------- */ ------- public boolean contains(lalr_item itm) {return _all.containsKey(itm);} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return the item in the set matching a particular item (or null if not ------- * found) ------- * @param itm the item we are looking for. ------- */ ------- public lalr_item find(lalr_item itm) {return (lalr_item)_all.get(itm);} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Is this set an (improper) subset of another? ------- * @param other the other set in question. ------- */ ------- public boolean is_subset_of(lalr_item_set other) throws internal_error ------- { ------- not_null(other); ------- ------- /* walk down our set and make sure every element is in the other */ ------- for (Enumeration e = all(); e.hasMoreElements(); ) ------- if (!other.contains((lalr_item)e.nextElement())) ------- return false; ------- ------- /* they were all there */ ------- return true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Is this set an (improper) superset of another? ------- * @param other the other set in question. ------- */ ------- public boolean is_superset_of(lalr_item_set other) throws internal_error ------- { ------- not_null(other); ------- return other.is_subset_of(this); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add a singleton item, merging lookahead sets if the item is already ------- * part of the set. returns the element of the set that was added or ------- * merged into. ------- * @param itm the item being added. ------- */ ------- public lalr_item add(lalr_item itm) throws internal_error ------- { ------- lalr_item other; ------- ------- not_null(itm); ------- ------- /* see if an item with a matching core is already there */ ------- other = (lalr_item)_all.get(itm); ------- ------- /* if so, merge this lookahead into the original and leave it */ ------- if (other != null) ------- { ------- other.lookahead().add(itm.lookahead()); ------- return other; ------- } ------- /* otherwise we just go in the set */ ------- else ------- { ------- /* invalidate cached hashcode */ ------- hashcode_cache = null; ------- ------- _all.put(itm,itm); ------- return itm; ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Remove a single item if it is in the set. ------- * @param itm the item to remove. ------- */ ------- public void remove(lalr_item itm) throws internal_error ------- { ------- not_null(itm); ------- ------- /* invalidate cached hashcode */ ------- hashcode_cache = null; ------- ------- /* remove it from hash table implementing set */ ------- _all.remove(itm); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add a complete set, merging lookaheads where items are already in ------- * the set ------- * @param other the set to be added. ------- */ ------- public void add(lalr_item_set other) throws internal_error ------- { ------- not_null(other); ------- ------- /* walk down the other set and do the adds individually */ ------- for (Enumeration e = other.all(); e.hasMoreElements(); ) ------- add((lalr_item)e.nextElement()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Remove (set subtract) a complete set. ------- * @param other the set to remove. ------- */ ------- public void remove(lalr_item_set other) throws internal_error ------- { ------- not_null(other); ------- ------- /* walk down the other set and do the removes individually */ ------- for (Enumeration e = other.all(); e.hasMoreElements(); ) ------- remove((lalr_item)e.nextElement()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Remove and return one item from the set (done in hash order). */ ------- public lalr_item get_one() throws internal_error ------- { ------- Enumeration the_set; ------- lalr_item result; ------- ------- the_set = all(); ------- if (the_set.hasMoreElements()) ------- { ------- result = (lalr_item)the_set.nextElement(); ------- remove(result); ------- return result; ------- } ------- else ------- return null; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Helper function for null test. Throws an interal_error exception if its ------- * parameter is null. ------- * @param obj the object we are testing. ------- */ ------- protected void not_null(Object obj) throws internal_error ------- { ------- if (obj == null) ------- throw new internal_error("Null object used in set operation"); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute the closure of the set using the LALR closure rules. Basically ------- * for every item of the form:

-------   *    [L ::= a *N alpha, l] 
-------   *  
------- * (where N is a a non terminal and alpha is a string of symbols) make ------- * sure there are also items of the form:
-------   *    [N ::= *beta, first(alpha l)] 
-------   *  
------- * corresponding to each production of N. Items with identical cores but ------- * differing lookahead sets are merged by creating a new item with the same ------- * core and the union of the lookahead sets (the LA in LALR stands for ------- * "lookahead merged" and this is where the merger is). This routine ------- * assumes that nullability and first sets have been computed for all ------- * productions before it is called. ------- */ ------- public void compute_closure() ------- throws internal_error ------- { ------- lalr_item_set consider; ------- lalr_item itm, new_itm, add_itm; ------- non_terminal nt; ------- terminal_set new_lookaheads; ------- Enumeration p; ------- production prod; ------- boolean need_prop; ------- ------- ------- ------- /* invalidate cached hashcode */ ------- hashcode_cache = null; ------- ------- /* each current element needs to be considered */ ------- consider = new lalr_item_set(this); ------- ------- /* repeat this until there is nothing else to consider */ ------- while (consider.size() > 0) ------- { ------- /* get one item to consider */ ------- itm = consider.get_one(); ------- ------- /* do we have a dot before a non terminal */ ------- nt = itm.dot_before_nt(); ------- if (nt != null) ------- { ------- /* create the lookahead set based on first after dot */ ------- new_lookaheads = itm.calc_lookahead(itm.lookahead()); ------- ------- /* are we going to need to propagate our lookahead to new item */ ------- need_prop = itm.lookahead_visible(); ------- ------- /* create items for each production of that non term */ ------- for (p = nt.productions(); p.hasMoreElements(); ) ------- { ------- prod = (production)p.nextElement(); ------- ------- /* create new item with dot at start and that lookahead */ ------- new_itm = new lalr_item(prod, ------- new terminal_set(new_lookaheads)); ------- ------- /* add/merge item into the set */ ------- add_itm = add(new_itm); ------- /* if propagation is needed link to that item */ ------- if (need_prop) ------- itm.add_propagate(add_itm); ------- ------- /* was this was a new item*/ ------- if (add_itm == new_itm) ------- { ------- /* that may need further closure, consider it also */ ------- consider.add(new_itm); ------- } ------- } ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(lalr_item_set other) ------- { ------- if (other == null || other.size() != size()) return false; ------- ------- /* once we know they are the same size, then improper subset does test */ ------- try { ------- return is_subset_of(other); ------- } catch (internal_error e) { ------- /* can't throw error from here (because superclass doesn't) so crash */ ------- e.crash(); ------- return false; ------- } ------- ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof lalr_item_set)) ------- return false; ------- else ------- return equals((lalr_item_set)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return hash code. */ ------- public int hashCode() ------- { ------- int result = 0; ------- Enumeration e; ------- int cnt; ------- ------- /* only compute a new one if we don't have it cached */ ------- if (hashcode_cache == null) ------- { ------- /* hash together codes from at most first 5 elements */ ------- // CSA fix! we'd *like* to hash just a few elements, but ------- // that means equal sets will have inequal hashcodes, which ------- // we're not allowed (by contract) to do. So hash them all. ------- for (e = all(), cnt=0 ; e.hasMoreElements() /*&& cnt<5*/; cnt++) ------- result ^= ((lalr_item)e.nextElement()).hashCode(); ------- ------- hashcode_cache = new Integer(result); ------- } ------- ------- return hashcode_cache.intValue(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to string. */ ------- public String toString() ------- { ------- StringBuffer result = new StringBuffer(); ------- ------- result.append("{\n"); ------- for (Enumeration e=all(); e.hasMoreElements(); ) ------- { ------- result.append(" " + (lalr_item)e.nextElement() + "\n"); ------- } ------- result.append("}"); ------- ------- return result.toString(); ------- } ------- /*-----------------------------------------------------------*/ -------} ------- diff --cc Robust/cup/java_cup/lalr_state.class index 79705a25,79705a25,79705a25,79705a25,79705a25,79705a25,79705a25..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/lalr_state.java index 5298e877,5298e877,5298e877,5298e877,5298e877,5298e877,5298e877..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/lalr_state.java +++ /dev/null @@@@@@@@ -1,884 -1,884 -1,884 -1,884 -1,884 -1,884 -1,884 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.Hashtable; -------import java.util.Enumeration; -------import java.util.Stack; ------- -------/** This class represents a state in the LALR viable prefix recognition machine. ------- * A state consists of an LALR item set and a set of transitions to other ------- * states under terminal and non-terminal symbols. Each state represents ------- * a potential configuration of the parser. If the item set of a state ------- * includes an item such as:
------- *    [A ::= B * C d E , {a,b,c}]
------- *  
------- * this indicates that when the parser is in this state it is currently ------- * looking for an A of the given form, has already seen the B, and would ------- * expect to see an a, b, or c after this sequence is complete. Note that ------- * the parser is normally looking for several things at once (represented ------- * by several items). In our example above, the state would also include ------- * items such as:
------- *    [C ::= * X e Z, {d}]
------- *    [X ::= * f, {e}]
------- *  
------- * to indicate that it was currently looking for a C followed by a d (which ------- * would be reduced into a C, matching the first symbol in our production ------- * above), and the terminal f followed by e.

------- * ------- * At runtime, the parser uses a viable prefix recognition machine made up ------- * of these states to parse. The parser has two operations, shift and reduce. ------- * In a shift, it consumes one Symbol and makes a transition to a new state. ------- * This corresponds to "moving the dot past" a terminal in one or more items ------- * in the state (these new shifted items will then be found in the state at ------- * the end of the transition). For a reduce operation, the parser is ------- * signifying that it is recognizing the RHS of some production. To do this ------- * it first "backs up" by popping a stack of previously saved states. It ------- * pops off the same number of states as are found in the RHS of the ------- * production. This leaves the machine in the same state is was in when the ------- * parser first attempted to find the RHS. From this state it makes a ------- * transition based on the non-terminal on the LHS of the production. This ------- * corresponds to placing the parse in a configuration equivalent to having ------- * replaced all the symbols from the the input corresponding to the RHS with ------- * the symbol on the LHS. ------- * ------- * @see java_cup.lalr_item ------- * @see java_cup.lalr_item_set ------- * @see java_cup.lalr_transition ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- * ------- */ ------- -------public class lalr_state { ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Constructor for building a state from a set of items. ------- * @param itms the set of items that makes up this state. ------- */ ------- public lalr_state(lalr_item_set itms) throws internal_error ------- { ------- /* don't allow null or duplicate item sets */ ------- if (itms == null) ------- throw new internal_error( ------- "Attempt to construct an LALR state from a null item set"); ------- ------- if (find_state(itms) != null) ------- throw new internal_error( ------- "Attempt to construct a duplicate LALR state"); ------- ------- /* assign a unique index */ ------- _index = next_index++; ------- ------- /* store the items */ ------- _items = itms; ------- ------- /* add to the global collection, keyed with its item set */ ------- _all.put(_items,this); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Collection of all states. */ ------- protected static Hashtable _all = new Hashtable(); ------- ------- /** Collection of all states. */ ------- public static Enumeration all() {return _all.elements();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Indicate total number of states there are. */ ------- public static int number() {return _all.size();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Hash table to find states by their kernels (i.e, the original, ------- * unclosed, set of items -- which uniquely define the state). This table ------- * stores state objects using (a copy of) their kernel item sets as keys. ------- */ ------- protected static Hashtable _all_kernels = new Hashtable(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Find and return state with a given a kernel item set (or null if not ------- * found). The kernel item set is the subset of items that were used to ------- * originally create the state. These items are formed by "shifting the ------- * dot" within items of other states that have a transition to this one. ------- * The remaining elements of this state's item set are added during closure. ------- * @param itms the kernel set of the state we are looking for. ------- */ ------- public static lalr_state find_state(lalr_item_set itms) ------- { ------- if (itms == null) ------- return null; ------- else ------- return (lalr_state)_all.get(itms); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Static counter for assigning unique state indexes. */ ------- protected static int next_index = 0; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The item set for this state. */ ------- protected lalr_item_set _items; ------- ------- /** The item set for this state. */ ------- public lalr_item_set items() {return _items;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** List of transitions out of this state. */ ------- protected lalr_transition _transitions = null; ------- ------- /** List of transitions out of this state. */ ------- public lalr_transition transitions() {return _transitions;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Index of this state in the parse tables */ ------- protected int _index; ------- ------- /** Index of this state in the parse tables */ ------- public int index() {return _index;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Static Methods ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Helper routine for debugging -- produces a dump of the given state ------- * onto System.out. ------- */ ------- protected static void dump_state(lalr_state st) throws internal_error ------- { ------- lalr_item_set itms; ------- lalr_item itm; ------- production_part part; ------- ------- if (st == null) ------- { ------- System.out.println("NULL lalr_state"); ------- return; ------- } ------- ------- System.out.println("lalr_state [" + st.index() + "] {"); ------- itms = st.items(); ------- for (Enumeration e = itms.all(); e.hasMoreElements(); ) ------- { ------- itm = (lalr_item)e.nextElement(); ------- System.out.print(" ["); ------- System.out.print(itm.the_production().lhs().the_symbol().name()); ------- System.out.print(" ::= "); ------- for (int i = 0; i ------- * [A ::= a b * X c, {d,e}] ------- * [B ::= a b * X d, {a,b}] ------- * ------- * in some state, then we would be making a transition under X to a new ------- * state. This new state would be formed by a "kernel" of items ------- * corresponding to moving the dot past the X. In this case:

-------   *    [A ::= a b X * c, {d,e}]
-------   *    [B ::= a b X * Y, {a,b}]
-------   *  
------- * The full state would then be formed by "closing" this kernel set of ------- * items so that it included items that represented productions of things ------- * the parser was now looking for. In this case we would items ------- * corresponding to productions of Y, since various forms of Y are expected ------- * next when in this state (see lalr_item_set.compute_closure() for details ------- * on closure).

------- * ------- * The process of building the viable prefix recognizer terminates when no ------- * new states can be added. However, in order to build a smaller number of ------- * states (i.e., corresponding to LALR rather than canonical LR) the state ------- * building process does not maintain full loookaheads in all items. ------- * Consequently, after the machine is built, we go back and propagate ------- * lookaheads through the constructed machine using a call to ------- * propagate_all_lookaheads(). This makes use of propagation links ------- * constructed during the closure and transition process. ------- * ------- * @param start_prod the start production of the grammar ------- * @see java_cup.lalr_item_set#compute_closure ------- * @see java_cup.lalr_state#propagate_all_lookaheads ------- */ ------- ------- public static lalr_state build_machine(production start_prod) ------- throws internal_error ------- { ------- lalr_state start_state; ------- lalr_item_set start_items; ------- lalr_item_set new_items; ------- lalr_item_set linked_items; ------- lalr_item_set kernel; ------- Stack work_stack = new Stack(); ------- lalr_state st, new_st; ------- symbol_set outgoing; ------- lalr_item itm, new_itm, existing, fix_itm; ------- symbol sym, sym2; ------- Enumeration i, s, fix; ------- ------- /* sanity check */ ------- if (start_prod == null) ------- throw new internal_error( ------- "Attempt to build viable prefix recognizer using a null production"); ------- ------- /* build item with dot at front of start production and EOF lookahead */ ------- start_items = new lalr_item_set(); ------- ------- itm = new lalr_item(start_prod); ------- itm.lookahead().add(terminal.EOF); ------- ------- start_items.add(itm); ------- ------- /* create copy the item set to form the kernel */ ------- kernel = new lalr_item_set(start_items); ------- ------- /* create the closure from that item set */ ------- start_items.compute_closure(); ------- ------- /* build a state out of that item set and put it in our work set */ ------- start_state = new lalr_state(start_items); ------- work_stack.push(start_state); ------- ------- /* enter the state using the kernel as the key */ ------- _all_kernels.put(kernel, start_state); ------- ------- /* continue looking at new states until we have no more work to do */ ------- while (!work_stack.empty()) ------- { ------- /* remove a state from the work set */ ------- st = (lalr_state)work_stack.pop(); ------- ------- /* gather up all the symbols that appear before dots */ ------- outgoing = new symbol_set(); ------- for (i = st.items().all(); i.hasMoreElements(); ) ------- { ------- itm = (lalr_item)i.nextElement(); ------- ------- /* add the symbol before the dot (if any) to our collection */ ------- sym = itm.symbol_after_dot(); ------- if (sym != null) outgoing.add(sym); ------- } ------- ------- /* now create a transition out for each individual symbol */ ------- for (s = outgoing.all(); s.hasMoreElements(); ) ------- { ------- sym = (symbol)s.nextElement(); ------- ------- /* will be keeping the set of items with propagate links */ ------- linked_items = new lalr_item_set(); ------- ------- /* gather up shifted versions of all the items that have this ------- symbol before the dot */ ------- new_items = new lalr_item_set(); ------- for (i = st.items().all(); i.hasMoreElements();) ------- { ------- itm = (lalr_item)i.nextElement(); ------- ------- /* if this is the symbol we are working on now, add to set */ ------- sym2 = itm.symbol_after_dot(); ------- if (sym.equals(sym2)) ------- { ------- /* add to the kernel of the new state */ ------- new_items.add(itm.shift()); ------- ------- /* remember that itm has propagate link to it */ ------- linked_items.add(itm); ------- } ------- } ------- ------- /* use new items as state kernel */ ------- kernel = new lalr_item_set(new_items); ------- ------- /* have we seen this one already? */ ------- new_st = (lalr_state)_all_kernels.get(kernel); ------- ------- /* if we haven't, build a new state out of the item set */ ------- if (new_st == null) ------- { ------- /* compute closure of the kernel for the full item set */ ------- new_items.compute_closure(); ------- ------- /* build the new state */ ------- new_st = new lalr_state(new_items); ------- ------- /* add the new state to our work set */ ------- work_stack.push(new_st); ------- ------- /* put it in our kernel table */ ------- _all_kernels.put(kernel, new_st); ------- } ------- /* otherwise relink propagation to items in existing state */ ------- else ------- { ------- /* walk through the items that have links to the new state */ ------- for (fix = linked_items.all(); fix.hasMoreElements(); ) ------- { ------- fix_itm = (lalr_item)fix.nextElement(); ------- ------- /* look at each propagate link out of that item */ ------- for (int l =0; l < fix_itm.propagate_items().size(); l++) ------- { ------- /* pull out item linked to in the new state */ ------- new_itm = ------- (lalr_item)fix_itm.propagate_items().elementAt(l); ------- ------- /* find corresponding item in the existing state */ ------- existing = new_st.items().find(new_itm); ------- ------- /* fix up the item so it points to the existing set */ ------- if (existing != null) ------- fix_itm.propagate_items().setElementAt(existing ,l); ------- } ------- } ------- } ------- ------- /* add a transition from current state to that state */ ------- st.add_transition(sym, new_st); ------- } ------- } ------- ------- /* all done building states */ ------- ------- /* propagate complete lookahead sets throughout the states */ ------- propagate_all_lookaheads(); ------- ------- return start_state; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Propagate lookahead sets out of this state. This recursively ------- * propagates to all items that have propagation links from some item ------- * in this state. ------- */ ------- protected void propagate_lookaheads() throws internal_error ------- { ------- /* recursively propagate out from each item in the state */ ------- for (Enumeration itm = items().all(); itm.hasMoreElements(); ) ------- ((lalr_item)itm.nextElement()).propagate_lookaheads(null); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Fill in the parse table entries for this state. There are two ------- * parse tables that encode the viable prefix recognition machine, an ------- * action table and a reduce-goto table. The rows in each table ------- * correspond to states of the machine. The columns of the action table ------- * are indexed by terminal symbols and correspond to either transitions ------- * out of the state (shift entries) or reductions from the state to some ------- * previous state saved on the stack (reduce entries). All entries in the ------- * action table that are not shifts or reduces, represent errors. The ------- * reduce-goto table is indexed by non terminals and represents transitions ------- * out of a state on that non-terminal.

------- * Conflicts occur if more than one action needs to go in one entry of the ------- * action table (this cannot happen with the reduce-goto table). Conflicts ------- * are resolved by always shifting for shift/reduce conflicts and choosing ------- * the lowest numbered production (hence the one that appeared first in ------- * the specification) in reduce/reduce conflicts. All conflicts are ------- * reported and if more conflicts are detected than were declared by the ------- * user, code generation is aborted. ------- * ------- * @param act_table the action table to put entries in. ------- * @param reduce_table the reduce-goto table to put entries in. ------- */ ------- public void build_table_entries( ------- parse_action_table act_table, ------- parse_reduce_table reduce_table) ------- throws internal_error ------- { ------- parse_action_row our_act_row; ------- parse_reduce_row our_red_row; ------- lalr_item itm; ------- parse_action act, other_act; ------- symbol sym; ------- terminal_set conflict_set = new terminal_set(); ------- ------- /* pull out our rows from the tables */ ------- our_act_row = act_table.under_state[index()]; ------- our_red_row = reduce_table.under_state[index()]; ------- ------- /* consider each item in our state */ ------- for (Enumeration i = items().all(); i.hasMoreElements(); ) ------- { ------- itm = (lalr_item)i.nextElement(); ------- ------- ------- /* if its completed (dot at end) then reduce under the lookahead */ ------- if (itm.dot_at_end()) ------- { ------- act = new reduce_action(itm.the_production()); ------- ------- /* consider each lookahead symbol */ ------- for (int t = 0; t < terminal.number(); t++) ------- { ------- /* skip over the ones not in the lookahead */ ------- if (!itm.lookahead().contains(t)) continue; ------- ------- /* if we don't already have an action put this one in */ ------- if (our_act_row.under_term[t].kind() == ------- parse_action.ERROR) ------- { ------- our_act_row.under_term[t] = act; ------- } ------- else ------- { ------- /* we now have at least one conflict */ ------- terminal term = terminal.find(t); ------- other_act = our_act_row.under_term[t]; ------- ------- /* if the other act was not a shift */ ------- if ((other_act.kind() != parse_action.SHIFT) && ------- (other_act.kind() != parse_action.NONASSOC)) ------- { ------- /* if we have lower index hence priority, replace it*/ ------- if (itm.the_production().index() < ------- ((reduce_action)other_act).reduce_with().index()) ------- { ------- /* replace the action */ ------- our_act_row.under_term[t] = act; ------- } ------- } else { ------- /* Check precedences,see if problem is correctable */ ------- if(fix_with_precedence(itm.the_production(), ------- t, our_act_row, act)) { ------- term = null; ------- } ------- } ------- if(term!=null) { ------- ------- conflict_set.add(term); ------- } ------- } ------- } ------- } ------- } ------- ------- /* consider each outgoing transition */ ------- for (lalr_transition trans=transitions(); trans!=null; trans=trans.next()) ------- { ------- /* if its on an terminal add a shift entry */ ------- sym = trans.on_symbol(); ------- if (!sym.is_non_term()) ------- { ------- act = new shift_action(trans.to_state()); ------- ------- /* if we don't already have an action put this one in */ ------- if ( our_act_row.under_term[sym.index()].kind() == ------- parse_action.ERROR) ------- { ------- our_act_row.under_term[sym.index()] = act; ------- } ------- else ------- { ------- /* we now have at least one conflict */ ------- production p = ((reduce_action)our_act_row.under_term[sym.index()]).reduce_with(); ------- ------- /* shift always wins */ ------- if (!fix_with_precedence(p, sym.index(), our_act_row, act)) { ------- our_act_row.under_term[sym.index()] = act; ------- conflict_set.add(terminal.find(sym.index())); ------- } ------- } ------- } ------- else ------- { ------- /* for non terminals add an entry to the reduce-goto table */ ------- our_red_row.under_non_term[sym.index()] = trans.to_state(); ------- } ------- } ------- ------- /* if we end up with conflict(s), report them */ ------- if (!conflict_set.empty()) ------- report_conflicts(conflict_set); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- ------- /** Procedure that attempts to fix a shift/reduce error by using ------- * precedences. --frankf 6/26/96 ------- * ------- * if a production (also called rule) or the lookahead terminal ------- * has a precedence, then the table can be fixed. if the rule ------- * has greater precedence than the terminal, a reduce by that rule ------- * in inserted in the table. If the terminal has a higher precedence, ------- * it is shifted. if they have equal precedence, then the associativity ------- * of the precedence is used to determine what to put in the table: ------- * if the precedence is left associative, the action is to reduce. ------- * if the precedence is right associative, the action is to shift. ------- * if the precedence is non associative, then it is a syntax error. ------- * ------- * @param p the production ------- * @param term_index the index of the lokahead terminal ------- * @param parse_action_row a row of the action table ------- * @param act the rule in conflict with the table entry ------- */ ------- ------- protected boolean fix_with_precedence( ------- production p, ------- int term_index, ------- parse_action_row table_row, ------- parse_action act) ------- ------- throws internal_error { ------- ------- terminal term = terminal.find(term_index); ------- ------- /* if the production has a precedence number, it can be fixed */ ------- if (p.precedence_num() > assoc.no_prec) { ------- ------- /* if production precedes terminal, put reduce in table */ ------- if (p.precedence_num() > term.precedence_num()) { ------- table_row.under_term[term_index] = ------- insert_reduce(table_row.under_term[term_index],act); ------- return true; ------- } ------- ------- /* if terminal precedes rule, put shift in table */ ------- else if (p.precedence_num() < term.precedence_num()) { ------- table_row.under_term[term_index] = ------- insert_shift(table_row.under_term[term_index],act); ------- return true; ------- } ------- else { /* they are == precedence */ ------- ------- /* equal precedences have equal sides, so only need to ------- look at one: if it is right, put shift in table */ ------- if (term.precedence_side() == assoc.right) { ------- table_row.under_term[term_index] = ------- insert_shift(table_row.under_term[term_index],act); ------- return true; ------- } ------- ------- /* if it is left, put reduce in table */ ------- else if (term.precedence_side() == assoc.left) { ------- table_row.under_term[term_index] = ------- insert_reduce(table_row.under_term[term_index],act); ------- return true; ------- } ------- ------- /* if it is nonassoc, we're not allowed to have two nonassocs ------- of equal precedence in a row, so put in NONASSOC */ ------- else if (term.precedence_side() == assoc.nonassoc) { ------- table_row.under_term[term_index] = new nonassoc_action(); ------- return true; ------- } else { ------- /* something really went wrong */ ------- throw new internal_error("Unable to resolve conflict correctly"); ------- } ------- } ------- } ------- /* check if terminal has precedence, if so, shift, since ------- rule does not have precedence */ ------- else if (term.precedence_num() > assoc.no_prec) { ------- table_row.under_term[term_index] = ------- insert_shift(table_row.under_term[term_index],act); ------- return true; ------- } ------- ------- /* otherwise, neither the rule nor the terminal has a precedence, ------- so it can't be fixed. */ ------- return false; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- ------- /* given two actions, and an action type, return the ------- action of that action type. give an error if they are of ------- the same action, because that should never have tried ------- to be fixed ------- ------- */ ------- protected parse_action insert_action( ------- parse_action a1, ------- parse_action a2, ------- int act_type) ------- throws internal_error ------- { ------- if ((a1.kind() == act_type) && (a2.kind() == act_type)) { ------- throw new internal_error("Conflict resolution of bogus actions"); ------- } else if (a1.kind() == act_type) { ------- return a1; ------- } else if (a2.kind() == act_type) { ------- return a2; ------- } else { ------- throw new internal_error("Conflict resolution of bogus actions"); ------- } ------- } ------- ------- /* find the shift in the two actions */ ------- protected parse_action insert_shift( ------- parse_action a1, ------- parse_action a2) ------- throws internal_error ------- { ------- return insert_action(a1, a2, parse_action.SHIFT); ------- } ------- ------- /* find the reduce in the two actions */ ------- protected parse_action insert_reduce( ------- parse_action a1, ------- parse_action a2) ------- throws internal_error ------- { ------- return insert_action(a1, a2, parse_action.REDUCE); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce warning messages for all conflicts found in this state. */ ------- protected void report_conflicts(terminal_set conflict_set) ------- throws internal_error ------- { ------- lalr_item itm, compare; ------- symbol shift_sym; ------- ------- boolean after_itm; ------- ------- /* consider each element */ ------- for (Enumeration itms = items().all(); itms.hasMoreElements(); ) ------- { ------- itm = (lalr_item)itms.nextElement(); ------- ------- /* clear the S/R conflict set for this item */ ------- ------- /* if it results in a reduce, it could be a conflict */ ------- if (itm.dot_at_end()) ------- { ------- /* not yet after itm */ ------- after_itm = false; ------- ------- /* compare this item against all others looking for conflicts */ ------- for (Enumeration comps = items().all(); comps.hasMoreElements(); ) ------- { ------- compare = (lalr_item)comps.nextElement(); ------- ------- /* if this is the item, next one is after it */ ------- if (itm == compare) after_itm = true; ------- ------- /* only look at it if its not the same item */ ------- if (itm != compare) ------- { ------- /* is it a reduce */ ------- if (compare.dot_at_end()) ------- { ------- /* only look at reduces after itm */ ------- if (after_itm) ------- /* does the comparison item conflict? */ ------- if (compare.lookahead().intersects(itm.lookahead())) ------- /* report a reduce/reduce conflict */ ------- report_reduce_reduce(itm, compare); ------- } ------- } ------- } ------- /* report S/R conflicts under all the symbols we conflict under */ ------- for (int t = 0; t < terminal.number(); t++) ------- if (conflict_set.contains(t)) ------- report_shift_reduce(itm,t); ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a warning message for one reduce/reduce conflict. ------- * ------- * @param itm1 first item in conflict. ------- * @param itm2 second item in conflict. ------- */ ------- protected void report_reduce_reduce(lalr_item itm1, lalr_item itm2) ------- throws internal_error ------- { ------- boolean comma_flag = false; ------- ------- System.err.println("*** Reduce/Reduce conflict found in state #"+index()); ------- System.err.print (" between "); ------- System.err.println(itm1.to_simple_string()); ------- System.err.print (" and "); ------- System.err.println(itm2.to_simple_string()); ------- System.err.print(" under symbols: {" ); ------- for (int t = 0; t < terminal.number(); t++) ------- { ------- if (itm1.lookahead().contains(t) && itm2.lookahead().contains(t)) ------- { ------- if (comma_flag) System.err.print(", "); else comma_flag = true; ------- System.err.print(terminal.find(t).name()); ------- } ------- } ------- System.err.println("}"); ------- System.err.print(" Resolved in favor of "); ------- if (itm1.the_production().index() < itm2.the_production().index()) ------- System.err.println("the first production.\n"); ------- else ------- System.err.println("the second production.\n"); ------- ------- /* count the conflict */ ------- emit.num_conflicts++; ------- lexer.warning_count++; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a warning message for one shift/reduce conflict. ------- * ------- * @param red_itm the item with the reduce. ------- * @param conflict_sym the index of the symbol conflict occurs under. ------- */ ------- protected void report_shift_reduce( ------- lalr_item red_itm, ------- int conflict_sym) ------- throws internal_error ------- { ------- lalr_item itm; ------- symbol shift_sym; ------- ------- /* emit top part of message including the reduce item */ ------- System.err.println("*** Shift/Reduce conflict found in state #"+index()); ------- System.err.print (" between "); ------- System.err.println(red_itm.to_simple_string()); ------- ------- /* find and report on all items that shift under our conflict symbol */ ------- for (Enumeration itms = items().all(); itms.hasMoreElements(); ) ------- { ------- itm = (lalr_item)itms.nextElement(); ------- ------- /* only look if its not the same item and not a reduce */ ------- if (itm != red_itm && !itm.dot_at_end()) ------- { ------- /* is it a shift on our conflicting terminal */ ------- shift_sym = itm.symbol_after_dot(); ------- if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym) ------- { ------- /* yes, report on it */ ------- System.err.println(" and " + itm.to_simple_string()); ------- } ------- } ------- } ------- System.err.println(" under symbol "+ terminal.find(conflict_sym).name()); ------- System.err.println(" Resolved in favor of shifting.\n"); ------- ------- /* count the conflict */ ------- emit.num_conflicts++; ------- lexer.warning_count++; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(lalr_state other) ------- { ------- /* we are equal if our item sets are equal */ ------- return other != null && items().equals(other.items()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof lalr_state)) ------- return false; ------- else ------- return equals((lalr_state)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a hash code. */ ------- public int hashCode() ------- { ------- /* just use the item set hash code */ ------- return items().hashCode(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- String result; ------- lalr_transition tr; ------- ------- /* dump the item set */ ------- result = "lalr_state [" + index() + "]: " + _items + "\n"; ------- ------- /* do the transitions */ ------- for (tr = transitions(); tr != null; tr = tr.next()) ------- { ------- result += tr; ------- result += "\n"; ------- } ------- ------- return result; ------- } ------- ------- /*-----------------------------------------------------------*/ -------} diff --cc Robust/cup/java_cup/lalr_transition.class index 4d33e8dd,4d33e8dd,4d33e8dd,4d33e8dd,4d33e8dd,4d33e8dd,4d33e8dd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/lalr_transition.java index 1c941bd9,1c941bd9,1c941bd9,1c941bd9,1c941bd9,1c941bd9,1c941bd9..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/lalr_transition.java +++ /dev/null @@@@@@@@ -1,93 -1,93 -1,93 -1,93 -1,93 -1,93 -1,93 +1,0 @@@@@@@@ -------package java_cup; ------- -------/** This class represents a transition in an LALR viable prefix recognition ------- * machine. Transitions can be under terminals for non-terminals. They are ------- * internally linked together into singly linked lists containing all the ------- * transitions out of a single state via the _next field. ------- * ------- * @see java_cup.lalr_state ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- * ------- */ -------public class lalr_transition { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param on_sym symbol we are transitioning on. ------- * @param to_st state we transition to. ------- * @param nxt next transition in linked list. ------- */ ------- public lalr_transition(symbol on_sym, lalr_state to_st, lalr_transition nxt) ------- throws internal_error ------- { ------- /* sanity checks */ ------- if (on_sym == null) ------- throw new internal_error("Attempt to create transition on null symbol"); ------- if (to_st == null) ------- throw new internal_error("Attempt to create transition to null state"); ------- ------- /* initialize */ ------- _on_symbol = on_sym; ------- _to_state = to_st; ------- _next = nxt; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with null next. ------- * @param on_sym symbol we are transitioning on. ------- * @param to_st state we transition to. ------- */ ------- public lalr_transition(symbol on_sym, lalr_state to_st) throws internal_error ------- { ------- this(on_sym, to_st, null); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The symbol we make the transition on. */ ------- protected symbol _on_symbol; ------- ------- /** The symbol we make the transition on. */ ------- public symbol on_symbol() {return _on_symbol;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The state we transition to. */ ------- protected lalr_state _to_state; ------- ------- /** The state we transition to. */ ------- public lalr_state to_state() {return _to_state;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Next transition in linked list of transitions out of a state */ ------- protected lalr_transition _next; ------- ------- /** Next transition in linked list of transitions out of a state */ ------- public lalr_transition next() {return _next;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- String result; ------- ------- result = "transition on " + on_symbol().name() + " to state ["; ------- result += _to_state.index(); ------- result += "]"; ------- ------- return result; ------- } ------- ------- /*-----------------------------------------------------------*/ -------} diff --cc Robust/cup/java_cup/lexer.class index e633ff28,e633ff28,e633ff28,e633ff28,e633ff28,e633ff28,e633ff28..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/lexer.java index 2230d123,2230d123,2230d123,2230d123,2230d123,2230d123,2230d123..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/lexer.java +++ /dev/null @@@@@@@@ -1,543 -1,543 -1,543 -1,543 -1,543 -1,543 -1,543 +1,0 @@@@@@@@ -------package java_cup; ------- -------import java_cup.runtime.Symbol; -------import java.util.Hashtable; ------- -------/** This class implements a small scanner (aka lexical analyzer or lexer) for ------- * the JavaCup specification. This scanner reads characters from standard ------- * input (System.in) and returns integers corresponding to the terminal ------- * number of the next Symbol. Once end of input is reached the EOF Symbol is ------- * returned on every subsequent call.

------- * Symbols currently returned include:

------- *    Symbol        Constant Returned     Symbol        Constant Returned
------- *    ------        -----------------     ------        -----------------
------- *    "package"     PACKAGE               "import"      IMPORT 
------- *    "code"        CODE                  "action"      ACTION 
------- *    "parser"      PARSER                "terminal"    TERMINAL
------- *    "non"         NON                   "init"        INIT 
------- *    "scan"        SCAN                  "with"        WITH
------- *    "start"       START                 "precedence"  PRECEDENCE
------- *    "left"        LEFT		  "right"       RIGHT
------- *    "nonassoc"    NONASSOC		  "%prec        PRECENT_PREC  
------- *      [           LBRACK                  ]           RBRACK
------- *      ;           SEMI 
------- *      ,           COMMA                   *           STAR 
------- *      .           DOT                     :           COLON
------- *      ::=         COLON_COLON_EQUALS      |           BAR
------- *    identifier    ID                    {:...:}       CODE_STRING
------- *    "nonterminal" NONTERMINAL
------- *  
------- * All symbol constants are defined in sym.java which is generated by ------- * JavaCup from parser.cup.

------- * ------- * In addition to the scanner proper (called first via init() then with ------- * next_token() to get each Symbol) this class provides simple error and ------- * warning routines and keeps a count of errors and warnings that is ------- * publicly accessible.

------- * ------- * This class is "static" (i.e., it has only static members and methods). ------- * ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ -------public class lexer { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The only constructor is private, so no instances can be created. */ ------- private lexer() { } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Static (Class) Variables ------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** First character of lookahead. */ ------- protected static int next_char; ------- ------- /** Second character of lookahead. */ ------- protected static int next_char2; ------- ------- /** Second character of lookahead. */ ------- protected static int next_char3; ------- ------- /** Second character of lookahead. */ ------- protected static int next_char4; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** EOF constant. */ ------- protected static final int EOF_CHAR = -1; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Table of keywords. Keywords are initially treated as identifiers. ------- * Just before they are returned we look them up in this table to see if ------- * they match one of the keywords. The string of the name is the key here, ------- * which indexes Integer objects holding the symbol number. ------- */ ------- protected static Hashtable keywords = new Hashtable(23); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Table of single character symbols. For ease of implementation, we ------- * store all unambiguous single character Symbols in this table of Integer ------- * objects keyed by Integer objects with the numerical value of the ------- * appropriate char (currently Character objects have a bug which precludes ------- * their use in tables). ------- */ ------- protected static Hashtable char_symbols = new Hashtable(11); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Current line number for use in error messages. */ ------- protected static int current_line = 1; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Character position in current line. */ ------- protected static int current_position = 1; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Character position in current line. */ ------- protected static int absolute_position = 1; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of total errors detected so far. */ ------- public static int error_count = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of warnings issued so far */ ------- public static int warning_count = 0; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Static Methods ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Initialize the scanner. This sets up the keywords and char_symbols ------- * tables and reads the first two characters of lookahead. ------- */ ------- public static void init() throws java.io.IOException ------- { ------- /* set up the keyword table */ ------- keywords.put("package", new Integer(sym.PACKAGE)); ------- keywords.put("import", new Integer(sym.IMPORT)); ------- keywords.put("code", new Integer(sym.CODE)); ------- keywords.put("action", new Integer(sym.ACTION)); ------- keywords.put("parser", new Integer(sym.PARSER)); ------- keywords.put("terminal", new Integer(sym.TERMINAL)); ------- keywords.put("non", new Integer(sym.NON)); ------- keywords.put("nonterminal",new Integer(sym.NONTERMINAL));// [CSA] ------- keywords.put("init", new Integer(sym.INIT)); ------- keywords.put("scan", new Integer(sym.SCAN)); ------- keywords.put("with", new Integer(sym.WITH)); ------- keywords.put("start", new Integer(sym.START)); ------- keywords.put("precedence", new Integer(sym.PRECEDENCE)); ------- keywords.put("left", new Integer(sym.LEFT)); ------- keywords.put("right", new Integer(sym.RIGHT)); ------- keywords.put("nonassoc", new Integer(sym.NONASSOC)); ------- ------- /* set up the table of single character symbols */ ------- char_symbols.put(new Integer(';'), new Integer(sym.SEMI)); ------- char_symbols.put(new Integer(','), new Integer(sym.COMMA)); ------- char_symbols.put(new Integer('*'), new Integer(sym.STAR)); ------- char_symbols.put(new Integer('.'), new Integer(sym.DOT)); ------- char_symbols.put(new Integer('|'), new Integer(sym.BAR)); ------- char_symbols.put(new Integer('['), new Integer(sym.LBRACK)); ------- char_symbols.put(new Integer(']'), new Integer(sym.RBRACK)); ------- ------- /* read two characters of lookahead */ ------- next_char = System.in.read(); ------- if (next_char == EOF_CHAR) { ------- next_char2 = EOF_CHAR; ------- next_char3 = EOF_CHAR; ------- next_char4 = EOF_CHAR; ------- } else { ------- next_char2 = System.in.read(); ------- if (next_char2 == EOF_CHAR) { ------- next_char3 = EOF_CHAR; ------- next_char4 = EOF_CHAR; ------- } else { ------- next_char3 = System.in.read(); ------- if (next_char3 == EOF_CHAR) { ------- next_char4 = EOF_CHAR; ------- } else { ------- next_char4 = System.in.read(); ------- } ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Advance the scanner one character in the input stream. This moves ------- * next_char2 to next_char and then reads a new next_char2. ------- */ ------- protected static void advance() throws java.io.IOException ------- { ------- int old_char; ------- ------- old_char = next_char; ------- next_char = next_char2; ------- if (next_char == EOF_CHAR) { ------- next_char2 = EOF_CHAR; ------- next_char3 = EOF_CHAR; ------- next_char4 = EOF_CHAR; ------- } else { ------- next_char2 = next_char3; ------- if (next_char2 == EOF_CHAR) { ------- next_char3 = EOF_CHAR; ------- next_char4 = EOF_CHAR; ------- } else { ------- next_char3 = next_char4; ------- if (next_char3 == EOF_CHAR) { ------- next_char4 = EOF_CHAR; ------- } else { ------- next_char4 = System.in.read(); ------- } ------- } ------- } ------- ------- /* count this */ ------- absolute_position++; ------- current_position++; ------- if (old_char == '\n' || (old_char == '\r' && next_char!='\n')) ------- { ------- current_line++; ------- current_position = 1; ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit an error message. The message will be marked with both the ------- * current line number and the position in the line. Error messages ------- * are printed on standard error (System.err). ------- * @param message the message to print. ------- */ ------- public static void emit_error(String message) ------- { ------- System.err.println("Error at " + current_line + "(" + current_position + ------- "): " + message); ------- error_count++; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Emit a warning message. The message will be marked with both the ------- * current line number and the position in the line. Messages are ------- * printed on standard error (System.err). ------- * @param message the message to print. ------- */ ------- public static void emit_warn(String message) ------- { ------- System.err.println("Warning at " + current_line + "(" + current_position + ------- "): " + message); ------- warning_count++; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if a character is ok to start an id. ------- * @param ch the character in question. ------- */ ------- protected static boolean id_start_char(int ch) ------- { ------- /* allow for % in identifiers. a hack to allow my ------- %prec in. Should eventually make lex spec for this ------- frankf */ ------- return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ------- (ch == '_'); ------- ------- // later need to deal with non-8-bit chars here ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if a character is ok for the middle of an id. ------- * @param ch the character in question. ------- */ ------- protected static boolean id_char(int ch) ------- { ------- return id_start_char(ch) || (ch >= '0' && ch <= '9'); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Try to look up a single character symbol, returns -1 for not found. ------- * @param ch the character in question. ------- */ ------- protected static int find_single_char(int ch) ------- { ------- Integer result; ------- ------- result = (Integer)char_symbols.get(new Integer((char)ch)); ------- if (result == null) ------- return -1; ------- else ------- return result.intValue(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Handle swallowing up a comment. Both old style C and new style C++ ------- * comments are handled. ------- */ ------- protected static void swallow_comment() throws java.io.IOException ------- { ------- /* next_char == '/' at this point */ ------- ------- /* is it a traditional comment */ ------- if (next_char2 == '*') ------- { ------- /* swallow the opener */ ------- advance(); advance(); ------- ------- /* swallow the comment until end of comment or EOF */ ------- for (;;) ------- { ------- /* if its EOF we have an error */ ------- if (next_char == EOF_CHAR) ------- { ------- emit_error("Specification file ends inside a comment"); ------- return; ------- } ------- ------- /* if we can see the closer we are done */ ------- if (next_char == '*' && next_char2 == '/') ------- { ------- advance(); ------- advance(); ------- return; ------- } ------- ------- /* otherwise swallow char and move on */ ------- advance(); ------- } ------- } ------- ------- /* is its a new style comment */ ------- if (next_char2 == '/') ------- { ------- /* swallow the opener */ ------- advance(); advance(); ------- ------- /* swallow to '\n', '\r', '\f', or EOF */ ------- while (next_char != '\n' && next_char != '\r' && ------- next_char != '\f' && next_char!=EOF_CHAR) ------- advance(); ------- ------- return; ------- ------- } ------- ------- /* shouldn't get here, but... if we get here we have an error */ ------- emit_error("Malformed comment in specification -- ignored"); ------- advance(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Swallow up a code string. Code strings begin with "{:" and include ------- all characters up to the first occurrence of ":}" (there is no way to ------- include ":}" inside a code string). The routine returns a String ------- object suitable for return by the scanner. ------- */ ------- protected static Symbol do_code_string() throws java.io.IOException ------- { ------- StringBuffer result = new StringBuffer(); ------- ------- /* at this point we have lookahead of "{:" -- swallow that */ ------- advance(); advance(); ------- ------- /* save chars until we see ":}" */ ------- while (!(next_char == ':' && next_char2 == '}')) ------- { ------- /* if we have run off the end issue a message and break out of loop */ ------- if (next_char == EOF_CHAR) ------- { ------- emit_error("Specification file ends inside a code string"); ------- break; ------- } ------- ------- /* otherwise record the char and move on */ ------- result.append(new Character((char)next_char)); ------- advance(); ------- } ------- ------- /* advance past the closer and build a return Symbol */ ------- advance(); advance(); ------- return new Symbol(sym.CODE_STRING, result.toString()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Process an identifier. Identifiers begin with a letter, underscore, ------- * or dollar sign, which is followed by zero or more letters, numbers, ------- * underscores or dollar signs. This routine returns a String suitable ------- * for return by the scanner. ------- */ ------- protected static Symbol do_id() throws java.io.IOException ------- { ------- StringBuffer result = new StringBuffer(); ------- String result_str; ------- Integer keyword_num; ------- char buffer[] = new char[1]; ------- ------- /* next_char holds first character of id */ ------- buffer[0] = (char)next_char; ------- result.append(buffer,0,1); ------- advance(); ------- ------- /* collect up characters while they fit in id */ ------- while(id_char(next_char)) ------- { ------- buffer[0] = (char)next_char; ------- result.append(buffer,0,1); ------- advance(); ------- } ------- ------- /* extract a string and try to look it up as a keyword */ ------- result_str = result.toString(); ------- keyword_num = (Integer)keywords.get(result_str); ------- ------- /* if we found something, return that keyword */ ------- if (keyword_num != null) ------- return new Symbol(keyword_num.intValue()); ------- ------- /* otherwise build and return an id Symbol with an attached string */ ------- return new Symbol(sym.ID, result_str); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return one Symbol. This is the main external interface to the scanner. ------- * It consumes sufficient characters to determine the next input Symbol ------- * and returns it. To help with debugging, this routine actually calls ------- * real_next_token() which does the work. If you need to debug the ------- * parser, this can be changed to call debug_next_token() which prints ------- * a debugging message before returning the Symbol. ------- */ ------- public static Symbol next_token() throws java.io.IOException ------- { ------- return real_next_token(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Debugging version of next_token(). This routine calls the real scanning ------- * routine, prints a message on System.out indicating what the Symbol is, ------- * then returns it. ------- */ ------- public static Symbol debug_next_token() throws java.io.IOException ------- { ------- Symbol result = real_next_token(); ------- System.out.println("# next_Symbol() => " + result.sym); ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The actual routine to return one Symbol. This is normally called from ------- * next_token(), but for debugging purposes can be called indirectly from ------- * debug_next_token(). ------- */ ------- protected static Symbol real_next_token() throws java.io.IOException ------- { ------- int sym_num; ------- ------- for (;;) ------- { ------- /* look for white space */ ------- if (next_char == ' ' || next_char == '\t' || next_char == '\n' || ------- next_char == '\f' || next_char == '\r') ------- { ------- /* advance past it and try the next character */ ------- advance(); ------- continue; ------- } ------- ------- /* look for a single character symbol */ ------- sym_num = find_single_char(next_char); ------- if (sym_num != -1) ------- { ------- /* found one -- advance past it and return a Symbol for it */ ------- advance(); ------- return new Symbol(sym_num); ------- } ------- ------- /* look for : or ::= */ ------- if (next_char == ':') ------- { ------- /* if we don't have a second ':' return COLON */ ------- if (next_char2 != ':') ------- { ------- advance(); ------- return new Symbol(sym.COLON); ------- } ------- ------- /* move forward and look for the '=' */ ------- advance(); ------- if (next_char2 == '=') ------- { ------- advance(); advance(); ------- return new Symbol(sym.COLON_COLON_EQUALS); ------- } ------- else ------- { ------- /* return just the colon (already consumed) */ ------- return new Symbol(sym.COLON); ------- } ------- } ------- ------- /* find a "%prec" string and return it. otherwise, a '%' was found, ------- which has no right being in the specification otherwise */ ------- if (next_char == '%') { ------- advance(); ------- if ((next_char == 'p') && (next_char2 == 'r') && (next_char3 == 'e') && ------- (next_char4 == 'c')) { ------- advance(); ------- advance(); ------- advance(); ------- advance(); ------- return new Symbol(sym.PERCENT_PREC); ------- } else { ------- emit_error("Found extraneous percent sign"); ------- } ------- } ------- ------- /* look for a comment */ ------- if (next_char == '/' && (next_char2 == '*' || next_char2 == '/')) ------- { ------- /* swallow then continue the scan */ ------- swallow_comment(); ------- continue; ------- } ------- ------- /* look for start of code string */ ------- if (next_char == '{' && next_char2 == ':') ------- return do_code_string(); ------- ------- /* look for an id or keyword */ ------- if (id_start_char(next_char)) return do_id(); ------- ------- /* look for EOF */ ------- if (next_char == EOF_CHAR) return new Symbol(sym.EOF); ------- ------- /* if we get here, we have an unrecognized character */ ------- emit_warn("Unrecognized character '" + ------- new Character((char)next_char) + "'(" + next_char + ------- ") -- ignored"); ------- ------- /* advance past it */ ------- advance(); ------- } ------- } ------- ------- /*-----------------------------------------------------------*/ -------} ------- diff --cc Robust/cup/java_cup/lr_item_core.class index e5988e7f,e5988e7f,e5988e7f,e5988e7f,e5988e7f,e5988e7f,e5988e7f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/lr_item_core.java index c0fa656a,c0fa656a,c0fa656a,c0fa656a,c0fa656a,c0fa656a,c0fa656a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/lr_item_core.java +++ /dev/null @@@@@@@@ -1,280 -1,280 -1,280 -1,280 -1,280 -1,280 -1,280 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** The "core" of an LR item. This includes a production and the position ------- * of a marker (the "dot") within the production. Typically item cores ------- * are written using a production with an embedded "dot" to indicate their ------- * position. For example:

------- *     A ::= B * C d E
------- *  
------- * This represents a point in a parse where the parser is trying to match ------- * the given production, and has succeeded in matching everything before the ------- * "dot" (and hence is expecting to see the symbols after the dot next). See ------- * lalr_item, lalr_item_set, and lalr_start for full details on the meaning ------- * and use of items. ------- * ------- * @see java_cup.lalr_item ------- * @see java_cup.lalr_item_set ------- * @see java_cup.lalr_state ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson -------*/ ------- -------public class lr_item_core { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param prod production this item uses. ------- * @param pos position of the "dot" within the item. ------- */ ------- public lr_item_core(production prod, int pos) throws internal_error ------- { ------- symbol after_dot = null; ------- production_part part; ------- ------- if (prod == null) ------- throw new internal_error( ------- "Attempt to create an lr_item_core with a null production"); ------- ------- _the_production = prod; ------- ------- if (pos < 0 || pos > _the_production.rhs_length()) ------- throw new internal_error( ------- "Attempt to create an lr_item_core with a bad dot position"); ------- ------- _dot_pos = pos; ------- ------- /* compute and cache hash code now */ ------- _core_hash_cache = 13*_the_production.hashCode() + pos; ------- ------- /* cache the symbol after the dot */ ------- if (_dot_pos < _the_production.rhs_length()) ------- { ------- part = _the_production.rhs(_dot_pos); ------- if (!part.is_action()) ------- _symbol_after_dot = ((symbol_part)part).the_symbol(); ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor for dot at start of right hand side. ------- * @param prod production this item uses. ------- */ ------- public lr_item_core(production prod) throws internal_error ------- { ------- this(prod,0); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The production for the item. */ ------- protected production _the_production; ------- ------- /** The production for the item. */ ------- public production the_production() {return _the_production;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The position of the "dot" -- this indicates the part of the production ------- * that the marker is before, so 0 indicates a dot at the beginning of ------- * the RHS. ------- */ ------- protected int _dot_pos; ------- ------- /** The position of the "dot" -- this indicates the part of the production ------- * that the marker is before, so 0 indicates a dot at the beginning of ------- * the RHS. ------- */ ------- public int dot_pos() {return _dot_pos;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Cache of the hash code. */ ------- protected int _core_hash_cache; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Cache of symbol after the dot. */ ------- protected symbol _symbol_after_dot = null; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Is the dot at the end of the production? */ ------- public boolean dot_at_end() ------- { ------- return _dot_pos >= _the_production.rhs_length(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return the symbol after the dot. If there is no symbol after the dot ------- * we return null. */ ------- public symbol symbol_after_dot() ------- { ------- /* use the cached symbol */ ------- return _symbol_after_dot; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if we have a dot before a non terminal, and if so which one ------- * (return null or the non terminal). ------- */ ------- public non_terminal dot_before_nt() ------- { ------- symbol sym; ------- ------- /* get the symbol after the dot */ ------- sym = symbol_after_dot(); ------- ------- /* if it exists and is a non terminal, return it */ ------- if (sym != null && sym.is_non_term()) ------- return (non_terminal)sym; ------- else ------- return null; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a new lr_item_core that results from shifting the dot one ------- * position to the right. ------- */ ------- public lr_item_core shift_core() throws internal_error ------- { ------- if (dot_at_end()) ------- throw new internal_error( ------- "Attempt to shift past end of an lr_item_core"); ------- ------- return new lr_item_core(_the_production, _dot_pos+1); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison for the core only. This is separate out because we ------- * need separate access in a super class. ------- */ ------- public boolean core_equals(lr_item_core other) ------- { ------- return other != null && ------- _the_production.equals(other._the_production) && ------- _dot_pos == other._dot_pos; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(lr_item_core other) {return core_equals(other);} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof lr_item_core)) ------- return false; ------- else ------- return equals((lr_item_core)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Hash code for the core (separated so we keep non overridden version). */ ------- public int core_hashCode() ------- { ------- return _core_hash_cache; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Hash code for the item. */ ------- public int hashCode() ------- { ------- return _core_hash_cache; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return the hash code that object would have provided for us so we have ------- * a (nearly) unique id for debugging. ------- */ ------- protected int obj_hash() ------- { ------- return super.hashCode(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string (separated out from toString() so we can call it ------- * from subclass that overrides toString()). ------- */ ------- public String to_simple_string() throws internal_error ------- { ------- String result; ------- production_part part; ------- ------- if (_the_production.lhs() != null && ------- _the_production.lhs().the_symbol() != null && ------- _the_production.lhs().the_symbol().name() != null) ------- result = _the_production.lhs().the_symbol().name(); ------- else ------- result = "$$NULL$$"; ------- ------- result += " ::= "; ------- ------- for (int i = 0; i<_the_production.rhs_length(); i++) ------- { ------- /* do we need the dot before this one? */ ------- if (i == _dot_pos) ------- result += "(*) "; ------- ------- /* print the name of the part */ ------- if (_the_production.rhs(i) == null) ------- { ------- result += "$$NULL$$ "; ------- } ------- else ------- { ------- part = _the_production.rhs(i); ------- if (part == null) ------- result += "$$NULL$$ "; ------- else if (part.is_action()) ------- result += "{ACTION} "; ------- else if (((symbol_part)part).the_symbol() != null && ------- ((symbol_part)part).the_symbol().name() != null) ------- result += ((symbol_part)part).the_symbol().name() + " "; ------- else ------- result += "$$NULL$$ "; ------- } ------- } ------- ------- /* put the dot after if needed */ ------- if (_dot_pos == _the_production.rhs_length()) ------- result += "(*) "; ------- ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string */ ------- public String toString() ------- { ------- /* can't throw here since super class doesn't, so we crash instead */ ------- try { ------- return to_simple_string(); ------- } catch(internal_error e) { ------- e.crash(); ------- return null; ------- } ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} ------- diff --cc Robust/cup/java_cup/non_terminal.class index 88d8183d,88d8183d,88d8183d,88d8183d,88d8183d,88d8183d,88d8183d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/non_terminal.java index 9354a7fa,9354a7fa,9354a7fa,9354a7fa,9354a7fa,9354a7fa,9354a7fa..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/non_terminal.java +++ /dev/null @@@@@@@@ -1,301 -1,301 -1,301 -1,301 -1,301 -1,301 -1,301 +1,0 @@@@@@@@ -------package java_cup; ------- -------import java.util.Hashtable; -------import java.util.Enumeration; ------- -------/** This class represents a non-terminal symbol in the grammar. Each ------- * non terminal has a textual name, an index, and a string which indicates ------- * the type of object it will be implemented with at runtime (i.e. the class ------- * of object that will be pushed on the parse stack to represent it). ------- * ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ ------- -------public class non_terminal extends symbol { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param nm the name of the non terminal. ------- * @param tp the type string for the non terminal. ------- */ ------- public non_terminal(String nm, String tp) ------- { ------- /* super class does most of the work */ ------- super(nm, tp); ------- ------- /* add to set of all non terminals and check for duplicates */ ------- Object conflict = _all.put(nm,this); ------- if (conflict != null) ------- // can't throw an exception here because these are used in static ------- // initializers, so we crash instead ------- // was: ------- // throw new internal_error("Duplicate non-terminal ("+nm+") created"); ------- (new internal_error("Duplicate non-terminal ("+nm+") created")).crash(); ------- ------- /* assign a unique index */ ------- _index = next_index++; ------- ------- /* add to by_index set */ ------- _all_by_index.put(new Integer(_index), this); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with default type. ------- * @param nm the name of the non terminal. ------- */ ------- public non_terminal(String nm) ------- { ------- this(nm, null); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Table of all non-terminals -- elements are stored using name strings ------- * as the key ------- */ ------- protected static Hashtable _all = new Hashtable(); ------- ------- /** Access to all non-terminals. */ ------- public static Enumeration all() {return _all.elements();} ------- ------- /** lookup a non terminal by name string */ ------- public static non_terminal find(String with_name) ------- { ------- if (with_name == null) ------- return null; ------- else ------- return (non_terminal)_all.get(with_name); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Table of all non terminals indexed by their index number. */ ------- protected static Hashtable _all_by_index = new Hashtable(); ------- ------- /** Lookup a non terminal by index. */ ------- public static non_terminal find(int indx) ------- { ------- Integer the_indx = new Integer(indx); ------- ------- return (non_terminal)_all_by_index.get(the_indx); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Total number of non-terminals. */ ------- public static int number() {return _all.size();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Static counter to assign unique indexes. */ ------- protected static int next_index = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Static counter for creating unique non-terminal names */ ------- static protected int next_nt = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** special non-terminal for start symbol */ ------- public static final non_terminal START_nt = new non_terminal("$START"); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** flag non-terminals created to embed action productions */ ------- public boolean is_embedded_action = false; /* added 24-Mar-1998, CSA */ ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Static Methods ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Method for creating a new uniquely named hidden non-terminal using ------- * the given string as a base for the name (or "NT$" if null is passed). ------- * @param prefix base name to construct unique name from. ------- */ ------- static non_terminal create_new(String prefix) throws internal_error ------- { ------- if (prefix == null) prefix = "NT$"; ------- return new non_terminal(prefix + next_nt++); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** static routine for creating a new uniquely named hidden non-terminal */ ------- static non_terminal create_new() throws internal_error ------- { ------- return create_new(null); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute nullability of all non-terminals. */ ------- public static void compute_nullability() throws internal_error ------- { ------- boolean change = true; ------- non_terminal nt; ------- Enumeration e; ------- production prod; ------- ------- /* repeat this process until there is no change */ ------- while (change) ------- { ------- /* look for a new change */ ------- change = false; ------- ------- /* consider each non-terminal */ ------- for (e=all(); e.hasMoreElements(); ) ------- { ------- nt = (non_terminal)e.nextElement(); ------- ------- /* only look at things that aren't already marked nullable */ ------- if (!nt.nullable()) ------- { ------- if (nt.looks_nullable()) ------- { ------- nt._nullable = true; ------- change = true; ------- } ------- } ------- } ------- } ------- ------- /* do one last pass over the productions to finalize all of them */ ------- for (e=production.all(); e.hasMoreElements(); ) ------- { ------- prod = (production)e.nextElement(); ------- prod.set_nullable(prod.check_nullable()); ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute first sets for all non-terminals. This assumes nullability has ------- * already computed. ------- */ ------- public static void compute_first_sets() throws internal_error ------- { ------- boolean change = true; ------- Enumeration n; ------- Enumeration p; ------- non_terminal nt; ------- production prod; ------- terminal_set prod_first; ------- ------- /* repeat this process until we have no change */ ------- while (change) ------- { ------- /* look for a new change */ ------- change = false; ------- ------- /* consider each non-terminal */ ------- for (n = all(); n.hasMoreElements(); ) ------- { ------- nt = (non_terminal)n.nextElement(); ------- ------- /* consider every production of that non terminal */ ------- for (p = nt.productions(); p.hasMoreElements(); ) ------- { ------- prod = (production)p.nextElement(); ------- ------- /* get the updated first of that production */ ------- prod_first = prod.check_first_set(); ------- ------- /* if this going to add anything, add it */ ------- if (!prod_first.is_subset_of(nt._first_set)) ------- { ------- change = true; ------- nt._first_set.add(prod_first); ------- } ------- } ------- } ------- } ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Table of all productions with this non terminal on the LHS. */ ------- protected Hashtable _productions = new Hashtable(11); ------- ------- /** Access to productions with this non terminal on the LHS. */ ------- public Enumeration productions() {return _productions.elements();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Total number of productions with this non terminal on the LHS. */ ------- public int num_productions() {return _productions.size();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add a production to our set of productions. */ ------- public void add_production(production prod) throws internal_error ------- { ------- /* catch improper productions */ ------- if (prod == null || prod.lhs() == null || prod.lhs().the_symbol() != this) ------- throw new internal_error( ------- "Attempt to add invalid production to non terminal production table"); ------- ------- /* add it to the table, keyed with itself */ ------- _productions.put(prod,prod); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Nullability of this non terminal. */ ------- protected boolean _nullable; ------- ------- /** Nullability of this non terminal. */ ------- public boolean nullable() {return _nullable;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** First set for this non-terminal. */ ------- protected terminal_set _first_set = new terminal_set(); ------- ------- /** First set for this non-terminal. */ ------- public terminal_set first_set() {return _first_set;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Indicate that this symbol is a non-terminal. */ ------- public boolean is_non_term() ------- { ------- return true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Test to see if this non terminal currently looks nullable. */ ------- protected boolean looks_nullable() throws internal_error ------- { ------- /* look and see if any of the productions now look nullable */ ------- for (Enumeration e = productions(); e.hasMoreElements(); ) ------- /* if the production can go to empty, we are nullable */ ------- if (((production)e.nextElement()).check_nullable()) ------- return true; ------- ------- /* none of the productions can go to empty, so we are not nullable */ ------- return false; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** convert to string */ ------- public String toString() ------- { ------- return super.toString() + "[" + index() + "]" + (nullable() ? "*" : ""); ------- } ------- ------- /*-----------------------------------------------------------*/ -------} diff --cc Robust/cup/java_cup/nonassoc_action.class index fcb75a76,fcb75a76,fcb75a76,fcb75a76,fcb75a76,fcb75a76,fcb75a76..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/nonassoc_action.java index 38823244,38823244,38823244,38823244,38823244,38823244,38823244..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/nonassoc_action.java +++ /dev/null @@@@@@@@ -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class represents a shift/reduce nonassociative error within the ------- * parse table. If action_table element is assign to type ------- * nonassoc_action, it cannot be changed, and signifies that there ------- * is a conflict between shifting and reducing a production and a ------- * terminal that shouldn't be next to each other. ------- * ------- * @version last updated: 7/2/96 ------- * @author Frank Flannery ------- */ -------public class nonassoc_action extends parse_action { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. ------- */ ------- public nonassoc_action() throws internal_error ------- { ------- /* don't need to set anything, since it signifies error */ ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Quick access to type of action. */ ------- public int kind() {return NONASSOC;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality test. */ ------- public boolean equals(parse_action other) ------- { ------- return other != null && other.kind() == NONASSOC; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality test. */ ------- public boolean equals(Object other) ------- { ------- if (other instanceof parse_action) ------- return equals((parse_action)other); ------- else ------- return false; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute a hash code. */ ------- public int hashCode() ------- { ------- /* all objects of this class hash together */ ------- return 0xCafe321; ------- } ------- ------- ------- ------- /** Convert to string. */ ------- public String toString() ------- { ------- return "NONASSOC"; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/parse_action.class index 63c0ffa8,63c0ffa8,63c0ffa8,63c0ffa8,63c0ffa8,63c0ffa8,63c0ffa8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/parse_action.java index 92286635,92286635,92286635,92286635,92286635,92286635,92286635..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parse_action.java +++ /dev/null @@@@@@@@ -1,92 -1,92 -1,92 -1,92 -1,92 -1,92 -1,92 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class serves as the base class for entries in a parse action table. ------- * Full entries will either be SHIFT(state_num), REDUCE(production), NONASSOC, ------- * or ERROR. Objects of this base class will default to ERROR, while ------- * the other three types will be represented by subclasses. ------- * ------- * @see java_cup.reduce_action ------- * @see java_cup.shift_action ------- * @version last updated: 7/2/96 ------- * @author Frank Flannery ------- */ ------- -------public class parse_action { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. */ ------- public parse_action() ------- { ------- /* nothing to do in the base class */ ------- } ------- ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Constant for action type -- error action. */ ------- public static final int ERROR = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constant for action type -- shift action. */ ------- public static final int SHIFT = 1; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constants for action type -- reduce action. */ ------- public static final int REDUCE = 2; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constants for action type -- reduce action. */ ------- public static final int NONASSOC = 3; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Quick access to the type -- base class defaults to error. */ ------- public int kind() {return ERROR;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality test. */ ------- public boolean equals(parse_action other) ------- { ------- /* we match all error actions */ ------- return other != null && other.kind() == ERROR; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality test. */ ------- public boolean equals(Object other) ------- { ------- if (other instanceof parse_action) ------- return equals((parse_action)other); ------- else ------- return false; ------- } ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute a hash code. */ ------- public int hashCode() ------- { ------- /* all objects of this class hash together */ ------- return 0xCafe123; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to string. */ ------- public String toString() {return "ERROR";} ------- ------- /*-----------------------------------------------------------*/ -------} ------- diff --cc Robust/cup/java_cup/parse_action_row.class index 5c407fb8,5c407fb8,5c407fb8,5c407fb8,5c407fb8,5c407fb8,5c407fb8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/parse_action_row.java index 817b8c52,817b8c52,817b8c52,817b8c52,817b8c52,817b8c52,817b8c52..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parse_action_row.java +++ /dev/null @@@@@@@@ -1,106 -1,106 -1,106 -1,106 -1,106 -1,106 -1,106 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class represents one row (corresponding to one machine state) of the ------- * parse action table. ------- */ -------public class parse_action_row { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. Note: this should not be used until the number of ------- * terminals in the grammar has been established. ------- */ ------- public parse_action_row() ------- { ------- /* make sure the size is set */ ------- if (_size <= 0 ) _size = terminal.number(); ------- ------- /* allocate the array */ ------- under_term = new parse_action[size()]; ------- ------- /* set each element to an error action */ ------- for (int i=0; i<_size; i++) ------- under_term[i] = new parse_action(); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Number of columns (terminals) in every row. */ ------- protected static int _size = 0; ------- ------- /** Number of columns (terminals) in every row. */ ------- public static int size() {return _size;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Table of reduction counts (reused by compute_default()). */ ------- protected static int reduction_count[] = null; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Actual action entries for the row. */ ------- public parse_action under_term[]; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Default (reduce) action for this row. -1 will represent default ------- * of error. ------- */ ------- public int default_reduce; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Compute the default (reduce) action for this row and store it in ------- * default_reduce. In the case of non-zero default we will have the ------- * effect of replacing all errors by that reduction. This may cause ------- * us to do erroneous reduces, but will never cause us to shift past ------- * the point of the error and never cause an incorrect parse. -1 will ------- * be used to encode the fact that no reduction can be used as a ------- * default (in which case error will be used). ------- */ ------- public void compute_default() ------- { ------- int i, prod, max_prod, max_red; ------- ------- /* if we haven't allocated the count table, do so now */ ------- if (reduction_count == null) ------- reduction_count = new int[production.number()]; ------- ------- /* clear the reduction count table and maximums */ ------- for (i = 0; i < production.number(); i++) ------- reduction_count[i] = 0; ------- max_prod = -1; ------- max_red = 0; ------- ------- /* walk down the row and look at the reduces */ ------- for (i = 0; i < size(); i++) ------- if (under_term[i].kind() == parse_action.REDUCE) ------- { ------- /* count the reduce in the proper production slot and keep the ------- max up to date */ ------- prod = ((reduce_action)under_term[i]).reduce_with().index(); ------- reduction_count[prod]++; ------- if (reduction_count[prod] > max_red) ------- { ------- max_red = reduction_count[prod]; ------- max_prod = prod; ------- } ------- } ------- ------- /* record the max as the default (or -1 for not found) */ ------- default_reduce = max_prod; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} ------- diff --cc Robust/cup/java_cup/parse_action_table.class index f30b638b,f30b638b,f30b638b,f30b638b,f30b638b,f30b638b,f30b638b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/parse_action_table.java index 1e0edb2c,1e0edb2c,1e0edb2c,1e0edb2c,1e0edb2c,1e0edb2c,1e0edb2c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parse_action_table.java +++ /dev/null @@@@@@@@ -1,143 -1,143 -1,143 -1,143 -1,143 -1,143 -1,143 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.Enumeration; ------- -------/** This class represents the complete "action" table of the parser. ------- * It has one row for each state in the parse machine, and a column for ------- * each terminal symbol. Each entry in the table represents a shift, ------- * reduce, or an error. ------- * ------- * @see java_cup.parse_action ------- * @see java_cup.parse_action_row ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class parse_action_table { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. All terminals, non-terminals, and productions must ------- * already have been entered, and the viable prefix recognizer should ------- * have been constructed before this is called. ------- */ ------- public parse_action_table() ------- { ------- /* determine how many states we are working with */ ------- _num_states = lalr_state.number(); ------- ------- /* allocate the array and fill it in with empty rows */ ------- under_state = new parse_action_row[_num_states]; ------- for (int i=0; i<_num_states; i++) ------- under_state[i] = new parse_action_row(); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** How many rows/states are in the machine/table. */ ------- protected int _num_states; ------- ------- /** How many rows/states are in the machine/table. */ ------- public int num_states() {return _num_states;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Actual array of rows, one per state. */ ------- public parse_action_row[] under_state; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Check the table to ensure that all productions have been reduced. ------- * Issue a warning message (to System.err) for each production that ------- * is never reduced. ------- */ ------- public void check_reductions() ------- throws internal_error ------- { ------- parse_action act; ------- production prod; ------- ------- /* tabulate reductions -- look at every table entry */ ------- for (int row = 0; row < num_states(); row++) ------- { ------- for (int col = 0; col < under_state[row].size(); col++) ------- { ------- /* look at the action entry to see if its a reduce */ ------- act = under_state[row].under_term[col]; ------- if (act != null && act.kind() == parse_action.REDUCE) ------- { ------- /* tell production that we used it */ ------- ((reduce_action)act).reduce_with().note_reduction_use(); ------- } ------- } ------- } ------- ------- /* now go across every production and make sure we hit it */ ------- for (Enumeration p = production.all(); p.hasMoreElements(); ) ------- { ------- prod = (production)p.nextElement(); ------- ------- /* if we didn't hit it give a warning */ ------- if (prod.num_reductions() == 0) ------- { ------- /* count it * ------- emit.not_reduced++; ------- ------- /* give a warning if they haven't been turned off */ ------- if (!emit.nowarn) ------- { ------- System.err.println("*** Production \"" + ------- prod.to_simple_string() + "\" never reduced"); ------- lexer.warning_count++; ------- } ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .* ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- String result; ------- int cnt; ------- ------- result = "-------- ACTION_TABLE --------\n"; ------- for (int row = 0; row < num_states(); row++) ------- { ------- result += "From state #" + row + "\n"; ------- cnt = 0; ------- for (int col = 0; col < under_state[row].size(); col++) ------- { ------- /* if the action is not an error print it */ ------- if (under_state[row].under_term[col].kind() != parse_action.ERROR) ------- { ------- result += " [term " + col + ":" + under_state[row].under_term[col] + "]"; ------- ------- /* end the line after the 2nd one */ ------- cnt++; ------- if (cnt == 2) ------- { ------- result += "\n"; ------- cnt = 0; ------- } ------- } ------- } ------- /* finish the line if we haven't just done that */ ------- if (cnt != 0) result += "\n"; ------- } ------- result += "------------------------------"; ------- ------- return result; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} ------- diff --cc Robust/cup/java_cup/parse_reduce_row.class index f62f13aa,f62f13aa,f62f13aa,f62f13aa,f62f13aa,f62f13aa,f62f13aa..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/parse_reduce_row.java index 57d978ec,57d978ec,57d978ec,57d978ec,57d978ec,57d978ec,57d978ec..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parse_reduce_row.java +++ /dev/null @@@@@@@@ -1,41 -1,41 -1,41 -1,41 -1,41 -1,41 -1,41 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class represents one row (corresponding to one machine state) of the ------- * reduce-goto parse table. ------- */ -------public class parse_reduce_row { ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. Note: this should not be used until the number ------- * of terminals in the grammar has been established. ------- */ ------- public parse_reduce_row() ------- { ------- /* make sure the size is set */ ------- if (_size <= 0 ) _size = non_terminal.number(); ------- ------- /* allocate the array */ ------- under_non_term = new lalr_state[size()]; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Number of columns (non terminals) in every row. */ ------- protected static int _size = 0; ------- ------- /** Number of columns (non terminals) in every row. */ ------- public static int size() {return _size;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Actual entries for the row. */ ------- public lalr_state under_non_term[]; -------} ------- diff --cc Robust/cup/java_cup/parse_reduce_table.class index 44211d2f,44211d2f,44211d2f,44211d2f,44211d2f,44211d2f,44211d2f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/parse_reduce_table.java index 9ac1b11c,9ac1b11c,9ac1b11c,9ac1b11c,9ac1b11c,9ac1b11c,9ac1b11c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parse_reduce_table.java +++ /dev/null @@@@@@@@ -1,99 -1,99 -1,99 -1,99 -1,99 -1,99 -1,99 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.Enumeration; ------- -------/** This class represents the complete "reduce-goto" table of the parser. ------- * It has one row for each state in the parse machines, and a column for ------- * each terminal symbol. Each entry contains a state number to shift to ------- * as the last step of a reduce. ------- * ------- * @see java_cup.parse_reduce_row ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class parse_reduce_table { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. Note: all terminals, non-terminals, and productions ------- * must already have been entered, and the viable prefix recognizer should ------- * have been constructed before this is called. ------- */ ------- public parse_reduce_table() ------- { ------- /* determine how many states we are working with */ ------- _num_states = lalr_state.number(); ------- ------- /* allocate the array and fill it in with empty rows */ ------- under_state = new parse_reduce_row[_num_states]; ------- for (int i=0; i<_num_states; i++) ------- under_state[i] = new parse_reduce_row(); ------- } ------- ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** How many rows/states in the machine/table. */ ------- protected int _num_states; ------- ------- /** How many rows/states in the machine/table. */ ------- public int num_states() {return _num_states;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Actual array of rows, one per state */ ------- public parse_reduce_row[] under_state; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- String result; ------- lalr_state goto_st; ------- int cnt; ------- ------- result = "-------- REDUCE_TABLE --------\n"; ------- for (int row = 0; row < num_states(); row++) ------- { ------- result += "From state #" + row + "\n"; ------- cnt = 0; ------- for (int col = 0; col < under_state[row].size(); col++) ------- { ------- /* pull out the table entry */ ------- goto_st = under_state[row].under_non_term[col]; ------- ------- /* if it has action in it, print it */ ------- if (goto_st != null) ------- { ------- result += " [non term " + col + "->"; ------- result += "state " + goto_st.index() + "]"; ------- ------- /* end the line after the 3rd one */ ------- cnt++; ------- if (cnt == 3) ------- { ------- result += "\n"; ------- cnt = 0; ------- } ------- } ------- } ------- /* finish the line if we haven't just done that */ ------- if (cnt != 0) result += "\n"; ------- } ------- result += "-----------------------------"; ------- ------- return result; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} ------- diff --cc Robust/cup/java_cup/parser.class index 05af393b,05af393b,05af393b,05af393b,05af393b,05af393b,05af393b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/parser.cup index 8af0d056,8af0d056,8af0d056,8af0d056,8af0d056,8af0d056,8af0d056..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parser.cup +++ /dev/null @@@@@@@@ -1,863 -1,863 -1,863 -1,863 -1,863 -1,863 -1,863 +1,0 @@@@@@@@ ------- -------/*================================================================*/ -------/* ------- JavaCup Specification for the JavaCup Specification Language ------- by Scott Hudson, GVU Center, Georgia Tech, August 1995 ------- and Frank Flannery, Department of Computer Science, Princeton Univ, ------- July 1996 ------- Bug Fixes: C. Scott Ananian, Dept of Electrical Engineering, Princeton ------- University, October 1996. [later Massachusetts Institute of Technology] ------- ------- ------- This JavaCup specification is used to implement JavaCup itself. ------- It specifies the parser for the JavaCup specification language. ------- (It also serves as a reasonable example of what a typical JavaCup ------- spec looks like). ------- ------- The specification has the following parts: ------- Package and import declarations ------- These serve the same purpose as in a normal Java source file ------- (and will appear in the generated code for the parser). In this ------- case we are part of the java_cup package and we import both the ------- java_cup runtime system and Hashtable from the standard Java ------- utilities package. ------- ------- Action code ------- This section provides code that is included with the class encapsulating ------- the various pieces of user code embedded in the grammar (i.e., the ------- semantic actions). This provides a series of helper routines and ------- data structures that the semantic actions use. ------- ------- Parser code ------- This section provides code included in the parser class itself. In ------- this case we override the default error reporting routines. ------- ------- Init with and scan with ------- These sections provide small bits of code that initialize, then ------- indicate how to invoke the scanner. ------- ------- Symbols and grammar ------- These sections declare all the terminal and non terminal symbols ------- and the types of objects that they will be represented by at runtime, ------- then indicate the start symbol of the grammar (), and finally provide ------- the grammar itself (with embedded actions). ------- ------- Operation of the parser ------- The parser acts primarily by accumulating data structures representing ------- various parts of the specification. Various small parts (e.g., single ------- code strings) are stored as static variables of the emit class and ------- in a few cases as variables declared in the action code section. ------- Terminals, non terminals, and productions, are maintained as collection ------- accessible via static methods of those classes. In addition, two ------- symbol tables are kept: ------- symbols maintains the name to object mapping for all symbols ------- non_terms maintains a separate mapping containing only the non terms ------- ------- Several intermediate working structures are also declared in the action ------- code section. These include: rhs_parts, rhs_pos, and lhs_nt which ------- build up parts of the current production while it is being parsed. ------- ------- Author(s) ------- Scott Hudson, GVU Center, Georgia Tech. ------- Frank Flannery, Department of Computer Science, Princeton Univ. ------- C. Scott Ananian, Department of Electrical Engineering, Princeton Univ. ------- ------- Revisions ------- v0.9a First released version [SEH] 8/29/95 ------- v0.9b Updated for beta language (throws clauses) [SEH] 11/25/95 ------- v0.10a Made many improvements/changes. now offers: ------- return value ------- left/right positions and propagations ------- cleaner label references ------- precedence and associativity for terminals ------- contextual precedence for productions ------- [FF] 7/3/96 ------- v0.10b Fixed %prec directive so it works like it's supposed to. ------- [CSA] 10/10/96 ------- v0.10g Added support for array types on symbols. ------- [CSA] 03/23/98 ------- v0.10i Broaden set of IDs allowed in multipart_id and label_id so ------- that only java reserved words (and not CUP reserved words like ------- 'parser' and 'start') are prohibited. Allow reordering of ------- action code, parser code, init code, and scan with sections, ------- and made closing semicolon optional for these sections. ------- Added 'nonterminal' as a terminal symbol, finally fixing a ------- spelling mistake that's been around since the beginning. ------- For backwards compatibility, you can still misspell the ------- word if you like. -------*/ -------/*================================================================*/ ------- -------package java_cup; -------import java_cup.runtime.*; -------import java.util.Hashtable; ------- -------/*----------------------------------------------------------------*/ ------- -------action code {: ------- /** helper routine to clone a new production part adding a given label */ ------- protected production_part add_lab(production_part part, String lab) ------- throws internal_error ------- { ------- /* if there is no label, or this is an action, just return the original */ ------- if (lab == null || part.is_action()) return part; ------- ------- /* otherwise build a new one with the given label attached */ ------- return new symbol_part(((symbol_part)part).the_symbol(),lab); ------- } ------- ------- /** max size of right hand side we will support */ ------- protected final int MAX_RHS = 200; ------- ------- /** array for accumulating right hand side parts */ ------- protected production_part[] rhs_parts = new production_part[MAX_RHS]; ------- ------- /** where we are currently in building a right hand side */ ------- protected int rhs_pos = 0; ------- ------- /** start a new right hand side */ ------- protected void new_rhs() {rhs_pos = 0; } ------- ------- /** add a new right hand side part */ ------- protected void add_rhs_part(production_part part) throws java.lang.Exception ------- { ------- if (rhs_pos >= MAX_RHS) ------- throw new Exception("Internal Error: Productions limited to " + ------- MAX_RHS + " symbols and actions"); ------- ------- rhs_parts[rhs_pos] = part; ------- rhs_pos++; ------- } ------- ------- /** string to build up multiple part names */ ------- protected String multipart_name = new String(); ------- ------- /** append a new name segment to the accumulated multipart name */ ------- protected void append_multipart(String name) ------- { ------- String dot = ""; ------- ------- /* if we aren't just starting out, put on a dot */ ------- if (multipart_name.length() != 0) dot = "."; ------- ------- multipart_name = multipart_name.concat(dot + name); ------- } ------- ------- /** table of declared symbols -- contains production parts indexed by name */ ------- protected Hashtable symbols = new Hashtable(); ------- ------- /** table of just non terminals -- contains non_terminals indexed by name */ ------- protected Hashtable non_terms = new Hashtable(); ------- ------- /** declared start non_terminal */ ------- protected non_terminal start_nt = null; ------- ------- /** left hand side non terminal of the current production */ ------- protected non_terminal lhs_nt; ------- ------- /** Current precedence number */ ------- int _cur_prec = 0; ------- ------- /** Current precedence side */ ------- int _cur_side = assoc.no_prec; ------- ------- /** update the precedences we are declaring */ ------- protected void update_precedence(int p) { ------- _cur_side = p; ------- _cur_prec++; ------- } ------- /** add relevant data to terminals */ ------- protected void add_precedence(String term) { ------- if (term == null) { ------- System.err.println("Unable to add precedence to nonexistent terminal"); ------- } else { ------- symbol_part sp = (symbol_part)symbols.get(term); ------- if (sp == null) { ------- System.err.println("Could find terminal " + term + " while declaring precedence"); ------- } else { ------- java_cup.symbol sym = sp.the_symbol(); ------- if (sym instanceof terminal) ------- ((terminal)sym).set_precedence(_cur_side, _cur_prec); ------- else System.err.println("Precedence declaration: Can't find terminal " + term); ------- } ------- } ------- } -------:}; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------parser code {: ------- ------- /* override error routines */ ------- ------- public void report_fatal_error( ------- String message, ------- Object info) ------- { ------- done_parsing(); ------- lexer.emit_error(message); ------- System.err.println("Can't recover from previous error(s), giving up."); ------- System.exit(1); ------- } ------- ------- public void report_error(String message, Object info) ------- { ------- lexer.emit_error(message); ------- } -------:}; ------- -------/*----------------------------------------------------------------*/ ------- -------init with {: lexer.init(); :}; -------scan with {: return lexer.next_token(); :}; ------- -------/*----------------------------------------------------------------*/ ------- -------terminal ------- PACKAGE, IMPORT, CODE, ACTION, PARSER, TERMINAL, NON, INIT, SCAN, WITH, ------- START, SEMI, COMMA, STAR, DOT, COLON, COLON_COLON_EQUALS, BAR, PRECEDENCE, ------- LEFT, RIGHT, NONASSOC, PERCENT_PREC, LBRACK, RBRACK, NONTERMINAL; ------- -------terminal String ID, CODE_STRING; ------- -------non terminal ------- spec, package_spec, import_list, action_code_part, ------- code_parts, code_part, opt_semi, non_terminal, ------- parser_code_part, symbol_list, start_spec, production_list, ------- multipart_id, import_spec, import_id, init_code, scan_code, symbol, ------- type_id, term_name_list, non_term_name_list, production, prod_part_list, ------- prod_part, new_term_id, new_non_term_id, rhs_list, rhs, empty, ------- precedence_list, preced, terminal_list, precedence_l, declares_term, ------- declares_non_term; ------- -------non terminal String nt_id, symbol_id, label_id, opt_label, terminal_id, ------- term_id, robust_id; ------- -------/*----------------------------------------------------------------*/ ------- -------start with spec; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------spec ::= ------- {: ------- /* declare "error" as a terminal */ ------- symbols.put("error", new symbol_part(terminal.error)); ------- ------- /* declare start non terminal */ ------- non_terms.put("$START", non_terminal.START_nt); ------- :} ------- package_spec ------- import_list ------- code_parts ------- symbol_list ------- precedence_list ------- start_spec ------- production_list ------- | ------- /* error recovery assuming something went wrong before symbols ------- and we have TERMINAL or NON TERMINAL to sync on. if we get ------- an error after that, we recover inside symbol_list or ------- production_list ------- */ ------- error ------- symbol_list ------- precedence_list ------- start_spec ------- production_list ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------package_spec ::= ------- PACKAGE ------- multipart_id ------- {: ------- /* save the package name */ ------- emit.package_name = multipart_name; ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- :} ------- SEMI ------- | ------- empty ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------import_list ::= ------- import_list ------- import_spec ------- | ------- empty ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------import_spec ::= ------- IMPORT ------- import_id ------- {: ------- /* save this import on the imports list */ ------- emit.import_list.push(multipart_name); ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- :} ------- SEMI ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------// allow any order; all parts are optional. [CSA, 23-Jul-1999] -------// (we check in the part action to make sure we don't have 2 of any part) -------code_part ::= ------- action_code_part | parser_code_part | init_code | scan_code ; -------code_parts ::= ------- | code_parts code_part; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------action_code_part ::= ------- ACTION CODE CODE_STRING:user_code opt_semi ------- {: ------- if (emit.action_code!=null) ------- lexer.emit_error("Redundant action code (skipping)"); ------- else /* save the user included code string */ ------- emit.action_code = user_code; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------parser_code_part ::= ------- PARSER CODE CODE_STRING:user_code opt_semi ------- {: ------- if (emit.parser_code!=null) ------- lexer.emit_error("Redundant parser code (skipping)"); ------- else /* save the user included code string */ ------- emit.parser_code = user_code; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------init_code ::= ------- INIT WITH CODE_STRING:user_code opt_semi ------- {: ------- if (emit.init_code!=null) ------- lexer.emit_error("Redundant init code (skipping)"); ------- else /* save the user code */ ------- emit.init_code = user_code; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------scan_code ::= ------- SCAN WITH CODE_STRING:user_code opt_semi ------- {: ------- if (emit.scan_code!=null) ------- lexer.emit_error("Redundant scan code (skipping)"); ------- else /* save the user code */ ------- emit.scan_code = user_code; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------symbol_list ::= symbol_list symbol | symbol; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------symbol ::= ------- TERMINAL ------- type_id ------- declares_term ------- | ------- TERMINAL ------- declares_term ------- | ------- non_terminal ------- type_id ------- declares_non_term ------- | ------- non_terminal ------- declares_non_term ------- | ------- /* error recovery productions -- sync on semicolon */ ------- ------- TERMINAL ------- error ------- {: ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- :} ------- SEMI ------- | ------- non_terminal ------- error ------- {: ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- :} ------- SEMI ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------declares_term ::= ------- term_name_list ------- {: ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- :} ------- SEMI ------- ; -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------declares_non_term ::= ------- non_term_name_list ------- {: ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- :} ------- SEMI ------- ; -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------term_name_list ::= term_name_list COMMA new_term_id | new_term_id; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------non_term_name_list ::= ------- non_term_name_list ------- COMMA ------- new_non_term_id ------- | ------- new_non_term_id ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- ------- -------precedence_list ::= precedence_l | empty; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------precedence_l ::= precedence_l preced | preced; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------preced ::= ------- PRECEDENCE LEFT ------- {: ------- update_precedence(assoc.left); ------- :} ------- terminal_list SEMI ------- | ------- PRECEDENCE RIGHT ------- {: ------- update_precedence(assoc.right); ------- :} ------- terminal_list SEMI ------- | ------- PRECEDENCE NONASSOC ------- {: ------- update_precedence(assoc.nonassoc); ------- :} ------- terminal_list SEMI ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------terminal_list ::= terminal_list COMMA terminal_id ------- | ------- terminal_id ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------terminal_id ::= term_id:sym ------- {: ------- add_precedence(sym); ------- RESULT = sym; ------- :}; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------term_id ::= symbol_id:sym ------- {: ------- /* check that the symbol_id is a terminal */ ------- if (symbols.get(sym) == null) ------- { ------- /* issue a message */ ------- lexer.emit_error("Terminal \"" + sym + ------- "\" has not been declared"); ------- } ------- RESULT = sym; ------- :}; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------start_spec ::= ------- START WITH nt_id:start_name ------- {: ------- /* verify that the name has been declared as a non terminal */ ------- non_terminal nt = (non_terminal)non_terms.get(start_name); ------- if (nt == null) ------- { ------- lexer.emit_error( "Start non terminal \"" + start_name + ------- "\" has not been declared"); ------- } ------- else ------- { ------- /* remember the non-terminal for later */ ------- start_nt = nt; ------- ------- /* build a special start production */ ------- new_rhs(); ------- add_rhs_part(add_lab(new symbol_part(start_nt), "start_val")); ------- add_rhs_part(new symbol_part(terminal.EOF)); ------- add_rhs_part(new action_part("RESULT = start_val;")); ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, rhs_pos); ------- new_rhs(); ------- } ------- :} ------- SEMI ------- | ------- empty ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------production_list ::= production_list production | production; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------production ::= ------- nt_id:lhs_id ------- {: ------- /* lookup the lhs nt */ ------- lhs_nt = (non_terminal)non_terms.get(lhs_id); ------- ------- /* if it wasn't declared, emit a message */ ------- if (lhs_nt == null) ------- { ------- if (lexer.error_count == 0) ------- lexer.emit_error("LHS non terminal \"" + lhs_id + ------- "\" has not been declared"); ------- } ------- ------- /* reset the rhs accumulation */ ------- new_rhs(); ------- :} ------- COLON_COLON_EQUALS ------- {: :} ------- rhs_list ------- SEMI ------- | ------- error ------- {: lexer.emit_error("Syntax Error"); :} ------- SEMI ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------rhs_list ::= rhs_list BAR rhs | rhs; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------rhs ::= ------- prod_part_list PERCENT_PREC term_id:term_name ------- {: ------- java_cup.symbol sym = null; ------- if (lhs_nt != null) ------- { ------- /* Find the precedence symbol */ ------- if (term_name == null) { ------- System.err.println("No terminal for contextual precedence"); ------- sym = null; ------- } else { ------- sym = ((symbol_part)symbols.get(term_name)).the_symbol(); ------- } ------- /* build the production */ ------- production p; ------- if ((sym!=null) && (sym instanceof terminal)) { ------- p = new production(lhs_nt, rhs_parts, rhs_pos, ------- ((terminal)sym).precedence_num(), ------- ((terminal)sym).precedence_side()); ------- ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); ------- } else { ------- System.err.println("Invalid terminal " + term_name + ------- " for contextual precedence assignment"); ------- p = new production(lhs_nt, rhs_parts, rhs_pos); ------- } ------- ------- /* if we have no start non-terminal declared and this is ------- the first production, make its lhs nt the start_nt ------- and build a special start production for it. */ ------- if (start_nt == null) ------- { ------- start_nt = lhs_nt; ------- ------- /* build a special start production */ ------- new_rhs(); ------- add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); ------- add_rhs_part(new symbol_part(terminal.EOF)); ------- add_rhs_part(new action_part("RESULT = start_val;")); ------- if ((sym!=null) && (sym instanceof terminal)) { ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, ------- rhs_pos, ((terminal)sym).precedence_num(), ------- ((terminal)sym).precedence_side()); ------- } else { ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, rhs_pos); ------- } ------- new_rhs(); ------- } ------- } ------- ------- /* reset the rhs accumulation in any case */ ------- new_rhs(); ------- :} ------- | ------- prod_part_list ------- {: ------- if (lhs_nt != null) ------- { ------- /* build the production */ ------- production p = new production(lhs_nt, rhs_parts, rhs_pos); ------- ------- /* if we have no start non-terminal declared and this is ------- the first production, make its lhs nt the start_nt ------- and build a special start production for it. */ ------- if (start_nt == null) ------- { ------- start_nt = lhs_nt; ------- ------- /* build a special start production */ ------- new_rhs(); ------- add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); ------- add_rhs_part(new symbol_part(terminal.EOF)); ------- add_rhs_part(new action_part("RESULT = start_val;")); ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, rhs_pos); ------- ------- new_rhs(); ------- } ------- } ------- ------- /* reset the rhs accumulation in any case */ ------- new_rhs(); ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------prod_part_list ::= prod_part_list prod_part | empty; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------prod_part ::= ------- symbol_id:symid opt_label:labid ------- {: ------- /* try to look up the id */ ------- production_part symb = (production_part)symbols.get(symid); ------- ------- /* if that fails, symbol is undeclared */ ------- if (symb == null) ------- { ------- if (lexer.error_count == 0) ------- lexer.emit_error("java_cup.runtime.Symbol \"" + symid + ------- "\" has not been declared"); ------- } ------- else ------- { ------- /* add a labeled production part */ ------- add_rhs_part(add_lab(symb, labid)); ------- } ------- :} ------- | ------- CODE_STRING:code_str ------- {: ------- /* add a new production part */ ------- add_rhs_part(new action_part(code_str)); ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------opt_label ::= ------- COLON label_id:labid ------- {: RESULT = labid; :} ------- | ------- empty ------- {: RESULT = null; :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------multipart_id ::= ------- multipart_id DOT robust_id:another_id ------- {: append_multipart(another_id); :} ------- | ------- robust_id:an_id ------- {: append_multipart(an_id); :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------import_id ::= ------- multipart_id DOT STAR ------- {: append_multipart("*"); :} ------- | ------- multipart_id ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------type_id ::= multipart_id ------- | type_id LBRACK RBRACK ------- {: multipart_name = multipart_name.concat("[]"); :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------new_term_id ::= ------- ID:term_id ------- {: ------- /* see if this terminal has been declared before */ ------- if (symbols.get(term_id) != null) ------- { ------- /* issue a message */ ------- lexer.emit_error("java_cup.runtime.Symbol \"" + term_id + ------- "\" has already been declared"); ------- } ------- else ------- { ------- /* if no type declared, declare one */ ------- if (multipart_name.equals("")) { ------- append_multipart("Object"); ------- } ------- /* build a production_part and put it in the table */ ------- symbols.put(term_id, ------- new symbol_part(new terminal(term_id, multipart_name))); ------- } ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------new_non_term_id ::= ------- ID:non_term_id ------- {: ------- /* see if this non terminal has been declared before */ ------- if (symbols.get(non_term_id) != null) ------- { ------- /* issue a message */ ------- lexer.emit_error( "java_cup.runtime.Symbol \"" + non_term_id + ------- "\" has already been declared"); ------- } ------- else ------- { ------- if (multipart_name.equals("")) { ------- append_multipart("Object"); ------- } ------- /* build the non terminal object */ ------- non_terminal this_nt = ------- new non_terminal(non_term_id, multipart_name); ------- ------- /* put it in the non_terms table */ ------- non_terms.put(non_term_id, this_nt); ------- ------- /* build a production_part and put it in the symbols table */ ------- symbols.put(non_term_id, new symbol_part(this_nt)); ------- } ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------nt_id ::= ------- ID:the_id ------- {: RESULT = the_id; :} ------- | error ------- {: ------- lexer.emit_error("Illegal use of reserved word"); ------- RESULT="ILLEGAL"; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------symbol_id ::= ------- ID:the_id ------- {: RESULT = the_id; :} ------- | error ------- {: ------- lexer.emit_error("Illegal use of reserved word"); ------- RESULT="ILLEGAL"; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------label_id ::= ------- robust_id:the_id ------- {: RESULT = the_id; :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------robust_id ::= /* all ids that aren't reserved words in Java */ ------- ID:the_id {: RESULT = the_id; :} ------- /* package is reserved. */ ------- /* import is reserved. */ ------- | CODE {: RESULT = "code"; :} ------- | ACTION {: RESULT = "action"; :} ------- | PARSER {: RESULT = "parser"; :} ------- | TERMINAL {: RESULT = "terminal"; :} ------- | NON {: RESULT = "non"; :} ------- | NONTERMINAL {: RESULT = "nonterminal"; :} ------- | INIT {: RESULT = "init"; :} ------- | SCAN {: RESULT = "scan"; :} ------- | WITH {: RESULT = "with"; :} ------- | START {: RESULT = "start"; :} ------- | PRECEDENCE {: RESULT = "precedence"; :} ------- | LEFT {: RESULT = "left"; :} ------- | RIGHT {: RESULT = "right"; :} ------- | NONASSOC {: RESULT = "nonassoc"; :} ------- | error ------- {: ------- lexer.emit_error("Illegal use of reserved word"); ------- RESULT="ILLEGAL"; ------- :} ------- ; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------non_terminal ::= NON TERMINAL | NONTERMINAL; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------opt_semi ::= /* nothing */ ------- | SEMI; ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ ------- -------empty ::= /* nothing */; ------- -------/*----------------------------------------------------------------*/ ------- ------- ------- ------- ------- ------- ------- ------- ------- diff --cc Robust/cup/java_cup/parser.java index 163968e2,163968e2,163968e2,163968e2,163968e2,163968e2,163968e2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/parser.java +++ /dev/null @@@@@@@@ -1,1849 -1,1849 -1,1849 -1,1849 -1,1849 -1,1849 -1,1849 +1,0 @@@@@@@@ ------- -------//---------------------------------------------------- -------// The following code was generated by CUP v0.10k -------// Sun Jul 25 13:35:26 EDT 1999 -------//---------------------------------------------------- ------- -------package java_cup; ------- -------import java_cup.runtime.*; -------import java.util.Hashtable; ------- -------/** CUP v0.10k generated parser. ------- * @version Sun Jul 25 13:35:26 EDT 1999 ------- */ -------public class parser extends java_cup.runtime.lr_parser { ------- ------- /** Default constructor. */ ------- public parser() {super();} ------- ------- /** Constructor which sets the default scanner. */ ------- public parser(java_cup.runtime.Scanner s) {super(s);} ------- ------- /** Production table. */ ------- protected static final short _production_table[][] = ------- unpackFromStrings(new String[] { ------- "\000\153\000\002\002\004\000\002\055\002\000\002\003" + ------- "\012\000\002\003\007\000\002\056\002\000\002\004\006" + ------- "\000\002\004\003\000\002\005\004\000\002\005\003\000" + ------- "\002\057\002\000\002\020\006\000\002\010\003\000\002" + ------- "\010\003\000\002\010\003\000\002\010\003\000\002\007" + ------- "\002\000\002\007\004\000\002\006\006\000\002\013\006" + ------- "\000\002\022\006\000\002\023\006\000\002\014\004\000" + ------- "\002\014\003\000\002\024\005\000\002\024\004\000\002" + ------- "\024\005\000\002\024\004\000\002\060\002\000\002\024" + ------- "\006\000\002\061\002\000\002\024\006\000\002\062\002" + ------- "\000\002\044\005\000\002\063\002\000\002\045\005\000" + ------- "\002\026\005\000\002\026\003\000\002\027\005\000\002" + ------- "\027\003\000\002\040\003\000\002\040\003\000\002\043" + ------- "\004\000\002\043\003\000\002\064\002\000\002\041\007" + ------- "\000\002\065\002\000\002\041\007\000\002\066\002\000" + ------- "\002\041\007\000\002\042\005\000\002\042\003\000\002" + ------- "\052\003\000\002\053\003\000\002\067\002\000\002\015" + ------- "\007\000\002\015\003\000\002\016\004\000\002\016\003" + ------- "\000\002\070\002\000\002\071\002\000\002\030\010\000" + ------- "\002\072\002\000\002\030\005\000\002\035\005\000\002" + ------- "\035\003\000\002\036\005\000\002\036\003\000\002\031" + ------- "\004\000\002\031\003\000\002\032\004\000\002\032\003" + ------- "\000\002\051\004\000\002\051\003\000\002\017\005\000" + ------- "\002\017\003\000\002\021\005\000\002\021\003\000\002" + ------- "\025\003\000\002\025\005\000\002\033\003\000\002\034" + ------- "\003\000\002\046\003\000\002\046\003\000\002\047\003" + ------- "\000\002\047\003\000\002\050\003\000\002\054\003\000" + ------- "\002\054\003\000\002\054\003\000\002\054\003\000\002" + ------- "\054\003\000\002\054\003\000\002\054\003\000\002\054" + ------- "\003\000\002\054\003\000\002\054\003\000\002\054\003" + ------- "\000\002\054\003\000\002\054\003\000\002\054\003\000" + ------- "\002\054\003\000\002\054\003\000\002\012\004\000\002" + ------- "\012\003\000\002\011\002\000\002\011\003\000\002\037" + ------- "\002" }); ------- ------- /** Access to production table. */ ------- public short[][] production_table() {return _production_table;} ------- ------- /** Parse-action table. */ ------- protected static final short[][] _action_table = ------- unpackFromStrings(new String[] { ------- "\000\247\000\026\003\006\004\000\005\000\007\000\010" + ------- "\000\011\000\012\000\013\000\014\000\035\000\001\002" + ------- "\000\004\002\251\001\002\000\024\004\200\005\uff97\007" + ------- "\uff97\010\uff97\011\uff97\012\uff97\013\uff97\014\uff97\035\uff97" + ------- "\001\002\000\010\011\007\012\012\035\014\001\002\000" + ------- "\042\003\163\006\026\007\027\010\040\011\036\012\022" + ------- "\013\042\014\030\015\017\016\015\026\033\027\023\030" + ------- "\035\031\041\035\025\036\160\001\002\000\020\003\uffeb" + ------- "\011\uffeb\012\uffeb\016\uffeb\026\uffeb\035\uffeb\036\uffeb\001" + ------- "\002\000\020\003\uff97\011\007\012\012\016\uff97\026\065" + ------- "\035\014\036\uff97\001\002\000\004\011\061\001\002\000" + ------- "\042\003\034\006\026\007\027\010\040\011\036\012\022" + ------- "\013\042\014\030\015\017\016\015\026\033\027\023\030" + ------- "\035\031\041\035\025\036\016\001\002\000\042\003\uff9a" + ------- "\006\uff9a\007\uff9a\010\uff9a\011\uff9a\012\uff9a\013\uff9a\014" + ------- "\uff9a\015\uff9a\016\uff9a\026\uff9a\027\uff9a\030\uff9a\031\uff9a" + ------- "\035\uff9a\036\uff9a\001\002\000\022\003\uffa1\017\uffa1\022" + ------- "\uffa1\025\uffa1\032\uffa1\033\uffa1\036\uffa1\037\uffa1\001\002" + ------- "\000\014\017\uffb1\020\uffb1\022\uffab\033\uffab\036\uffab\001" + ------- "\002\000\022\003\uffa2\017\uffa2\022\uffa2\025\uffa2\032\uffa2" + ------- "\033\uffa2\036\uffa2\037\uffa2\001\002\000\006\017\uffe0\020" + ------- "\055\001\002\000\010\022\051\033\uffb4\036\uffb4\001\002" + ------- "\000\022\003\uffa6\017\uffa6\022\uffa6\025\uffa6\032\uffa6\033" + ------- "\uffa6\036\uffa6\037\uffa6\001\002\000\022\003\uff9f\017\uff9f" + ------- "\022\uff9f\025\uff9f\032\uff9f\033\uff9f\036\uff9f\037\uff9f\001" + ------- "\002\000\006\033\047\036\045\001\002\000\022\003\uffa5" + ------- "\017\uffa5\022\uffa5\025\uffa5\032\uffa5\033\uffa5\036\uffa5\037" + ------- "\uffa5\001\002\000\022\003\uffaa\017\uffaa\022\uffaa\025\uffaa" + ------- "\032\uffaa\033\uffaa\036\uffaa\037\uffaa\001\002\000\022\003" + ------- "\uffa9\017\uffa9\022\uffa9\025\uffa9\032\uffa9\033\uffa9\036\uffa9" + ------- "\037\uffa9\001\002\000\022\003\uffa3\017\uffa3\022\uffa3\025" + ------- "\uffa3\032\uffa3\033\uffa3\036\uffa3\037\uffa3\001\002\000\012" + ------- "\017\uffb7\022\uffb7\033\uffb7\036\uffb7\001\002\000\020\003" + ------- "\uffe7\011\uffe7\012\uffe7\016\uffe7\026\uffe7\035\uffe7\036\uffe7" + ------- "\001\002\000\022\003\uffa0\017\uffa0\022\uffa0\025\uffa0\032" + ------- "\uffa0\033\uffa0\036\uffa0\037\uffa0\001\002\000\012\017\uffe4" + ------- "\022\uff9c\033\uff9c\036\uff9c\001\002\000\022\003\uff9e\017" + ------- "\uff9e\022\uff9e\025\uff9e\032\uff9e\033\uff9e\036\uff9e\037\uff9e" + ------- "\001\002\000\022\003\uffa7\017\uffa7\022\uffa7\025\uffa7\032" + ------- "\uffa7\033\uffa7\036\uffa7\037\uffa7\001\002\000\006\017\uffdb" + ------- "\020\uffdb\001\002\000\022\003\uffa8\017\uffa8\022\uffa8\025" + ------- "\uffa8\032\uffa8\033\uffa8\036\uffa8\037\uffa8\001\002\000\022" + ------- "\003\uff9d\017\uff9d\022\uff9d\025\uff9d\032\uff9d\033\uff9d\036" + ------- "\uff9d\037\uff9d\001\002\000\022\003\uffa4\017\uffa4\022\uffa4" + ------- "\025\uffa4\032\uffa4\033\uffa4\036\uffa4\037\uffa4\001\002\000" + ------- "\004\017\044\001\002\000\020\003\uffe3\011\uffe3\012\uffe3" + ------- "\016\uffe3\026\uffe3\035\uffe3\036\uffe3\001\002\000\006\017" + ------- "\uffb1\020\uffb1\001\002\000\020\003\uffe8\011\uffe8\012\uffe8" + ------- "\016\uffe8\026\uffe8\035\uffe8\036\uffe8\001\002\000\004\034" + ------- "\050\001\002\000\006\033\uffb3\036\uffb3\001\002\000\042" + ------- "\003\054\006\026\007\027\010\040\011\036\012\022\013" + ------- "\042\014\030\015\017\016\015\026\033\027\023\030\035" + ------- "\031\041\035\025\036\053\001\002\000\012\017\uffb8\022" + ------- "\uffb8\033\uffb8\036\uffb8\001\002\000\022\003\uffab\017\uffab" + ------- "\022\uffab\025\uffab\032\uffab\033\uffab\036\uffab\037\uffab\001" + ------- "\002\000\022\003\uff9c\017\uff9c\022\uff9c\025\uff9c\032\uff9c" + ------- "\033\uff9c\036\uff9c\037\uff9c\001\002\000\004\036\045\001" + ------- "\002\000\004\017\057\001\002\000\020\003\uffdf\011\uffdf" + ------- "\012\uffdf\016\uffdf\026\uffdf\035\uffdf\036\uffdf\001\002\000" + ------- "\006\017\uffdc\020\uffdc\001\002\000\042\003\uff9b\006\uff9b" + ------- "\007\uff9b\010\uff9b\011\uff9b\012\uff9b\013\uff9b\014\uff9b\015" + ------- "\uff9b\016\uff9b\026\uff9b\027\uff9b\030\uff9b\031\uff9b\035\uff9b" + ------- "\036\uff9b\001\002\000\010\003\uff97\016\116\036\uff97\001" + ------- "\002\000\012\003\uffda\016\uffda\026\065\036\uffda\001\002" + ------- "\000\010\003\uffd9\016\uffd9\036\uffd9\001\002\000\010\027" + ------- "\071\030\072\031\070\001\002\000\020\003\uffec\011\uffec" + ------- "\012\uffec\016\uffec\026\uffec\035\uffec\036\uffec\001\002\000" + ------- "\012\003\uffd7\016\uffd7\026\uffd7\036\uffd7\001\002\000\006" + ------- "\003\uffd2\036\uffd2\001\002\000\006\003\uffd6\036\uffd6\001" + ------- "\002\000\006\003\uffd4\036\uffd4\001\002\000\006\003\077" + ------- "\036\074\001\002\000\022\003\uffae\017\uffae\020\uffae\023" + ------- "\uffae\025\uffae\032\uffae\036\uffae\037\uffae\001\002\000\010" + ------- "\017\uffcd\020\uffcd\025\uffcd\001\002\000\006\017\uffce\020" + ------- "\uffce\001\002\000\022\003\uffad\017\uffad\020\uffad\023\uffad" + ------- "\025\uffad\032\uffad\036\uffad\037\uffad\001\002\000\006\017" + ------- "\102\020\103\001\002\000\006\017\uffcf\020\uffcf\001\002" + ------- "\000\012\003\uffd3\016\uffd3\026\uffd3\036\uffd3\001\002\000" + ------- "\006\003\077\036\074\001\002\000\006\017\uffd0\020\uffd0" + ------- "\001\002\000\006\003\077\036\074\001\002\000\006\017" + ------- "\107\020\103\001\002\000\012\003\uffd5\016\uffd5\026\uffd5" + ------- "\036\uffd5\001\002\000\006\003\077\036\074\001\002\000" + ------- "\006\017\112\020\103\001\002\000\012\003\uffd1\016\uffd1" + ------- "\026\uffd1\036\uffd1\001\002\000\012\003\uffd8\016\uffd8\026" + ------- "\uffd8\036\uffd8\001\002\000\006\003\uffca\036\uffca\001\002" + ------- "\000\006\003\126\036\120\001\002\000\004\015\117\001" + ------- "\002\000\006\003\122\036\120\001\002\000\006\017\uffb0" + ------- "\024\uffb0\001\002\000\004\017\uffcc\001\002\000\004\017" + ------- "\uffaf\001\002\000\004\017\124\001\002\000\006\003\uffcb" + ------- "\036\uffcb\001\002\000\004\024\uffc7\001\002\000\006\017" + ------- "\uffc4\024\uffaf\001\002\000\010\002\ufffe\003\126\036\120" + ------- "\001\002\000\010\002\uffc8\003\uffc8\036\uffc8\001\002\000" + ------- "\010\002\uffc9\003\uffc9\036\uffc9\001\002\000\004\017\133" + ------- "\001\002\000\010\002\uffc3\003\uffc3\036\uffc3\001\002\000" + ------- "\004\024\135\001\002\000\016\003\uffc6\017\uffc6\025\uffc6" + ------- "\032\uffc6\036\uffc6\037\uffc6\001\002\000\016\003\uff97\017" + ------- "\uff97\025\uff97\032\uff97\036\uff97\037\uff97\001\002\000\016" + ------- "\003\uffbd\017\uffbd\025\uffbd\032\uffbd\036\uffbd\037\uffbd\001" + ------- "\002\000\016\003\077\017\uffbf\025\uffbf\032\147\036\074" + ------- "\037\146\001\002\000\006\017\uffc1\025\uffc1\001\002\000" + ------- "\006\017\143\025\144\001\002\000\010\002\uffc5\003\uffc5" + ------- "\036\uffc5\001\002\000\016\003\uff97\017\uff97\025\uff97\032" + ------- "\uff97\036\uff97\037\uff97\001\002\000\006\017\uffc2\025\uffc2" + ------- "\001\002\000\016\003\uffbb\017\uffbb\025\uffbb\032\uffbb\036" + ------- "\uffbb\037\uffbb\001\002\000\006\003\077\036\074\001\002" + ------- "\000\020\003\uff97\017\uff97\023\154\025\uff97\032\uff97\036" + ------- "\uff97\037\uff97\001\002\000\016\003\uffbe\017\uffbe\025\uffbe" + ------- "\032\uffbe\036\uffbe\037\uffbe\001\002\000\016\003\uffb9\017" + ------- "\uffb9\025\uffb9\032\uffb9\036\uffb9\037\uffb9\001\002\000\016" + ------- "\003\uffbc\017\uffbc\025\uffbc\032\uffbc\036\uffbc\037\uffbc\001" + ------- "\002\000\042\003\054\006\026\007\027\010\040\011\036" + ------- "\012\022\013\042\014\030\015\017\016\015\026\033\027" + ------- "\023\030\035\031\041\035\025\036\053\001\002\000\016" + ------- "\003\uffba\017\uffba\025\uffba\032\uffba\036\uffba\037\uffba\001" + ------- "\002\000\016\003\uffac\017\uffac\025\uffac\032\uffac\036\uffac" + ------- "\037\uffac\001\002\000\006\017\uffc0\025\uffc0\001\002\000" + ------- "\014\017\uffb2\020\uffb2\022\uffab\033\uffab\036\uffab\001\002" + ------- "\000\006\033\047\036\170\001\002\000\006\017\uffdd\020" + ------- "\uffdd\001\002\000\012\017\uffe6\022\uff9c\033\uff9c\036\uff9c" + ------- "\001\002\000\020\003\uffe9\011\uffe9\012\uffe9\016\uffe9\026" + ------- "\uffe9\035\uffe9\036\uffe9\001\002\000\006\017\uffe2\020\167" + ------- "\001\002\000\004\017\172\001\002\000\004\036\170\001" + ------- "\002\000\006\017\uffb2\020\uffb2\001\002\000\006\017\uffde" + ------- "\020\uffde\001\002\000\020\003\uffe1\011\uffe1\012\uffe1\016" + ------- "\uffe1\026\uffe1\035\uffe1\036\uffe1\001\002\000\004\017\174" + ------- "\001\002\000\020\003\uffe5\011\uffe5\012\uffe5\016\uffe5\026" + ------- "\uffe5\035\uffe5\036\uffe5\001\002\000\020\003\uffea\011\uffea" + ------- "\012\uffea\016\uffea\026\uffea\035\uffea\036\uffea\001\002\000" + ------- "\022\005\ufffb\007\ufffb\010\ufffb\011\ufffb\012\ufffb\013\ufffb" + ------- "\014\ufffb\035\ufffb\001\002\000\022\005\uff97\007\uff97\010" + ------- "\uff97\011\uff97\012\uff97\013\uff97\014\uff97\035\uff97\001\002" + ------- "\000\042\003\054\006\026\007\027\010\040\011\036\012" + ------- "\022\013\042\014\030\015\017\016\015\026\033\027\023" + ------- "\030\035\031\041\035\025\036\053\001\002\000\006\017" + ------- "\ufffd\022\051\001\002\000\004\017\203\001\002\000\022" + ------- "\005\ufffc\007\ufffc\010\ufffc\011\ufffc\012\ufffc\013\ufffc\014" + ------- "\ufffc\035\ufffc\001\002\000\022\005\210\007\ufff2\010\ufff2" + ------- "\011\ufff2\012\ufff2\013\ufff2\014\ufff2\035\ufff2\001\002\000" + ------- "\022\005\ufff9\007\ufff9\010\ufff9\011\ufff9\012\ufff9\013\ufff9" + ------- "\014\ufff9\035\ufff9\001\002\000\020\007\223\010\224\011" + ------- "\007\012\012\013\227\014\225\035\014\001\002\000\022" + ------- "\005\ufffa\007\ufffa\010\ufffa\011\ufffa\012\ufffa\013\ufffa\014" + ------- "\ufffa\035\ufffa\001\002\000\042\003\054\006\026\007\027" + ------- "\010\040\011\036\012\022\013\042\014\030\015\017\016" + ------- "\015\026\033\027\023\030\035\031\041\035\025\036\053" + ------- "\001\002\000\006\017\uffb5\022\215\001\002\000\004\017" + ------- "\ufff8\001\002\000\004\017\214\001\002\000\022\005\ufff7" + ------- "\007\ufff7\010\ufff7\011\ufff7\012\ufff7\013\ufff7\014\ufff7\035" + ------- "\ufff7\001\002\000\044\003\054\006\026\007\027\010\040" + ------- "\011\036\012\022\013\042\014\030\015\017\016\015\021" + ------- "\216\026\033\027\023\030\035\031\041\035\025\036\053" + ------- "\001\002\000\004\017\uffb6\001\002\000\020\007\ufff3\010" + ------- "\ufff3\011\ufff3\012\ufff3\013\ufff3\014\ufff3\035\ufff3\001\002" + ------- "\000\020\007\ufff5\010\ufff5\011\ufff5\012\ufff5\013\ufff5\014" + ------- "\ufff5\035\ufff5\001\002\000\020\007\ufff1\010\ufff1\011\ufff1" + ------- "\012\ufff1\013\ufff1\014\ufff1\035\ufff1\001\002\000\020\007" + ------- "\ufff4\010\ufff4\011\ufff4\012\ufff4\013\ufff4\014\ufff4\035\ufff4" + ------- "\001\002\000\004\006\246\001\002\000\004\006\243\001" + ------- "\002\000\004\015\240\001\002\000\020\007\ufff6\010\ufff6" + ------- "\011\ufff6\012\ufff6\013\ufff6\014\ufff6\035\ufff6\001\002\000" + ------- "\004\015\234\001\002\000\020\003\uff97\011\007\012\012" + ------- "\016\uff97\026\065\035\014\036\uff97\001\002\000\010\003" + ------- "\uff97\016\116\036\uff97\001\002\000\006\003\126\036\120" + ------- "\001\002\000\010\002\uffff\003\126\036\120\001\002\000" + ------- "\004\037\235\001\002\000\022\007\uff99\010\uff99\011\uff99" + ------- "\012\uff99\013\uff99\014\uff99\017\236\035\uff99\001\002\000" + ------- "\020\007\uff98\010\uff98\011\uff98\012\uff98\013\uff98\014\uff98" + ------- "\035\uff98\001\002\000\020\007\uffee\010\uffee\011\uffee\012" + ------- "\uffee\013\uffee\014\uffee\035\uffee\001\002\000\004\037\241" + ------- "\001\002\000\022\007\uff99\010\uff99\011\uff99\012\uff99\013" + ------- "\uff99\014\uff99\017\236\035\uff99\001\002\000\020\007\uffed" + ------- "\010\uffed\011\uffed\012\uffed\013\uffed\014\uffed\035\uffed\001" + ------- "\002\000\004\037\244\001\002\000\022\007\uff99\010\uff99" + ------- "\011\uff99\012\uff99\013\uff99\014\uff99\017\236\035\uff99\001" + ------- "\002\000\020\007\uffef\010\uffef\011\uffef\012\uffef\013\uffef" + ------- "\014\uffef\035\uffef\001\002\000\004\037\247\001\002\000" + ------- "\022\007\uff99\010\uff99\011\uff99\012\uff99\013\uff99\014\uff99" + ------- "\017\236\035\uff99\001\002\000\020\007\ufff0\010\ufff0\011" + ------- "\ufff0\012\ufff0\013\ufff0\014\ufff0\035\ufff0\001\002\000\004" + ------- "\002\001\001\002" }); ------- ------- /** Access to parse-action table. */ ------- public short[][] action_table() {return _action_table;} ------- ------- /** reduce_goto table. */ ------- protected static final short[][] _reduce_table = ------- unpackFromStrings(new String[] { ------- "\000\247\000\006\003\003\055\004\001\001\000\002\001" + ------- "\001\000\006\004\176\037\175\001\001\000\010\012\012" + ------- "\014\010\024\007\001\001\000\016\017\020\025\160\026" + ------- "\164\033\161\044\163\054\030\001\001\000\002\001\001" + ------- "\000\016\012\012\024\065\037\063\040\061\041\066\043" + ------- "\062\001\001\000\002\001\001\000\016\017\020\025\023" + ------- "\027\017\034\036\045\031\054\030\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\004\063\055\001\001\000\002\001\001\000\002\001" + ------- "\001\000\002\001\001\000\010\027\017\034\036\045\045" + ------- "\001\001\000\002\001\001\000\002\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\002\001\001\000\004\061\042\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\002\001\001\000\002\001\001\000\002\001\001\000" + ------- "\002\001\001\000\002\001\001\000\002\001\001\000\002" + ------- "\001\001\000\002\001\001\000\004\054\051\001\001\000" + ------- "\002\001\001\000\002\001\001\000\002\001\001\000\004" + ------- "\034\057\001\001\000\002\001\001\000\002\001\001\000" + ------- "\002\001\001\000\002\001\001\000\006\015\114\037\113" + ------- "\001\001\000\004\041\112\001\001\000\002\001\001\000" + ------- "\002\001\001\000\002\001\001\000\002\001\001\000\004" + ------- "\066\107\001\001\000\004\064\104\001\001\000\004\065" + ------- "\072\001\001\000\012\042\077\047\074\052\100\053\075" + ------- "\001\001\000\002\001\001\000\002\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\002\001\001\000\010\047\074\052\103\053\075\001" + ------- "\001\000\002\001\001\000\012\042\105\047\074\052\100" + ------- "\053\075\001\001\000\002\001\001\000\002\001\001\000" + ------- "\012\042\110\047\074\052\100\053\075\001\001\000\002" + ------- "\001\001\000\002\001\001\000\002\001\001\000\002\001" + ------- "\001\000\010\016\126\030\127\046\124\001\001\000\002" + ------- "\001\001\000\004\046\120\001\001\000\002\001\001\000" + ------- "\004\067\122\001\001\000\002\001\001\000\002\001\001" + ------- "\000\002\001\001\000\004\070\133\001\001\000\004\072" + ------- "\131\001\001\000\006\030\130\046\124\001\001\000\002" + ------- "\001\001\000\002\001\001\000\002\001\001\000\002\001" + ------- "\001\000\002\001\001\000\004\071\135\001\001\000\012" + ------- "\031\137\035\141\036\140\037\136\001\001\000\002\001" + ------- "\001\000\006\032\150\047\147\001\001\000\002\001\001" + ------- "\000\002\001\001\000\002\001\001\000\010\031\137\036" + ------- "\144\037\136\001\001\000\002\001\001\000\002\001\001" + ------- "\000\006\047\074\053\156\001\001\000\006\037\151\051" + ------- "\152\001\001\000\002\001\001\000\002\001\001\000\002" + ------- "\001\001\000\006\050\154\054\155\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\010\026\164\033\161\044\174\001\001\000\002\001" + ------- "\001\000\004\060\172\001\001\000\002\001\001\000\004" + ------- "\062\165\001\001\000\002\001\001\000\004\033\170\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\002\001\001\000\002\001\001\000\002\001\001\000" + ------- "\002\001\001\000\006\005\203\037\204\001\001\000\006" + ------- "\017\200\054\030\001\001\000\004\056\201\001\001\000" + ------- "\002\001\001\000\002\001\001\000\006\007\205\020\206" + ------- "\001\001\000\002\001\001\000\022\006\225\010\220\012" + ------- "\012\013\217\014\227\022\221\023\216\024\007\001\001" + ------- "\000\002\001\001\000\010\017\210\021\211\054\030\001" + ------- "\001\000\002\001\001\000\004\057\212\001\001\000\002" + ------- "\001\001\000\002\001\001\000\004\054\051\001\001\000" + ------- "\002\001\001\000\002\001\001\000\002\001\001\000\002" + ------- "\001\001\000\002\001\001\000\002\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\016\012\012\024\065\037\063\040\230\041\066\043" + ------- "\062\001\001\000\006\015\231\037\113\001\001\000\010" + ------- "\016\232\030\127\046\124\001\001\000\006\030\130\046" + ------- "\124\001\001\000\002\001\001\000\004\011\236\001\001" + ------- "\000\002\001\001\000\002\001\001\000\002\001\001\000" + ------- "\004\011\241\001\001\000\002\001\001\000\002\001\001" + ------- "\000\004\011\244\001\001\000\002\001\001\000\002\001" + ------- "\001\000\004\011\247\001\001\000\002\001\001\000\002" + ------- "\001\001" }); ------- ------- /** Access to reduce_goto table. */ ------- public short[][] reduce_table() {return _reduce_table;} ------- ------- /** Instance of action encapsulation class. */ ------- protected CUP$parser$actions action_obj; ------- ------- /** Action encapsulation object initializer. */ ------- protected void init_actions() ------- { ------- action_obj = new CUP$parser$actions(this); ------- } ------- ------- /** Invoke a user supplied parse action. */ ------- public java_cup.runtime.Symbol do_action( ------- int act_num, ------- java_cup.runtime.lr_parser parser, ------- java.util.Stack stack, ------- int top) ------- throws java.lang.Exception ------- { ------- /* call code in generated class */ ------- return action_obj.CUP$parser$do_action(act_num, parser, stack, top); ------- } ------- ------- /** Indicates start state. */ ------- public int start_state() {return 0;} ------- /** Indicates start production. */ ------- public int start_production() {return 0;} ------- ------- /** EOF Symbol index. */ ------- public int EOF_sym() {return 0;} ------- ------- /** error Symbol index. */ ------- public int error_sym() {return 1;} ------- ------- ------- /** User initialization code. */ ------- public void user_init() throws java.lang.Exception ------- { ------- lexer.init(); ------- } ------- ------- /** Scan to get the next Symbol. */ ------- public java_cup.runtime.Symbol scan() ------- throws java.lang.Exception ------- { ------- return lexer.next_token(); ------- } ------- ------- ------- ------- /* override error routines */ ------- ------- public void report_fatal_error( ------- String message, ------- Object info) ------- { ------- done_parsing(); ------- lexer.emit_error(message); ------- System.err.println("Can't recover from previous error(s), giving up."); ------- System.exit(1); ------- } ------- ------- public void report_error(String message, Object info) ------- { ------- lexer.emit_error(message); ------- } ------- -------} ------- -------/** Cup generated class to encapsulate user supplied action code.*/ -------class CUP$parser$actions { ------- ------- ------- /** helper routine to clone a new production part adding a given label */ ------- protected production_part add_lab(production_part part, String lab) ------- throws internal_error ------- { ------- /* if there is no label, or this is an action, just return the original */ ------- if (lab == null || part.is_action()) return part; ------- ------- /* otherwise build a new one with the given label attached */ ------- return new symbol_part(((symbol_part)part).the_symbol(),lab); ------- } ------- ------- /** max size of right hand side we will support */ ------- protected final int MAX_RHS = 200; ------- ------- /** array for accumulating right hand side parts */ ------- protected production_part[] rhs_parts = new production_part[MAX_RHS]; ------- ------- /** where we are currently in building a right hand side */ ------- protected int rhs_pos = 0; ------- ------- /** start a new right hand side */ ------- protected void new_rhs() {rhs_pos = 0; } ------- ------- /** add a new right hand side part */ ------- protected void add_rhs_part(production_part part) throws java.lang.Exception ------- { ------- if (rhs_pos >= MAX_RHS) ------- throw new Exception("Internal Error: Productions limited to " + ------- MAX_RHS + " symbols and actions"); ------- ------- rhs_parts[rhs_pos] = part; ------- rhs_pos++; ------- } ------- ------- /** string to build up multiple part names */ ------- protected String multipart_name = new String(); ------- ------- /** append a new name segment to the accumulated multipart name */ ------- protected void append_multipart(String name) ------- { ------- String dot = ""; ------- ------- /* if we aren't just starting out, put on a dot */ ------- if (multipart_name.length() != 0) dot = "."; ------- ------- multipart_name = multipart_name.concat(dot + name); ------- } ------- ------- /** table of declared symbols -- contains production parts indexed by name */ ------- protected Hashtable symbols = new Hashtable(); ------- ------- /** table of just non terminals -- contains non_terminals indexed by name */ ------- protected Hashtable non_terms = new Hashtable(); ------- ------- /** declared start non_terminal */ ------- protected non_terminal start_nt = null; ------- ------- /** left hand side non terminal of the current production */ ------- protected non_terminal lhs_nt; ------- ------- /** Current precedence number */ ------- int _cur_prec = 0; ------- ------- /** Current precedence side */ ------- int _cur_side = assoc.no_prec; ------- ------- /** update the precedences we are declaring */ ------- protected void update_precedence(int p) { ------- _cur_side = p; ------- _cur_prec++; ------- } ------- /** add relevant data to terminals */ ------- protected void add_precedence(String term) { ------- if (term == null) { ------- System.err.println("Unable to add precedence to nonexistent terminal"); ------- } else { ------- symbol_part sp = (symbol_part)symbols.get(term); ------- if (sp == null) { ------- System.err.println("Could find terminal " + term + " while declaring precedence"); ------- } else { ------- java_cup.symbol sym = sp.the_symbol(); ------- if (sym instanceof terminal) ------- ((terminal)sym).set_precedence(_cur_side, _cur_prec); ------- else System.err.println("Precedence declaration: Can't find terminal " + term); ------- } ------- } ------- } ------- ------- private final parser parser; ------- ------- /** Constructor */ ------- CUP$parser$actions(parser parser) { ------- this.parser = parser; ------- } ------- ------- /** Method with the actual generated action code. */ ------- public final java_cup.runtime.Symbol CUP$parser$do_action( ------- int CUP$parser$act_num, ------- java_cup.runtime.lr_parser CUP$parser$parser, ------- java.util.Stack CUP$parser$stack, ------- int CUP$parser$top) ------- throws java.lang.Exception ------- { ------- /* Symbol object for return from actions */ ------- java_cup.runtime.Symbol CUP$parser$result; ------- ------- /* select the action based on the action number */ ------- switch (CUP$parser$act_num) ------- { ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 106: // empty ::= ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(29/*empty*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 105: // opt_semi ::= SEMI ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(7/*opt_semi*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 104: // opt_semi ::= ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(7/*opt_semi*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 103: // non_terminal ::= NONTERMINAL ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(8/*non_terminal*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 102: // non_terminal ::= NON TERMINAL ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(8/*non_terminal*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 101: // robust_id ::= error ------- { ------- String RESULT = null; ------- ------- lexer.emit_error("Illegal use of reserved word"); ------- RESULT="ILLEGAL"; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 100: // robust_id ::= NONASSOC ------- { ------- String RESULT = null; ------- RESULT = "nonassoc"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 99: // robust_id ::= RIGHT ------- { ------- String RESULT = null; ------- RESULT = "right"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 98: // robust_id ::= LEFT ------- { ------- String RESULT = null; ------- RESULT = "left"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 97: // robust_id ::= PRECEDENCE ------- { ------- String RESULT = null; ------- RESULT = "precedence"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 96: // robust_id ::= START ------- { ------- String RESULT = null; ------- RESULT = "start"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 95: // robust_id ::= WITH ------- { ------- String RESULT = null; ------- RESULT = "with"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 94: // robust_id ::= SCAN ------- { ------- String RESULT = null; ------- RESULT = "scan"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 93: // robust_id ::= INIT ------- { ------- String RESULT = null; ------- RESULT = "init"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 92: // robust_id ::= NONTERMINAL ------- { ------- String RESULT = null; ------- RESULT = "nonterminal"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 91: // robust_id ::= NON ------- { ------- String RESULT = null; ------- RESULT = "non"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 90: // robust_id ::= TERMINAL ------- { ------- String RESULT = null; ------- RESULT = "terminal"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 89: // robust_id ::= PARSER ------- { ------- String RESULT = null; ------- RESULT = "parser"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 88: // robust_id ::= ACTION ------- { ------- String RESULT = null; ------- RESULT = "action"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 87: // robust_id ::= CODE ------- { ------- String RESULT = null; ------- RESULT = "code"; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 86: // robust_id ::= ID ------- { ------- String RESULT = null; ------- int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = the_id; ------- CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 85: // label_id ::= robust_id ------- { ------- String RESULT = null; ------- int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = the_id; ------- CUP$parser$result = new java_cup.runtime.Symbol(38/*label_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 84: // symbol_id ::= error ------- { ------- String RESULT = null; ------- ------- lexer.emit_error("Illegal use of reserved word"); ------- RESULT="ILLEGAL"; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(37/*symbol_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 83: // symbol_id ::= ID ------- { ------- String RESULT = null; ------- int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = the_id; ------- CUP$parser$result = new java_cup.runtime.Symbol(37/*symbol_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 82: // nt_id ::= error ------- { ------- String RESULT = null; ------- ------- lexer.emit_error("Illegal use of reserved word"); ------- RESULT="ILLEGAL"; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(36/*nt_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 81: // nt_id ::= ID ------- { ------- String RESULT = null; ------- int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = the_id; ------- CUP$parser$result = new java_cup.runtime.Symbol(36/*nt_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 80: // new_non_term_id ::= ID ------- { ------- Object RESULT = null; ------- int non_term_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int non_term_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String non_term_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* see if this non terminal has been declared before */ ------- if (symbols.get(non_term_id) != null) ------- { ------- /* issue a message */ ------- lexer.emit_error( "java_cup.runtime.Symbol \"" + non_term_id + ------- "\" has already been declared"); ------- } ------- else ------- { ------- if (multipart_name.equals("")) { ------- append_multipart("Object"); ------- } ------- /* build the non terminal object */ ------- non_terminal this_nt = ------- new non_terminal(non_term_id, multipart_name); ------- ------- /* put it in the non_terms table */ ------- non_terms.put(non_term_id, this_nt); ------- ------- /* build a production_part and put it in the symbols table */ ------- symbols.put(non_term_id, new symbol_part(this_nt)); ------- } ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(26/*new_non_term_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 79: // new_term_id ::= ID ------- { ------- Object RESULT = null; ------- int term_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int term_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String term_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* see if this terminal has been declared before */ ------- if (symbols.get(term_id) != null) ------- { ------- /* issue a message */ ------- lexer.emit_error("java_cup.runtime.Symbol \"" + term_id + ------- "\" has already been declared"); ------- } ------- else ------- { ------- /* if no type declared, declare one */ ------- if (multipart_name.equals("")) { ------- append_multipart("Object"); ------- } ------- /* build a production_part and put it in the table */ ------- symbols.put(term_id, ------- new symbol_part(new terminal(term_id, multipart_name))); ------- } ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(25/*new_term_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 78: // type_id ::= type_id LBRACK RBRACK ------- { ------- Object RESULT = null; ------- multipart_name = multipart_name.concat("[]"); ------- CUP$parser$result = new java_cup.runtime.Symbol(19/*type_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 77: // type_id ::= multipart_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(19/*type_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 76: // import_id ::= multipart_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(15/*import_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 75: // import_id ::= multipart_id DOT STAR ------- { ------- Object RESULT = null; ------- append_multipart("*"); ------- CUP$parser$result = new java_cup.runtime.Symbol(15/*import_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 74: // multipart_id ::= robust_id ------- { ------- Object RESULT = null; ------- int an_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int an_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String an_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- append_multipart(an_id); ------- CUP$parser$result = new java_cup.runtime.Symbol(13/*multipart_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 73: // multipart_id ::= multipart_id DOT robust_id ------- { ------- Object RESULT = null; ------- int another_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int another_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String another_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- append_multipart(another_id); ------- CUP$parser$result = new java_cup.runtime.Symbol(13/*multipart_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 72: // opt_label ::= empty ------- { ------- String RESULT = null; ------- RESULT = null; ------- CUP$parser$result = new java_cup.runtime.Symbol(39/*opt_label*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 71: // opt_label ::= COLON label_id ------- { ------- String RESULT = null; ------- int labidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int labidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String labid = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = labid; ------- CUP$parser$result = new java_cup.runtime.Symbol(39/*opt_label*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 70: // prod_part ::= CODE_STRING ------- { ------- Object RESULT = null; ------- int code_strleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int code_strright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String code_str = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* add a new production part */ ------- add_rhs_part(new action_part(code_str)); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(24/*prod_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 69: // prod_part ::= symbol_id opt_label ------- { ------- Object RESULT = null; ------- int symidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int symidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- String symid = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- int labidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int labidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String labid = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* try to look up the id */ ------- production_part symb = (production_part)symbols.get(symid); ------- ------- /* if that fails, symbol is undeclared */ ------- if (symb == null) ------- { ------- if (lexer.error_count == 0) ------- lexer.emit_error("java_cup.runtime.Symbol \"" + symid + ------- "\" has not been declared"); ------- } ------- else ------- { ------- /* add a labeled production part */ ------- add_rhs_part(add_lab(symb, labid)); ------- } ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(24/*prod_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 68: // prod_part_list ::= empty ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(23/*prod_part_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 67: // prod_part_list ::= prod_part_list prod_part ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(23/*prod_part_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 66: // rhs ::= prod_part_list ------- { ------- Object RESULT = null; ------- ------- if (lhs_nt != null) ------- { ------- /* build the production */ ------- production p = new production(lhs_nt, rhs_parts, rhs_pos); ------- ------- /* if we have no start non-terminal declared and this is ------- the first production, make its lhs nt the start_nt ------- and build a special start production for it. */ ------- if (start_nt == null) ------- { ------- start_nt = lhs_nt; ------- ------- /* build a special start production */ ------- new_rhs(); ------- add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); ------- add_rhs_part(new symbol_part(terminal.EOF)); ------- add_rhs_part(new action_part("RESULT = start_val;")); ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, rhs_pos); ------- ------- new_rhs(); ------- } ------- } ------- ------- /* reset the rhs accumulation in any case */ ------- new_rhs(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(28/*rhs*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 65: // rhs ::= prod_part_list PERCENT_PREC term_id ------- { ------- Object RESULT = null; ------- int term_nameleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int term_nameright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String term_name = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- java_cup.symbol sym = null; ------- if (lhs_nt != null) ------- { ------- /* Find the precedence symbol */ ------- if (term_name == null) { ------- System.err.println("No terminal for contextual precedence"); ------- sym = null; ------- } else { ------- sym = ((symbol_part)symbols.get(term_name)).the_symbol(); ------- } ------- /* build the production */ ------- production p; ------- if ((sym!=null) && (sym instanceof terminal)) { ------- p = new production(lhs_nt, rhs_parts, rhs_pos, ------- ((terminal)sym).precedence_num(), ------- ((terminal)sym).precedence_side()); ------- ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); ------- } else { ------- System.err.println("Invalid terminal " + term_name + ------- " for contextual precedence assignment"); ------- p = new production(lhs_nt, rhs_parts, rhs_pos); ------- } ------- ------- /* if we have no start non-terminal declared and this is ------- the first production, make its lhs nt the start_nt ------- and build a special start production for it. */ ------- if (start_nt == null) ------- { ------- start_nt = lhs_nt; ------- ------- /* build a special start production */ ------- new_rhs(); ------- add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); ------- add_rhs_part(new symbol_part(terminal.EOF)); ------- add_rhs_part(new action_part("RESULT = start_val;")); ------- if ((sym!=null) && (sym instanceof terminal)) { ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, ------- rhs_pos, ((terminal)sym).precedence_num(), ------- ((terminal)sym).precedence_side()); ------- } else { ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, rhs_pos); ------- } ------- new_rhs(); ------- } ------- } ------- ------- /* reset the rhs accumulation in any case */ ------- new_rhs(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(28/*rhs*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 64: // rhs_list ::= rhs ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(27/*rhs_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 63: // rhs_list ::= rhs_list BAR rhs ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(27/*rhs_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 62: // production ::= error NT$13 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$13 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(22/*production*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 61: // NT$13 ::= ------- { ------- Object RESULT = null; ------- lexer.emit_error("Syntax Error"); ------- CUP$parser$result = new java_cup.runtime.Symbol(56/*NT$13*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 60: // production ::= nt_id NT$11 COLON_COLON_EQUALS NT$12 rhs_list SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$11 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value; ------- // propagate RESULT from NT$12 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- int lhs_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left; ------- int lhs_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).right; ------- String lhs_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(22/*production*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 59: // NT$12 ::= ------- { ------- Object RESULT = null; ------- int lhs_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int lhs_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- String lhs_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(55/*NT$12*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 58: // NT$11 ::= ------- { ------- Object RESULT = null; ------- int lhs_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int lhs_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String lhs_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* lookup the lhs nt */ ------- lhs_nt = (non_terminal)non_terms.get(lhs_id); ------- ------- /* if it wasn't declared, emit a message */ ------- if (lhs_nt == null) ------- { ------- if (lexer.error_count == 0) ------- lexer.emit_error("LHS non terminal \"" + lhs_id + ------- "\" has not been declared"); ------- } ------- ------- /* reset the rhs accumulation */ ------- new_rhs(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(54/*NT$11*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 57: // production_list ::= production ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(12/*production_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 56: // production_list ::= production_list production ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(12/*production_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 55: // start_spec ::= empty ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(11/*start_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 54: // start_spec ::= START WITH nt_id NT$10 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$10 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- int start_nameleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int start_nameright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- String start_name = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(11/*start_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 53: // NT$10 ::= ------- { ------- Object RESULT = null; ------- int start_nameleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int start_nameright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String start_name = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* verify that the name has been declared as a non terminal */ ------- non_terminal nt = (non_terminal)non_terms.get(start_name); ------- if (nt == null) ------- { ------- lexer.emit_error( "Start non terminal \"" + start_name + ------- "\" has not been declared"); ------- } ------- else ------- { ------- /* remember the non-terminal for later */ ------- start_nt = nt; ------- ------- /* build a special start production */ ------- new_rhs(); ------- add_rhs_part(add_lab(new symbol_part(start_nt), "start_val")); ------- add_rhs_part(new symbol_part(terminal.EOF)); ------- add_rhs_part(new action_part("RESULT = start_val;")); ------- emit.start_production = ------- new production(non_terminal.START_nt, rhs_parts, rhs_pos); ------- new_rhs(); ------- } ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(53/*NT$10*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 52: // term_id ::= symbol_id ------- { ------- String RESULT = null; ------- int symleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int symright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String sym = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- /* check that the symbol_id is a terminal */ ------- if (symbols.get(sym) == null) ------- { ------- /* issue a message */ ------- lexer.emit_error("Terminal \"" + sym + ------- "\" has not been declared"); ------- } ------- RESULT = sym; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(41/*term_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 51: // terminal_id ::= term_id ------- { ------- String RESULT = null; ------- int symleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int symright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- String sym = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- ------- add_precedence(sym); ------- RESULT = sym; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(40/*terminal_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 50: // terminal_list ::= terminal_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(32/*terminal_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 49: // terminal_list ::= terminal_list COMMA terminal_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(32/*terminal_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 48: // preced ::= PRECEDENCE NONASSOC NT$9 terminal_list SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$9 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(31/*preced*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 47: // NT$9 ::= ------- { ------- Object RESULT = null; ------- ------- update_precedence(assoc.nonassoc); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(52/*NT$9*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 46: // preced ::= PRECEDENCE RIGHT NT$8 terminal_list SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$8 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(31/*preced*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 45: // NT$8 ::= ------- { ------- Object RESULT = null; ------- ------- update_precedence(assoc.right); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(51/*NT$8*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 44: // preced ::= PRECEDENCE LEFT NT$7 terminal_list SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$7 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(31/*preced*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 43: // NT$7 ::= ------- { ------- Object RESULT = null; ------- ------- update_precedence(assoc.left); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(50/*NT$7*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 42: // precedence_l ::= preced ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(33/*precedence_l*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 41: // precedence_l ::= precedence_l preced ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(33/*precedence_l*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 40: // precedence_list ::= empty ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(30/*precedence_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 39: // precedence_list ::= precedence_l ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(30/*precedence_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 38: // non_term_name_list ::= new_non_term_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(21/*non_term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 37: // non_term_name_list ::= non_term_name_list COMMA new_non_term_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(21/*non_term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 36: // term_name_list ::= new_term_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(20/*term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 35: // term_name_list ::= term_name_list COMMA new_term_id ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(20/*term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 34: // declares_non_term ::= non_term_name_list NT$6 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$6 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(35/*declares_non_term*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 33: // NT$6 ::= ------- { ------- Object RESULT = null; ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(49/*NT$6*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 32: // declares_term ::= term_name_list NT$5 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$5 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(34/*declares_term*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 31: // NT$5 ::= ------- { ------- Object RESULT = null; ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(48/*NT$5*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 30: // symbol ::= non_terminal error NT$4 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$4 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 29: // NT$4 ::= ------- { ------- Object RESULT = null; ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(47/*NT$4*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 28: // symbol ::= TERMINAL error NT$3 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$3 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 27: // NT$3 ::= ------- { ------- Object RESULT = null; ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(46/*NT$3*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 26: // symbol ::= non_terminal declares_non_term ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 25: // symbol ::= non_terminal type_id declares_non_term ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 24: // symbol ::= TERMINAL declares_term ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 23: // symbol ::= TERMINAL type_id declares_term ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 22: // symbol_list ::= symbol ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(10/*symbol_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 21: // symbol_list ::= symbol_list symbol ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(10/*symbol_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 20: // scan_code ::= SCAN WITH CODE_STRING opt_semi ------- { ------- Object RESULT = null; ------- int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- if (emit.scan_code!=null) ------- lexer.emit_error("Redundant scan code (skipping)"); ------- else /* save the user code */ ------- emit.scan_code = user_code; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(17/*scan_code*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 19: // init_code ::= INIT WITH CODE_STRING opt_semi ------- { ------- Object RESULT = null; ------- int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- if (emit.init_code!=null) ------- lexer.emit_error("Redundant init code (skipping)"); ------- else /* save the user code */ ------- emit.init_code = user_code; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(16/*init_code*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 18: // parser_code_part ::= PARSER CODE CODE_STRING opt_semi ------- { ------- Object RESULT = null; ------- int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- if (emit.parser_code!=null) ------- lexer.emit_error("Redundant parser code (skipping)"); ------- else /* save the user included code string */ ------- emit.parser_code = user_code; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(9/*parser_code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 17: // action_code_part ::= ACTION CODE CODE_STRING opt_semi ------- { ------- Object RESULT = null; ------- int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- if (emit.action_code!=null) ------- lexer.emit_error("Redundant action code (skipping)"); ------- else /* save the user included code string */ ------- emit.action_code = user_code; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(4/*action_code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 16: // code_parts ::= code_parts code_part ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(5/*code_parts*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 15: // code_parts ::= ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(5/*code_parts*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 14: // code_part ::= scan_code ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 13: // code_part ::= init_code ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 12: // code_part ::= parser_code_part ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 11: // code_part ::= action_code_part ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 10: // import_spec ::= IMPORT import_id NT$2 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$2 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(14/*import_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 9: // NT$2 ::= ------- { ------- Object RESULT = null; ------- ------- /* save this import on the imports list */ ------- emit.import_list.push(multipart_name); ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(45/*NT$2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 8: // import_list ::= empty ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*import_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 7: // import_list ::= import_list import_spec ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*import_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 6: // package_spec ::= empty ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(2/*package_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 5: // package_spec ::= PACKAGE multipart_id NT$1 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$1 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(2/*package_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 4: // NT$1 ::= ------- { ------- Object RESULT = null; ------- ------- /* save the package name */ ------- emit.package_name = multipart_name; ------- ------- /* reset the accumulated multipart name */ ------- multipart_name = new String(); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(44/*NT$1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 3: // spec ::= error symbol_list precedence_list start_spec production_list ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(1/*spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 2: // spec ::= NT$0 package_spec import_list code_parts symbol_list precedence_list start_spec production_list ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$0 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-7)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-7)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(1/*spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-7)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 1: // NT$0 ::= ------- { ------- Object RESULT = null; ------- ------- /* declare "error" as a terminal */ ------- symbols.put("error", new symbol_part(terminal.error)); ------- ------- /* declare start non terminal */ ------- non_terms.put("$START", non_terminal.START_nt); ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(43/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 0: // $START ::= spec EOF ------- { ------- Object RESULT = null; ------- int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- RESULT = start_val; ------- CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- /* ACCEPT */ ------- CUP$parser$parser.done_parsing(); ------- return CUP$parser$result; ------- ------- /* . . . . . .*/ ------- default: ------- throw new Exception( ------- "Invalid action number found in internal parse table"); ------- ------- } ------- } -------} ------- diff --cc Robust/cup/java_cup/production.class index e689e1c7,e689e1c7,e689e1c7,e689e1c7,e689e1c7,e689e1c7,e689e1c7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/production.java index 5a412871,5a412871,5a412871,5a412871,5a412871,5a412871,5a412871..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/production.java +++ /dev/null @@@@@@@@ -1,756 -1,756 -1,756 -1,756 -1,756 -1,756 -1,756 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.Hashtable; -------import java.util.Enumeration; ------- -------/** This class represents a production in the grammar. It contains ------- * a LHS non terminal, and an array of RHS symbols. As various ------- * transformations are done on the RHS of the production, it may shrink. ------- * As a result a separate length is always maintained to indicate how much ------- * of the RHS array is still valid.

------- * ------- * I addition to construction and manipulation operations, productions provide ------- * methods for factoring out actions (see remove_embedded_actions()), for ------- * computing the nullability of the production (i.e., can it derive the empty ------- * string, see check_nullable()), and operations for computing its first ------- * set (i.e., the set of terminals that could appear at the beginning of some ------- * string derived from the production, see check_first_set()). ------- * ------- * @see java_cup.production_part ------- * @see java_cup.symbol_part ------- * @see java_cup.action_part ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ ------- -------public class production { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. This constructor accepts a LHS non terminal, ------- * an array of RHS parts (including terminals, non terminals, and ------- * actions), and a string for a final reduce action. It does several ------- * manipulations in the process of creating a production object. ------- * After some validity checking it translates labels that appear in ------- * actions into code for accessing objects on the runtime parse stack. ------- * It them merges adjacent actions if they appear and moves any trailing ------- * action into the final reduce actions string. Next it removes any ------- * embedded actions by factoring them out with new action productions. ------- * Finally it assigns a unique index to the production.

------- * ------- * Factoring out of actions is accomplished by creating new "hidden" ------- * non terminals. For example if the production was originally:

-------   *    A ::= B {action} C D
-------   *  
------- * then it is factored into two productions:
-------   *    A ::= B X C D
-------   *    X ::= {action}
-------   *  
------- * (where X is a unique new non terminal). This has the effect of placing ------- * all actions at the end where they can be handled as part of a reduce by ------- * the parser. ------- */ ------- public production( ------- non_terminal lhs_sym, ------- production_part rhs_parts[], ------- int rhs_l, ------- String action_str) ------- throws internal_error ------- { ------- int i; ------- action_part tail_action; ------- String declare_str; ------- int rightlen = rhs_l; ------- ------- /* remember the length */ ------- if (rhs_l >= 0) ------- _rhs_length = rhs_l; ------- else if (rhs_parts != null) ------- _rhs_length = rhs_parts.length; ------- else ------- _rhs_length = 0; ------- ------- /* make sure we have a valid left-hand-side */ ------- if (lhs_sym == null) ------- throw new internal_error( ------- "Attempt to construct a production with a null LHS"); ------- ------- /* I'm not translating labels anymore, I'm adding code to declare ------- labels as valid variables. This way, the users code string is ------- untouched ------- 6/96 frankf */ ------- ------- /* check if the last part of the right hand side is an action. If ------- it is, it won't be on the stack, so we don't want to count it ------- in the rightlen. Then when we search down the stack for a ------- Symbol, we don't try to search past action */ ------- ------- if (rhs_l > 0) { ------- if (rhs_parts[rhs_l - 1].is_action()) { ------- rightlen = rhs_l - 1; ------- } else { ------- rightlen = rhs_l; ------- } ------- } ------- ------- /* get the generated declaration code for the necessary labels. */ ------- declare_str = declare_labels( ------- rhs_parts, rightlen, action_str); ------- ------- if (action_str == null) ------- action_str = declare_str; ------- else ------- action_str = declare_str + action_str; ------- ------- /* count use of lhs */ ------- lhs_sym.note_use(); ------- ------- /* create the part for left-hand-side */ ------- _lhs = new symbol_part(lhs_sym); ------- ------- /* merge adjacent actions (if any) */ ------- _rhs_length = merge_adjacent_actions(rhs_parts, _rhs_length); ------- ------- /* strip off any trailing action */ ------- tail_action = strip_trailing_action(rhs_parts, _rhs_length); ------- if (tail_action != null) _rhs_length--; ------- ------- /* Why does this run through the right hand side happen ------- over and over? here a quick combination of two ------- prior runs plus one I wanted of my own ------- frankf 6/25/96 */ ------- /* allocate and copy over the right-hand-side */ ------- /* count use of each rhs symbol */ ------- _rhs = new production_part[_rhs_length]; ------- for (i=0; i<_rhs_length; i++) { ------- _rhs[i] = rhs_parts[i]; ------- if (!_rhs[i].is_action()) { ------- ((symbol_part)_rhs[i]).the_symbol().note_use(); ------- if (((symbol_part)_rhs[i]).the_symbol() instanceof terminal) { ------- _rhs_prec = ------- ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_num(); ------- _rhs_assoc = ------- ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_side(); ------- } ------- } ------- } ------- ------- /*now action string is really declaration string, so put it in front! ------- 6/14/96 frankf */ ------- if (action_str == null) action_str = ""; ------- if (tail_action != null && tail_action.code_string() != null) ------- action_str = action_str + "\t\t" + tail_action.code_string(); ------- ------- /* stash the action */ ------- _action = new action_part(action_str); ------- ------- /* rewrite production to remove any embedded actions */ ------- remove_embedded_actions(); ------- ------- /* assign an index */ ------- _index = next_index++; ------- ------- /* put us in the global collection of productions */ ------- _all.put(new Integer(_index),this); ------- ------- /* put us in the production list of the lhs non terminal */ ------- lhs_sym.add_production(this); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with no action string. */ ------- public production( ------- non_terminal lhs_sym, ------- production_part rhs_parts[], ------- int rhs_l) ------- throws internal_error ------- { ------- this(lhs_sym,rhs_parts,rhs_l,null); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /* Constructor with precedence and associativity of production ------- contextually define */ ------- public production( ------- non_terminal lhs_sym, ------- production_part rhs_parts[], ------- int rhs_l, ------- String action_str, ------- int prec_num, ------- int prec_side) ------- throws internal_error ------- { ------- this(lhs_sym,rhs_parts,rhs_l,action_str); ------- ------- /* set the precedence */ ------- set_precedence_num(prec_num); ------- set_precedence_side(prec_side); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /* Constructor w/ no action string and contextual precedence ------- defined */ ------- public production( ------- non_terminal lhs_sym, ------- production_part rhs_parts[], ------- int rhs_l, ------- int prec_num, ------- int prec_side) ------- throws internal_error ------- { ------- this(lhs_sym,rhs_parts,rhs_l,null); ------- /* set the precedence */ ------- set_precedence_num(prec_num); ------- set_precedence_side(prec_side); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- ------- /** Table of all productions. Elements are stored using their index as ------- * the key. ------- */ ------- protected static Hashtable _all = new Hashtable(); ------- ------- /** Access to all productions. */ ------- public static Enumeration all() {return _all.elements();} ------- ------- /** Lookup a production by index. */ ------- public static production find(int indx) { ------- return (production) _all.get(new Integer(indx)); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Total number of productions. */ ------- public static int number() {return _all.size();} ------- ------- /** Static counter for assigning unique index numbers. */ ------- protected static int next_index; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The left hand side non-terminal. */ ------- protected symbol_part _lhs; ------- ------- /** The left hand side non-terminal. */ ------- public symbol_part lhs() {return _lhs;} ------- ------- ------- /** The precedence of the rule */ ------- protected int _rhs_prec = -1; ------- protected int _rhs_assoc = -1; ------- ------- /** Access to the precedence of the rule */ ------- public int precedence_num() { return _rhs_prec; } ------- public int precedence_side() { return _rhs_assoc; } ------- ------- /** Setting the precedence of a rule */ ------- public void set_precedence_num(int prec_num) { ------- _rhs_prec = prec_num; ------- } ------- public void set_precedence_side(int prec_side) { ------- _rhs_assoc = prec_side; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** A collection of parts for the right hand side. */ ------- protected production_part _rhs[]; ------- ------- /** Access to the collection of parts for the right hand side. */ ------- public production_part rhs(int indx) throws internal_error ------- { ------- if (indx >= 0 && indx < _rhs_length) ------- return _rhs[indx]; ------- else ------- throw new internal_error( ------- "Index out of range for right hand side of production"); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** How much of the right hand side array we are presently using. */ ------- protected int _rhs_length; ------- ------- /** How much of the right hand side array we are presently using. */ ------- public int rhs_length() {return _rhs_length;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** An action_part containing code for the action to be performed when we ------- * reduce with this production. ------- */ ------- protected action_part _action; ------- ------- /** An action_part containing code for the action to be performed when we ------- * reduce with this production. ------- */ ------- public action_part action() {return _action;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Index number of the production. */ ------- protected int _index; ------- ------- /** Index number of the production. */ ------- public int index() {return _index;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of number of reductions using this production. */ ------- protected int _num_reductions = 0; ------- ------- /** Count of number of reductions using this production. */ ------- public int num_reductions() {return _num_reductions;} ------- ------- /** Increment the count of reductions with this non-terminal */ ------- public void note_reduction_use() {_num_reductions++;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Is the nullability of the production known or unknown? */ ------- protected boolean _nullable_known = false; ------- ------- /** Is the nullability of the production known or unknown? */ ------- public boolean nullable_known() {return _nullable_known;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Nullability of the production (can it derive the empty string). */ ------- protected boolean _nullable = false; ------- ------- /** Nullability of the production (can it derive the empty string). */ ------- public boolean nullable() {return _nullable;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** First set of the production. This is the set of terminals that ------- * could appear at the front of some string derived from this production. ------- */ ------- protected terminal_set _first_set = new terminal_set(); ------- ------- /** First set of the production. This is the set of terminals that ------- * could appear at the front of some string derived from this production. ------- */ ------- public terminal_set first_set() {return _first_set;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Static Methods ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Determine if a given character can be a label id starter. ------- * @param c the character in question. ------- */ ------- protected static boolean is_id_start(char c) ------- { ------- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'); ------- ------- //later need to handle non-8-bit chars here ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if a character can be in a label id. ------- * @param c the character in question. ------- */ ------- protected static boolean is_id_char(char c) ------- { ------- return is_id_start(c) || (c >= '0' && c <= '9'); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- ------- /** Return label declaration code ------- * @param labelname the label name ------- * @param stack_type the stack type of label? ------- * @author frankf ------- */ ------- protected String make_declaration( ------- String labelname, ------- String stack_type, ------- int offset) ------- { ------- String ret; ------- ------- /* Put in the left/right value labels */ ------- if (emit.lr_values()) ------- ret = "\t\tint " + labelname + "left = ((java_cup.runtime.Symbol)" + ------- emit.pre("stack") + ".elementAt(" + emit.pre("top") + ------- "-" + offset + ")).left;\n" + ------- "\t\tint " + labelname + "right = ((java_cup.runtime.Symbol)" + ------- emit.pre("stack") + ".elementAt(" + emit.pre("top") + ------- "-" + offset + ")).right;\n"; ------- else ret = ""; ------- ------- /* otherwise, just declare label. */ ------- return ret + "\t\t" + stack_type + " " + labelname + " = (" + stack_type + ------- ")((" + "java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") ------- + "-" + offset + ")).value;\n"; ------- ------- } ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Declare label names as valid variables within the action string ------- * @param rhs array of RHS parts. ------- * @param rhs_len how much of rhs to consider valid. ------- * @param final_action the final action string of the production. ------- * @param lhs_type the object type associated with the LHS symbol. ------- */ ------- protected String declare_labels( ------- production_part rhs[], ------- int rhs_len, ------- String final_action) ------- { ------- String declaration = ""; ------- ------- symbol_part part; ------- action_part act_part; ------- int pos; ------- ------- /* walk down the parts and extract the labels */ ------- for (pos = 0; pos < rhs_len; pos++) ------- { ------- if (!rhs[pos].is_action()) ------- { ------- part = (symbol_part)rhs[pos]; ------- ------- /* if it has a label, make declaration! */ ------- if (part.label() != null) ------- { ------- declaration = declaration + ------- make_declaration(part.label(), part.the_symbol().stack_type(), ------- rhs_len-pos-1); ------- } ------- } ------- } ------- return declaration; ------- } ------- ------- ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Helper routine to merge adjacent actions in a set of RHS parts ------- * @param rhs_parts array of RHS parts. ------- * @param len amount of that array that is valid. ------- * @return remaining valid length. ------- */ ------- protected int merge_adjacent_actions(production_part rhs_parts[], int len) ------- { ------- int from_loc, to_loc, merge_cnt; ------- ------- /* bail out early if we have no work to do */ ------- if (rhs_parts == null || len == 0) return 0; ------- ------- merge_cnt = 0; ------- to_loc = -1; ------- for (from_loc=0; from_loc ------- * A ::= B {action1} C {action2} D ------- * ------- * then it will be factored into:
-------   *    A ::= B NT$1 C NT$2 D
-------   *    NT$1 ::= {action1}
-------   *    NT$2 ::= {action2}
-------   *  
------- * where NT$1 and NT$2 are new system created non terminals. ------- */ ------- ------- /* the declarations added to the parent production are also passed along, ------- as they should be perfectly valid in this code string, since it ------- was originally a code string in the parent, not on its own. ------- frank 6/20/96 */ ------- protected void remove_embedded_actions( ------- ------- ) throws internal_error ------- { ------- non_terminal new_nt; ------- production new_prod; ------- String declare_str; ------- ------- /* walk over the production and process each action */ ------- for (int act_loc = 0; act_loc < rhs_length(); act_loc++) ------- if (rhs(act_loc).is_action()) ------- { ------- ------- ------- declare_str = declare_labels( ------- _rhs, act_loc, ""); ------- /* create a new non terminal for the action production */ ------- new_nt = non_terminal.create_new(); ------- new_nt.is_embedded_action = true; /* 24-Mar-1998, CSA */ ------- ------- /* create a new production with just the action */ ------- new_prod = new action_production(this, new_nt, null, 0, ------- declare_str + ((action_part)rhs(act_loc)).code_string()); ------- ------- /* replace the action with the generated non terminal */ ------- _rhs[act_loc] = new symbol_part(new_nt); ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Check to see if the production (now) appears to be nullable. ------- * A production is nullable if its RHS could derive the empty string. ------- * This results when the RHS is empty or contains only non terminals ------- * which themselves are nullable. ------- */ ------- public boolean check_nullable() throws internal_error ------- { ------- production_part part; ------- symbol sym; ------- int pos; ------- ------- /* if we already know bail out early */ ------- if (nullable_known()) return nullable(); ------- ------- /* if we have a zero size RHS we are directly nullable */ ------- if (rhs_length() == 0) ------- { ------- /* stash and return the result */ ------- return set_nullable(true); ------- } ------- ------- /* otherwise we need to test all of our parts */ ------- for (pos=0; pos ------- * ------- * This is an abstract class. ------- * ------- * @see java_cup.production ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public abstract class production_part { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. */ ------- public production_part(String lab) ------- { ------- _label = lab; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Optional label for referring to the part within an action (null for ------- * no label). ------- */ ------- protected String _label; ------- ------- /** Optional label for referring to the part within an action (null for ------- * no label). ------- */ ------- public String label() {return _label;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Indicate if this is an action (rather than a symbol). Here in the ------- * base class, we don't this know yet, so its an abstract method. ------- */ ------- public abstract boolean is_action(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(production_part other) ------- { ------- if (other == null) return false; ------- ------- /* compare the labels */ ------- if (label() != null) ------- return label().equals(other.label()); ------- else ------- return other.label() == null; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof production_part)) ------- return false; ------- else ------- return equals((production_part)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a hash code. */ ------- public int hashCode() ------- { ------- return label()==null ? 0 : label().hashCode(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- if (label() != null) ------- return label() + ":"; ------- else ------- return " "; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/reduce_action.class index 14379c22,14379c22,14379c22,14379c22,14379c22,14379c22,14379c22..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/reduce_action.java index e8f4c84a,e8f4c84a,e8f4c84a,e8f4c84a,e8f4c84a,e8f4c84a,e8f4c84a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/reduce_action.java +++ /dev/null @@@@@@@@ -1,84 -1,84 -1,84 -1,84 -1,84 -1,84 -1,84 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class represents a reduce action within the parse table. ------- * The action simply stores the production that it reduces with and ------- * responds to queries about its type. ------- * ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class reduce_action extends parse_action { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. ------- * @param prod the production this action reduces with. ------- */ ------- public reduce_action(production prod ) throws internal_error ------- { ------- /* sanity check */ ------- if (prod == null) ------- throw new internal_error( ------- "Attempt to create a reduce_action with a null production"); ------- ------- _reduce_with = prod; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The production we reduce with. */ ------- protected production _reduce_with; ------- ------- /** The production we reduce with. */ ------- public production reduce_with() {return _reduce_with;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Quick access to type of action. */ ------- public int kind() {return REDUCE;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality test. */ ------- public boolean equals(reduce_action other) ------- { ------- return other != null && other.reduce_with() == reduce_with(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality test. */ ------- public boolean equals(Object other) ------- { ------- if (other instanceof reduce_action) ------- return equals((reduce_action)other); ------- else ------- return false; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute a hash code. */ ------- public int hashCode() ------- { ------- /* use the hash code of the production we are reducing with */ ------- return reduce_with().hashCode(); ------- } ------- ------- ------- /** Convert to string. */ ------- public String toString() ------- { ------- return "REDUCE(with prod " + reduce_with().index() + ")"; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/runtime/Scanner.class index 29ef66b2,29ef66b2,29ef66b2,29ef66b2,29ef66b2,29ef66b2,29ef66b2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/runtime/Scanner.java index 32335516,32335516,32335516,32335516,32335516,32335516,32335516..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/runtime/Scanner.java +++ /dev/null @@@@@@@@ -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 +1,0 @@@@@@@@ -------package java_cup.runtime; ------- -------/** ------- * Defines the Scanner interface, which CUP uses in the default ------- * implementation of lr_parser.scan(). Integration ------- * of scanners implementing Scanner is facilitated. ------- * ------- * @version last updated 23-Jul-1999 ------- * @author David MacMahon ------- */ ------- -------/* ************************************************* ------- Interface Scanner ------- ------- Declares the next_token() method that should be ------- implemented by scanners. This method is typically ------- called by lr_parser.scan(). End-of-file can be ------- indicated either by returning ------- new Symbol(lr_parser.EOF_sym()) or ------- null. ------- ***************************************************/ -------public interface Scanner { ------- /** Return the next token, or null on end-of-file. */ ------- public Symbol next_token() throws java.lang.Exception; -------} diff --cc Robust/cup/java_cup/runtime/Symbol.class index 4831d12d,4831d12d,4831d12d,4831d12d,4831d12d,4831d12d,4831d12d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/runtime/Symbol.java index eeb6a0b4,eeb6a0b4,eeb6a0b4,eeb6a0b4,eeb6a0b4,eeb6a0b4,eeb6a0b4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/runtime/Symbol.java +++ /dev/null @@@@@@@@ -1,105 -1,105 -1,105 -1,105 -1,105 -1,105 -1,105 +1,0 @@@@@@@@ -------package java_cup.runtime; ------- -------/** ------- * Defines the Symbol class, which is used to represent all terminals ------- * and nonterminals while parsing. The lexer should pass CUP Symbols ------- * and CUP returns a Symbol. ------- * ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ ------- -------/* **************************************************************** ------- Class Symbol ------- what the parser expects to receive from the lexer. ------- the token is identified as follows: ------- sym: the symbol type ------- parse_state: the parse state. ------- value: is the lexical value of type Object ------- left : is the left position in the original input file ------- right: is the right position in the original input file -------******************************************************************/ ------- -------public class Symbol { ------- -------/******************************* ------- Constructor for l,r values ------- *******************************/ ------- ------- public Symbol(int id, int l, int r, Object o) { ------- this(id); ------- left = l; ------- right = r; ------- value = o; ------- } ------- -------/******************************* ------- Constructor for no l,r values -------********************************/ ------- ------- public Symbol(int id, Object o) { ------- this(id, -1, -1, o); ------- } ------- -------/***************************** ------- Constructor for no value ------- ***************************/ ------- ------- public Symbol(int id, int l, int r) { ------- this(id, l, r, null); ------- } ------- -------/*********************************** ------- Constructor for no value or l,r -------***********************************/ ------- ------- public Symbol(int sym_num) { ------- this(sym_num, -1); ------- left = -1; ------- right = -1; ------- value = null; ------- } ------- -------/*********************************** ------- Constructor to give a start state -------***********************************/ ------- Symbol(int sym_num, int state) ------- { ------- sym = sym_num; ------- parse_state = state; ------- } ------- -------/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The symbol number of the terminal or non terminal being represented */ ------- public int sym; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The parse state to be recorded on the parse stack with this symbol. ------- * This field is for the convenience of the parser and shouldn't be ------- * modified except by the parser. ------- */ ------- public int parse_state; ------- /** This allows us to catch some errors caused by scanners recycling ------- * symbols. For the use of the parser only. [CSA, 23-Jul-1999] */ ------- boolean used_by_parser = false; ------- -------/******************************* ------- The data passed to parser ------- *******************************/ ------- ------- public int left, right; ------- public Object value; ------- ------- /***************************** ------- Printing this token out. (Override for pretty-print). ------- ****************************/ ------- public String toString() { return "#"+sym; } -------} ------- ------- ------- ------- ------- ------- diff --cc Robust/cup/java_cup/runtime/lr_parser.class index 3edd4973,3edd4973,3edd4973,3edd4973,3edd4973,3edd4973,3edd4973..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/runtime/lr_parser.java index 3c8335cb,3c8335cb,3c8335cb,3c8335cb,3c8335cb,3c8335cb,3c8335cb..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/runtime/lr_parser.java +++ /dev/null @@@@@@@@ -1,1238 -1,1238 -1,1238 -1,1238 -1,1238 -1,1238 -1,1238 +1,0 @@@@@@@@ ------- -------package java_cup.runtime; ------- -------import java.util.Stack; ------- -------/** This class implements a skeleton table driven LR parser. In general, ------- * LR parsers are a form of bottom up shift-reduce parsers. Shift-reduce ------- * parsers act by shifting input onto a parse stack until the Symbols ------- * matching the right hand side of a production appear on the top of the ------- * stack. Once this occurs, a reduce is performed. This involves removing ------- * the Symbols corresponding to the right hand side of the production ------- * (the so called "handle") and replacing them with the non-terminal from ------- * the left hand side of the production.

------- * ------- * To control the decision of whether to shift or reduce at any given point, ------- * the parser uses a state machine (the "viable prefix recognition machine" ------- * built by the parser generator). The current state of the machine is placed ------- * on top of the parse stack (stored as part of a Symbol object representing ------- * a terminal or non terminal). The parse action table is consulted ------- * (using the current state and the current lookahead Symbol as indexes) to ------- * determine whether to shift or to reduce. When the parser shifts, it ------- * changes to a new state by pushing a new Symbol (containing a new state) ------- * onto the stack. When the parser reduces, it pops the handle (right hand ------- * side of a production) off the stack. This leaves the parser in the state ------- * it was in before any of those Symbols were matched. Next the reduce-goto ------- * table is consulted (using the new state and current lookahead Symbol as ------- * indexes) to determine a new state to go to. The parser then shifts to ------- * this goto state by pushing the left hand side Symbol of the production ------- * (also containing the new state) onto the stack.

------- * ------- * This class actually provides four LR parsers. The methods parse() and ------- * debug_parse() provide two versions of the main parser (the only difference ------- * being that debug_parse() emits debugging trace messages as it parses). ------- * In addition to these main parsers, the error recovery mechanism uses two ------- * more. One of these is used to simulate "parsing ahead" in the input ------- * without carrying out actions (to verify that a potential error recovery ------- * has worked), and the other is used to parse through buffered "parse ahead" ------- * input in order to execute all actions and re-synchronize the actual parser ------- * configuration.

------- * ------- * This is an abstract class which is normally filled out by a subclass ------- * generated by the JavaCup parser generator. In addition to supplying ------- * the actual parse tables, generated code also supplies methods which ------- * invoke various pieces of user supplied code, provide access to certain ------- * special Symbols (e.g., EOF and error), etc. Specifically, the following ------- * abstract methods are normally supplied by generated code: ------- *

------- *
short[][] production_table() ------- *
Provides a reference to the production table (indicating the index of ------- * the left hand side non terminal and the length of the right hand side ------- * for each production in the grammar). ------- *
short[][] action_table() ------- *
Provides a reference to the parse action table. ------- *
short[][] reduce_table() ------- *
Provides a reference to the reduce-goto table. ------- *
int start_state() ------- *
Indicates the index of the start state. ------- *
int start_production() ------- *
Indicates the index of the starting production. ------- *
int EOF_sym() ------- *
Indicates the index of the EOF Symbol. ------- *
int error_sym() ------- *
Indicates the index of the error Symbol. ------- *
Symbol do_action() ------- *
Executes a piece of user supplied action code. This always comes at ------- * the point of a reduce in the parse, so this code also allocates and ------- * fills in the left hand side non terminal Symbol object that is to be ------- * pushed onto the stack for the reduce. ------- *
void init_actions() ------- *
Code to initialize a special object that encapsulates user supplied ------- * actions (this object is used by do_action() to actually carry out the ------- * actions). ------- *
------- * ------- * In addition to these routines that must be supplied by the ------- * generated subclass there are also a series of routines that may ------- * be supplied. These include: ------- *
------- *
Symbol scan() ------- *
Used to get the next input Symbol from the scanner. ------- *
Scanner getScanner() ------- *
Used to provide a scanner for the default implementation of ------- * scan(). ------- *
int error_sync_size() ------- *
This determines how many Symbols past the point of an error ------- * must be parsed without error in order to consider a recovery to ------- * be valid. This defaults to 3. Values less than 2 are not ------- * recommended. ------- *
void report_error(String message, Object info) ------- *
This method is called to report an error. The default implementation ------- * simply prints a message to System.err and where the error occurred. ------- * This method is often replaced in order to provide a more sophisticated ------- * error reporting mechanism. ------- *
void report_fatal_error(String message, Object info) ------- *
This method is called when a fatal error that cannot be recovered from ------- * is encountered. In the default implementation, it calls ------- * report_error() to emit a message, then throws an exception. ------- *
void syntax_error(Symbol cur_token) ------- *
This method is called as soon as syntax error is detected (but ------- * before recovery is attempted). In the default implementation it ------- * invokes: report_error("Syntax error", null); ------- *
void unrecovered_syntax_error(Symbol cur_token) ------- *
This method is called if syntax error recovery fails. In the default ------- * implementation it invokes:
------- * report_fatal_error("Couldn't repair and continue parse", null); ------- *
------- * ------- * @see java_cup.runtime.Symbol ------- * @see java_cup.runtime.Symbol ------- * @see java_cup.runtime.virtual_parse_stack ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ ------- -------public abstract class lr_parser { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. */ ------- public lr_parser() ------- { ------- /* nothing to do here */ ------- } ------- ------- /** Constructor that sets the default scanner. [CSA/davidm] */ ------- public lr_parser(Scanner s) { ------- this(); /* in case default constructor someday does something */ ------- setScanner(s); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The default number of Symbols after an error we much match to consider ------- * it recovered from. ------- */ ------- protected final static int _error_sync_size = 3; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The number of Symbols after an error we much match to consider it ------- * recovered from. ------- */ ------- protected int error_sync_size() {return _error_sync_size; } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Table of production information (supplied by generated subclass). ------- * This table contains one entry per production and is indexed by ------- * the negative-encoded values (reduce actions) in the action_table. ------- * Each entry has two parts, the index of the non-terminal on the ------- * left hand side of the production, and the number of Symbols ------- * on the right hand side. ------- */ ------- public abstract short[][] production_table(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The action table (supplied by generated subclass). This table is ------- * indexed by state and terminal number indicating what action is to ------- * be taken when the parser is in the given state (i.e., the given state ------- * is on top of the stack) and the given terminal is next on the input. ------- * States are indexed using the first dimension, however, the entries for ------- * a given state are compacted and stored in adjacent index, value pairs ------- * which are searched for rather than accessed directly (see get_action()). ------- * The actions stored in the table will be either shifts, reduces, or ------- * errors. Shifts are encoded as positive values (one greater than the ------- * state shifted to). Reduces are encoded as negative values (one less ------- * than the production reduced by). Error entries are denoted by zero. ------- * ------- * @see java_cup.runtime.lr_parser#get_action ------- */ ------- public abstract short[][] action_table(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The reduce-goto table (supplied by generated subclass). This ------- * table is indexed by state and non-terminal number and contains ------- * state numbers. States are indexed using the first dimension, however, ------- * the entries for a given state are compacted and stored in adjacent ------- * index, value pairs which are searched for rather than accessed ------- * directly (see get_reduce()). When a reduce occurs, the handle ------- * (corresponding to the RHS of the matched production) is popped off ------- * the stack. The new top of stack indicates a state. This table is ------- * then indexed by that state and the LHS of the reducing production to ------- * indicate where to "shift" to. ------- * ------- * @see java_cup.runtime.lr_parser#get_reduce ------- */ ------- public abstract short[][] reduce_table(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The index of the start state (supplied by generated subclass). */ ------- public abstract int start_state(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The index of the start production (supplied by generated subclass). */ ------- public abstract int start_production(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The index of the end of file terminal Symbol (supplied by generated ------- * subclass). ------- */ ------- public abstract int EOF_sym(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The index of the special error Symbol (supplied by generated subclass). */ ------- public abstract int error_sym(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Internal flag to indicate when parser should quit. */ ------- protected boolean _done_parsing = false; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** This method is called to indicate that the parser should quit. This is ------- * normally called by an accept action, but can be used to cancel parsing ------- * early in other circumstances if desired. ------- */ ------- public void done_parsing() ------- { ------- _done_parsing = true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- /* Global parse state shared by parse(), error recovery, and ------- * debugging routines */ ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Indication of the index for top of stack (for use by actions). */ ------- protected int tos; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The current lookahead Symbol. */ ------- protected Symbol cur_token; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The parse stack itself. */ ------- protected Stack stack = new Stack(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Direct reference to the production table. */ ------- protected short[][] production_tab; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Direct reference to the action table. */ ------- protected short[][] action_tab; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Direct reference to the reduce-goto table. */ ------- protected short[][] reduce_tab; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** This is the scanner object used by the default implementation ------- * of scan() to get Symbols. To avoid name conflicts with existing ------- * code, this field is private. [CSA/davidm] */ ------- private Scanner _scanner; ------- ------- /** ------- * Simple accessor method to set the default scanner. ------- */ ------- public void setScanner(Scanner s) { _scanner = s; } ------- ------- /** ------- * Simple accessor method to get the default scanner. ------- */ ------- public Scanner getScanner() { return _scanner; } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Perform a bit of user supplied action code (supplied by generated ------- * subclass). Actions are indexed by an internal action number assigned ------- * at parser generation time. ------- * ------- * @param act_num the internal index of the action to be performed. ------- * @param parser the parser object we are acting for. ------- * @param stack the parse stack of that object. ------- * @param top the index of the top element of the parse stack. ------- */ ------- public abstract Symbol do_action( ------- int act_num, ------- lr_parser parser, ------- Stack stack, ------- int top) ------- throws java.lang.Exception; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** User code for initialization inside the parser. Typically this ------- * initializes the scanner. This is called before the parser requests ------- * the first Symbol. Here this is just a placeholder for subclasses that ------- * might need this and we perform no action. This method is normally ------- * overridden by the generated code using this contents of the "init with" ------- * clause as its body. ------- */ ------- public void user_init() throws java.lang.Exception { } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Initialize the action object. This is called before the parser does ------- * any parse actions. This is filled in by generated code to create ------- * an object that encapsulates all action code. ------- */ ------- protected abstract void init_actions() throws java.lang.Exception; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Get the next Symbol from the input (supplied by generated subclass). ------- * Once end of file has been reached, all subsequent calls to scan ------- * should return an EOF Symbol (which is Symbol number 0). By default ------- * this method returns getScanner().next_token(); this implementation ------- * can be overriden by the generated parser using the code declared in ------- * the "scan with" clause. Do not recycle objects; every call to ------- * scan() should return a fresh object. ------- */ ------- public Symbol scan() throws java.lang.Exception { ------- Symbol sym = getScanner().next_token(); ------- return (sym!=null) ? sym : new Symbol(EOF_sym()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Report a fatal error. This method takes a message string and an ------- * additional object (to be used by specializations implemented in ------- * subclasses). Here in the base class a very simple implementation ------- * is provided which reports the error then throws an exception. ------- * ------- * @param message an error message. ------- * @param info an extra object reserved for use by specialized subclasses. ------- */ ------- public void report_fatal_error( ------- String message, ------- Object info) ------- throws java.lang.Exception ------- { ------- /* stop parsing (not really necessary since we throw an exception, but) */ ------- done_parsing(); ------- ------- /* use the normal error message reporting to put out the message */ ------- report_error(message, info); ------- ------- /* throw an exception */ ------- throw new Exception("Can't recover from previous error(s)"); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Report a non fatal error (or warning). This method takes a message ------- * string and an additional object (to be used by specializations ------- * implemented in subclasses). Here in the base class a very simple ------- * implementation is provided which simply prints the message to ------- * System.err. ------- * ------- * @param message an error message. ------- * @param info an extra object reserved for use by specialized subclasses. ------- */ ------- public void report_error(String message, Object info) ------- { ------- System.err.print(message); ------- if (info instanceof Symbol) ------- if (((Symbol)info).left != -1) ------- System.err.println(" at character " + ((Symbol)info).left + ------- " of input"); ------- else System.err.println(""); ------- else System.err.println(""); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** This method is called when a syntax error has been detected and recovery ------- * is about to be invoked. Here in the base class we just emit a ------- * "Syntax error" error message. ------- * ------- * @param cur_token the current lookahead Symbol. ------- */ ------- public void syntax_error(Symbol cur_token) ------- { ------- report_error("Syntax error", cur_token); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** This method is called if it is determined that syntax error recovery ------- * has been unsuccessful. Here in the base class we report a fatal error. ------- * ------- * @param cur_token the current lookahead Symbol. ------- */ ------- public void unrecovered_syntax_error(Symbol cur_token) ------- throws java.lang.Exception ------- { ------- report_fatal_error("Couldn't repair and continue parse", cur_token); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Fetch an action from the action table. The table is broken up into ------- * rows, one per state (rows are indexed directly by state number). ------- * Within each row, a list of index, value pairs are given (as sequential ------- * entries in the table), and the list is terminated by a default entry ------- * (denoted with a Symbol index of -1). To find the proper entry in a row ------- * we do a linear or binary search (depending on the size of the row). ------- * ------- * @param state the state index of the action being accessed. ------- * @param sym the Symbol index of the action being accessed. ------- */ ------- protected final short get_action(int state, int sym) ------- { ------- short tag; ------- int first, last, probe; ------- short[] row = action_tab[state]; ------- ------- /* linear search if we are < 10 entries */ ------- if (row.length < 20) ------- for (probe = 0; probe < row.length; probe++) ------- { ------- /* is this entry labeled with our Symbol or the default? */ ------- tag = row[probe++]; ------- if (tag == sym || tag == -1) ------- { ------- /* return the next entry */ ------- return row[probe]; ------- } ------- } ------- /* otherwise binary search */ ------- else ------- { ------- first = 0; ------- last = (row.length-1)/2 - 1; /* leave out trailing default entry */ ------- while (first <= last) ------- { ------- probe = (first+last)/2; ------- if (sym == row[probe*2]) ------- return row[probe*2+1]; ------- else if (sym > row[probe*2]) ------- first = probe+1; ------- else ------- last = probe-1; ------- } ------- ------- /* not found, use the default at the end */ ------- return row[row.length-1]; ------- } ------- ------- /* shouldn't happened, but if we run off the end we return the ------- default (error == 0) */ ------- return 0; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Fetch a state from the reduce-goto table. The table is broken up into ------- * rows, one per state (rows are indexed directly by state number). ------- * Within each row, a list of index, value pairs are given (as sequential ------- * entries in the table), and the list is terminated by a default entry ------- * (denoted with a Symbol index of -1). To find the proper entry in a row ------- * we do a linear search. ------- * ------- * @param state the state index of the entry being accessed. ------- * @param sym the Symbol index of the entry being accessed. ------- */ ------- protected final short get_reduce(int state, int sym) ------- { ------- short tag; ------- short[] row = reduce_tab[state]; ------- ------- /* if we have a null row we go with the default */ ------- if (row == null) ------- return -1; ------- ------- for (int probe = 0; probe < row.length; probe++) ------- { ------- /* is this entry labeled with our Symbol or the default? */ ------- tag = row[probe++]; ------- if (tag == sym || tag == -1) ------- { ------- /* return the next entry */ ------- return row[probe]; ------- } ------- } ------- /* if we run off the end we return the default (error == -1) */ ------- return -1; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** This method provides the main parsing routine. It returns only when ------- * done_parsing() has been called (typically because the parser has ------- * accepted, or a fatal error has been reported). See the header ------- * documentation for the class regarding how shift/reduce parsers operate ------- * and how the various tables are used. ------- */ ------- public Symbol parse() throws java.lang.Exception ------- { ------- /* the current action code */ ------- int act; ------- ------- /* the Symbol/stack element returned by a reduce */ ------- Symbol lhs_sym = null; ------- ------- /* information about production being reduced with */ ------- short handle_size, lhs_sym_num; ------- ------- /* set up direct reference to tables to drive the parser */ ------- ------- production_tab = production_table(); ------- action_tab = action_table(); ------- reduce_tab = reduce_table(); ------- ------- /* initialize the action encapsulation object */ ------- init_actions(); ------- ------- /* do user initialization */ ------- user_init(); ------- ------- /* get the first token */ ------- cur_token = scan(); ------- ------- /* push dummy Symbol with start state to get us underway */ ------- stack.removeAllElements(); ------- stack.push(new Symbol(0, start_state())); ------- tos = 0; ------- ------- /* continue until we are told to stop */ ------- for (_done_parsing = false; !_done_parsing; ) ------- { ------- /* Check current token for freshness. */ ------- if (cur_token.used_by_parser) ------- throw new Error("Symbol recycling detected (fix your scanner)."); ------- ------- /* current state is always on the top of the stack */ ------- ------- /* look up action out of the current state with the current input */ ------- act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym); ------- ------- /* decode the action -- > 0 encodes shift */ ------- if (act > 0) ------- { ------- /* shift to the encoded state by pushing it on the stack */ ------- cur_token.parse_state = act-1; ------- cur_token.used_by_parser = true; ------- stack.push(cur_token); ------- tos++; ------- ------- /* advance to the next Symbol */ ------- cur_token = scan(); ------- } ------- /* if its less than zero, then it encodes a reduce action */ ------- else if (act < 0) ------- { ------- /* perform the action for the reduce */ ------- lhs_sym = do_action((-act)-1, this, stack, tos); ------- ------- /* look up information about the production */ ------- lhs_sym_num = production_tab[(-act)-1][0]; ------- handle_size = production_tab[(-act)-1][1]; ------- ------- /* pop the handle off the stack */ ------- for (int i = 0; i < handle_size; i++) ------- { ------- stack.pop(); ------- tos--; ------- } ------- ------- /* look up the state to go to from the one popped back to */ ------- act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); ------- ------- /* shift to that state */ ------- lhs_sym.parse_state = act; ------- lhs_sym.used_by_parser = true; ------- stack.push(lhs_sym); ------- tos++; ------- } ------- /* finally if the entry is zero, we have an error */ ------- else if (act == 0) ------- { ------- /* call user syntax error reporting routine */ ------- syntax_error(cur_token); ------- ------- /* try to error recover */ ------- if (!error_recovery(false)) ------- { ------- /* if that fails give up with a fatal syntax error */ ------- unrecovered_syntax_error(cur_token); ------- ------- /* just in case that wasn't fatal enough, end parse */ ------- done_parsing(); ------- } else { ------- lhs_sym = (Symbol)stack.peek(); ------- } ------- } ------- } ------- return lhs_sym; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Write a debugging message to System.err for the debugging version ------- * of the parser. ------- * ------- * @param mess the text of the debugging message. ------- */ ------- public void debug_message(String mess) ------- { ------- System.err.println(mess); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Dump the parse stack for debugging purposes. */ ------- public void dump_stack() ------- { ------- if (stack == null) ------- { ------- debug_message("# Stack dump requested, but stack is null"); ------- return; ------- } ------- ------- debug_message("============ Parse Stack Dump ============"); ------- ------- /* dump the stack */ ------- for (int i=0; i"); ------- if ((i%3)==2 || (i==(stack.size()-1))) { ------- debug_message(sb.toString()); ------- sb = new StringBuffer(" "); ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Perform a parse with debugging output. This does exactly the ------- * same things as parse(), except that it calls debug_shift() and ------- * debug_reduce() when shift and reduce moves are taken by the parser ------- * and produces various other debugging messages. ------- */ ------- public Symbol debug_parse() ------- throws java.lang.Exception ------- { ------- /* the current action code */ ------- int act; ------- ------- /* the Symbol/stack element returned by a reduce */ ------- Symbol lhs_sym = null; ------- ------- /* information about production being reduced with */ ------- short handle_size, lhs_sym_num; ------- ------- /* set up direct reference to tables to drive the parser */ ------- production_tab = production_table(); ------- action_tab = action_table(); ------- reduce_tab = reduce_table(); ------- ------- debug_message("# Initializing parser"); ------- ------- /* initialize the action encapsulation object */ ------- init_actions(); ------- ------- /* do user initialization */ ------- user_init(); ------- ------- /* the current Symbol */ ------- cur_token = scan(); ------- ------- debug_message("# Current Symbol is #" + cur_token.sym); ------- ------- /* push dummy Symbol with start state to get us underway */ ------- stack.removeAllElements(); ------- stack.push(new Symbol(0, start_state())); ------- tos = 0; ------- ------- /* continue until we are told to stop */ ------- for (_done_parsing = false; !_done_parsing; ) ------- { ------- /* Check current token for freshness. */ ------- if (cur_token.used_by_parser) ------- throw new Error("Symbol recycling detected (fix your scanner)."); ------- ------- /* current state is always on the top of the stack */ ------- //debug_stack(); ------- ------- /* look up action out of the current state with the current input */ ------- act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym); ------- ------- /* decode the action -- > 0 encodes shift */ ------- if (act > 0) ------- { ------- /* shift to the encoded state by pushing it on the stack */ ------- cur_token.parse_state = act-1; ------- cur_token.used_by_parser = true; ------- debug_shift(cur_token); ------- stack.push(cur_token); ------- tos++; ------- ------- /* advance to the next Symbol */ ------- cur_token = scan(); ------- debug_message("# Current token is " + cur_token); ------- } ------- /* if its less than zero, then it encodes a reduce action */ ------- else if (act < 0) ------- { ------- /* perform the action for the reduce */ ------- lhs_sym = do_action((-act)-1, this, stack, tos); ------- ------- /* look up information about the production */ ------- lhs_sym_num = production_tab[(-act)-1][0]; ------- handle_size = production_tab[(-act)-1][1]; ------- ------- debug_reduce((-act)-1, lhs_sym_num, handle_size); ------- ------- /* pop the handle off the stack */ ------- for (int i = 0; i < handle_size; i++) ------- { ------- stack.pop(); ------- tos--; ------- } ------- ------- /* look up the state to go to from the one popped back to */ ------- act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); ------- debug_message("# Reduce rule: top state " + ------- ((Symbol)stack.peek()).parse_state + ------- ", lhs sym " + lhs_sym_num + " -> state " + act); ------- ------- /* shift to that state */ ------- lhs_sym.parse_state = act; ------- lhs_sym.used_by_parser = true; ------- stack.push(lhs_sym); ------- tos++; ------- ------- debug_message("# Goto state #" + act); ------- } ------- /* finally if the entry is zero, we have an error */ ------- else if (act == 0) ------- { ------- /* call user syntax error reporting routine */ ------- syntax_error(cur_token); ------- ------- /* try to error recover */ ------- if (!error_recovery(true)) ------- { ------- /* if that fails give up with a fatal syntax error */ ------- unrecovered_syntax_error(cur_token); ------- ------- /* just in case that wasn't fatal enough, end parse */ ------- done_parsing(); ------- } else { ------- lhs_sym = (Symbol)stack.peek(); ------- } ------- } ------- } ------- return lhs_sym; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- /* Error recovery code */ ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Attempt to recover from a syntax error. This returns false if recovery ------- * fails, true if it succeeds. Recovery happens in 4 steps. First we ------- * pop the parse stack down to a point at which we have a shift out ------- * of the top-most state on the error Symbol. This represents the ------- * initial error recovery configuration. If no such configuration is ------- * found, then we fail. Next a small number of "lookahead" or "parse ------- * ahead" Symbols are read into a buffer. The size of this buffer is ------- * determined by error_sync_size() and determines how many Symbols beyond ------- * the error must be matched to consider the recovery a success. Next, ------- * we begin to discard Symbols in attempt to get past the point of error ------- * to a point where we can continue parsing. After each Symbol, we attempt ------- * to "parse ahead" though the buffered lookahead Symbols. The "parse ahead" ------- * process simulates that actual parse, but does not modify the real ------- * parser's configuration, nor execute any actions. If we can parse all ------- * the stored Symbols without error, then the recovery is considered a ------- * success. Once a successful recovery point is determined, we do an ------- * actual parse over the stored input -- modifying the real parse ------- * configuration and executing all actions. Finally, we return the the ------- * normal parser to continue with the overall parse. ------- * ------- * @param debug should we produce debugging messages as we parse. ------- */ ------- protected boolean error_recovery(boolean debug) ------- throws java.lang.Exception ------- { ------- if (debug) debug_message("# Attempting error recovery"); ------- ------- /* first pop the stack back into a state that can shift on error and ------- do that shift (if that fails, we fail) */ ------- if (!find_recovery_config(debug)) ------- { ------- if (debug) debug_message("# Error recovery fails"); ------- return false; ------- } ------- ------- /* read ahead to create lookahead we can parse multiple times */ ------- read_lookahead(); ------- ------- /* repeatedly try to parse forward until we make it the required dist */ ------- for (;;) ------- { ------- /* try to parse forward, if it makes it, bail out of loop */ ------- if (debug) debug_message("# Trying to parse ahead"); ------- if (try_parse_ahead(debug)) ------- { ------- break; ------- } ------- ------- /* if we are now at EOF, we have failed */ ------- if (lookahead[0].sym == EOF_sym()) ------- { ------- if (debug) debug_message("# Error recovery fails at EOF"); ------- return false; ------- } ------- ------- /* otherwise, we consume another Symbol and try again */ ------- // BUG FIX by Bruce Hutton ------- // Computer Science Department, University of Auckland, ------- // Auckland, New Zealand. ------- // It is the first token that is being consumed, not the one ------- // we were up to parsing ------- if (debug) ------- debug_message("# Consuming Symbol #" + lookahead[ 0 ].sym); ------- restart_lookahead(); ------- } ------- ------- /* we have consumed to a point where we can parse forward */ ------- if (debug) debug_message("# Parse-ahead ok, going back to normal parse"); ------- ------- /* do the real parse (including actions) across the lookahead */ ------- parse_lookahead(debug); ------- ------- /* we have success */ ------- return true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if we can shift under the special error Symbol out of the ------- * state currently on the top of the (real) parse stack. ------- */ ------- protected boolean shift_under_error() ------- { ------- /* is there a shift under error Symbol */ ------- return get_action(((Symbol)stack.peek()).parse_state, error_sym()) > 0; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Put the (real) parse stack into error recovery configuration by ------- * popping the stack down to a state that can shift on the special ------- * error Symbol, then doing the shift. If no suitable state exists on ------- * the stack we return false ------- * ------- * @param debug should we produce debugging messages as we parse. ------- */ ------- protected boolean find_recovery_config(boolean debug) ------- { ------- Symbol error_token; ------- int act; ------- ------- if (debug) debug_message("# Finding recovery state on stack"); ------- ------- /* Remember the right-position of the top symbol on the stack */ ------- int right_pos = ((Symbol)stack.peek()).right; ------- int left_pos = ((Symbol)stack.peek()).left; ------- ------- /* pop down until we can shift under error Symbol */ ------- while (!shift_under_error()) ------- { ------- /* pop the stack */ ------- if (debug) ------- debug_message("# Pop stack by one, state was # " + ------- ((Symbol)stack.peek()).parse_state); ------- left_pos = ((Symbol)stack.pop()).left; ------- tos--; ------- ------- /* if we have hit bottom, we fail */ ------- if (stack.empty()) ------- { ------- if (debug) debug_message("# No recovery state found on stack"); ------- return false; ------- } ------- } ------- ------- /* state on top of the stack can shift under error, find the shift */ ------- act = get_action(((Symbol)stack.peek()).parse_state, error_sym()); ------- if (debug) ------- { ------- debug_message("# Recover state found (#" + ------- ((Symbol)stack.peek()).parse_state + ")"); ------- debug_message("# Shifting on error to state #" + (act-1)); ------- } ------- ------- /* build and shift a special error Symbol */ ------- error_token = new Symbol(error_sym(), left_pos, right_pos); ------- error_token.parse_state = act-1; ------- error_token.used_by_parser = true; ------- stack.push(error_token); ------- tos++; ------- ------- return true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Lookahead Symbols used for attempting error recovery "parse aheads". */ ------- protected Symbol lookahead[]; ------- ------- /** Position in lookahead input buffer used for "parse ahead". */ ------- protected int lookahead_pos; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Read from input to establish our buffer of "parse ahead" lookahead ------- * Symbols. ------- */ ------- protected void read_lookahead() throws java.lang.Exception ------- { ------- /* create the lookahead array */ ------- lookahead = new Symbol[error_sync_size()]; ------- ------- /* fill in the array */ ------- for (int i = 0; i < error_sync_size(); i++) ------- { ------- lookahead[i] = cur_token; ------- cur_token = scan(); ------- } ------- ------- /* start at the beginning */ ------- lookahead_pos = 0; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return the current lookahead in our error "parse ahead" buffer. */ ------- protected Symbol cur_err_token() { return lookahead[lookahead_pos]; } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Advance to next "parse ahead" input Symbol. Return true if we have ------- * input to advance to, false otherwise. ------- */ ------- protected boolean advance_lookahead() ------- { ------- /* advance the input location */ ------- lookahead_pos++; ------- ------- /* return true if we didn't go off the end */ ------- return lookahead_pos < error_sync_size(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Reset the parse ahead input to one Symbol past where we started error ------- * recovery (this consumes one new Symbol from the real input). ------- */ ------- protected void restart_lookahead() throws java.lang.Exception ------- { ------- /* move all the existing input over */ ------- for (int i = 1; i < error_sync_size(); i++) ------- lookahead[i-1] = lookahead[i]; ------- ------- /* read a new Symbol into the last spot */ ------- // BUG Fix by Bruce Hutton ------- // Computer Science Department, University of Auckland, ------- // Auckland, New Zealand. [applied 5-sep-1999 by csa] ------- // The following two lines were out of order!! ------- lookahead[error_sync_size()-1] = cur_token; ------- cur_token = scan(); ------- ------- /* reset our internal position marker */ ------- lookahead_pos = 0; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Do a simulated parse forward (a "parse ahead") from the current ------- * stack configuration using stored lookahead input and a virtual parse ------- * stack. Return true if we make it all the way through the stored ------- * lookahead input without error. This basically simulates the action of ------- * parse() using only our saved "parse ahead" input, and not executing any ------- * actions. ------- * ------- * @param debug should we produce debugging messages as we parse. ------- */ ------- protected boolean try_parse_ahead(boolean debug) ------- throws java.lang.Exception ------- { ------- int act; ------- short lhs, rhs_size; ------- ------- /* create a virtual stack from the real parse stack */ ------- virtual_parse_stack vstack = new virtual_parse_stack(stack); ------- ------- /* parse until we fail or get past the lookahead input */ ------- for (;;) ------- { ------- /* look up the action from the current state (on top of stack) */ ------- act = get_action(vstack.top(), cur_err_token().sym); ------- ------- /* if its an error, we fail */ ------- if (act == 0) return false; ------- ------- /* > 0 encodes a shift */ ------- if (act > 0) ------- { ------- /* push the new state on the stack */ ------- vstack.push(act-1); ------- ------- if (debug) debug_message("# Parse-ahead shifts Symbol #" + ------- cur_err_token().sym + " into state #" + (act-1)); ------- ------- /* advance simulated input, if we run off the end, we are done */ ------- if (!advance_lookahead()) return true; ------- } ------- /* < 0 encodes a reduce */ ------- else ------- { ------- /* if this is a reduce with the start production we are done */ ------- if ((-act)-1 == start_production()) ------- { ------- if (debug) debug_message("# Parse-ahead accepts"); ------- return true; ------- } ------- ------- /* get the lhs Symbol and the rhs size */ ------- lhs = production_tab[(-act)-1][0]; ------- rhs_size = production_tab[(-act)-1][1]; ------- ------- /* pop handle off the stack */ ------- for (int i = 0; i < rhs_size; i++) ------- vstack.pop(); ------- ------- if (debug) ------- debug_message("# Parse-ahead reduces: handle size = " + ------- rhs_size + " lhs = #" + lhs + " from state #" + vstack.top()); ------- ------- /* look up goto and push it onto the stack */ ------- vstack.push(get_reduce(vstack.top(), lhs)); ------- if (debug) ------- debug_message("# Goto state #" + vstack.top()); ------- } ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Parse forward using stored lookahead Symbols. In this case we have ------- * already verified that parsing will make it through the stored lookahead ------- * Symbols and we are now getting back to the point at which we can hand ------- * control back to the normal parser. Consequently, this version of the ------- * parser performs all actions and modifies the real parse configuration. ------- * This returns once we have consumed all the stored input or we accept. ------- * ------- * @param debug should we produce debugging messages as we parse. ------- */ ------- protected void parse_lookahead(boolean debug) ------- throws java.lang.Exception ------- { ------- /* the current action code */ ------- int act; ------- ------- /* the Symbol/stack element returned by a reduce */ ------- Symbol lhs_sym = null; ------- ------- /* information about production being reduced with */ ------- short handle_size, lhs_sym_num; ------- ------- /* restart the saved input at the beginning */ ------- lookahead_pos = 0; ------- ------- if (debug) ------- { ------- debug_message("# Reparsing saved input with actions"); ------- debug_message("# Current Symbol is #" + cur_err_token().sym); ------- debug_message("# Current state is #" + ------- ((Symbol)stack.peek()).parse_state); ------- } ------- ------- /* continue until we accept or have read all lookahead input */ ------- while(!_done_parsing) ------- { ------- /* current state is always on the top of the stack */ ------- ------- /* look up action out of the current state with the current input */ ------- act = ------- get_action(((Symbol)stack.peek()).parse_state, cur_err_token().sym); ------- ------- /* decode the action -- > 0 encodes shift */ ------- if (act > 0) ------- { ------- /* shift to the encoded state by pushing it on the stack */ ------- cur_err_token().parse_state = act-1; ------- cur_err_token().used_by_parser = true; ------- if (debug) debug_shift(cur_err_token()); ------- stack.push(cur_err_token()); ------- tos++; ------- ------- /* advance to the next Symbol, if there is none, we are done */ ------- if (!advance_lookahead()) ------- { ------- if (debug) debug_message("# Completed reparse"); ------- ------- /* scan next Symbol so we can continue parse */ ------- // BUGFIX by Chris Harris : ------- // correct a one-off error by commenting out ------- // this next line. ------- /*cur_token = scan();*/ ------- ------- /* go back to normal parser */ ------- return; ------- } ------- ------- if (debug) ------- debug_message("# Current Symbol is #" + cur_err_token().sym); ------- } ------- /* if its less than zero, then it encodes a reduce action */ ------- else if (act < 0) ------- { ------- /* perform the action for the reduce */ ------- lhs_sym = do_action((-act)-1, this, stack, tos); ------- ------- /* look up information about the production */ ------- lhs_sym_num = production_tab[(-act)-1][0]; ------- handle_size = production_tab[(-act)-1][1]; ------- ------- if (debug) debug_reduce((-act)-1, lhs_sym_num, handle_size); ------- ------- /* pop the handle off the stack */ ------- for (int i = 0; i < handle_size; i++) ------- { ------- stack.pop(); ------- tos--; ------- } ------- ------- /* look up the state to go to from the one popped back to */ ------- act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); ------- ------- /* shift to that state */ ------- lhs_sym.parse_state = act; ------- lhs_sym.used_by_parser = true; ------- stack.push(lhs_sym); ------- tos++; ------- ------- if (debug) debug_message("# Goto state #" + act); ------- ------- } ------- /* finally if the entry is zero, we have an error ------- (shouldn't happen here, but...)*/ ------- else if (act == 0) ------- { ------- report_fatal_error("Syntax error", lhs_sym); ------- return; ------- } ------- } ------- ------- ------- } ------- ------- /*-----------------------------------------------------------*/ ------- ------- /** Utility function: unpacks parse tables from strings */ ------- protected static short[][] unpackFromStrings(String[] sa) ------- { ------- // Concatanate initialization strings. ------- StringBuffer sb = new StringBuffer(sa[0]); ------- for (int i=1; i= real_stack.size()) return; ------- ------- /* get a copy of the first Symbol we have not transfered */ ------- stack_sym = (Symbol)real_stack.elementAt(real_stack.size()-1-real_next); ------- ------- /* record the transfer */ ------- real_next++; ------- ------- /* put the state number from the Symbol onto the virtual stack */ ------- vstack.push(new Integer(stack_sym.parse_state)); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Indicate whether the stack is empty. */ ------- public boolean empty() ------- { ------- /* if vstack is empty then we were unable to transfer onto it and ------- the whole thing is empty. */ ------- return vstack.empty(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Return value on the top of the stack (without popping it). */ ------- public int top() throws java.lang.Exception ------- { ------- if (vstack.empty()) ------- throw new Exception( ------- "Internal parser error: top() called on empty virtual stack"); ------- ------- return ((Integer)vstack.peek()).intValue(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Pop the stack. */ ------- public void pop() throws java.lang.Exception ------- { ------- if (vstack.empty()) ------- throw new Exception( ------- "Internal parser error: pop from empty virtual stack"); ------- ------- /* pop it */ ------- vstack.pop(); ------- ------- /* if we are now empty transfer an element (if there is one) */ ------- if (vstack.empty()) ------- get_from_real(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Push a state number onto the stack. */ ------- public void push(int state_num) ------- { ------- vstack.push(new Integer(state_num)); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/shift_action.class index db961ff1,db961ff1,db961ff1,db961ff1,db961ff1,db961ff1,db961ff1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/shift_action.java index 33fc17a6,33fc17a6,33fc17a6,33fc17a6,33fc17a6,33fc17a6,33fc17a6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/shift_action.java +++ /dev/null @@@@@@@@ -1,82 -1,82 -1,82 -1,82 -1,82 -1,82 -1,82 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class represents a shift action within the parse table. ------- * The action simply stores the state that it shifts to and responds ------- * to queries about its type. ------- * ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class shift_action extends parse_action { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Simple constructor. ------- * @param shft_to the state that this action shifts to. ------- */ ------- public shift_action(lalr_state shft_to) throws internal_error ------- { ------- /* sanity check */ ------- if (shft_to == null) ------- throw new internal_error( ------- "Attempt to create a shift_action to a null state"); ------- ------- _shift_to = shft_to; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The state we shift to. */ ------- protected lalr_state _shift_to; ------- ------- /** The state we shift to. */ ------- public lalr_state shift_to() {return _shift_to;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Quick access to type of action. */ ------- public int kind() {return SHIFT;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality test. */ ------- public boolean equals(shift_action other) ------- { ------- return other != null && other.shift_to() == shift_to(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality test. */ ------- public boolean equals(Object other) ------- { ------- if (other instanceof shift_action) ------- return equals((shift_action)other); ------- else ------- return false; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute a hash code. */ ------- public int hashCode() ------- { ------- /* use the hash code of the state we are shifting to */ ------- return shift_to().hashCode(); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() {return "SHIFT(to state " + shift_to().index() + ")";} ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/simple_calc/CUP$parser$actions.class index 5758ef55,5758ef55,5758ef55,5758ef55,5758ef55,5758ef55,5758ef55..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/simple_calc/Main.class index aa2cc953,aa2cc953,aa2cc953,aa2cc953,aa2cc953,aa2cc953,aa2cc953..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/simple_calc/Main.java index 21ff5aa5,21ff5aa5,21ff5aa5,21ff5aa5,21ff5aa5,21ff5aa5,21ff5aa5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/simple_calc/Main.java +++ /dev/null @@@@@@@@ -1,32 -1,32 -1,32 -1,32 -1,32 -1,32 -1,32 +1,0 @@@@@@@@ -------// Driver for parser ------- -------package java_cup.simple_calc; ------- -------import java_cup.simple_calc.parser; -------import java_cup.runtime.Symbol; ------- -------class Main { ------- ------- static boolean do_debug_parse = false; ------- ------- static public void main(String[] args) throws java.io.IOException { ------- ------- /* create a parsing object */ ------- parser parser_obj = new parser(new scanner()); ------- ------- /* open input files, etc. here */ ------- Symbol parse_tree = null; ------- ------- try { ------- if (do_debug_parse) ------- parse_tree = parser_obj.debug_parse(); ------- else ------- parse_tree = parser_obj.parse(); ------- } catch (Exception e) { ------- /* do cleanup here -- possibly rethrow e */ ------- } finally { ------- /* do close out here */ ------- } ------- } -------} ------- diff --cc Robust/cup/java_cup/simple_calc/parser.class index 05da56ab,05da56ab,05da56ab,05da56ab,05da56ab,05da56ab,05da56ab..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/simple_calc/parser.cup index a88d9007,a88d9007,a88d9007,a88d9007,a88d9007,a88d9007,a88d9007..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/simple_calc/parser.cup +++ /dev/null @@@@@@@@ -1,55 -1,55 -1,55 -1,55 -1,55 -1,55 -1,55 +1,0 @@@@@@@@ -------// JavaCup specification for a simple expression evaluator (w/ actions) ------- -------package java_cup.simple_calc; ------- -------import java_cup.runtime.*; ------- -------/* Terminals (tokens returned by the scanner). */ -------terminal SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD; -------terminal UMINUS, LPAREN, RPAREN; -------terminal Integer NUMBER; ------- -------/* Non terminals */ -------non terminal Object expr_list, expr_part; -------non terminal Integer expr; ------- -------/* Precedences */ -------precedence left PLUS, MINUS; -------precedence left TIMES, DIVIDE, MOD; -------precedence left UMINUS, LPAREN; ------- -------/* The grammar */ -------expr_list ::= expr_list expr_part ------- | ------- expr_part; ------- -------expr_part ::= expr:e ------- {: System.out.println("= " + e); :} ------- SEMI ------- ; ------- -------expr ::= expr:e1 PLUS expr:e2 ------- {: RESULT = new Integer(e1.intValue() + e2.intValue()); :} ------- | ------- expr:e1 MINUS expr:e2 ------- {: RESULT = new Integer(e1.intValue() - e2.intValue()); :} ------- | ------- expr:e1 TIMES expr:e2 ------- {: RESULT = new Integer(e1.intValue() * e2.intValue()); :} ------- | ------- expr:e1 DIVIDE expr:e2 ------- {: RESULT = new Integer(e1.intValue() / e2.intValue()); :} ------- | ------- expr:e1 MOD expr:e2 ------- {: RESULT = new Integer(e1.intValue() % e2.intValue()); :} ------- | ------- NUMBER:n ------- {: RESULT = n; :} ------- | ------- MINUS expr:e ------- {: RESULT = new Integer(0 - e.intValue()); :} ------- %prec UMINUS ------- | ------- LPAREN expr:e RPAREN ------- {: RESULT = e; :} ------- ; diff --cc Robust/cup/java_cup/simple_calc/parser.java index d6003c72,d6003c72,d6003c72,d6003c72,d6003c72,d6003c72,d6003c72..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/simple_calc/parser.java +++ /dev/null @@@@@@@@ -1,318 -1,318 -1,318 -1,318 -1,318 -1,318 -1,318 +1,0 @@@@@@@@ ------- -------//---------------------------------------------------- -------// The following code was generated by CUP v0.10k -------// Sun Jul 25 13:36:02 EDT 1999 -------//---------------------------------------------------- ------- -------package java_cup.simple_calc; ------- -------import java_cup.runtime.*; ------- -------/** CUP v0.10k generated parser. ------- * @version Sun Jul 25 13:36:02 EDT 1999 ------- */ -------public class parser extends java_cup.runtime.lr_parser { ------- ------- /** Default constructor. */ ------- public parser() {super();} ------- ------- /** Constructor which sets the default scanner. */ ------- public parser(java_cup.runtime.Scanner s) {super(s);} ------- ------- /** Production table. */ ------- protected static final short _production_table[][] = ------- unpackFromStrings(new String[] { ------- "\000\015\000\002\003\004\000\002\002\004\000\002\003" + ------- "\003\000\002\006\002\000\002\004\005\000\002\005\005" + ------- "\000\002\005\005\000\002\005\005\000\002\005\005\000" + ------- "\002\005\005\000\002\005\003\000\002\005\004\000\002" + ------- "\005\005" }); ------- ------- /** Access to production table. */ ------- public short[][] production_table() {return _production_table;} ------- ------- /** Parse-action table. */ ------- protected static final short[][] _action_table = ------- unpackFromStrings(new String[] { ------- "\000\030\000\010\006\004\013\011\015\005\001\002\000" + ------- "\010\006\004\013\011\015\005\001\002\000\020\004\ufff7" + ------- "\005\ufff7\006\ufff7\007\ufff7\010\ufff7\011\ufff7\014\ufff7\001" + ------- "\002\000\012\002\uffff\006\uffff\013\uffff\015\uffff\001\002" + ------- "\000\016\004\ufffe\005\016\006\014\007\020\010\017\011" + ------- "\013\001\002\000\012\002\027\006\004\013\011\015\005" + ------- "\001\002\000\010\006\004\013\011\015\005\001\002\000" + ------- "\016\005\016\006\014\007\020\010\017\011\013\014\015" + ------- "\001\002\000\010\006\004\013\011\015\005\001\002\000" + ------- "\010\006\004\013\011\015\005\001\002\000\020\004\ufff5" + ------- "\005\ufff5\006\ufff5\007\ufff5\010\ufff5\011\ufff5\014\ufff5\001" + ------- "\002\000\010\006\004\013\011\015\005\001\002\000\010" + ------- "\006\004\013\011\015\005\001\002\000\010\006\004\013" + ------- "\011\015\005\001\002\000\020\004\ufffa\005\ufffa\006\ufffa" + ------- "\007\ufffa\010\ufffa\011\ufffa\014\ufffa\001\002\000\020\004" + ------- "\ufff9\005\ufff9\006\ufff9\007\ufff9\010\ufff9\011\ufff9\014\ufff9" + ------- "\001\002\000\020\004\ufffc\005\ufffc\006\ufffc\007\020\010" + ------- "\017\011\013\014\ufffc\001\002\000\020\004\ufffb\005\ufffb" + ------- "\006\ufffb\007\020\010\017\011\013\014\ufffb\001\002\000" + ------- "\020\004\ufff8\005\ufff8\006\ufff8\007\ufff8\010\ufff8\011\ufff8" + ------- "\014\ufff8\001\002\000\012\002\001\006\001\013\001\015" + ------- "\001\001\002\000\004\002\000\001\002\000\004\004\031" + ------- "\001\002\000\012\002\ufffd\006\ufffd\013\ufffd\015\ufffd\001" + ------- "\002\000\020\004\ufff6\005\ufff6\006\ufff6\007\ufff6\010\ufff6" + ------- "\011\ufff6\014\ufff6\001\002" }); ------- ------- /** Access to parse-action table. */ ------- public short[][] action_table() {return _action_table;} ------- ------- /** reduce_goto table. */ ------- protected static final short[][] _reduce_table = ------- unpackFromStrings(new String[] { ------- "\000\030\000\010\003\007\004\005\005\006\001\001\000" + ------- "\004\005\031\001\001\000\002\001\001\000\002\001\001" + ------- "\000\004\006\027\001\001\000\006\004\025\005\006\001" + ------- "\001\000\004\005\011\001\001\000\002\001\001\000\004" + ------- "\005\024\001\001\000\004\005\023\001\001\000\002\001" + ------- "\001\000\004\005\022\001\001\000\004\005\021\001\001" + ------- "\000\004\005\020\001\001\000\002\001\001\000\002\001" + ------- "\001\000\002\001\001\000\002\001\001\000\002\001\001" + ------- "\000\002\001\001\000\002\001\001\000\002\001\001\000" + ------- "\002\001\001\000\002\001\001" }); ------- ------- /** Access to reduce_goto table. */ ------- public short[][] reduce_table() {return _reduce_table;} ------- ------- /** Instance of action encapsulation class. */ ------- protected CUP$parser$actions action_obj; ------- ------- /** Action encapsulation object initializer. */ ------- protected void init_actions() ------- { ------- action_obj = new CUP$parser$actions(this); ------- } ------- ------- /** Invoke a user supplied parse action. */ ------- public java_cup.runtime.Symbol do_action( ------- int act_num, ------- java_cup.runtime.lr_parser parser, ------- java.util.Stack stack, ------- int top) ------- throws java.lang.Exception ------- { ------- /* call code in generated class */ ------- return action_obj.CUP$parser$do_action(act_num, parser, stack, top); ------- } ------- ------- /** Indicates start state. */ ------- public int start_state() {return 0;} ------- /** Indicates start production. */ ------- public int start_production() {return 1;} ------- ------- /** EOF Symbol index. */ ------- public int EOF_sym() {return 0;} ------- ------- /** error Symbol index. */ ------- public int error_sym() {return 1;} ------- -------} ------- -------/** Cup generated class to encapsulate user supplied action code.*/ -------class CUP$parser$actions { ------- private final parser parser; ------- ------- /** Constructor */ ------- CUP$parser$actions(parser parser) { ------- this.parser = parser; ------- } ------- ------- /** Method with the actual generated action code. */ ------- public final java_cup.runtime.Symbol CUP$parser$do_action( ------- int CUP$parser$act_num, ------- java_cup.runtime.lr_parser CUP$parser$parser, ------- java.util.Stack CUP$parser$stack, ------- int CUP$parser$top) ------- throws java.lang.Exception ------- { ------- /* Symbol object for return from actions */ ------- java_cup.runtime.Symbol CUP$parser$result; ------- ------- /* select the action based on the action number */ ------- switch (CUP$parser$act_num) ------- { ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 12: // expr ::= LPAREN expr RPAREN ------- { ------- Integer RESULT = null; ------- int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- RESULT = e; ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 11: // expr ::= MINUS expr ------- { ------- Integer RESULT = null; ------- int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = new Integer(0 - e.intValue()); ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 10: // expr ::= NUMBER ------- { ------- Integer RESULT = null; ------- int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer n = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = n; ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 9: // expr ::= expr MOD expr ------- { ------- Integer RESULT = null; ------- int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = new Integer(e1.intValue() % e2.intValue()); ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 8: // expr ::= expr DIVIDE expr ------- { ------- Integer RESULT = null; ------- int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = new Integer(e1.intValue() / e2.intValue()); ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 7: // expr ::= expr TIMES expr ------- { ------- Integer RESULT = null; ------- int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = new Integer(e1.intValue() * e2.intValue()); ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 6: // expr ::= expr MINUS expr ------- { ------- Integer RESULT = null; ------- int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = new Integer(e1.intValue() - e2.intValue()); ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 5: // expr ::= expr PLUS expr ------- { ------- Integer RESULT = null; ------- int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- RESULT = new Integer(e1.intValue() + e2.intValue()); ------- CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 4: // expr_part ::= expr NT$0 SEMI ------- { ------- Object RESULT = null; ------- // propagate RESULT from NT$0 ------- if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) ------- RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; ------- int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; ------- Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(2/*expr_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 3: // NT$0 ::= ------- { ------- Object RESULT = null; ------- int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; ------- int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ------- Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; ------- System.out.println("= " + e); ------- CUP$parser$result = new java_cup.runtime.Symbol(4/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 2: // expr_list ::= expr_part ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(1/*expr_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 1: // $START ::= expr_list EOF ------- { ------- Object RESULT = null; ------- int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; ------- int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ------- Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; ------- RESULT = start_val; ------- CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- /* ACCEPT */ ------- CUP$parser$parser.done_parsing(); ------- return CUP$parser$result; ------- ------- /*. . . . . . . . . . . . . . . . . . . .*/ ------- case 0: // expr_list ::= expr_list expr_part ------- { ------- Object RESULT = null; ------- ------- CUP$parser$result = new java_cup.runtime.Symbol(1/*expr_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); ------- } ------- return CUP$parser$result; ------- ------- /* . . . . . .*/ ------- default: ------- throw new Exception( ------- "Invalid action number found in internal parse table"); ------- ------- } ------- } -------} ------- diff --cc Robust/cup/java_cup/simple_calc/scanner.class index b24ff03b,b24ff03b,b24ff03b,b24ff03b,b24ff03b,b24ff03b,b24ff03b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/simple_calc/scanner.java index f8f850ac,f8f850ac,f8f850ac,f8f850ac,f8f850ac,f8f850ac,f8f850ac..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/simple_calc/scanner.java +++ /dev/null @@@@@@@@ -1,63 -1,63 -1,63 -1,63 -1,63 -1,63 -1,63 +1,0 @@@@@@@@ -------// Simple Example Scanner Class ------- -------package java_cup.simple_calc; ------- -------import java_cup.runtime.Symbol; ------- -------public class scanner implements java_cup.runtime.Scanner { ------- final java.io.InputStream instream; ------- ------- public scanner(java.io.InputStream is) throws java.io.IOException { ------- instream = is; ------- } ------- public scanner() throws java.io.IOException { this(System.in); } ------- ------- /* single lookahead character */ ------- protected int next_char = -2; ------- ------- /* advance input by one character */ ------- protected void advance() ------- throws java.io.IOException ------- { next_char = instream.read(); } ------- ------- /* initialize the scanner */ ------- private void init() ------- throws java.io.IOException ------- { advance(); } ------- ------- /* recognize and return the next complete token */ ------- public Symbol next_token() ------- throws java.io.IOException ------- { ------- if (next_char==-2) init(); // set stuff up first time we are called. ------- for (;;) ------- switch (next_char) ------- { ------- case '0': case '1': case '2': case '3': case '4': ------- case '5': case '6': case '7': case '8': case '9': ------- /* parse a decimal integer */ ------- int i_val = 0; ------- do { ------- i_val = i_val * 10 + (next_char - '0'); ------- advance(); ------- } while (next_char >= '0' && next_char <= '9'); ------- return new Symbol(sym.NUMBER, new Integer(i_val)); ------- ------- case ';': advance(); return new Symbol(sym.SEMI); ------- case '+': advance(); return new Symbol(sym.PLUS); ------- case '-': advance(); return new Symbol(sym.MINUS); ------- case '*': advance(); return new Symbol(sym.TIMES); ------- case '/': advance(); return new Symbol(sym.DIVIDE); ------- case '%': advance(); return new Symbol(sym.MOD); ------- case '(': advance(); return new Symbol(sym.LPAREN); ------- case ')': advance(); return new Symbol(sym.RPAREN); ------- ------- case -1: return new Symbol(sym.EOF); ------- ------- default: ------- /* in this simple scanner we just ignore everything else */ ------- advance(); ------- break; ------- } ------- } -------}; diff --cc Robust/cup/java_cup/simple_calc/sym.class index 46aed769,46aed769,46aed769,46aed769,46aed769,46aed769,46aed769..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/simple_calc/sym.java index 2584f2f0,2584f2f0,2584f2f0,2584f2f0,2584f2f0,2584f2f0,2584f2f0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/simple_calc/sym.java +++ /dev/null @@@@@@@@ -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 +1,0 @@@@@@@@ ------- -------//---------------------------------------------------- -------// The following code was generated by CUP v0.10k -------// Sun Jul 25 13:36:02 EDT 1999 -------//---------------------------------------------------- ------- -------package java_cup.simple_calc; ------- -------/** CUP generated class containing symbol constants. */ -------public class sym { ------- /* terminals */ ------- public static final int SEMI = 2; ------- public static final int EOF = 0; ------- public static final int DIVIDE = 6; ------- public static final int NUMBER = 11; ------- public static final int error = 1; ------- public static final int UMINUS = 8; ------- public static final int MINUS = 4; ------- public static final int TIMES = 5; ------- public static final int LPAREN = 9; ------- public static final int RPAREN = 10; ------- public static final int MOD = 7; ------- public static final int PLUS = 3; -------} ------- diff --cc Robust/cup/java_cup/sym.class index 97397bd8,97397bd8,97397bd8,97397bd8,97397bd8,97397bd8,97397bd8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/sym.java index 9810a3d7,9810a3d7,9810a3d7,9810a3d7,9810a3d7,9810a3d7,9810a3d7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/sym.java +++ /dev/null @@@@@@@@ -1,43 -1,43 -1,43 -1,43 -1,43 -1,43 -1,43 +1,0 @@@@@@@@ ------- -------//---------------------------------------------------- -------// The following code was generated by CUP v0.10k -------// Sun Jul 25 13:35:26 EDT 1999 -------//---------------------------------------------------- ------- -------package java_cup; ------- -------/** CUP generated class containing symbol constants. */ -------public class sym { ------- /* terminals */ ------- public static final int NON = 8; ------- public static final int NONTERMINAL = 27; ------- public static final int STAR = 15; ------- public static final int SEMI = 13; ------- public static final int CODE = 4; ------- public static final int EOF = 0; ------- public static final int NONASSOC = 23; ------- public static final int LEFT = 21; ------- public static final int PACKAGE = 2; ------- public static final int COLON = 17; ------- public static final int WITH = 11; ------- public static final int IMPORT = 3; ------- public static final int error = 1; ------- public static final int COLON_COLON_EQUALS = 18; ------- public static final int COMMA = 14; ------- public static final int DOT = 16; ------- public static final int SCAN = 10; ------- public static final int ID = 28; ------- public static final int INIT = 9; ------- public static final int PARSER = 6; ------- public static final int TERMINAL = 7; ------- public static final int PRECEDENCE = 20; ------- public static final int LBRACK = 25; ------- public static final int RBRACK = 26; ------- public static final int PERCENT_PREC = 24; ------- public static final int START = 12; ------- public static final int RIGHT = 22; ------- public static final int BAR = 19; ------- public static final int ACTION = 5; ------- public static final int CODE_STRING = 29; -------} ------- diff --cc Robust/cup/java_cup/symbol.class index 04d222df,04d222df,04d222df,04d222df,04d222df,04d222df,04d222df..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/symbol.java index 94d8b7d3,94d8b7d3,94d8b7d3,94d8b7d3,94d8b7d3,94d8b7d3,94d8b7d3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/symbol.java +++ /dev/null @@@@@@@@ -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 +1,0 @@@@@@@@ -------package java_cup; ------- -------/** This abstract class serves as the base class for grammar symbols (i.e., ------- * both terminals and non-terminals). Each symbol has a name string, and ------- * a string giving the type of object that the symbol will be represented by ------- * on the runtime parse stack. In addition, each symbol maintains a use count ------- * in order to detect symbols that are declared but never used, and an index ------- * number that indicates where it appears in parse tables (index numbers are ------- * unique within terminals or non terminals, but not across both). ------- * ------- * @see java_cup.terminal ------- * @see java_cup.non_terminal ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ -------public abstract class symbol { ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param nm the name of the symbol. ------- * @param tp a string with the type name. ------- */ ------- public symbol(String nm, String tp) ------- { ------- /* sanity check */ ------- if (nm == null) nm = ""; ------- ------- /* apply default if no type given */ ------- if (tp == null) tp = "Object"; ------- ------- _name = nm; ------- _stack_type = tp; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with default type. ------- * @param nm the name of the symbol. ------- */ ------- public symbol(String nm) ------- { ------- this(nm, null); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** String for the human readable name of the symbol. */ ------- protected String _name; ------- ------- /** String for the human readable name of the symbol. */ ------- public String name() {return _name;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** String for the type of object used for the symbol on the parse stack. */ ------- protected String _stack_type; ------- ------- /** String for the type of object used for the symbol on the parse stack. */ ------- public String stack_type() {return _stack_type;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Count of how many times the symbol appears in productions. */ ------- protected int _use_count = 0; ------- ------- /** Count of how many times the symbol appears in productions. */ ------- public int use_count() {return _use_count;} ------- ------- /** Increment the use count. */ ------- public void note_use() {_use_count++;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Index of this symbol (terminal or non terminal) in the parse tables. ------- * Note: indexes are unique among terminals and unique among non terminals, ------- * however, a terminal may have the same index as a non-terminal, etc. ------- */ ------- protected int _index; ------- ------- /** Index of this symbol (terminal or non terminal) in the parse tables. ------- * Note: indexes are unique among terminals and unique among non terminals, ------- * however, a terminal may have the same index as a non-terminal, etc. ------- */ ------- public int index() {return _index;} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Indicate if this is a non-terminal. Here in the base class we ------- * don't know, so this is abstract. ------- */ ------- public abstract boolean is_non_term(); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- return name(); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/symbol_part.class index 1b81faa6,1b81faa6,1b81faa6,1b81faa6,1b81faa6,1b81faa6,1b81faa6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/symbol_part.java index 9142b5fc,9142b5fc,9142b5fc,9142b5fc,9142b5fc,9142b5fc,9142b5fc..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/symbol_part.java +++ /dev/null @@@@@@@@ -1,100 -1,100 -1,100 -1,100 -1,100 -1,100 -1,100 +1,0 @@@@@@@@ -------package java_cup; ------- -------/** This class represents a part of a production which is a symbol (terminal ------- * or non terminal). This simply maintains a reference to the symbol in ------- * question. ------- * ------- * @see java_cup.production ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class symbol_part extends production_part { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param sym the symbol that this part is made up of. ------- * @param lab an optional label string for the part. ------- */ ------- public symbol_part(symbol sym, String lab) throws internal_error ------- { ------- super(lab); ------- ------- if (sym == null) ------- throw new internal_error( ------- "Attempt to construct a symbol_part with a null symbol"); ------- _the_symbol = sym; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with no label. ------- * @param sym the symbol that this part is made up of. ------- */ ------- public symbol_part(symbol sym) throws internal_error ------- { ------- this(sym,null); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** The symbol that this part is made up of. */ ------- protected symbol _the_symbol; ------- ------- /** The symbol that this part is made up of. */ ------- public symbol the_symbol() {return _the_symbol;} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Respond that we are not an action part. */ ------- public boolean is_action() { return false; } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(symbol_part other) ------- { ------- return other != null && super.equals(other) && ------- the_symbol().equals(other.the_symbol()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof symbol_part)) ------- return false; ------- else ------- return equals((symbol_part)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Produce a hash code. */ ------- public int hashCode() ------- { ------- return super.hashCode() ^ ------- (the_symbol()==null ? 0 : the_symbol().hashCode()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- if (the_symbol() != null) ------- return super.toString() + the_symbol(); ------- else ------- return super.toString() + "$$MISSING-SYMBOL$$"; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/symbol_set.class index f26071a1,f26071a1,f26071a1,f26071a1,f26071a1,f26071a1,f26071a1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/symbol_set.java index a1aec102,a1aec102,a1aec102,a1aec102,a1aec102,a1aec102,a1aec102..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/symbol_set.java +++ /dev/null @@@@@@@@ -1,231 -1,231 -1,231 -1,231 -1,231 -1,231 -1,231 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.Hashtable; -------import java.util.Enumeration; ------- -------/** This class represents a set of symbols and provides a series of ------- * set operations to manipulate them. ------- * ------- * @see java_cup.symbol ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class symbol_set { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Constructor for an empty set. */ ------- public symbol_set() { } ------- ------- /** Constructor for cloning from another set. ------- * @param other the set we are cloning from. ------- */ ------- public symbol_set(symbol_set other) throws internal_error ------- { ------- not_null(other); ------- _all = (Hashtable)other._all.clone(); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** A hash table to hold the set. Symbols are keyed using their name string. ------- */ ------- protected Hashtable _all = new Hashtable(11); ------- ------- /** Access to all elements of the set. */ ------- public Enumeration all() {return _all.elements();} ------- ------- /** size of the set */ ------- public int size() {return _all.size();} ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Helper function to test for a null object and throw an exception ------- * if one is found. ------- * @param obj the object we are testing. ------- */ ------- protected void not_null(Object obj) throws internal_error ------- { ------- if (obj == null) ------- throw new internal_error("Null object used in set operation"); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if the set contains a particular symbol. ------- * @param sym the symbol we are looking for. ------- */ ------- public boolean contains(symbol sym) {return _all.containsKey(sym.name());} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if this set is an (improper) subset of another. ------- * @param other the set we are testing against. ------- */ ------- public boolean is_subset_of(symbol_set other) throws internal_error ------- { ------- not_null(other); ------- ------- /* walk down our set and make sure every element is in the other */ ------- for (Enumeration e = all(); e.hasMoreElements(); ) ------- if (!other.contains((symbol)e.nextElement())) ------- return false; ------- ------- /* they were all there */ ------- return true; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if this set is an (improper) superset of another. ------- * @param other the set we are are testing against. ------- */ ------- public boolean is_superset_of(symbol_set other) throws internal_error ------- { ------- not_null(other); ------- return other.is_subset_of(this); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add a single symbol to the set. ------- * @param sym the symbol we are adding. ------- * @return true if this changes the set. ------- */ ------- public boolean add(symbol sym) throws internal_error ------- { ------- Object previous; ------- ------- not_null(sym); ------- ------- /* put the object in */ ------- previous = _all.put(sym.name(),sym); ------- ------- /* if we had a previous, this is no change */ ------- return previous == null; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Remove a single symbol if it is in the set. ------- * @param sym the symbol we are removing. ------- */ ------- public void remove(symbol sym) throws internal_error ------- { ------- not_null(sym); ------- _all.remove(sym.name()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add (union) in a complete set. ------- * @param other the set we are adding in. ------- * @return true if this changes the set. ------- */ ------- public boolean add(symbol_set other) throws internal_error ------- { ------- boolean result = false; ------- ------- not_null(other); ------- ------- /* walk down the other set and do the adds individually */ ------- for (Enumeration e = other.all(); e.hasMoreElements(); ) ------- result = add((symbol)e.nextElement()) || result; ------- ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Remove (set subtract) a complete set. ------- * @param other the set we are removing. ------- */ ------- public void remove(symbol_set other) throws internal_error ------- { ------- not_null(other); ------- ------- /* walk down the other set and do the removes individually */ ------- for (Enumeration e = other.all(); e.hasMoreElements(); ) ------- remove((symbol)e.nextElement()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(symbol_set other) ------- { ------- if (other == null || other.size() != size()) return false; ------- ------- /* once we know they are the same size, then improper subset does test */ ------- try { ------- return is_subset_of(other); ------- } catch (internal_error e) { ------- /* can't throw the error (because super class doesn't), so we crash */ ------- e.crash(); ------- return false; ------- } ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof symbol_set)) ------- return false; ------- else ------- return equals((symbol_set)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Compute a hash code. */ ------- public int hashCode() ------- { ------- int result = 0; ------- int cnt; ------- Enumeration e; ------- ------- /* hash together codes from at most first 5 elements */ ------- for (e = all(), cnt=0 ; e.hasMoreElements() && cnt<5; cnt++) ------- result ^= ((symbol)e.nextElement()).hashCode(); ------- ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- String result; ------- boolean comma_flag; ------- ------- result = "{"; ------- comma_flag = false; ------- for (Enumeration e = all(); e.hasMoreElements(); ) ------- { ------- if (comma_flag) ------- result += ", "; ------- else ------- comma_flag = true; ------- ------- result += ((symbol)e.nextElement()).name(); ------- } ------- result += "}"; ------- ------- return result; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} ------- ------- diff --cc Robust/cup/java_cup/terminal.class index 8f9b423c,8f9b423c,8f9b423c,8f9b423c,8f9b423c,8f9b423c,8f9b423c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/terminal.java index e1a40aa3,e1a40aa3,e1a40aa3,e1a40aa3,e1a40aa3,e1a40aa3,e1a40aa3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/terminal.java +++ /dev/null @@@@@@@@ -1,169 -1,169 -1,169 -1,169 -1,169 -1,169 -1,169 +1,0 @@@@@@@@ -------package java_cup; ------- -------import java_cup.assoc; -------import java.util.Hashtable; -------import java.util.Enumeration; ------- -------/** This class represents a terminal symbol in the grammar. Each terminal ------- * has a textual name, an index, and a string which indicates the type of ------- * object it will be implemented with at runtime (i.e. the class of object ------- * that will be returned by the scanner and pushed on the parse stack to ------- * represent it). ------- * ------- * @version last updated: 7/3/96 ------- * @author Frank Flannery ------- */ -------public class terminal extends symbol { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Full constructor. ------- * @param nm the name of the terminal. ------- * @param tp the type of the terminal. ------- */ ------- public terminal(String nm, String tp, int precedence_side, int precedence_num) ------- { ------- /* superclass does most of the work */ ------- super(nm, tp); ------- ------- /* add to set of all terminals and check for duplicates */ ------- Object conflict = _all.put(nm,this); ------- if (conflict != null) ------- // can't throw an execption here because this is used in static ------- // initializers, so we do a crash instead ------- // was: ------- // throw new internal_error("Duplicate terminal (" + nm + ") created"); ------- (new internal_error("Duplicate terminal (" + nm + ") created")).crash(); ------- ------- /* assign a unique index */ ------- _index = next_index++; ------- ------- /* set the precedence */ ------- _precedence_num = precedence_num; ------- _precedence_side = precedence_side; ------- ------- /* add to by_index set */ ------- _all_by_index.put(new Integer(_index), this); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor for non-precedented terminal ------- */ ------- ------- public terminal(String nm, String tp) ------- { ------- this(nm, tp, assoc.no_prec, -1); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor with default type. ------- * @param nm the name of the terminal. ------- */ ------- public terminal(String nm) ------- { ------- this(nm, null); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*------------------- Class Variables ---------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- private int _precedence_num; ------- private int _precedence_side; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Table of all terminals. Elements are stored using name strings as ------- * the key ------- */ ------- protected static Hashtable _all = new Hashtable(); ------- ------- /** Access to all terminals. */ ------- public static Enumeration all() {return _all.elements();} ------- ------- /** Lookup a terminal by name string. */ ------- public static terminal find(String with_name) ------- { ------- if (with_name == null) ------- return null; ------- else ------- return (terminal)_all.get(with_name); ------- } ------- ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Table of all terminals indexed by their index number. */ ------- protected static Hashtable _all_by_index = new Hashtable(); ------- ------- /** Lookup a terminal by index. */ ------- public static terminal find(int indx) ------- { ------- Integer the_indx = new Integer(indx); ------- ------- return (terminal)_all_by_index.get(the_indx); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Total number of terminals. */ ------- public static int number() {return _all.size();} ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Static counter to assign unique index. */ ------- protected static int next_index = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Special terminal for end of input. */ ------- public static final terminal EOF = new terminal("EOF"); ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** special terminal used for error recovery */ ------- public static final terminal error = new terminal("error"); ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ---------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Report this symbol as not being a non-terminal. */ ------- public boolean is_non_term() ------- { ------- return false; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to a string. */ ------- public String toString() ------- { ------- return super.toString() + "[" + index() + "]"; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** get the precedence of a terminal */ ------- public int precedence_num() { ------- return _precedence_num; ------- } ------- public int precedence_side() { ------- return _precedence_side; ------- } ------- ------- /** set the precedence of a terminal */ ------- public void set_precedence(int p, int new_prec) { ------- _precedence_side = p; ------- _precedence_num = new_prec; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} diff --cc Robust/cup/java_cup/terminal_set.class index fd0453e1,fd0453e1,fd0453e1,fd0453e1,fd0453e1,fd0453e1,fd0453e1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/terminal_set.java index e921cb59,e921cb59,e921cb59,e921cb59,e921cb59,e921cb59,e921cb59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/terminal_set.java +++ /dev/null @@@@@@@@ -1,253 -1,253 -1,253 -1,253 -1,253 -1,253 -1,253 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------import java.util.BitSet; ------- -------/** A set of terminals implemented as a bitset. ------- * @version last updated: 11/25/95 ------- * @author Scott Hudson ------- */ -------public class terminal_set { ------- ------- /*-----------------------------------------------------------*/ ------- /*--- Constructor(s) ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Constructor for an empty set. */ ------- public terminal_set() ------- { ------- /* allocate the bitset at what is probably the right size */ ------- _elements = new BitSet(terminal.number()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Constructor for cloning from another set. ------- * @param other the set we are cloning from. ------- */ ------- public terminal_set(terminal_set other) ------- throws internal_error ------- { ------- not_null(other); ------- _elements = (BitSet)other._elements.clone(); ------- } ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Static (Class) Variables ------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Constant for the empty set. */ ------- public static final terminal_set EMPTY = new terminal_set(); ------- ------- /*-----------------------------------------------------------*/ ------- /*--- (Access to) Instance Variables ------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Bitset to implement the actual set. */ ------- protected BitSet _elements; ------- ------- /*-----------------------------------------------------------*/ ------- /*--- General Methods ----------------------------------------*/ ------- /*-----------------------------------------------------------*/ ------- ------- /** Helper function to test for a null object and throw an exception if ------- * one is found. ------- * @param obj the object we are testing. ------- */ ------- protected void not_null(Object obj) throws internal_error ------- { ------- if (obj == null) ------- throw new internal_error("Null object used in set operation"); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if the set is empty. */ ------- public boolean empty() ------- { ------- return equals(EMPTY); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if the set contains a particular terminal. ------- * @param sym the terminal symbol we are looking for. ------- */ ------- public boolean contains(terminal sym) ------- throws internal_error ------- { ------- not_null(sym); ------- return _elements.get(sym.index()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Given its index determine if the set contains a particular terminal. ------- * @param indx the index of the terminal in question. ------- */ ------- public boolean contains(int indx) ------- { ------- return _elements.get(indx); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if this set is an (improper) subset of another. ------- * @param other the set we are testing against. ------- */ ------- public boolean is_subset_of(terminal_set other) ------- throws internal_error ------- { ------- not_null(other); ------- ------- /* make a copy of the other set */ ------- BitSet copy_other = (BitSet)other._elements.clone(); ------- ------- /* and or in */ ------- copy_other.or(_elements); ------- ------- /* if it hasn't changed, we were a subset */ ------- return copy_other.equals(other._elements); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if this set is an (improper) superset of another. ------- * @param other the set we are testing against. ------- */ ------- public boolean is_superset_of(terminal_set other) ------- throws internal_error ------- { ------- not_null(other); ------- return other.is_subset_of(this); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add a single terminal to the set. ------- * @param sym the terminal being added. ------- * @return true if this changes the set. ------- */ ------- public boolean add(terminal sym) ------- throws internal_error ------- { ------- boolean result; ------- ------- not_null(sym); ------- ------- /* see if we already have this */ ------- result = _elements.get(sym.index()); ------- ------- /* if not we add it */ ------- if (!result) ------- _elements.set(sym.index()); ------- ------- return result; ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Remove a terminal if it is in the set. ------- * @param sym the terminal being removed. ------- */ ------- public void remove(terminal sym) ------- throws internal_error ------- { ------- not_null(sym); ------- _elements.clear(sym.index()); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Add (union) in a complete set. ------- * @param other the set being added. ------- * @return true if this changes the set. ------- */ ------- public boolean add(terminal_set other) ------- throws internal_error ------- { ------- not_null(other); ------- ------- /* make a copy */ ------- BitSet copy = (BitSet)_elements.clone(); ------- ------- /* or in the other set */ ------- _elements.or(other._elements); ------- ------- /* changed if we are not the same as the copy */ ------- return !_elements.equals(copy); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Determine if this set intersects another. ------- * @param other the other set in question. ------- */ ------- public boolean intersects(terminal_set other) ------- throws internal_error ------- { ------- not_null(other); ------- ------- /* make a copy of the other set */ ------- BitSet copy = (BitSet)other._elements.clone(); ------- ------- /* xor out our values */ ------- copy.xor(this._elements); ------- ------- /* see if its different */ ------- return !copy.equals(other._elements); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Equality comparison. */ ------- public boolean equals(terminal_set other) ------- { ------- if (other == null) ------- return false; ------- else ------- return _elements.equals(other._elements); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Generic equality comparison. */ ------- public boolean equals(Object other) ------- { ------- if (!(other instanceof terminal_set)) ------- return false; ------- else ------- return equals((terminal_set)other); ------- } ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Convert to string. */ ------- public String toString() ------- { ------- String result; ------- boolean comma_flag; ------- ------- result = "{"; ------- comma_flag = false; ------- for (int t = 0; t < terminal.number(); t++) ------- { ------- if (_elements.get(t)) ------- { ------- if (comma_flag) ------- result += ", "; ------- else ------- comma_flag = true; ------- ------- result += terminal.find(t).name(); ------- } ------- } ------- result += "}"; ------- ------- return result; ------- } ------- ------- /*-----------------------------------------------------------*/ ------- -------} ------- diff --cc Robust/cup/java_cup/version.class index 336e0997,336e0997,336e0997,336e0997,336e0997,336e0997,336e0997..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 Binary files differ diff --cc Robust/cup/java_cup/version.java index 06600b59,06600b59,06600b59,06600b59,06600b59,06600b59,06600b59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/java_cup/version.java +++ /dev/null @@@@@@@@ -1,55 -1,55 -1,55 -1,55 -1,55 -1,55 -1,55 +1,0 @@@@@@@@ ------- -------package java_cup; ------- -------/** This class contains version and authorship information. ------- * It contains only static data elements and basically just a central ------- * place to put this kind of information so it can be updated easily ------- * for each release. ------- * ------- * Version numbers used here are broken into 3 parts: major, minor, and ------- * update, and are written as v.. (e.g. v0.10a). ------- * Major numbers will change at the time of major reworking of some ------- * part of the system. Minor numbers for each public release or ------- * change big enough to cause incompatibilities. Finally update ------- * letter will be incremented for small bug fixes and changes that ------- * probably wouldn't be noticed by a user. ------- * ------- * @version last updated: 12/22/97 [CSA] ------- * @author Frank Flannery ------- */ ------- -------public class version { ------- /** The major version number. */ ------- public static final int major = 0; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The minor version number. */ ------- public static final int minor = 10; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The update letter. */ ------- public static final char update = 'k'; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** String for the current version. */ ------- public static final String version_str = "v" + major + "." + minor + update; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Full title of the system */ ------- public static final String title_str = "CUP " + version_str; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** Name of the author */ ------- public static final String author_str = ------- "Scott E. Hudson, Frank Flannery, and C. Scott Ananian"; ------- ------- /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ ------- ------- /** The command name normally used to invoke this program */ ------- public static final String program_name = "java_cup"; -------} diff --cc Robust/cup/manual.html index 5d6f6a8b,5d6f6a8b,5d6f6a8b,5d6f6a8b,5d6f6a8b,5d6f6a8b,5d6f6a8b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/manual.html +++ /dev/null @@@@@@@@ -1,1452 -1,1452 -1,1452 -1,1452 -1,1452 -1,1452 -1,1452 +1,0 @@@@@@@@ ------- -------CUP User's Manual ------- ------- ------- -------
-------[CUP Logo Image] -------
-------

CUP User's Manual

-------

-------Scott E. Hudson
------- -------Graphics Visualization and Usability Center
------- -------Georgia Institute of Technology

-------Modified by Frank -------Flannery, C. Scott Ananian, -------Dan Wang with advice from -------Andrew W. Appel
-------Last updated July 1999 (v0.10j) -------
------- -------

Table of Contents

-------
-------
i.
About CUP Version 0.10 -------
1.
Introduction and Example -------
2.
Specification Syntax -------
3.
Running CUP -------
4.
Customizing the Parser -------
5.
Scanner interface -------
6.
Error Recovery -------
7.
Conclusion -------
References -------
A.
Grammar for CUP Specification Files -------
B.
A Very Simple Example Scanner -------
C.
Incompatibilites between CUP 0.9 and CUP 0.10 -------
D.
Bugs -------
E.
Change log -------
------- ------- -------

i. About CUP Version 0.10

-------
Version -------0.10 of CUP adds many new changes and features over the previous releases -------of version 0.9. These changes attempt to make CUP more like its -------predecessor, YACC. As a result, the old 0.9 parser specifications for CUP are -------not compatible and a reading of appendix C of the new -------manual will be necessary to write new specifications. The new version, -------however, gives the user more power and options, making parser specifications -------easier to write. ------- ------- -------

1. Introduction and Example

------- -------This manual describes the basic operation and use of the -------Java(tm) -------Based Constructor of Useful Parsers (CUP for short). -------CUP is a system for generating LALR parsers from simple specifications. -------It serves the same role as the widely used program YACC -------[1] and in fact offers most of the features of YACC. -------However, CUP is written in Java, uses specifications including embedded -------Java code, and produces parsers which are implemented in Java.

------- -------Although this manual covers all aspects of the CUP system, it is relatively -------brief, and assumes you have at least a little bit of knowledge of LR -------parsing. A working knowledge of YACC is also very helpful in -------understanding how CUP specifications work. -------A number of compiler construction textbooks (such as -------[2,3]) cover this material, -------and discuss the YACC system (which is quite similar to this one) as a -------specific example. In addition, Andrew Appel's Modern Compiler -------Implementation in Java textbook [4] uses -------and describes CUP in the context of compiler construction. -------

------- -------Using CUP involves creating a simple specification based on the -------grammar for which a parser is needed, along with construction of a -------scanner capable of breaking characters up into meaningful tokens (such -------as keywords, numbers, and special symbols).

------- -------As a simple example, consider a -------system for evaluating simple arithmetic expressions over integers. -------This system would read expressions from standard input (each terminated -------with a semicolon), evaluate them, and print the result on standard output. -------A grammar for the input to such a system might look like:

-------  expr_list ::= expr_list expr_part | expr_part
-------  expr_part ::= expr ';'
-------  expr      ::= expr '+' expr | expr '-' expr | expr '*' expr 
-------	      | expr '/' expr | expr '%' expr | '(' expr ')'  
-------              | '-' expr | number 
-------
-------To specify a parser based on this grammar, our first step is to identify and -------name the set of terminal symbols that will appear on input, and the set of -------non-terminal symbols. In this case, the non-terminals are: ------- -------
  expr_list, expr_part  and  expr .
------- -------For terminal names we might choose: ------- -------
  SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD, NUMBER, LPAREN,
-------and RPAREN
------- -------The experienced user will note a problem with the above grammar. It is -------ambiguous. An ambiguous grammar is a grammar which, given a certain -------input, can reduce the parts of the input in two different ways such as -------to give two different answers. Take the above grammar, for -------example. given the following input:
-------3 + 4 * 6
-------The grammar can either evaluate the 3 + 4 and then multiply -------seven by six, or it can evaluate 4 * 6 and then add three. -------Older versions of CUP forced the user to write unambiguous grammars, but -------now there is a construct allowing the user to specify precedences and -------associativities for terminals. This means that the above ambiguous -------grammar can be used, after specifying precedences and associativities. -------There is more explanation later. ------- -------Based on these namings we can construct a small CUP specification -------as follows:
-------
-------
// CUP specification for a simple expression evaluator (no actions)
-------
-------import java_cup.runtime.*;
-------
-------/* Preliminaries to set up and use the scanner.  */
-------init with {: scanner.init();              :};
-------scan with {: return scanner.next_token(); :};
-------
-------/* Terminals (tokens returned by the scanner). */
-------terminal            SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD;
-------terminal            UMINUS, LPAREN, RPAREN;
-------terminal Integer    NUMBER;
-------
-------/* Non terminals */
-------non terminal            expr_list, expr_part;
-------non terminal Integer    expr, term, factor;
-------
-------/* Precedences */
-------precedence left PLUS, MINUS;
-------precedence left TIMES, DIVIDE, MOD;
-------precedence left UMINUS;
-------
-------/* The grammar */
-------expr_list ::= expr_list expr_part | 
-------              expr_part;
-------expr_part ::= expr SEMI;
-------expr      ::= expr PLUS expr 
-------            | expr MINUS expr  
-------            | expr TIMES expr  
-------            | expr DIVIDE expr  
-------            | expr MOD expr 
-------	    | MINUS expr %prec UMINUS
-------            | LPAREN expr RPAREN
-------	    | NUMBER
-------	    ;
-------
-------

-------We will consider each part of the specification syntax in detail later. -------However, here we can quickly see that the specification contains four -------main parts. The first part provides preliminary and miscellaneous declarations -------to specify how the parser is to be generated, and supply parts of the -------runtime code. In this case we indicate that the java_cup.runtime -------classes should be imported, then supply a small bit of initialization code, -------and some code for invoking the scanner to retrieve the next input token. -------The second part of the specification declares terminals and non-terminals, -------and associates object classes with each. In this case, the terminals -------are declared as either with no type, or of type -------Integer. The specified type of the -------terminal or non-terminal is the type of the value of those terminals or -------non-terminals. If no type is specified, the terminal or non-terminal -------carries no value. Here, no type indicates that these -------terminals and non-terminals hold no value. -------The third part specifies the precedence and -------associativity of terminals. The last precedence declaration give its -------terminals the highest precedence. The final -------part of the specification contains the grammar.

------- ------- -------To produce a parser from this specification we use the CUP generator. -------If this specification were stored in a file parser.cup, then -------(on a Unix system at least) we might invoke CUP using a command like: -------

 java java_cup.Main < parser.cup 
-------or (starting with CUP 0.10k): -------
 java java_cup.Main parser.cup 
-------The system will produce two Java source files containing -------parts of the generated parser: sym.java and parser.java -------(these names can be changed with command-line options; see -------below). -------As you might expect, these two files contain declarations for the classes -------sym and parser. The sym class contains a series of -------constant declarations, one for each terminal symbol. This is typically used -------by the scanner to refer to symbols (e.g. with code such as -------"return new Symbol(sym.SEMI);" ). The parser class -------implements the parser itself.

------- -------The specification above, while constructing a full parser, does not perform -------any semantic actions &emdash; it will only indicate success or failure of a parse. -------To calculate and print values of each expression, we must embed Java -------code within the parser to carry out actions at various points. In CUP, -------actions are contained in code strings which are surrounded by delimiters -------of the form {: and :} (we can see examples of this in the -------init with and scan with clauses above). In general, the -------system records all characters within the delimiters, but does not try to check -------that it contains valid Java code.

------- -------A more complete CUP specification for our example system (with actions -------embedded at various points in the grammar) is shown below:
-------


-------
// CUP specification for a simple expression evaluator (w/ actions)
-------
-------import java_cup.runtime.*;
-------
-------/* Preliminaries to set up and use the scanner.  */
-------init with {: scanner.init();              :};
-------scan with {: return scanner.next_token(); :};
-------
-------/* Terminals (tokens returned by the scanner). */
-------terminal           SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD;
-------terminal           UMINUS, LPAREN, RPAREN;
-------terminal Integer   NUMBER;
-------
-------/* Non-terminals */
-------non terminal            expr_list, expr_part;
-------non terminal Integer    expr;
-------
-------/* Precedences */
-------precedence left PLUS, MINUS;
-------precedence left TIMES, DIVIDE, MOD;
-------precedence left UMINUS;
-------
-------/* The grammar */
-------expr_list ::= expr_list expr_part 
-------	      | 
-------              expr_part;
-------
-------expr_part ::= expr:e 
-------	      {: System.out.println("= " + e); :} 
-------              SEMI              
-------	      ;
-------
-------expr      ::= expr:e1 PLUS expr:e2    
-------	      {: RESULT = new Integer(e1.intValue() + e2.intValue()); :} 
-------	      | 
-------              expr:e1 MINUS expr:e2    
-------              {: RESULT = new Integer(e1.intValue() - e2.intValue()); :} 
-------	      | 
-------              expr:e1 TIMES expr:e2 
-------	      {: RESULT = new Integer(e1.intValue() * e2.intValue()); :} 
-------	      | 
-------              expr:e1 DIVIDE expr:e2 
-------	      {: RESULT = new Integer(e1.intValue() / e2.intValue()); :} 
-------	      | 
-------              expr:e1 MOD expr:e2 
-------	      {: RESULT = new Integer(e1.intValue() % e2.intValue()); :} 
-------	      | 
-------              NUMBER:n                 
-------	      {: RESULT = n; :} 
-------	      | 
-------              MINUS expr:e             
-------	      {: RESULT = new Integer(0 - e.intValue()); :} 
-------	      %prec UMINUS
-------	      | 
-------              LPAREN expr:e RPAREN     
-------	      {: RESULT = e; :} 
-------	      ;
-------
-------

-------Here we can see several changes. Most importantly, code to be executed at -------various points in the parse is included inside code strings delimited by -------{: and :}. In addition, labels have been placed on various -------symbols in the right hand side of productions. For example in:
-------
  expr:e1 PLUS expr:e2    
-------	{: RESULT = new Integer(e1.intValue() + e2.intValue()); :} 
-------
------- -------the first non-terminal expr has been labeled with e1, and -------the second with e2. The left hand side value -------of each production is always implicitly labeled as RESULT.

------- -------Each symbol appearing in a production is represented at runtime by an -------object of type Symbol on the parse stack. The labels refer to -------the instance variable value in those objects. In the -------expression expr:e1 PLUS expr:e2, e1 and e2 -------refer to objects of type Integer. These objects are in the value fields -------of the objects of type Symbol representing those non-terminals -------on the parse stack. RESULT is of type Integer as -------well, since the resulting non-terminal expr was declared as of -------type Integer. This object becomes the value instance -------variable of a new Symbol object.

------- -------For each label, two more variables accessible to the user are declared. -------A left and right value labels are passed to the code string, so that the -------user can find out where the left and right side of each terminal or -------non-terminal is in the input stream. The name of these variables is the -------label name, plus left or right. for example, given -------the right hand side of a production expr:e1 PLUS expr:e2 the -------user could not only access variables e1 and e2, but -------also e1left, e1right, e2left and e2right. these -------variables are of type int.

------- ------- ------- -------The final step in creating a working parser is to create a scanner (also -------known as a lexical analyzer or simply a lexer). This routine is -------responsible for reading individual characters, removing things things like -------white space and comments, recognizing which terminal symbols from the -------grammar each group of characters represents, then returning Symbol objects -------representing these symbols to the parser. -------The terminals will be retrieved with a call to the -------scanner function. In the example, the parser will call -------scanner.next_token(). The scanner should return objects of -------type java_cup.runtime.Symbol. This type is very different than -------older versions of CUP's java_cup.runtime.symbol. These Symbol -------objects contains the instance variable value of type Object, -------which should be -------set by the lexer. This variable refers to the value of that symbol, and -------the type of object in value should be of the same type as declared in -------the terminal and non terminal declarations. In the -------above example, if the lexer wished to pass a NUMBER token, it should -------create a Symbol with the value instance variable -------filled with an object of type Integer. Symbol -------objects corresponding to terminals and non-terminals with no value -------have a null value field.

------- -------The code contained in the init with clause of the specification -------will be executed before any tokens are requested. Each token will be -------requested using whatever code is found in the scan with clause. -------Beyond this, the exact form the scanner takes is up to you; however -------note that each call to the scanner function should return a new -------instance of java_cup.runtime.Symbol (or a subclass). -------These symbol objects are annotated with parser information and pushed -------onto a stack; reusing objects will result in the parser annotations -------being scrambled. As of CUP 0.10j, Symbol reuse should be -------detected if it occurs; the parser will throw an Error -------telling you to fix your scanner.

------- -------In the next section a more detailed and formal -------explanation of all parts of a CUP specification will be given. -------Section 3 describes options for running the -------CUP system. Section 4 discusses the details -------of how to customize a CUP parser, while section 5 -------discusses the scanner interface added in CUP 0.10j. Section ------- 6 considers error recovery. Finally, Section 7 -------provides a conclusion. ------- ------- -------

2. Specification Syntax

-------Now that we have seen a small example, we present a complete description of all -------parts of a CUP specification. A specification has four sections with -------a total of eight specific parts (however, most of these are optional). -------A specification consists of: ------- -------Each of these parts must appear in the order presented here. (A complete -------grammar for the specification language is given in -------Appendix A.) The particulars of each part of -------the specification are described in the subsections below.

------- -------

Package and Import Specifications
------- -------A specification begins with optional package and import -------declarations. These have the same syntax, and play the same -------role, as the package and import declarations found in a normal Java program. -------A package declaration is of the form: ------- -------
    package name;
------- -------where name name is a Java package identifier, possibly in -------several parts separated by ".". In general, CUP employs Java lexical -------conventions. So for example, both styles of Java comments are supported, -------and identifiers are constructed beginning with a letter, dollar -------sign ($), or underscore (_), which can then be followed by zero or more -------letters, numbers, dollar signs, and underscores.

------- -------After an optional package declaration, there can be zero or more -------import declarations. As in a Java program these have the form: ------- -------

    import package_name.class_name;
-------
-------or -------
    import package_name.*;
-------
------- -------The package declaration indicates what package the sym and -------parser classes that are generated by the system will be in. -------Any import declarations that appear in the specification will also appear -------in the source file for the parser class allowing various names from -------that package to be used directly in user supplied action code. ------- -------
User Code Components
------- -------Following the optional package and import declarations -------are a series of optional declarations that allow user code to be included -------as part of the generated parser (see Section 4 for a -------full description of how the parser uses this code). As a part of the parser -------file, a separate non-public class to contain all embedded user actions is -------produced. The first action code declaration section allows code to -------be included in this class. Routines and variables for use by the code -------embedded in the grammar would normally be placed in this section (a typical -------example might be symbol table manipulation routines). This declaration takes -------the form: ------- -------
    action code {: ... :};
-------
------- -------where {: ... :} is a code string whose contents will be placed -------directly within the action class class declaration.

------- -------After the action code declaration is an optional -------parser code declaration. This declaration allows methods and -------variable to be placed directly within the generated parser class. -------Although this is less common, it can be helpful when customizing the -------parser &emdash; it is possible for example, to include scanning methods inside -------the parser and/or override the default error reporting routines. This -------declaration is very similar to the action code declaration and -------takes the form: ------- -------

    parser code {: ... :};
-------
------- -------Again, code from the code string is placed directly into the generated parser -------class definition.

------- -------Next in the specification is the optional init declaration -------which has the form: ------- -------

    init with {: ... :};
------- -------This declaration provides code that will be executed by the parser -------before it asks for the first token. Typically, this is used to initialize -------the scanner as well as various tables and other data structures that might -------be needed by semantic actions. In this case, the code given in the code -------string forms the body of a void method inside the parser -------class.

------- -------The final (optional) user code section of the specification indicates how -------the parser should ask for the next token from the scanner. This has the -------form: ------- -------

    scan with {: ... :};
------- -------As with the init clause, the contents of the code string forms -------the body of a method in the generated parser. However, in this case -------the method returns an object of type java_cup.runtime.Symbol. -------Consequently the code found in the scan with clause should -------return such a value. See section 5 for -------information on the default behavior if the scan with -------section is omitted.

------- -------As of CUP 0.10j the action code, parser code, init code, and scan with -------sections may appear in any order. They must, however, precede the -------symbol lists.

------- -------

Symbol Lists
------- -------Following user supplied code comes the first required part of the -------specification: the symbol lists. These declarations are responsible -------for naming and supplying a type for each terminal and non-terminal -------symbol that appears in the grammar. As indicated above, each terminal -------and non-terminal symbol is represented at runtime with a Symbol -------object. In -------the case of terminals, these are returned by the scanner and placed on -------the parse stack. The lexer should put the value of the terminal in the -------value instance variable. -------In the case of non-terminals these replace a series -------of Symbol objects on the parse stack whenever the right hand side of -------some production is recognized. In order to tell the parser which object -------types should be used for which symbol, terminal and -------non terminal declarations are used. These take the forms: ------- -------
    terminal classname name1, name2, ...;
-------    non terminal classname name1, name2, ...;
-------    terminal name1, name2, ...;
-------
------- -------and ------- -------
    non terminal name1, name2, ...;
-------
------- -------where classname can be a multiple part name separated with -------"."s. The -------classname specified represents the type of the value of -------that terminal or non-terminal. When accessing these values through -------labels, the users uses the type declared. the classname -------can be of any type. If no classname is given, then the -------terminal or non-terminal holds no value. a label referring to such a -------symbol with have a null value. As of CUP 0.10j, you may specify -------non-terminals the declaration "nonterminal" (note, no -------space) as well as the original "non terminal" spelling.

------- -------Names of terminals and non-terminals cannot be CUP reserved words; -------these include "code", "action", "parser", "terminal", "non", -------"nonterminal", "init", "scan", "with", "start", "precedence", "left", -------"right", "nonassoc", "import", and "package".

------- -------

Precedence and Associativity declarations
------- -------The third section, which is optional, specifies the precedences and -------associativity of terminals. This is useful for parsing with ambiguous -------grammars, as done in the example above. There are three type of -------precedence/associativity declarations: -------

-------	precedence left     terminal[, terminal...];
-------	precedence right    terminal[, terminal...];
-------	precedence nonassoc terminal[, terminal...];
-------
------- -------The comma separated list indicates that those terminals should have the -------associativity specified at that precedence level and the precedence of -------that declaration. The order of precedence, from highest to lowest, is -------bottom to top. Hence, this declares that multiplication and division have -------higher precedence than addition and subtraction: -------

-------	precedence left  ADD, SUBTRACT;
-------	precedence left  TIMES, DIVIDE;
-------
-------Precedence resolves shift reduce problems. For example, given the input -------to the above example parser 3 + 4 * 8, the parser doesn't know -------whether to reduce 3 + 4 or shift the '*' onto the stack. -------However, since '*' has a higher precedence than '+', it will be shifted -------and the multiplication will be performed before the addition.

------- -------CUP assigns each one of its terminals a precedence according to these -------declarations. Any terminals not in this declaration have lowest -------precedence. CUP also assigns each of its productions a precedence. -------That precedence is equal to the precedence of the last terminal in that -------production. If the production has no terminals, then it has lowest -------precedence. For example, expr ::= expr TIMES expr would have -------the same precedence as TIMES. When there is a shift/reduce -------conflict, the parser determines whether the terminal to be shifted has a -------higher precedence, or if the production to reduce by does. If the -------terminal has higher precedence, it it shifted, if the production has -------higher precedence, a reduce is performed. If they have equal -------precedence, associativity of the terminal determine what happens.

------- -------An associativity is assigned to each terminal used in the -------precedence/associativity declarations. The three associativities are -------left, right and nonassoc Associativities are also -------used to resolve shift/reduce conflicts, but only in the case of equal -------precedences. If the associativity of the terminal that can be shifted -------is left, then a reduce is performed. This means, if the input -------is a string of additions, like 3 + 4 + 5 + 6 + 7, the parser -------will always reduce them from left to right, in this case, -------starting with 3 + 4. If the associativity of the terminal is -------right, it is shifted onto the stack. hence, the reductions -------will take place from right to left. So, if PLUS were declared with -------associativity of right, the 6 + 7 would be reduced -------first in the above string. If a terminal is declared as -------nonassoc, then two consecutive occurrences of equal precedence -------non-associative terminals generates an error. This is useful for -------comparison operations. For example, if the input string is -------6 == 7 == 8 == 9, the parser should generate an error. If '==' -------is declared as nonassoc then an error will be generated.

------- -------All terminals not used in the precedence/associativity declarations are -------treated as lowest precedence. If a shift/reduce error results, -------involving two such terminals, it cannot be resolved, as the above -------conflicts are, so it will be reported.

------- -------

The Grammar
------- -------The final section of a CUP declaration provides the grammar. This -------section optionally starts with a declaration of the form: ------- -------
    start with non-terminal;
-------
------- -------This indicates which non-terminal is the start or goal -------non-terminal for parsing. If a start non-terminal is not explicitly -------declared, then the non-terminal on the left hand side of the first -------production will be used. At the end of a successful parse, CUP returns -------an object of type java_cup.runtime.Symbol. This -------Symbol's value instance variable contains the final reduction -------result.

------- -------The grammar itself follows the optional start declaration. Each -------production in the grammar has a left hand side non-terminal followed by -------the symbol "::=", which is then followed by a series of zero or more -------actions, terminal, or non-terminal -------symbols, followed by an optional contextual precedence assignment, -------and terminated with a semicolon (;).

------- ------- ------- -------Each symbol on the right hand side can optionally be labeled with a name. -------Label names appear after the symbol name separated by a colon (:). Label -------names must be unique within the production, and can be used within action -------code to refer to the value of the symbol. Along with the label, two -------more variables are created, which are the label plus left and -------the label plus right. These are int values that -------contain the right and left locations of what the terminal or -------non-terminal covers in the input file. These values must be properly -------initialized in the terminals by the lexer. The left and right values -------then propagate to non-terminals to which productions reduce.

------- -------If there are several productions for the same non-terminal they may be -------declared together. In this case the productions start with the non-terminal -------and "::=". This is followed by multiple right hand sides each -------separated by a bar (|). The full set of productions is then terminated by a -------semicolon.

------- -------Actions appear in the right hand side as code strings (e.g., Java code inside -------{: ... :} delimiters). These are executed by the parser -------at the point when the portion of the production to the left of the -------action has been recognized. (Note that the scanner will have returned the -------token one past the point of the action since the parser needs this extra -------lookahead token for recognition.)

------- ------- ------- -------Contextual precedence assignments follow all the symbols and actions of -------the right hand side of the production whose precedence it is assigning. -------Contextual precedence assignment allows a production to be assigned a -------precedence not based on the last terminal in it. A good example is -------shown in the above sample parser specification: ------- -------


-------	precedence left PLUS, MINUS;
-------	precedence left TIMES, DIVIDE, MOD;
-------	precedence left UMINUS;
-------
-------	expr ::=  MINUS expr:e             
-------	          {: RESULT = new Integer(0 - e.intValue()); :} 
-------	          %prec UMINUS
-------
------- -------Here, there production is declared as having the precedence of UMINUS. -------Hence, the parser can give the MINUS sign two different precedences, -------depending on whether it is a unary minus or a subtraction operation. ------- ------- -------

3. Running CUP

------- -------As mentioned above, CUP is written in Java. To invoke it, one needs -------to use the Java interpreter to invoke the static method -------java_cup.Main(), passing an array of strings containing options. -------Assuming a Unix machine, the simplest way to do this is typically to invoke it -------directly from the command line with a command such as: ------- -------
    java java_cup.Main options < inputfile
------- -------Once running, CUP expects to find a specification file on standard input -------and produces two Java source files as output. Starting with CUP 0.10k, -------the final command-line argument may be a filename, in which case the -------specification will be read from that file instead of from standard input.

------- -------In addition to the specification file, CUP's behavior can also be changed -------by passing various options to it. Legal options are documented in -------Main.java and include: -------

-------
-package name -------
Specify that the parser and sym classes are to be ------- placed in the named package. By default, no package specification ------- is put in the generated code (hence the classes default to the special ------- "unnamed" package). ------- -------
-parser name -------
Output parser and action code into a file (and class) with the given ------- name instead of the default of "parser". ------- -------
-symbols name -------
Output the symbol constant code into a class with the given ------- name instead of the default of "sym". ------- -------
-interface -------
Outputs the symbol constant code as an interface ------- rather than as a class. ------- -------
-nonterms -------
Place constants for non-terminals into the symbol constant class. ------- The parser does not need these symbol constants, so they are not normally ------- output. However, it can be very helpful to refer to these constants ------- when debugging a generated parser. ------- -------
-expect number -------
During parser construction the system may detect that an ambiguous ------- situation would occur at runtime. This is called a conflict. ------- In general, the parser may be unable to decide whether to shift ------- (read another symbol) or reduce (replace the recognized right ------- hand side of a production with its left hand side). This is called a ------- shift/reduce conflict. Similarly, the parser may not be able ------- to decide between reduction with two different productions. This is ------- called a reduce/reduce conflict. Normally, if one or more of ------- these conflicts occur, parser generation is aborted. However, in ------- certain carefully considered cases it may be advantageous to ------- arbitrarily break such a conflict. In this case CUP uses YACC ------- convention and resolves shift/reduce conflicts by shifting, and ------- reduce/reduce conflicts using the "highest priority" production (the ------- one declared first in the specification). In order to enable automatic ------- breaking of conflicts the -expect option must be given ------- indicating exactly how many conflicts are expected. Conflicts ------- resolved by precedences and associativities are not reported. ------- -------
-compact_red -------
Including this option enables a table compaction optimization involving ------- reductions. In particular, it allows the most common reduce entry in ------- each row of the parse action table to be used as the default for that ------- row. This typically saves considerable room in the tables, which can ------- grow to be very large. This optimization has the effect of replacing ------- all error entries in a row with the default reduce entry. While this ------- may sound dangerous, if not down right incorrect, it turns out that this ------- does not affect the correctness of the parser. In particular, some ------- changes of this type are inherent in LALR parsers (when compared to ------- canonical LR parsers), and the resulting parsers will still never ------- read past the first token at which the error could be detected. ------- The parser can, however, make extra erroneous reduces before detecting ------- the error, so this can degrade the parser's ability to do ------- error recovery. ------- (Refer to reference [2] pp. 244-247 or reference [3] pp. 190-194 for a ------- complete explanation of this compaction technique.)

------- ------- This option is typically used to work-around the java bytecode ------- limitations on table initialization code sizes. However, CUP ------- 0.10h introduced a string-encoding for the parser tables which ------- is not subject to the standard method-size limitations. ------- Consequently, use of this option should no longer be required ------- for large grammars. ------- -------
-nowarn -------
This options causes all warning messages (as opposed to error messages) ------- produced by the system to be suppressed. ------- -------
-nosummary -------
Normally, the system prints a summary listing such things as the ------- number of terminals, non-terminals, parse states, etc. at the end of ------- its run. This option suppresses that summary. ------- -------
-progress -------
This option causes the system to print short messages indicating its ------- progress through various parts of the parser generation process. ------- -------
-dump_grammar -------
-dump_states -------
-dump_tables -------
-dump -------
These options cause the system to produce a human readable dump of ------- the grammar, the constructed parse states (often needed to resolve ------- parse conflicts), and the parse tables (rarely needed), respectively. ------- The -dump option can be used to produce all of these dumps. ------- -------
-time -------
This option adds detailed timing statistics to the normal summary of ------- results. This is normally of great interest only to maintainers of ------- the system itself. ------- -------
-debug -------
This option produces voluminous internal debugging information about ------- the system as it runs. This is normally of interest only to maintainers ------- of the system itself. ------- -------
-nopositions -------
This option keeps CUP from generating code to propagate the left ------- and right hand values of terminals to non-terminals, and then from ------- non-terminals to other terminals. If the left and right values aren't ------- going to be used by the parser, then it will save some runtime ------- computation to not generate these position propagations. This option ------- also keeps the left and right label variables from being generated, so ------- any reference to these will cause an error. ------- -------
-noscanner -------
CUP 0.10j introduced improved scanner ------- integration and a new interface, ------- java_cup.runtime.Scanner. By default, the ------- generated parser refers to this interface, which means you cannot ------- use these parsers with CUP runtimes older than 0.10j. If your ------- parser does not use the new scanner integration features, then you ------- may specify the -noscanner option to suppress the ------- java_cup.runtime.Scanner references and allow ------- compatibility with old runtimes. Not many people should have reason ------- to do this. ------- -------
-version -------
Invoking CUP with the -version flag will cause it ------- to print out the working version of CUP and halt. This allows ------- automated CUP version checking for Makefiles, install scripts and ------- other applications which may require it. -------
------- ------- -------

4. Customizing the Parser

------- -------Each generated parser consists of three generated classes. The -------sym class (which can be renamed using the -symbols -------option) simply contains a series of int constants, -------one for each terminal. Non-terminals are also included if the -nonterms -------option is given. The source file for the parser class (which can -------be renamed using the -parser option) actually contains two -------class definitions, the public parser class that implements the -------actual parser, and another non-public class (called CUP$action) which -------encapsulates all user actions contained in the grammar, as well as code from -------the action code declaration. In addition to user supplied code, this -------class contains one method: CUP$do_action which consists of a large -------switch statement for selecting and executing various fragments of user -------supplied action code. In general, all names beginning with the prefix of -------CUP$ are reserved for internal uses by CUP generated code.

------- -------The parser class contains the actual generated parser. It is -------a subclass of java_cup.runtime.lr_parser which implements a -------general table driven framework for an LR parser. The generated parser -------class provides a series of tables for use by the general framework. -------Three tables are provided: -------

-------
the production table -------
provides the symbol number of the left hand side non-terminal, along with ------- the length of the right hand side, for each production in the grammar, -------
the action table -------
indicates what action (shift, reduce, or error) is to be taken on each ------- lookahead symbol when encountered in each state, and -------
the reduce-goto table -------
indicates which state to shift to after reduces (under each non-terminal -------from each state). -------
-------(Note that the action and reduce-goto tables are not stored as simple arrays, -------but use a compacted "list" structure to save a significant amount of space. -------See comments the runtime system source code for details.)

------- -------Beyond the parse tables, generated (or inherited) code provides a series -------of methods that can be used to customize the generated parser. Some of these -------methods are supplied by code found in part of the specification and can -------be customized directly in that fashion. The others are provided by the -------lr_parser base class and can be overridden with new versions (via -------the parser code declaration) to customize the system. Methods -------available for customization include: -------

-------
public void user_init() -------
This method is called by the parser prior to asking for the first token ------- from the scanner. The body of this method contains the code from the ------- init with clause of the the specification. -------
public java_cup.runtime.Symbol scan() -------
This method encapsulates the scanner and is called each time a new ------- terminal is needed by the parser. The body of this method is ------- supplied by the scan with clause of the specification, if ------- present; otherwise it returns getScanner().next_token(). -------
public java_cup.runtime.Scanner getScanner() -------
Returns the default scanner. See section 5. -------
public void setScanner(java_cup.runtime.Scanner s) -------
Sets the default scanner. See section 5. -------
public void report_error(String message, Object info) -------
This method should be called whenever an error message is to be issued. In ------- the default implementation of this method, the first parameter provides ------- the text of a message which is printed on System.err ------- and the second parameter is simply ignored. It is very typical to ------- override this method in order to provide a more sophisticated error ------- reporting mechanism. -------
public void report_fatal_error(String message, Object info) -------
This method should be called whenever a non-recoverable error occurs. It ------- responds by calling report_error(), then aborts parsing ------- by calling the parser method done_parsing(), and finally ------- throws an exception. (In general done_parsing() should be called ------- at any point that parsing needs to be terminated early). -------
public void syntax_error(Symbol cur_token) -------
This method is called by the parser as soon as a syntax error is detected ------- (but before error recovery is attempted). In the default implementation it ------- calls: report_error("Syntax error", null);. -------
public void unrecovered_syntax_error(Symbol cur_token) -------
This method is called by the parser if it is unable to recover from a ------- syntax error. In the default implementation it calls: ------- report_fatal_error("Couldn't repair and continue parse", null);. -------
protected int error_sync_size() -------
This method is called by the parser to determine how many tokens it must ------- successfully parse in order to consider an error recovery successful. ------- The default implementation returns 3. Values below 2 are not recommended. ------- See the section on error recovery for details. -------
------- -------Parsing itself is performed by the method public Symbol parse(). -------This method starts by getting references to each of the parse tables, -------then initializes a CUP$action object (by calling -------protected void init_actions()). Next it calls user_init(), -------then fetches the first lookahead token with a call to scan(). -------Finally, it begins parsing. Parsing continues until done_parsing() -------is called (this is done automatically, for example, when the parser -------accepts). It then returns a Symbol with the value -------instance variable containing the RESULT of the start production, or -------null, if there is no value.

------- -------In addition to the normal parser, the runtime system also provides a debugging -------version of the parser. This operates in exactly the same way as the normal -------parser, but prints debugging messages (by calling -------public void debug_message(String mess) whose default implementation -------prints a message to System.err).

------- -------Based on these routines, invocation of a CUP parser is typically done -------with code such as: -------

-------      /* create a parsing object */
-------      parser parser_obj = new parser();
-------
-------      /* open input files, etc. here */
-------      Symbol parse_tree = null;
-------
-------      try {
-------        if (do_debug_parse)
-------          parse_tree = parser_obj.debug_parse();
-------        else
-------          parse_tree = parser_obj.parse();
-------      } catch (Exception e) {
-------        /* do cleanup here - - possibly rethrow e */
-------      } finally {
-------	/* do close out here */
-------      }
-------
------- ------- -------

5. Scanner Interface

------- -------In CUP 0.10j scanner integration was improved according to -------suggestions made by David MacMahon. -------The changes make it easier to incorporate JLex and other -------automatically-generated scanners into CUP parsers.

------- -------To use the new code, your scanner should implement the -------java_cup.runtime.Scanner interface, defined as: -------

-------package java_cup.runtime;
-------
-------public interface Scanner {
-------    public Symbol next_token() throws java.lang.Exception;
-------}
-------

------- -------In addition to the methods described in section -------4, the java_cup.runtime.lr_parser class has two new -------accessor methods, setScanner() and getScanner(). -------The default implementation of scan() -------is: -------

-------  public Symbol scan() throws java.lang.Exception {
-------    Symbol sym = getScanner().next_token();
-------    return (sym!=null) ? sym : new Symbol(EOF_sym());
-------  }
-------

-------The generated parser also contains a constructor which takes a -------Scanner and calls setScanner() with it. In -------most cases, then, the init with and scan -------with directives may be omitted. You can simply create the -------parser with a reference to the desired scanner: -------

-------      /* create a parsing object */
-------      parser parser_obj = new parser(new my_scanner());
-------
-------or set the scanner after the parser is created: -------
-------      /* create a parsing object */
-------      parser parser_obj = new parser();
-------      /* set the default scanner */
-------      parser_obj.setScanner(new my_scanner());
-------

-------Note that because the parser uses look-ahead, resetting the scanner in -------the middle of a parse is not recommended. If you attempt to use the -------default implementation of scan() without first calling -------setScanner(), a NullPointerException will be -------thrown.

-------As an example of scanner integration, the following three lines in the -------lexer-generator input are all that is required to use a -------JLex -------or JFlex -------scanner with CUP: -------

-------%implements java_cup.runtime.Scanner
-------%function next_token
-------%type java_cup.runtime.Symbol
-------
-------The JLex directive %cup -------abbreviates the above three directive in JLex versions 1.2.5 and above. -------Invoking the parser with the JLex scanner is then simply: -------
-------parser parser_obj = new parser( new Yylex( some_InputStream_or_Reader));
-------

------- -------Note CUP handles the JLex/JFlex convention of returning null on EOF -------without a problem, so an %eofval directive is not -------required in the JLex specification (this feature was added in CUP 0.10k). ------- -------The simple_calc example in the CUP distribution illustrates the use of -------the scanner integration features with a hand-coded scanner. -------The CUP website has a minimal CUP/JLex integration example for study.

------- ------- -------

6. Error Recovery

------- -------A final important aspect of building parsers with CUP is -------support for syntactic error recovery. CUP uses the same -------error recovery mechanisms as YACC. In particular, it supports -------a special error symbol (denoted simply as error). -------This symbol plays the role of a special non-terminal which, instead of -------being defined by productions, instead matches an erroneous input -------sequence.

------- -------The error symbol only comes into play if a syntax error is -------detected. If a syntax error is detected then the parser tries to replace -------some portion of the input token stream with error and then -------continue parsing. For example, we might have productions such as: ------- -------

    stmt ::= expr SEMI | while_stmt SEMI | if_stmt SEMI | ... |
-------	     error SEMI
-------	     ;
------- -------This indicates that if none of the normal productions for stmt can -------be matched by the input, then a syntax error should be declared, and recovery -------should be made by skipping erroneous tokens (equivalent to matching and -------replacing them with error) up to a point at which the parse can -------be continued with a semicolon (and additional context that legally follows a -------statement). An error is considered to be recovered from if and only if a -------sufficient number of tokens past the error symbol can be successfully -------parsed. (The number of tokens required is determined by the -------error_sync_size() method of the parser and defaults to 3).

------- -------Specifically, the parser first looks for the closest state to the top -------of the parse stack that has an outgoing transition under -------error. This generally corresponds to working from -------productions that represent more detailed constructs (such as a specific -------kind of statement) up to productions that represent more general or -------enclosing constructs (such as the general production for all -------statements or a production representing a whole section of declarations) -------until we get to a place where an error recovery production -------has been provided for. Once the parser is placed into a configuration -------that has an immediate error recovery (by popping the stack to the first -------such state), the parser begins skipping tokens to find a point at -------which the parse can be continued. After discarding each token, the -------parser attempts to parse ahead in the input (without executing any -------embedded semantic actions). If the parser can successfully parse past -------the required number of tokens, then the input is backed up to the point -------of recovery and the parse is resumed normally (executing all actions). -------If the parse cannot be continued far enough, then another token is -------discarded and the parser again tries to parse ahead. If the end of -------input is reached without making a successful recovery (or there was no -------suitable error recovery state found on the parse stack to begin with) -------then error recovery fails. ------- ------- -------

7. Conclusion

------- -------This manual has briefly described the CUP LALR parser generation system. -------CUP is designed to fill the same role as the well known YACC parser -------generator system, but is written in and operates entirely with Java code -------rather than C or C++. Additional details on the operation of the system can -------be found in the parser generator and runtime source code. See the CUP -------home page below for access to the API documentation for the system and its -------runtime.

------- -------This document covers version 0.10j of the system. Check the CUP home -------page: ------- -------http://www.cs.princeton.edu/~appel/modern/java/CUP/ -------for the latest release information, instructions for downloading the -------system, and additional news about CUP. Bug reports and other -------comments for the developers should be sent to the CUP maintainer, -------C. Scott Ananian, at ------- -------cananian@alumni.princeton.edu

------- -------CUP was originally written by ------- -------Scott Hudson, in August of 1995.

------- -------It was extended to support precedence by ------- -------Frank Flannery, in July of 1996.

------- -------On-going improvements have been done by ------- -------C. Scott Ananian, the CUP maintainer, from December of 1997 to the -------present.

------- ------- -------

References

-------
------- -------
[1] -------
S. C. Johnson, -------"YACC &emdash; Yet Another Compiler Compiler", -------CS Technical Report #32, -------Bell Telephone Laboratories, -------Murray Hill, NJ, -------1975. ------- -------
[2] -------
A. Aho, R. Sethi, and J. Ullman, -------Compilers: Principles, Techniques, and Tools, -------Addison-Wesley Publishing, -------Reading, MA, -------1986. ------- -------
[3] -------
C. Fischer, and R. LeBlanc, -------Crafting a Compiler with C, -------Benjamin/Cummings Publishing, -------Redwood City, CA, -------1991. ------- -------
[4] -------
Andrew W. Appel, -------Modern Compiler Implementation in Java, -------Cambridge University Press, -------New York, NY, -------1998. ------- -------
------- -------

-------Appendix A. Grammar for CUP Specification Files (0.10j)

-------

-------
java_cup_spec      ::= package_spec import_list code_parts
-------		       symbol_list precedence_list start_spec 
-------		       production_list
-------package_spec       ::= PACKAGE multipart_id SEMI | empty
-------import_list        ::= import_list import_spec | empty
-------import_spec        ::= IMPORT import_id SEMI
-------code_part          ::= action_code_part | parser_code_part |
-------                       init_code | scan_code
-------code_parts         ::= code_parts code_part | empty
-------action_code_part   ::= ACTION CODE CODE_STRING opt_semi
-------parser_code_part   ::= PARSER CODE CODE_STRING opt_semi
-------init_code          ::= INIT WITH CODE_STRING opt_semi
-------scan_code          ::= SCAN WITH CODE_STRING opt_semi
-------symbol_list        ::= symbol_list symbol | symbol
-------symbol             ::= TERMINAL type_id declares_term |
-------                       NON TERMINAL type_id declares_non_term |
-------		       NONTERMINAL type_id declares_non_term |
-------		       TERMINAL declares_term |
-------		       NON TERMINAL declares_non_term |
-------		       NONTERMIANL declared_non_term
-------term_name_list     ::= term_name_list COMMA new_term_id | new_term_id
-------non_term_name_list ::= non_term_name_list COMMA new_non_term_id |
-------	               new_non_term_id
-------declares_term      ::= term_name_list SEMI
-------declares_non_term  ::= non_term_name_list SEMI
-------precedence_list    ::= precedence_l | empty
-------precedence_l       ::= precedence_l preced + preced;
-------preced             ::= PRECEDENCE LEFT terminal_list SEMI
-------	               | PRECEDENCE RIGHT terminal_list SEMI
-------	               | PRECEDENCE NONASSOC terminal_list SEMI
-------terminal_list      ::= terminal_list COMMA terminal_id | terminal_id 
-------start_spec         ::= START WITH nt_id SEMI | empty
-------production_list    ::= production_list production | production
-------production         ::= nt_id COLON_COLON_EQUALS rhs_list SEMI
-------rhs_list           ::= rhs_list BAR rhs | rhs
-------rhs                ::= prod_part_list PERCENT_PREC term_id |
-------                       prod_part_list
-------prod_part_list     ::= prod_part_list prod_part | empty
-------prod_part          ::= symbol_id opt_label | CODE_STRING
-------opt_label          ::= COLON label_id | empty
-------multipart_id       ::= multipart_id DOT ID | ID
-------import_id          ::= multipart_id DOT STAR | multipart_id
-------type_id            ::= multipart_id
-------terminal_id        ::= term_id
-------term_id            ::= symbol_id
-------new_term_id        ::= ID
-------new_non_term_id    ::= ID
-------nt_id              ::= ID
-------symbol_id          ::= ID
-------label_id           ::= ID
-------opt_semi	   ::= SEMI | empty
-------
-------
-------

------- -------

Appendix B. A Very Simple Example Scanner

-------

-------
-------// Simple Example Scanner Class
-------
-------import java_cup.runtime.*;
-------import sym;
-------
-------public class scanner {
-------  /* single lookahead character */
-------  protected static int next_char;
-------
-------  /* advance input by one character */
-------  protected static void advance()
-------    throws java.io.IOException
-------    { next_char = System.in.read(); }
-------
-------  /* initialize the scanner */
-------  public static void init()
-------    throws java.io.IOException
-------    { advance(); }
-------
-------  /* recognize and return the next complete token */
-------  public static Symbol next_token()
-------    throws java.io.IOException
-------    {
-------      for (;;)
-------        switch (next_char)
-------	  {
-------	    case '0': case '1': case '2': case '3': case '4': 
-------	    case '5': case '6': case '7': case '8': case '9': 
-------	      /* parse a decimal integer */
-------	      int i_val = 0;
-------	      do {
-------	        i_val = i_val * 10 + (next_char - '0');
-------	        advance();
-------	      } while (next_char >= '0' && next_char <= '9');
-------	    return new Symbol(sym.NUMBER, new Integer(i_val));
-------
-------	    case ';': advance(); return new Symbol(sym.SEMI);
-------	    case '+': advance(); return new Symbol(sym.PLUS);
-------	    case '-': advance(); return new Symbol(sym.MINUS);
-------	    case '*': advance(); return new Symbol(sym.TIMES);
-------	    case '/': advance(); return new Symbol(sym.DIVIDE);
-------	    case '%': advance(); return new Symbol(sym.MOD);
-------	    case '(': advance(); return new Symbol(sym.LPAREN);
-------	    case ')': advance(); return new Symbol(sym.RPAREN);
-------
-------	    case -1: return new Symbol(sym.EOF);
-------
-------	    default: 
-------	      /* in this simple scanner we just ignore everything else */
-------	      advance();
-------	    break;
-------	  }
-------    }
-------};
-------
------- ------- -------
-------

Appendix C: Incompatibilites between CUP 0.9 and CUP 0.10

------- -------CUP version 0.10a is a major overhaul of CUP. The changes are severe, -------meaning no backwards compatibility to older versions. ------- -------The changes consist of: ------- ------- -------
Lexical Interface
------- -------CUP now interfaces with the lexer in a completely different -------manner. In the previous releases, a new class was used for every -------distinct type of terminal. This release, however, uses only one class: -------The Symbol class. The Symbol class has three instance -------variables which -------are significant to the parser when passing information from the lexer. -------The first is the value instance variable. This variable -------contains the -------value of that terminal. It is of the type declared as the terminal type -------in the parser specification file. The second two are the instance -------variables left and right. They should be filled with -------the int value of -------where in the input file, character-wise, that terminal was found.

------- -------For more information, refer to the manual on scanners. ------- -------

Terminal/Non-Terminal Declarations
------- -------Terminal and non-terminal declarations now can be declared in two -------different ways to indicate the values of the terminals or -------non-terminals. The previous declarations of the form ------- -------

-------terminal classname terminal [, terminal ...];
-------
------- -------still works. The classname, however indicates the type of the value of -------the terminal or non-terminal, and does not indicate the type of object -------placed on the parse stack. ------- -------A declaration, such as: ------- -------

-------terminal terminal [, terminal ...];
-------
------- -------indicates the terminals in the list hold no value.

------- -------For more information, refer to the manual on declarations. ------- -------

Label References
------- -------Label references do not refer to the object on the parse stack, as in -------the old CUP, but rather to the value of the value -------instance variable of -------the Symbol that represents that terminal or non-terminal. Hence, -------references to terminal and non-terminal values is direct, as opposed to -------the old CUP, where the labels referred to objects containing the value -------of the terminal or non-terminal.

------- -------For more information, refer to the manual on labels. ------- -------

RESULT Value
------- -------The RESULT variable refers directly to the value of the -------non-terminal -------to which a rule reduces, rather than to the object on the parse stack. -------Hence, RESULT is of the same type the non-terminal to which -------it reduces, -------as declared in the non-terminal declaration. Again, the reference is -------direct, rather than to something that will contain the data.

------- -------For more information, refer to the manual on RESULT. ------- -------

Position Propagation
------- -------For every label, two more variables are declared, which are the label -------plus left or the label plus right. These correspond -------to the left and -------right locations in the input stream to which that terminal or -------non-terminal came from. These values are propagated from the input -------terminals, so that the starting non-terminal should have a left value of -------0 and a right value of the location of the last character read.

------- -------For more information, refer to the manual on positions. ------- -------

Return Value
------- -------A call to parse() or debug_parse() returns a -------Symbol. This Symbol is the start non-terminal, so the value -------instance variable contains the final RESULT assignment. ------- -------
Precedence
------- -------CUP now has precedenced terminals. a new declaration section, -------occurring between the terminal and non-terminal declarations and the -------grammar specifies the precedence and associativity of rules. The -------declarations are of the form: ------- -------

-------precedence {left| right | nonassoc} terminal[, terminal ...];
-------...
-------
-------
------- -------The terminals are assigned a precedence, where terminals on the same -------line have equal precedences, and the precedence declarations farther -------down the list of precedence declarations have higher precedence. -------left, right and nonassoc specify the associativity -------of these terminals. left -------associativity corresponds to a reduce on conflict, right to a shift on -------conflict, and nonassoc to an error on conflict. Hence, ambiguous -------grammars may now be used.

------- -------For more information, refer to the manual on precedence. ------- -------

Contextual Precedence
------- -------Finally the new CUP adds contextual precedence. A production may be -------declare as followed: ------- -------

-------lhs ::= {right hand side list of terminals, non-terminals and actions}
-------        %prec {terminal};
-------
------- -------this production would then have a precedence equal to the terminal -------specified after the %prec. Hence, shift/reduce conflicts can be -------contextually resolved. Note that the %prec terminal -------part comes after all actions strings. It does not come before the -------last action string.

------- -------For more information, refer to the manual on contextual -------precedence. ------- -------These changes implemented by: -------

-------Frank Flannery
-------Department of Computer Science
-------Princeton University
-------

------- -------

Appendix D: Bugs

-------In this version of CUP it's difficult for the semantic action phrases (Java code attached -------to productions) to access the report_error method and other similar methods and -------objects defined in the parser code directive. -------

-------This is because the parsing tables (and parsing engine) are in one object (belonging to -------class parser or whatever name is specified by the -parser directive), -------and the semantic actions are in another object (of class CUP$actions). -------

-------However, there is a way to do it, though it's a bit inelegant. -------The action object has a private final field named -------parser that points to the parsing object. Thus, -------methods and instance variables of the parser can be accessed within semantic actions as: -------

-------    parser.report_error(message,info);
-------    x = parser.mydata;
-------
-------

-------Perhaps this will not be necessary in a future release, and that -------such methods and variables as report_error and -------mydata will be available -------directly from the semantic actions; we will achieve this by combining the -------"parser" object and the "actions" object together. ------- -------

-------For a list of any other currently known bugs in CUP, see ------- -------http://www.cs.princeton.edu/~appel/modern/java/CUP/bugs.html. ------- ------- -------

Appendix E: Change log

------- -------
-------
0.9e
March 1996, Scott Hudson's original version. -------
0.10a
August 1996, several major changes to -------the interface. -------
0.10b
November 1996, fixes a few minor bugs. -------
0.10c
July 1997, fixes a bug related to precedence declarations. -------
0.10e
September 1997, fixes a bug introduced in 0.10c relating -------to nonassoc precedence. Thanks to -------Tony Hosking -------for reporting the bug and providing the fix. -------Also recognizes carriage-return character as white space and fixes a -------number of other small bugs. -------
0.10f
December 1997, was a maintenance release. The CUP source -------was cleaned up for JDK 1.1. -------
0.10g
March 1998, adds new features and fixes old bugs. -------The behavior of RESULT assignments was normalized, and a problem -------with implicit start productions was fixed. The CUP grammar was -------extended to allow array types for terminals and non-terminals, and -------a command-line flag was added to allow the generation of a symbol -------interface, rather than class. Bugs associated with multiple -------invocations of a single parser object and multiple CUP classes in one -------package have been stomped on. Documentation was updated, as well. -------
0.10h-0.10i
February 1999, are maintenance releases. -------
0.10j
July 1999, broadened the CUP input grammar to allow more -------flexibility and improved scanner integration via the -------java_cup.runtime.Scanner interface. -------
------- ------- -------
------- ------- -------Java and HotJava are -------trademarks of Sun Microsystems, Inc., -------and refer to Sun's Java programming language and HotJava browser -------technologies. -------CUP is not sponsored by or affiliated with Sun Microsystems, Inc. ------- -------
------- ------- ------- diff --cc Robust/cup/winnt/README index 99a64716,99a64716,99a64716,99a64716,99a64716,99a64716,99a64716..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/winnt/README +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------From toddk@MICROSOFT.com Tue Mar 24 22:07:19 1998 -------Date: Fri, 30 Jan 1998 07:54:26 -0800 -------From: Todd Knoblock -------To: "'cananian@alumni.princeton.edu'" -------Subject: Java cup under Windows NT. ------- -------I wanted to try java cup under Windows NT. Rather than transliterating the -------csh shell script, I put together a little makefile for it. I thought you -------might want to include it in the distribution so that it is available for the -------next person that wants to use java cup under Windows NT. ------- -------Todd Knoblock ------- -------To use, place this file in the root javacup directory (where the "java_cup" -------directory lives), and type "nmake" from that directory. ------- -------[The makefile has been included in this directory. -- CSA 24-Mar-1998 ] diff --cc Robust/cup/winnt/makefile index 653f2075,653f2075,653f2075,653f2075,653f2075,653f2075,653f2075..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/cup/winnt/makefile +++ /dev/null @@@@@@@@ -1,51 -1,51 -1,51 -1,51 -1,51 -1,51 -1,51 +1,0 @@@@@@@@ -------# -------# Windows NT makefile for java_cup -------# by Todd Knoblock, 28 January 1998. -------# -------# To run, type "nmake all" from the directory containing the make file. -------# Tested under nmake version 1.62.7022 ------- -------JVC=jvc -------# -x means disable extensions -------# -g means include debug information -------# -w2 means warning level 2. -------# Unfornately, anything above warning level 2 is noisy -------JVCFLAGS= -x -g -w2 -------JVIEW=jview ------- -------.SUFFIXES: .java .class ------- -------.java.class: ------- $(JVC) $(JVCFLAGS) $< ------- -------all: runtime simple_calc java_cup test ------- -------java_cup: java_cup\*.class ------- -------runtime: java_cup\runtime\*.class ------- -------simple_calc: java_cup\simple_calc\sym.java \ ------- java_cup\simple_calc\parser.java \ ------- java_cup\simple_calc\*.class ------- ------- -------java_cup\simple_calc\sym.java: java_cup java_cup\simple_calc\parser.cup ------- $(JVIEW) java_cup.Main < java_cup\simple_calc\parser.cup ------- @del -f -q java_cup\simple_calc\sym.java >nul 2>nul ------- @del -f -q java_cup\simple_calc\parser.java >nul 2>nul ------- move sym.java java_cup\simple_calc\ ------- move parser.java java_cup\simple_calc\ ------- -------java_cup\simple_calc\parser.java: java_cup\simple_calc\sym.java ------- -------clean: ------- @del -f -q java_cup\simple_calc\sym.java >nul 2>nul ------- @del -f -q java_cup\simple_calc\parser.java >nul 2>nul ------- @for %d in (java_cup java_cup\runtime java_cup\simple_calc) do \ ------- @pushd %d \ ------- & del -f -q *.class >nul 2>nul \ ------- & popd ------- -------test: simple_calc ------- @echo Executing the demo program. Answer should be 5050. ------- echo 101*100/2; | $(JVIEW) java_cup.simple_calc.Main diff --cc Robust/rolebasedcomputation index f917a9b0,f917a9b0,f917a9b0,f917a9b0,f917a9b0,f917a9b0,f917a9b0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/rolebasedcomputation +++ /dev/null @@@@@@@@ -1,34 -1,34 -1,34 -1,34 -1,34 -1,34 -1,34 +1,0 @@@@@@@@ -------Input: -------trigger role specification for tasks: -------role mutator operation: -------role definition: ------- -------Generate: -------Role transition diagram ------- ------- -------Initial features: -------methods -------structs -------type system ------- -------Language features: -------Single Inheritance -------Virtual methods -------Objects ------- -------object metastate: -------1. flags: flag role1 -------2. tags: tag tag1 ------- -------tag operations: -------tag tag1=new tag; -------tag tag2=incrementtag(tag tag1); -------tag tag3=no tag; ------- -------metastate operations: ------- -------task foo(type1 o1{role1||role2}, type2 o2{role3}) { ------- ------- exit(o1{role1'=false},o2{role3'=false},onew{role4=true}); -------} diff --cc Robust/src/Analysis/CallGraph/CallGraph.java index 72c0232e,72c0232e,b3e68e12,b3e68e12,3042da3e,ee148c81,ee148c81..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/CallGraph/CallGraph.java +++ /dev/null @@@@@@@@ -1,126 -1,126 -1,237 -1,237 -1,237 -1,296 -1,296 +1,0 @@@@@@@@ -------package Analysis.CallGraph; -------import IR.State; -------import IR.Flat.FlatMethod; -------import IR.Flat.FlatNode; -------import IR.Flat.FlatCall; -------import IR.Flat.FKind; -- import java.util.*; -----import IR.Descriptor; -------import IR.ClassDescriptor; -------import IR.MethodDescriptor; -----import IR.TaskDescriptor; -------import IR.TypeDescriptor; -----import java.util.*; -----import java.io.*; ------- -------public class CallGraph { -- State state; -- Hashtable methods; -- Hashtable methodmap; -- private State state; --- private State state; ----- -- // MethodDescriptor maps to HashSet -- private Hashtable mapVirtual2ImplementationSet; --- // MethodDescriptor maps to HashSet --- private Hashtable mapVirtual2ImplementationSet; ----- -- // MethodDescriptor or TaskDescriptor maps to HashSet -- private Hashtable mapCaller2CalleeSet; --- // MethodDescriptor or TaskDescriptor maps to HashSet --- private Hashtable mapCaller2CalleeSet; ----- -- // MethodDescriptor maps to HashSet -- private Hashtable mapCallee2CallerSet; --- // MethodDescriptor maps to HashSet --- private Hashtable mapCallee2CallerSet; ------- ---- public CallGraph(State state) { ---- this.state=state; -- methods=new Hashtable(); -- methodmap=new Hashtable(); -- buildMethodTable(); -- mapVirtual2ImplementationSet = new Hashtable(); -- mapCaller2CalleeSet = new Hashtable(); -- mapCallee2CallerSet = new Hashtable(); -- buildVirtualMap(); ---- buildGraph(); -- } --- public CallGraph(State state) { --- this.state=state; --- mapVirtual2ImplementationSet = new Hashtable(); --- mapCaller2CalleeSet = new Hashtable(); --- mapCallee2CallerSet = new Hashtable(); --- buildVirtualMap(); --- buildGraph(); --- } ----- -- // this method returns the set of Descriptors -- // (MethodDescriptors and/or TaskDescriptors) -- // that call the given method -- public Set getCallerSet( MethodDescriptor md ) { -- return (Set) mapCallee2CallerSet.get( md ); -- } --- // this method returns the set of Descriptors --- // (MethodDescriptors and/or TaskDescriptors) --- // that call the given method --- public Set getCallerSet(MethodDescriptor md) { --- return (Set) mapCallee2CallerSet.get(md); --- } ----- -- // this method returns the set of MethodDescriptors that -- // are called by the given method or task -- public Set getCalleeSet( Descriptor d ) { -- assert (d instanceof MethodDescriptor) || -- (d instanceof TaskDescriptor); --- // this method returns the set of MethodDescriptors that --- // are called by the given method or task --- public Set getCalleeSet(Descriptor d) { --- assert(d instanceof MethodDescriptor) || --- (d instanceof TaskDescriptor); ----- -- return (Set) mapCaller2CalleeSet.get( d ); ---- } ---- -- private void buildMethodTable() { -- // build a mapping of virtual methods to all -- // possible implementations of that method -- private void buildVirtualMap() { ---- //Iterator through classes ---- Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); ---- while(it.hasNext()) { ---- ClassDescriptor cn=(ClassDescriptor)it.next(); ---- Iterator methodit=cn.getMethods(); ---- //Iterator through methods ---- while(methodit.hasNext()) { ---- MethodDescriptor md=(MethodDescriptor)methodit.next(); ---- if (md.isStatic()||md.getReturnType()==null) ---- continue; ---- ClassDescriptor superdesc=cn.getSuperDesc(); ---- if (superdesc!=null) { ---- Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); ---- boolean foundmatch=false; ---- for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) { ---- MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); ---- if (md.matches(matchmd)) { -- if (!methods.containsKey(matchmd)) -- methods.put(matchmd,new HashSet()); -- ((HashSet)methods.get(matchmd)).add(md); -- if (!mapVirtual2ImplementationSet.containsKey(matchmd)) -- mapVirtual2ImplementationSet.put(matchmd,new HashSet()); -- ((HashSet)mapVirtual2ImplementationSet.get(matchmd)).add(md); ---- break; ---- } ---- } ---- } --- return (Set) mapCaller2CalleeSet.get(d); --- } --- --- // build a mapping of virtual methods to all --- // possible implementations of that method --- private void buildVirtualMap() { --- //Iterator through classes --- Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); --- while(it.hasNext()) { --- ClassDescriptor cn=(ClassDescriptor)it.next(); --- Iterator methodit=cn.getMethods(); --- //Iterator through methods --- while(methodit.hasNext()) { --- MethodDescriptor md=(MethodDescriptor)methodit.next(); --- if (md.isStatic()||md.getReturnType()==null) --- continue; --- ClassDescriptor superdesc=cn.getSuperDesc(); --- if (superdesc!=null) { --- Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); --- boolean foundmatch=false; --- for(Iterator matchit=possiblematches.iterator(); matchit.hasNext();) { --- MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); --- if (md.matches(matchmd)) { --- if (!mapVirtual2ImplementationSet.containsKey(matchmd)) --- mapVirtual2ImplementationSet.put(matchmd,new HashSet()); --- ((HashSet)mapVirtual2ImplementationSet.get(matchmd)).add(md); --- break; ------- } --- } ------- } --- } ------- } --- } -- --- --- public Set getMethods(MethodDescriptor md, TypeDescriptor type) { --- return getMethods(md); --- } ------- ---- public Set getMethods(MethodDescriptor md, TypeDescriptor type) { ---- return getMethods(md); ---- } --- /** Given a call to MethodDescriptor, lists the methods which --- could actually be called due to virtual dispatch. */ --- public Set getMethods(MethodDescriptor md) { --- HashSet ns=new HashSet(); --- ns.add(md); --- Set s=(Set)mapVirtual2ImplementationSet.get(md); --- if (s!=null) --- for(Iterator it=s.iterator(); it.hasNext();) { --- MethodDescriptor md2=(MethodDescriptor)it.next(); --- ns.addAll(getMethods(md2)); --- } --- return ns; --- } ------- ---- /** Given a call to MethodDescriptor, lists the methods which ---- could actually be called due to virtual dispatch. */ ---- public Set getMethods(MethodDescriptor md) { ---- HashSet ns=new HashSet(); ---- ns.add(md); -- Set s=(Set)methods.get(md); -- Set s=(Set)mapVirtual2ImplementationSet.get(md); ---- if (s!=null) ---- for(Iterator it=s.iterator();it.hasNext();) { ---- MethodDescriptor md2=(MethodDescriptor)it.next(); ---- ns.addAll(getMethods(md2)); ---- } ---- return ns; ---- } --- /** Given a call to MethodDescriptor, lists the methods which --- could actually be call by that method. */ -- public Set getMethodCalls(TaskDescriptor td) { -- return getMethodCalls( (Descriptor) td); -- } -- --- public Set getMethodCalls(MethodDescriptor md) { -- return getMethodCalls( (Descriptor) md); -- } -- -- public Set getMethodCalls(Descriptor d) { -- assert d instanceof MethodDescriptor || -- d instanceof TaskDescriptor; -- --- HashSet ns=new HashSet(); - ns.add(md); - Set s=(Set)mapCaller2CalleeSet.get(md); -- ns.add(d); -- return getMoreMethodCalls(ns, d); -- } -- -- private Set getMoreMethodCalls(HashSet found, Descriptor d) { -- HashSet ns=new HashSet(); -- ns.add(d); -- found.add(d); -- Set s=(Set)mapCaller2CalleeSet.get(d); --- if (s!=null) --- for(Iterator it=s.iterator(); it.hasNext();) { - MethodDescriptor md2=(MethodDescriptor)it.next(); - ns.addAll(getMethodCalls(md2)); -- MethodDescriptor md=(MethodDescriptor)it.next(); -- if( !found.contains(md) ) { -- found.contains(md); -- ns.addAll(getMoreMethodCalls(found, md)); -- } --- } --- return ns; --- } ------- ---- /** Given a call to MethodDescriptor, lists the methods which ---- could actually be call by that method. */ ---- public Set getMethodCalls(MethodDescriptor md) { ---- HashSet ns=new HashSet(); ---- ns.add(md); -- Set s=(Set)methodmap.get(md); -- Set s=(Set)mapCaller2CalleeSet.get(md); ---- if (s!=null) ---- for(Iterator it=s.iterator();it.hasNext();) { ---- MethodDescriptor md2=(MethodDescriptor)it.next(); ---- ns.addAll(getMethodCalls(md2)); ---- } ---- return ns; -- --- private void buildGraph() { --- Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); --- while(it.hasNext()) { --- ClassDescriptor cn=(ClassDescriptor)it.next(); --- Iterator methodit=cn.getMethods(); --- //Iterator through methods --- while(methodit.hasNext()) { --- MethodDescriptor md=(MethodDescriptor)methodit.next(); --- analyzeMethod( (Object)md, state.getMethodFlat(md) ); --- } ------- } ---- ---- private void buildGraph() { ---- Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); ---- while(it.hasNext()) { ---- ClassDescriptor cn=(ClassDescriptor)it.next(); ---- Iterator methodit=cn.getMethods(); ---- //Iterator through methods ---- while(methodit.hasNext()) { ---- MethodDescriptor md=(MethodDescriptor)methodit.next(); -- analyzeMethod(md); -- analyzeMethod( (Object)md, state.getMethodFlat(md) ); ---- } -- } -- it=state.getTaskSymbolTable().getDescriptorsIterator(); -- while(it.hasNext()) { -- TaskDescriptor td=(TaskDescriptor)it.next(); -- analyzeMethod( (Object)td, state.getMethodFlat(td) ); ---- } --- it=state.getTaskSymbolTable().getDescriptorsIterator(); --- while(it.hasNext()) { --- TaskDescriptor td=(TaskDescriptor)it.next(); --- analyzeMethod( (Object)td, state.getMethodFlat(td) ); ------- } --- } ------- -- private void analyzeMethod(MethodDescriptor md) { -- FlatMethod fm=state.getMethodFlat(md); -- private void analyzeMethod(Object caller, FlatMethod fm) { ---- HashSet toexplore=new HashSet(); ---- toexplore.add(fm); ---- HashSet explored=new HashSet(); ---- //look at all the nodes in the flat representation ---- while(!toexplore.isEmpty()) { ---- FlatNode fn=(FlatNode)(toexplore.iterator()).next(); ---- toexplore.remove(fn); ---- explored.add(fn); ---- for(int i=0;i callee maps -- if( !mapCaller2CalleeSet.containsKey( caller ) ) { -- mapCaller2CalleeSet.put( caller, new HashSet() ); -- } -- ((HashSet)mapCaller2CalleeSet.get( caller )).addAll( methodsthatcouldbecalled ); --- // add caller -> callee maps --- if( !mapCaller2CalleeSet.containsKey(caller) ) { --- mapCaller2CalleeSet.put(caller, new HashSet() ); --- } --- ((HashSet)mapCaller2CalleeSet.get(caller)).addAll(methodsthatcouldbecalled); ----- -- // add callee -> caller maps -- Iterator calleeItr = methodsthatcouldbecalled.iterator(); -- while( calleeItr.hasNext() ) { -- MethodDescriptor callee = (MethodDescriptor) calleeItr.next(); -- if( !mapCallee2CallerSet.containsKey( callee ) ) { -- mapCallee2CallerSet.put( callee, new HashSet() ); -- } -- ((HashSet)mapCallee2CallerSet.get( callee )).add( caller ); -- } -- } --- // add callee -> caller maps --- Iterator calleeItr = methodsthatcouldbecalled.iterator(); --- while( calleeItr.hasNext() ) { --- MethodDescriptor callee = (MethodDescriptor) calleeItr.next(); --- if( !mapCallee2CallerSet.containsKey(callee) ) { --- mapCallee2CallerSet.put(callee, new HashSet() ); --- } --- ((HashSet)mapCallee2CallerSet.get(callee)).add(caller); ----- } --- } ----- } -- -- public void writeToDot( String graphName ) throws java.io.IOException { -- // each task or method only needs to be labeled once -- // in a dot file -- HashSet labeledInDot = new HashSet(); --- } ----- -- // write out the call graph using the callees mapping -- BufferedWriter bw = new BufferedWriter( new FileWriter( graphName+"byCallees.dot" ) ); -- bw.write( "digraph "+graphName+"byCallees {\n" ); -- Iterator mapItr = mapCallee2CallerSet.entrySet().iterator(); -- while( mapItr.hasNext() ) { -- Map.Entry me = (Map.Entry) mapItr.next(); -- MethodDescriptor callee = (MethodDescriptor) me.getKey(); -- HashSet callerSet = (HashSet) me.getValue(); - public void writeToDot(String graphName) throws java.io.IOException { - // each task or method only needs to be labeled once - // in a dot file -- -- public void writeVirtual2ImplemToDot(String graphName) throws java.io.IOException { --- HashSet labeledInDot = new HashSet(); ----- -- if( !labeledInDot.contains( callee ) ) { -- labeledInDot.add( callee ); -- bw.write( " " + callee.getNum() + "[label=\"" + callee + "\"];\n" ); -- } - // write out the call graph using the callees mapping - BufferedWriter bw = new BufferedWriter(new FileWriter(graphName+"byCallees.dot") ); - bw.write("digraph "+graphName+"byCallees {\n"); - Iterator mapItr = mapCallee2CallerSet.entrySet().iterator(); -- BufferedWriter bw = new BufferedWriter(new FileWriter(graphName+".dot") ); -- bw.write("digraph "+graphName+" {\n"); -- Iterator mapItr = mapVirtual2ImplementationSet.entrySet().iterator(); --- while( mapItr.hasNext() ) { --- Map.Entry me = (Map.Entry)mapItr.next(); - MethodDescriptor callee = (MethodDescriptor) me.getKey(); - HashSet callerSet = (HashSet) me.getValue(); -- MethodDescriptor virtual = (MethodDescriptor) me.getKey(); -- HashSet implemSet = (HashSet) me.getValue(); ----- -- Iterator callerItr = callerSet.iterator(); -- while( callerItr.hasNext() ) { -- Descriptor caller = (Descriptor) callerItr.next(); - if( !labeledInDot.contains(callee) ) { - labeledInDot.add(callee); - bw.write(" " + callee.getNum() + "[label=\"" + callee + "\"];\n"); -- if( !labeledInDot.contains(virtual) ) { -- labeledInDot.add(virtual); -- bw.write(" "+virtual.getNum()+"[label=\""+virtual+"\"];\n"); --- } ----- -- if( !labeledInDot.contains( caller ) ) { -- labeledInDot.add( caller ); -- bw.write( " " + caller.getNum() + "[label=\"" + caller + "\"];\n" ); -- } - Iterator callerItr = callerSet.iterator(); - while( callerItr.hasNext() ) { - Descriptor caller = (Descriptor) callerItr.next(); -- Iterator implemItr = implemSet.iterator(); -- while( implemItr.hasNext() ) { -- Descriptor implem = (Descriptor) implemItr.next(); ----- -- bw.write( " " + callee.getNum() + "->" + caller.getNum() + ";\n" ); -- } - if( !labeledInDot.contains(caller) ) { - labeledInDot.add(caller); - bw.write(" " + caller.getNum() + "[label=\"" + caller + "\"];\n"); -- if( !labeledInDot.contains(implem) ) { -- labeledInDot.add(implem); -- bw.write(" "+implem.getNum()+"[label=\""+implem+"\"];\n"); ----- } -- bw.write( "}\n" ); -- bw.close(); ----- -- // write out the call graph (should be equivalent) by -- // using the callers mapping -- labeledInDot = new HashSet(); -- bw = new BufferedWriter( new FileWriter( graphName+"byCallers.dot" ) ); -- bw.write( "digraph "+graphName+"byCallers {\n" ); -- mapItr = mapCaller2CalleeSet.entrySet().iterator(); -- while( mapItr.hasNext() ) { -- Map.Entry me = (Map.Entry) mapItr.next(); -- Descriptor caller = (Descriptor) me.getKey(); -- HashSet calleeSet = (HashSet) me.getValue(); - bw.write(" " + callee.getNum() + "->" + caller.getNum() + ";\n"); -- bw.write(" "+virtual.getNum()+"->"+implem.getNum()+";\n"); --- } --- } --- bw.write("}\n"); --- bw.close(); -- } ----- -- if( !labeledInDot.contains( caller ) ) { -- labeledInDot.add( caller ); -- bw.write( " " + caller.getNum() + "[label=\"" + caller + "\"];\n" ); -- } -- -- public void writeCaller2CalleesToDot(String graphName) throws java.io.IOException { --- // write out the call graph (should be equivalent) by --- // using the callers mapping - labeledInDot = new HashSet(); - bw = new BufferedWriter(new FileWriter(graphName+"byCallers.dot") ); -- HashSet labeledInDot = new HashSet(); -- BufferedWriter bw = new BufferedWriter(new FileWriter(graphName+"byCallers.dot") ); --- bw.write("digraph "+graphName+"byCallers {\n"); - mapItr = mapCaller2CalleeSet.entrySet().iterator(); -- Iterator mapItr = mapCaller2CalleeSet.entrySet().iterator(); --- while( mapItr.hasNext() ) { - Map.Entry me = (Map.Entry)mapItr.next(); - Descriptor caller = (Descriptor) me.getKey(); -- Map.Entry me = (Map.Entry)mapItr.next(); -- Descriptor caller = (Descriptor) me.getKey(); --- HashSet calleeSet = (HashSet) me.getValue(); ----- -- Iterator calleeItr = calleeSet.iterator(); -- while( calleeItr.hasNext() ) { -- MethodDescriptor callee = (MethodDescriptor) calleeItr.next(); --- if( !labeledInDot.contains(caller) ) { --- labeledInDot.add(caller); - bw.write(" " + caller.getNum() + "[label=\"" + caller + "\"];\n"); -- bw.write(" "+caller.getNum()+"[label=\"" +caller+"\"];\n"); --- } ----- -- if( !labeledInDot.contains( callee ) ) { -- labeledInDot.add( callee ); -- bw.write( " " + callee.getNum() + "[label=\"" + callee + "\"];\n" ); -- } --- Iterator calleeItr = calleeSet.iterator(); --- while( calleeItr.hasNext() ) { --- MethodDescriptor callee = (MethodDescriptor) calleeItr.next(); ----- -- bw.write( " " + callee.getNum() + "->" + caller.getNum() + ";\n" ); ---- } --- if( !labeledInDot.contains(callee) ) { --- labeledInDot.add(callee); - bw.write(" " + callee.getNum() + "[label=\"" + callee + "\"];\n"); -- bw.write(" "+callee.getNum()+"[label=\""+callee+"\"];\n"); ------- } -- bw.write( "}\n" ); -- bw.close(); --- - bw.write(" " + callee.getNum() + "->" + caller.getNum() + ";\n"); -- bw.write(" "+caller.getNum()+"->"+callee.getNum()+";\n"); -- } -- } -- bw.write("}\n"); -- bw.close(); -- } -- -- -- public void writeCallee2CallersToDot(String graphName) throws java.io.IOException { -- // each task or method only needs to be labeled once -- // in a dot file -- HashSet labeledInDot = new HashSet(); -- -- // write out the call graph using the callees mapping -- BufferedWriter bw = new BufferedWriter(new FileWriter(graphName+"byCallees.dot") ); -- bw.write("digraph "+graphName+"byCallees {\n"); -- Iterator mapItr = mapCallee2CallerSet.entrySet().iterator(); -- while( mapItr.hasNext() ) { -- Map.Entry me = (Map.Entry)mapItr.next(); -- MethodDescriptor callee = (MethodDescriptor) me.getKey(); -- HashSet callerSet = (HashSet) me.getValue(); -- -- if( !labeledInDot.contains(callee) ) { -- labeledInDot.add(callee); -- bw.write(" "+callee.getNum()+"[label=\""+callee+"\"];\n"); -- } -- -- Iterator callerItr = callerSet.iterator(); -- while( callerItr.hasNext() ) { -- Descriptor caller = (Descriptor) callerItr.next(); -- -- if( !labeledInDot.contains(caller) ) { -- labeledInDot.add(caller); -- bw.write(" "+caller.getNum()+"[label=\""+caller+"\"];\n"); -- } -- -- bw.write(" "+caller.getNum()+"->"+callee.getNum()+";\n"); --- } ------- } --- bw.write("}\n"); --- bw.close(); --- } -------} diff --cc Robust/src/Analysis/Locality/GenerateConversions.java index 8585773b,9b987c99,9b987c99,9b987c99,ff101120,8ee501b6,8ee501b6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/Locality/GenerateConversions.java +++ /dev/null @@@@@@@@ -1,202 -1,215 -1,215 -1,215 -1,215 -1,222 -1,222 +1,0 @@@@@@@@ -------package Analysis.Locality; -------import IR.State; -------import IR.Flat.*; -------import java.util.*; -------import IR.MethodDescriptor; ------- ------- -------public class GenerateConversions { ---- LocalityAnalysis locality; ---- State state; --- LocalityAnalysis locality; --- State state; ------- ---- /** Warning: This class modifies the code in place. */ --- /** Warning: This class modifies the code in place. */ ------- ---- public GenerateConversions(LocalityAnalysis la, State state) { ---- locality=la; ---- this.state=state; ---- doConversion(); ---- } ---- ---- private void doConversion() { ---- Set bindings=locality.getLocalityBindings(); ---- Iterator bindit=bindings.iterator(); ---- while(bindit.hasNext()) { ---- LocalityBinding lb=bindit.next(); ---- //Don't need to do conversion if it is already atomic ---- if (lb.isAtomic()) ---- continue; ---- converttoPtr(lb); ---- converttoOid(lb); ---- } --- public GenerateConversions(LocalityAnalysis la, State state) { --- locality=la; --- this.state=state; --- doConversion(); --- } --- --- private void doConversion() { --- Set bindings=locality.getLocalityBindings(); --- Iterator bindit=bindings.iterator(); --- while(bindit.hasNext()) { --- LocalityBinding lb=bindit.next(); --- //Don't need to do conversion if it is already atomic --- if (lb.isAtomic()) --- continue; --- converttoPtr(lb); --- converttoOid(lb); ------- } --- } ------- ---- /* At the end of an atomic block, we need to convert any global - * references that will be used again into OID's */ --- * references that will be used again into OID's. */ --- /* At the end of an atomic block, we need to convert any global --- * references that will be used again into OID's. */ ------- ---- private void converttoOid(LocalityBinding lb) { ---- Hashtable atomictab=locality.getAtomic(lb); ---- Hashtable> temptab=locality.getNodeTempInfo(lb); ---- MethodDescriptor md=lb.getMethod(); ---- FlatMethod fm=state.getMethodFlat(md); - - Hashtable> nodetotnpair=new Hashtable>(); --- Hashtable> nodetotnpair=new Hashtable>(); ---- Hashtable> nodetoconvs=new Hashtable>(); --- private void converttoOid(LocalityBinding lb) { --- Hashtable atomictab=locality.getAtomic(lb); --- Hashtable> temptab=locality.getNodeTempInfo(lb); --- MethodDescriptor md=lb.getMethod(); --- FlatMethod fm=state.getMethodFlat(md); --- Hashtable> nodetotnpair=new Hashtable>(); --- Hashtable> nodetoconvs=new Hashtable>(); -- Hashtable> nodetoconvs2=new Hashtable>(); ------- ---- Set toprocess=fm.getNodeSet(); --- Set toprocess=fm.getNodeSet(); ------- ---- while(!toprocess.isEmpty()) { ---- FlatNode fn=toprocess.iterator().next(); ---- toprocess.remove(fn); ---- boolean isatomic=atomictab.get(fn).intValue()>0; ---- Hashtable nodetemptab=temptab.get(fn); ---- ---- List reads=Arrays.asList(fn.readsTemps()); - List writes=Arrays.asList(fn.readsTemps()); --- while(!toprocess.isEmpty()) { --- FlatNode fn=toprocess.iterator().next(); --- toprocess.remove(fn); --- boolean isatomic=atomictab.get(fn).intValue()>0; -- --- Hashtable nodetemptab=temptab.get(fn); - --- --- List writes=Arrays.asList(fn.writesTemps()); --- ---- if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode ---- &&!nodetoconvs.containsKey(fn)) ---- nodetoconvs.put(fn, new HashSet()); --- List reads=Arrays.asList(fn.readsTemps()); --- List writes=Arrays.asList(fn.writesTemps()); - --- --- if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode - &&!nodetoconvs.containsKey(fn)) -- &&!nodetoconvs.containsKey(fn)) { --- nodetoconvs.put(fn, new HashSet()); -- nodetoconvs2.put(fn, new HashSet()); -- } - --- --- ---- HashSet tempset=new HashSet(); --- HashSet tempset=new HashSet(); ------ ---- for(int i=0;i prevset=nodetotnpair.get(fnprev); ---- for(Iterator it=prevset.iterator();it.hasNext();) { ---- TempNodePair tnp=it.next(); --- if (fn.kind()==FKind.FlatGlobalConvNode&& --- ((FlatGlobalConvNode)fn).getLocality()!=lb) { --- //ignore this node --- tempset.add(tnp); --- continue; --- } ---- if (reads.contains(tnp.getTemp())&&tnp.getNode()!=null) { ---- //Value actually is read... ---- nodetoconvs.get(tnp.getNode()).add(tnp.getTemp()); ---- } ---- if (writes.contains(tnp.getTemp())) //value overwritten ---- continue; ---- if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode) { ---- //Create new node and tag it with this exit ---- if (tnp.getNode()==null) { ---- TempNodePair tnp2=new TempNodePair(tnp.getTemp()); ---- tnp2.setNode(fn); ---- tempset.add(tnp2); - } --- } else --- tempset.add(tnp); ---- } else ---- tempset.add(tnp); ---- } ---- } ---- if (isatomic) { - //if this is in an atomic block, record temps that are written to --- /* If this is in an atomic block, record temps that --- * are written to.*/ --- Set prevset=nodetotnpair.get(fnprev); --- for(Iterator it=prevset.iterator(); it.hasNext();) { --- TempNodePair tnp=it.next(); --- if (fn.kind()==FKind.FlatGlobalConvNode&& --- ((FlatGlobalConvNode)fn).getLocality()!=lb) { --- //ignore this node --- tempset.add(tnp); --- continue; --- } --- if (reads.contains(tnp.getTemp())&&tnp.getNode()!=null) { --- //Value actually is read... --- nodetoconvs.get(tnp.getNode()).add(tnp.getTemp()); --- } -- --- if (writes.contains(tnp.getTemp())) //value overwritten --- continue; --- if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode) { --- //Create new node and tag it with this exit --- if (tnp.getNode()==null) { --- TempNodePair tnp2=new TempNodePair(tnp.getTemp()); --- tnp2.setNode(fn); --- tempset.add(tnp2); -- nodetoconvs2.get(fn).add(tnp.getTemp()); //have to hide cached copies from gc --- } else --- tempset.add(tnp); --- } else --- tempset.add(tnp); --- } --- } --- if (isatomic) { --- /* If this is in an atomic block, record temps that --- * are written to.*/ ------- ---- /* NOTE: If this compiler is changed to maintain ---- * OID/Ptr's in variables, then we need to use all ---- * global temps that could be read and not just the ---- * ones converted by globalconvnode*/ --- /* NOTE: If this compiler is changed to maintain --- * OID/Ptr's in variables, then we need to use all --- * global temps that could be read and not just the --- * ones converted by globalconvnode*/ ------- ---- if (fn.kind()!=FKind.FlatGlobalConvNode|| - ((FlatGlobalConvNode)fn).getLocality()==lb) - //If globalconvnode, make sure we have the right locality --- ((FlatGlobalConvNode)fn).getLocality()==lb) { --- /*If globalconvnode, make sure we have the right --- * locality. */ ---- for(Iterator writeit=writes.iterator();writeit.hasNext();) { ---- TempDescriptor wrtmp=writeit.next(); ---- if (nodetemptab.get(wrtmp)==LocalityAnalysis.GLOBAL) { ---- TempNodePair tnp=new TempNodePair(wrtmp); ---- tempset.add(tnp); ---- } ---- } --- } ---- } ---- if (!nodetotnpair.containsKey(fn)||!nodetotnpair.get(fn).equals(tempset)) { ---- //changes to set, so enqueue next nodes ---- nodetotnpair.put(fn, tempset); //update set ---- for(int i=0;i writeit=writes.iterator(); writeit.hasNext();) { --- TempDescriptor wrtmp=writeit.next(); --- if (nodetemptab.get(wrtmp)==LocalityAnalysis.GLOBAL) { --- TempNodePair tnp=new TempNodePair(wrtmp); --- tempset.add(tnp); ------- } --- } ------- } ---- //Place Convert to Oid nodes ---- toprocess=fm.getNodeSet(); ---- for(Iterator it=toprocess.iterator();it.hasNext();) { ---- FlatNode fn=it.next(); - if (atomictab.get(fn).intValue()==0&& --- if (atomictab.get(fn).intValue()==0&&fn.numPrev()>0&& ---- atomictab.get(fn.getPrev(0)).intValue()>0) { ---- //sanity check ---- assert(fn.kind()==FKind.FlatAtomicExitNode); - ---- //insert calls here... ---- Set tempset=nodetoconvs.get(fn); ---- for(Iterator tempit=tempset.iterator();tempit.hasNext();) { ---- FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, false); ---- atomictab.put(fgcn, atomictab.get(fn)); ---- temptab.put(fgcn, (Hashtable) temptab.get(fn).clone()); --- } --- if (!nodetotnpair.containsKey(fn)||!nodetotnpair.get(fn).equals(tempset)) { --- //changes to set, so enqueue next nodes --- nodetotnpair.put(fn, tempset); //update set --- for(int i=0; i it=toprocess.iterator(); it.hasNext();) { --- FlatNode fn=it.next(); --- if (atomictab.get(fn).intValue()==0&&fn.numPrev()>0&& --- atomictab.get(fn.getPrev(0)).intValue()>0) { --- //sanity check --- assert(fn.kind()==FKind.FlatAtomicExitNode); --- //insert calls here... - Set tempset=nodetoconvs.get(fn); -- Set tempset=nodetoconvs2.get(fn); --- for(Iterator tempit=tempset.iterator(); tempit.hasNext();) { - FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, false); -- TempDescriptor tmpd=tempit.next(); -- FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tmpd, lb, false, nodetoconvs.get(fn).contains(tmpd)); --- atomictab.put(fgcn, atomictab.get(fn)); --- temptab.put(fgcn, (Hashtable)temptab.get(fn).clone()); ------ ---- for(int i=0;i> nodetotranstemps=new Hashtable>(); ---- Hashtable atomictab=locality.getAtomic(lb); ---- Hashtable> temptab=locality.getNodeTempInfo(lb); ---- MethodDescriptor md=lb.getMethod(); ---- FlatMethod fm=state.getMethodFlat(md); ---- Set toprocess=fm.getNodeSet(); --- /* At the beginning of an atomic block, we need to convert any --- * OID's that will be used in the atomic block to pointers */ ------- ---- while(!toprocess.isEmpty()) { ---- FlatNode fn=toprocess.iterator().next(); ---- toprocess.remove(fn); - --- private void converttoPtr(LocalityBinding lb) { --- Hashtable> nodetotranstemps=new Hashtable>(); --- Hashtable atomictab=locality.getAtomic(lb); --- Hashtable> temptab=locality.getNodeTempInfo(lb); --- MethodDescriptor md=lb.getMethod(); --- FlatMethod fm=state.getMethodFlat(md); --- Set toprocess=fm.getNodeSet(); ------ ---- if (atomictab.get(fn).intValue()>0) { ---- //build set of transaction temps use by next nodes ---- HashSet transtemps=new HashSet(); ---- for(int i=0;i pretemptab=locality.getNodePreTempInfo(lb, fn); ---- TempDescriptor []readtemps=fn.readsTemps(); ---- for(int i=0;i0) { --- //build set of transaction temps use by next nodes --- HashSet transtemps=new HashSet(); --- for(int i=0; i it=toprocess.iterator();it.hasNext();) { ---- FlatNode fn=it.next(); ---- if (atomictab.get(fn).intValue()>0&& ---- atomictab.get(fn.getPrev(0)).intValue()==0) { ---- //sanity check ---- assert(fn.kind()==FKind.FlatAtomicEnterNode); --- //subtract out the ones we write to --- transtemps.removeAll(Arrays.asList(fn.writesTemps())); --- //add in the globals we read from --- Hashtable pretemptab=locality.getNodePreTempInfo(lb, fn); --- TempDescriptor [] readtemps=fn.readsTemps(); --- for(int i=0; i it=toprocess.iterator(); it.hasNext();) { --- FlatNode fn=it.next(); --- if (atomictab.get(fn).intValue()>0&& --- atomictab.get(fn.getPrev(0)).intValue()==0) { --- //sanity check --- assert(fn.kind()==FKind.FlatAtomicEnterNode); - --- --- ---- //insert calls here... ---- Set tempset=nodetotranstemps.get(fn); ---- for(Iterator tempit=tempset.iterator();tempit.hasNext();) { ---- FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, true); ---- atomictab.put(fgcn, atomictab.get(fn)); ---- temptab.put(fgcn, (Hashtable) temptab.get(fn).clone()); ---- fgcn.addNext(fn.getNext(0)); ---- fn.setNext(0, fgcn); ---- } ---- } --- //insert calls here... --- Set tempset=nodetotranstemps.get(fn); --- for(Iterator tempit=tempset.iterator(); tempit.hasNext();) { --- FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, true); --- atomictab.put(fgcn, atomictab.get(fn)); --- temptab.put(fgcn, (Hashtable)temptab.get(fn).clone()); --- fgcn.addNext(fn.getNext(0)); --- fn.setNext(0, fgcn); ------- } --- } ------- } --- } -------} diff --cc Robust/src/Analysis/Locality/LocalityAnalysis.java index bee5d13a,ccc28803,f4187fe1,adac83f8,a7e645f5,a7e645f5,a7e645f5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/Locality/LocalityAnalysis.java +++ /dev/null @@@@@@@@ -1,501 -1,666 -1,676 -1,727 -1,741 -1,741 -1,741 +1,0 @@@@@@@@ -------package Analysis.Locality; ------- -------import java.util.*; -------import Analysis.CallGraph.CallGraph; -------import IR.SymbolTable; -------import IR.State; -------import IR.TypeUtil; -------import IR.MethodDescriptor; -------import IR.Flat.*; ------import IR.ClassDescriptor; ------- -------public class LocalityAnalysis { ---- State state; ---- Stack lbtovisit; ---- Hashtable discovered; ---- Hashtable> dependence; - Hashtable> calldep; ---- Hashtable>> temptab; ---- Hashtable> atomictab; ---- Hashtable>> tempstosave; --- Hashtable> classtolb; --- Hashtable> methodtolb; --- private LocalityBinding lbmain; - private LocalityBinding lbrun; --- State state; --- Stack lbtovisit; --- Hashtable discovered; --- Hashtable> dependence; --- Hashtable> calldep; --- Hashtable>> temptab; --- Hashtable> atomictab; --- Hashtable>> tempstosave; --- Hashtable> classtolb; --- Hashtable> methodtolb; --- private LocalityBinding lbmain; --- private LocalityBinding lbrun; ------- ---- CallGraph callgraph; ---- TypeUtil typeutil; ---- public static final Integer LOCAL=new Integer(0); ---- public static final Integer GLOBAL=new Integer(1); ---- public static final Integer EITHER=new Integer(2); ---- public static final Integer CONFLICT=new Integer(3); --- CallGraph callgraph; --- TypeUtil typeutil; --- public static final Integer LOCAL=new Integer(0); --- public static final Integer GLOBAL=new Integer(1); --- public static final Integer EITHER=new Integer(2); --- public static final Integer CONFLICT=new Integer(3); ------- ---- public LocalityAnalysis(State state, CallGraph callgraph, TypeUtil typeutil) { ---- this.typeutil=typeutil; ---- this.state=state; ---- this.discovered=new Hashtable(); ---- this.dependence=new Hashtable>(); - this.calldep=new Hashtable>(); ---- this.temptab=new Hashtable>>(); ---- this.atomictab=new Hashtable>(); ---- this.lbtovisit=new Stack(); ---- this.callgraph=callgraph; ---- this.tempstosave=new Hashtable>>(); --- public LocalityAnalysis(State state, CallGraph callgraph, TypeUtil typeutil) { --- this.typeutil=typeutil; --- this.state=state; --- this.discovered=new Hashtable(); --- this.dependence=new Hashtable>(); --- this.calldep=new Hashtable>(); --- this.temptab=new Hashtable>>(); --- this.atomictab=new Hashtable>(); --- this.lbtovisit=new Stack(); --- this.callgraph=callgraph; --- this.tempstosave=new Hashtable>>(); --- this.classtolb=new Hashtable>(); --- this.methodtolb=new Hashtable>(); --- doAnalysis(); --- } - --- --- this.classtolb=new Hashtable>(); --- this.methodtolb=new Hashtable>(); ---- doAnalysis(); --- } --- public LocalityBinding getMain() { --- return lbmain; --- } ------ --- public LocalityBinding getMain() { --- return lbmain; --- } --- /** This method returns the set of LocalityBindings that a given --- * flatcall could invoke */ ------ --- /** This method returns the set of LocalityBindings that a given --- * flatcall could invoke */ --- public LocalityBinding getBinding(LocalityBinding currlb, FlatCall fc) { --- boolean isatomic=getAtomic(currlb).get(fc).intValue()>0; --- Hashtable currtable=getNodePreTempInfo(currlb,fc); --- MethodDescriptor md=fc.getMethod(); ------ --- public LocalityBinding getBinding(LocalityBinding currlb, FlatCall fc) { --- boolean isatomic=getAtomic(currlb).get(fc).intValue()>0; --- Hashtable currtable=getNodePreTempInfo(currlb,fc); --- MethodDescriptor md=fc.getMethod(); --- --- boolean isnative=md.getModifiers().isNative(); --- --- LocalityBinding lb=new LocalityBinding(md, isatomic); --- --- for(int i=0;i getClassBindings(ClassDescriptor cd) { --- return classtolb.get(cd); --- for(int i=0; i getMethodBindings(MethodDescriptor md) { --- return methodtolb.get(md); - } ---- - public Set getMethods() { - return methodtolb.keySet(); ---- } --- /** This method returns a set of LocalityBindings for the parameter class. */ --- public Set getClassBindings(ClassDescriptor cd) { --- return classtolb.get(cd); --- } ------- ---- /** This method returns a set of LocalityBindings. A ---- * LocalityBinding specifies a context a method can be invoked in. ---- * It specifies whether the method is in a transaction and whether ---- * its parameter objects are locals or globals. */ --- /** This method returns a set of LocalityBindings for the parameter method. */ ------- ---- public Set getLocalityBindings() { ---- return discovered.keySet(); ---- } --- public Set getMethodBindings(MethodDescriptor md) { --- return methodtolb.get(md); --- } ------- ---- /** This method returns a hashtable for a given LocalityBinding ---- * that tells the current local/global status of temps at the each ---- * node in the flat representation. */ --- public Set getMethods() { --- return methodtolb.keySet(); --- } ------- ---- public Hashtable> getNodeTempInfo(LocalityBinding lb) { ---- return temptab.get(lb); --- } --- /** This method returns a set of LocalityBindings. A --- * LocalityBinding specifies a context a method can be invoked in. --- * It specifies whether the method is in a transaction and whether --- * its parameter objects are locals or globals. */ ------ --- /** This method returns a hashtable for a given LocalityBinding --- * that tells the current local/global status of temps at the --- * beginning of each node in the flat representation. */ --- public Set getLocalityBindings() { --- return discovered.keySet(); --- } ------ --- public Hashtable getNodePreTempInfo(LocalityBinding lb, FlatNode fn) { --- Hashtable currtable=new Hashtable(); --- Hashtable> temptable=getNodeTempInfo(lb); --- /** This method returns a hashtable for a given LocalityBinding --- * that tells the current local/global status of temps at the each --- * node in the flat representation. */ ------ --- for(int i=0;i prevtable=temptable.get(prevnode); --- for(Iterator tempit=prevtable.keySet().iterator();tempit.hasNext();) { --- TempDescriptor temp=tempit.next(); --- Integer tmpint=prevtable.get(temp); --- Integer oldint=currtable.containsKey(temp)?currtable.get(temp):EITHER; --- Integer newint=merge(tmpint, oldint); --- currtable.put(temp, newint); --- } --- } --- return currtable; ---- } --- public Hashtable> getNodeTempInfo(LocalityBinding lb) { --- return temptab.get(lb); --- } ------- ---- /** This method returns an hashtable for a given LocalitBinding ---- * that tells whether a node in the flat represenation is in a ---- * transaction or not. Integer values greater than 0 indicate ---- * that the node is in a transaction and give the nesting depth. ---- * The outermost AtomicEnterNode will have a value of 1 and the ---- * outermost AtomicExitNode will have a value of 0. */ ---- ---- public Hashtable getAtomic(LocalityBinding lb) { ---- return atomictab.get(lb); --- /** This method returns a hashtable for a given LocalityBinding --- * that tells the current local/global status of temps at the --- * beginning of each node in the flat representation. */ --- --- public Hashtable getNodePreTempInfo(LocalityBinding lb, FlatNode fn) { --- Hashtable currtable=new Hashtable(); --- Hashtable> temptable=getNodeTempInfo(lb); --- --- for(int i=0; i prevtable=temptable.get(prevnode); --- for(Iterator tempit=prevtable.keySet().iterator(); tempit.hasNext();) { --- TempDescriptor temp=tempit.next(); --- Integer tmpint=prevtable.get(temp); --- Integer oldint=currtable.containsKey(temp) ? currtable.get(temp) : EITHER; --- Integer newint=merge(tmpint, oldint); --- currtable.put(temp, newint); --- } ------- } --- return currtable; --- } ------- ---- /** This methods returns a hashtable for a given LocalityBinding ---- * that tells which temps needs to be saved for each ---- * AtomicEnterNode. */ --- /** This method returns an hashtable for a given LocalitBinding --- * that tells whether a node in the flat represenation is in a --- * transaction or not. Integer values greater than 0 indicate --- * that the node is in a transaction and give the nesting depth. --- * The outermost AtomicEnterNode will have a value of 1 and the --- * outermost AtomicExitNode will have a value of 0. */ ------- ---- public Hashtable> getTemps(LocalityBinding lb) { ---- return tempstosave.get(lb); --- public Hashtable getAtomic(LocalityBinding lb) { --- return atomictab.get(lb); --- } --- --- /** This methods returns a hashtable for a given LocalityBinding --- * that tells which temps needs to be saved for each --- * AtomicEnterNode. */ --- --- public Hashtable> getTemps(LocalityBinding lb) { --- return tempstosave.get(lb); --- } --- --- public Set getTempSet(LocalityBinding lb) { --- HashSet set=new HashSet(); --- Hashtable> table=getTemps(lb); --- if (table!=null) --- for(Iterator faenit=table.keySet().iterator(); faenit.hasNext();) { --- FlatAtomicEnterNode faen=faenit.next(); --- set.addAll(table.get(faen)); --- } --- return set; --- } --- --- private void doAnalysis() { --- computeLocalityBindings(); --- computeTempstoSave(); --- cleanSets(); --- } --- --- private void cleanSets() { --- HashSet lbset=new HashSet(); --- Stack lbstack=new Stack(); --- lbstack.add(lbmain); --- lbstack.add(lbrun); --- lbset.add(lbmain); --- lbset.add(lbrun); --- while(!lbstack.isEmpty()) { --- LocalityBinding lb=lbstack.pop(); --- if (calldep.containsKey(lb)) { --- Set set=new HashSet(); --- set.addAll(calldep.get(lb)); --- set.removeAll(lbset); --- lbstack.addAll(set); --- lbset.addAll(set); --- } --- } --- for(Iterator lbit=discovered.keySet().iterator(); lbit.hasNext();) { --- LocalityBinding lb=lbit.next(); --- if (!lbset.contains(lb)) { --- lbit.remove(); --- classtolb.get(lb.getMethod().getClassDesc()).remove(lb); --- methodtolb.get(lb.getMethod()).remove(lb); --- } ------ } --- } ------ --- public Set getTempSet(LocalityBinding lb) { --- HashSet set=new HashSet(); --- Hashtable> table=getTemps(lb); --- if (table!=null) --- for(Iterator faenit=table.keySet().iterator();faenit.hasNext();) { --- FlatAtomicEnterNode faen=faenit.next(); --- set.addAll(table.get(faen)); --- } --- return set; --- private void computeLocalityBindings() { --- lbmain=new LocalityBinding(typeutil.getMain(), false); --- lbmain.setGlobalReturn(EITHER); --- lbmain.setGlobal(0, LOCAL); --- lbtovisit.add(lbmain); --- discovered.put(lbmain, lbmain); --- if (!classtolb.containsKey(lbmain.getMethod().getClassDesc())) --- classtolb.put(lbmain.getMethod().getClassDesc(), new HashSet()); --- classtolb.get(lbmain.getMethod().getClassDesc()).add(lbmain); --- --- if (!methodtolb.containsKey(lbmain.getMethod())) --- methodtolb.put(lbmain.getMethod(), new HashSet()); --- methodtolb.get(lbmain.getMethod()).add(lbmain); --- --- //Do this to force a virtual table number for the run method --- lbrun=new LocalityBinding(typeutil.getRun(), false); --- lbrun.setGlobalReturn(EITHER); --- lbrun.setGlobalThis(GLOBAL); --- lbtovisit.add(lbrun); --- discovered.put(lbrun, lbrun); --- if (!classtolb.containsKey(lbrun.getMethod().getClassDesc())) --- classtolb.put(lbrun.getMethod().getClassDesc(), new HashSet()); --- classtolb.get(lbrun.getMethod().getClassDesc()).add(lbrun); --- --- if (!methodtolb.containsKey(lbrun.getMethod())) --- methodtolb.put(lbrun.getMethod(), new HashSet()); --- methodtolb.get(lbrun.getMethod()).add(lbrun); --- --- while(!lbtovisit.empty()) { --- LocalityBinding lb=(LocalityBinding) lbtovisit.pop(); --- Integer returnglobal=lb.getGlobalReturn(); --- MethodDescriptor md=lb.getMethod(); --- Hashtable> temptable=new Hashtable>(); --- Hashtable atomictable=new Hashtable(); --- calldep.remove(lb); --- try { --- computeCallsFlags(md, lb, temptable, atomictable); --- } catch (Error e) { --- System.out.println("Error in "+md+" context "+lb); --- e.printStackTrace(); --- System.exit(-1); --- } --- atomictab.put(lb, atomictable); --- temptab.put(lb, temptable); --- --- if (md.getReturnType()!=null&&!returnglobal.equals(lb.getGlobalReturn())) { --- //return type is more precise now --- //rerun everything that call us --- lbtovisit.addAll(dependence.get(lb)); --- } ------- } --- } ------- ---- private void doAnalysis() { ---- computeLocalityBindings(); ---- computeTempstoSave(); - cleanSets(); --- public void computeCallsFlags(MethodDescriptor md, LocalityBinding lb, Hashtable> temptable, Hashtable atomictable) { --- FlatMethod fm=state.getMethodFlat(md); --- HashSet tovisit=new HashSet(); --- tovisit.add(fm.getNext(0)); --- { --- // Build table for initial node --- Hashtable table=new Hashtable(); --- temptable.put(fm, table); --- atomictable.put(fm, lb.isAtomic() ? 1 : 0); --- int offset=md.isStatic() ? 0 : 1; --- if (!md.isStatic()) { --- table.put(fm.getParameter(0), lb.getGlobalThis()); --- } --- for(int i=offset; i lbset=new HashSet(); - Stack lbstack=new Stack(); - lbstack.add(lbmain); - lbstack.add(lbrun); - lbset.add(lbmain); - lbset.add(lbrun); - while(!lbstack.isEmpty()) { - LocalityBinding lb=lbstack.pop(); - if (calldep.containsKey(lb)) { - Set set=new HashSet(); - set.addAll(calldep.get(lb)); - set.removeAll(lbset); - lbstack.addAll(set); - lbset.addAll(set); - } --- while(!tovisit.isEmpty()) { --- FlatNode fn=tovisit.iterator().next(); --- tovisit.remove(fn); --- Hashtable currtable=new Hashtable(); --- int atomicstate=0; --- for(int i=0; i lbit=discovered.keySet().iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - if (!lbset.contains(lb)) { - lbit.remove(); - classtolb.get(lb.getMethod().getClassDesc()).remove(lb); - methodtolb.get(lb.getMethod()).remove(lb); - } --- if (!temptable.containsKey(prevnode)) --- continue; --- Hashtable prevtable=temptable.get(prevnode); --- for(Iterator tempit=prevtable.keySet().iterator(); tempit.hasNext();) { --- TempDescriptor temp=tempit.next(); --- Integer tmpint=prevtable.get(temp); --- Integer oldint=currtable.containsKey(temp) ? currtable.get(temp) : EITHER; --- Integer newint=merge(tmpint, oldint); --- currtable.put(temp, newint); ---- } ---- } ---- ---- private void computeLocalityBindings() { - LocalityBinding lbmain=new LocalityBinding(typeutil.getMain(), false); --- lbmain=new LocalityBinding(typeutil.getMain(), false); --- lbmain.setGlobalReturn(EITHER); ---- lbmain.setGlobal(0, LOCAL); ---- lbtovisit.add(lbmain); ---- discovered.put(lbmain, lbmain); - --- if (!classtolb.containsKey(lbmain.getMethod().getClassDesc())) --- classtolb.put(lbmain.getMethod().getClassDesc(), new HashSet()); --- classtolb.get(lbmain.getMethod().getClassDesc()).add(lbmain); --- } --- atomictable.put(fn, atomicstate); --- // Process this node --- switch(fn.kind()) { --- case FKind.FlatAtomicEnterNode: --- processAtomicEnterNode((FlatAtomicEnterNode)fn, atomictable); --- if (!lb.isAtomic()) --- lb.setHasAtomic(); --- break; ------ --- if (!methodtolb.containsKey(lbmain.getMethod())) --- methodtolb.put(lbmain.getMethod(), new HashSet()); --- methodtolb.get(lbmain.getMethod()).add(lbmain); --- case FKind.FlatAtomicExitNode: --- processAtomicExitNode((FlatAtomicExitNode)fn, atomictable); --- break; ------ --- //Do this to force a virtual table number for the run method -- LocalityBinding lbrun=new LocalityBinding(typeutil.getRun(), false); - lbrun=new LocalityBinding(typeutil.getRun(), false); --- lbrun.setGlobalReturn(EITHER); --- lbrun.setGlobalThis(GLOBAL); --- lbtovisit.add(lbrun); --- discovered.put(lbrun, lbrun); --- if (!classtolb.containsKey(lbrun.getMethod().getClassDesc())) --- classtolb.put(lbrun.getMethod().getClassDesc(), new HashSet()); --- classtolb.get(lbrun.getMethod().getClassDesc()).add(lbrun); --- case FKind.FlatCall: --- processCallNode(lb, (FlatCall)fn, currtable, isAtomic(atomictable, fn)); --- break; ------ --- if (!methodtolb.containsKey(lbrun.getMethod())) --- methodtolb.put(lbrun.getMethod(), new HashSet()); --- methodtolb.get(lbrun.getMethod()).add(lbrun); --- case FKind.FlatFieldNode: --- processFieldNode(lb, (FlatFieldNode)fn, isAtomic(atomictable, fn), currtable); --- break; ------ ---- while(!lbtovisit.empty()) { ---- LocalityBinding lb=(LocalityBinding) lbtovisit.pop(); ---- Integer returnglobal=lb.getGlobalReturn(); ---- MethodDescriptor md=lb.getMethod(); ---- Hashtable> temptable=new Hashtable>(); ---- Hashtable atomictable=new Hashtable(); --- computeCallsFlags(md, lb, temptable, atomictable); - calldep.remove(lb); - try { - computeCallsFlags(md, lb, temptable, atomictable); - } catch (Error e) { - System.out.println("Error in "+md+" context "+lb); - e.printStackTrace(); - System.exit(-1); - } ---- atomictab.put(lb, atomictable); ---- temptab.put(lb, temptable); --- case FKind.FlatSetFieldNode: --- processSetFieldNode(lb, (FlatSetFieldNode)fn, isAtomic(atomictable,fn), currtable); --- break; ------- - if (!md.isStatic()&&!returnglobal.equals(lb.getGlobalReturn())) { --- if (md.getReturnType()!=null&&!returnglobal.equals(lb.getGlobalReturn())) { ---- //return type is more precise now ---- //rerun everything that call us ---- lbtovisit.addAll(dependence.get(lb)); ---- } ---- } ---- } --- case FKind.FlatNew: --- processNew(lb, (FlatNew)fn, isAtomic(atomictable, fn), currtable); --- break; - --- --- case FKind.FlatOpNode: --- processOpNode((FlatOpNode)fn, currtable); --- break; ------- ---- public void computeCallsFlags(MethodDescriptor md, LocalityBinding lb, Hashtable> temptable, Hashtable atomictable) { ---- FlatMethod fm=state.getMethodFlat(md); ---- HashSet tovisit=new HashSet(); ---- tovisit.add(fm.getNext(0)); ---- { ---- // Build table for initial node ---- Hashtable table=new Hashtable(); ---- temptable.put(fm, table); ---- atomictable.put(fm, lb.isAtomic()?1:0); ---- int offset=md.isStatic()?0:1; ---- if (!md.isStatic()) { ---- table.put(fm.getParameter(0), lb.getGlobalThis()); ---- } ---- for(int i=offset;i currtable=new Hashtable(); ---- int atomicstate=0; ---- for(int i=0;i prevtable=temptable.get(prevnode); ---- for(Iterator tempit=prevtable.keySet().iterator();tempit.hasNext();) { ---- TempDescriptor temp=tempit.next(); ---- Integer tmpint=prevtable.get(temp); ---- Integer oldint=currtable.containsKey(temp)?currtable.get(temp):EITHER; ---- Integer newint=merge(tmpint, oldint); ---- currtable.put(temp, newint); ---- } ---- } ---- atomictable.put(fn, atomicstate); ---- // Process this node ---- switch(fn.kind()) { ---- case FKind.FlatAtomicEnterNode: ---- processAtomicEnterNode((FlatAtomicEnterNode)fn, atomictable); --- if (!lb.isAtomic()) --- lb.setHasAtomic(); ---- break; ---- case FKind.FlatAtomicExitNode: ---- processAtomicExitNode((FlatAtomicExitNode)fn, atomictable); ---- break; ---- case FKind.FlatCall: ---- processCallNode(lb, (FlatCall)fn, currtable, isAtomic(atomictable, fn)); ---- break; ---- case FKind.FlatFieldNode: ---- processFieldNode(lb, (FlatFieldNode)fn, isAtomic(atomictable, fn), currtable); ---- break; ---- case FKind.FlatSetFieldNode: ---- processSetFieldNode(lb, (FlatSetFieldNode)fn, isAtomic(atomictable,fn), currtable); ---- break; ---- case FKind.FlatNew: ---- processNew(lb, (FlatNew)fn, isAtomic(atomictable, fn), currtable); ---- break; ---- case FKind.FlatOpNode: ---- processOpNode((FlatOpNode)fn, currtable); ---- break; ---- case FKind.FlatCastNode: ---- processCastNode((FlatCastNode)fn, currtable); ---- break; ---- case FKind.FlatLiteralNode: ---- processLiteralNode((FlatLiteralNode)fn, currtable); ---- break; ---- case FKind.FlatReturnNode: ---- processReturnNode(lb, (FlatReturnNode)fn, currtable); ---- break; ---- case FKind.FlatSetElementNode: ---- processSetElementNode(lb, (FlatSetElementNode)fn, currtable, isAtomic(atomictable, fn)); ---- break; ---- case FKind.FlatElementNode: ---- processElementNode(lb, (FlatElementNode)fn, currtable, isAtomic(atomictable, fn)); ---- break; ---- case FKind.FlatCondBranch: ---- case FKind.FlatBackEdge: ---- case FKind.FlatNop: --- case FKind.FlatPrefetchNode: ---- //No action needed for these ---- break; ---- case FKind.FlatFlagActionNode: ---- case FKind.FlatCheckNode: ---- case FKind.FlatTagDeclaration: ---- throw new Error("Incompatible with tasks!"); ---- case FKind.FlatMethod: ---- default: ---- throw new Error(); ---- } ---- Hashtable oldtable=temptable.get(fn); ---- if (oldtable==null||!oldtable.equals(currtable)) { ---- // Update table for this node ---- temptable.put(fn, currtable); ---- for(int i=0;i atomictable, FlatNode fn) { ---- return atomictable.get(fn).intValue()>0; ---- } --- case FKind.FlatReturnNode: --- processReturnNode(lb, (FlatReturnNode)fn, currtable); --- break; ------- ---- private static Integer merge(Integer a, Integer b) { ---- if (a==null||a.equals(EITHER)) ---- return b; ---- if (b==null||b.equals(EITHER)) ---- return a; ---- if (a.equals(b)) ---- return a; ---- return CONFLICT; ---- } --- case FKind.FlatSetElementNode: --- processSetElementNode(lb, (FlatSetElementNode)fn, currtable, isAtomic(atomictable, fn)); --- break; ------- ---- void processCallNode(LocalityBinding currlb, FlatCall fc, Hashtable currtable, boolean isatomic) { ---- MethodDescriptor nodemd=fc.getMethod(); - Set methodset=fc.getThis()==null?callgraph.getMethods(nodemd): - callgraph.getMethods(nodemd, fc.getThis().getType()); --- Set methodset=null; --- Set runmethodset=null; --- case FKind.FlatElementNode: --- processElementNode(lb, (FlatElementNode)fn, currtable, isAtomic(atomictable, fn)); --- break; ------ --- if (nodemd.isStatic()||nodemd.getReturnType()==null) { --- methodset=new HashSet(); --- methodset.add(nodemd); --- } else { --- methodset=callgraph.getMethods(nodemd, fc.getThis().getType()); --- // Build start -> run link --- if (nodemd.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&& --- nodemd.getSymbol().equals("start")&&!nodemd.getModifiers().isStatic()&& --- nodemd.numParameters()==1&&nodemd.getParamType(0).isInt()) { --- assert(nodemd.getModifiers().isNative()); --- --- MethodDescriptor runmd=null; --- for(Iterator methodit=nodemd.getClassDesc().getMethodTable().getSet("run").iterator();methodit.hasNext();) { --- MethodDescriptor md=(MethodDescriptor) methodit.next(); --- if (md.numParameters()!=0||md.getModifiers().isStatic()) --- continue; --- runmd=md; --- break; --- } --- if (runmd!=null) { --- runmethodset=callgraph.getMethods(runmd,fc.getThis().getType()); --- methodset.addAll(runmethodset); --- } else throw new Error("Can't find run method"); --- } --- case FKind.FlatCondBranch: --- case FKind.FlatBackEdge: --- case FKind.FlatNop: --- case FKind.FlatPrefetchNode: --- //No action needed for these --- break; --- --- case FKind.FlatFlagActionNode: --- case FKind.FlatCheckNode: --- case FKind.FlatTagDeclaration: --- throw new Error("Incompatible with tasks!"); --- --- case FKind.FlatMethod: --- default: --- throw new Error(); --- } --- Hashtable oldtable=temptable.get(fn); --- if (oldtable==null||!oldtable.equals(currtable)) { --- // Update table for this node --- temptable.put(fn, currtable); --- for(int i=0; i atomictable, FlatNode fn) { --- return atomictable.get(fn).intValue()>0; --- } ---- --- boolean isnative=md.getModifiers().isNative(); --- boolean isjoin = md.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&!nodemd.getModifiers().isStatic()&&nodemd.numParameters()==0&&md.getSymbol().equals("join"); --- ---- LocalityBinding lb=new LocalityBinding(md, isatomic); - for(int i=0;i currtable, boolean isatomic) { --- MethodDescriptor nodemd=fc.getMethod(); --- Set methodset=null; --- Set runmethodset=null; ------ --- if(runmethodset!=null&&runmethodset.contains(md)&&thistype.equals(LOCAL)) --- throw new Error("Starting thread on local object not allowed in context:\n"+currlb.getExplanation()); --- if(isjoin&&thistype.equals(LOCAL)) --- throw new Error("Joining thread on local object not allowed in context:\n"+currlb.getExplanation()); ---- if(thistype.equals(CONFLICT)) ---- throw new Error("Using type that can be either local or global in context:\n"+currlb.getExplanation()); - if(thistype.equals(GLOBAL)&&!isatomic) --- if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic && !isjoin) ---- throw new Error("Using global object outside of transaction in context:\n"+currlb.getExplanation()); --- if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin) --- throw new Error("Potential call to native method "+md+" on global objects:\n"+currlb.getExplanation()); ---- lb.setGlobalThis(thistype); - } else - lb.setGlobalThis(EITHER);//default value --- } ---- //lb is built ---- if (!discovered.containsKey(lb)) { - lb.setGlobalReturn(EITHER); --- if (isnative) --- lb.setGlobalReturn(LOCAL); --- else --- lb.setGlobalReturn(EITHER); ---- lb.setParent(currlb); ---- lbtovisit.add(lb); ---- discovered.put(lb, lb); --- if (!classtolb.containsKey(lb.getMethod().getClassDesc())) --- classtolb.put(lb.getMethod().getClassDesc(), new HashSet()); --- classtolb.get(lb.getMethod().getClassDesc()).add(lb); --- if (!methodtolb.containsKey(lb.getMethod())) --- methodtolb.put(lb.getMethod(), new HashSet()); --- methodtolb.get(lb.getMethod()).add(lb); ---- } else ---- lb=discovered.get(lb); ---- Integer returnval=lb.getGlobalReturn(); ---- currreturnval=merge(returnval, currreturnval); ---- if (!dependence.containsKey(lb)) ---- dependence.put(lb, new HashSet()); ---- dependence.get(lb).add(currlb); --- if (nodemd.isStatic()||nodemd.getReturnType()==null) { --- methodset=new HashSet(); --- methodset.add(nodemd); --- } else { --- methodset=callgraph.getMethods(nodemd, fc.getThis().getType()); --- // Build start -> run link --- if (nodemd.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&& --- nodemd.getSymbol().equals("start")&&!nodemd.getModifiers().isStatic()&& --- nodemd.numParameters()==1&&nodemd.getParamType(0).isInt()) { --- assert(nodemd.getModifiers().isNative()); ---- - if (!calldep.containsKey(currlb)) - calldep.put(currlb, new HashSet()); - calldep.get(currlb).add(lb); ---- } ---- if (fc.getReturnTemp()!=null) { ---- currtable.put(fc.getReturnTemp(), currreturnval); --- MethodDescriptor runmd=null; --- for(Iterator methodit=nodemd.getClassDesc().getMethodTable().getSet("run").iterator(); methodit.hasNext();) { --- MethodDescriptor md=(MethodDescriptor) methodit.next(); --- if (md.numParameters()!=0||md.getModifiers().isStatic()) --- continue; --- runmd=md; --- break; ------- } --- if (runmd!=null) { --- runmethodset=callgraph.getMethods(runmd,fc.getThis().getType()); --- methodset.addAll(runmethodset); --- } else throw new Error("Can't find run method"); --- } ------- } ------- ---- void processFieldNode(LocalityBinding lb, FlatFieldNode ffn, boolean transaction, Hashtable currtable) { ---- Integer type=currtable.get(ffn.getSrc()); ---- TempDescriptor dst=ffn.getDst(); ---- if (type.equals(LOCAL)) { ---- if (ffn.getField().isGlobal()) ---- currtable.put(dst,GLOBAL); ---- else ---- currtable.put(dst,LOCAL); ---- } else if (type.equals(GLOBAL)) { ---- if (!transaction) ---- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); - if (ffn.getField().getType().isPrimitive()) --- if (ffn.getField().getType().isPrimitive()&&!ffn.getField().getType().isArray()) ---- currtable.put(dst, LOCAL); // primitives are local ---- else ---- currtable.put(dst, GLOBAL); ---- } else if (type.equals(EITHER)) { - if (ffn.getField().getType().isPrimitive()) --- if (ffn.getField().getType().isPrimitive()&&!ffn.getField().getType().isArray()) ---- currtable.put(dst, LOCAL); // primitives are local --- else if (ffn.getField().isGlobal()) --- currtable.put(dst, GLOBAL); ---- else ---- currtable.put(dst, EITHER); ---- } else if (type.equals(CONFLICT)) { ---- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ---- } ---- } --- Integer currreturnval=EITHER; //Start off with the either value --- for(Iterator methodit=methodset.iterator(); methodit.hasNext();) { --- MethodDescriptor md=(MethodDescriptor) methodit.next(); ------- ---- //need to handle primitives ---- void processSetFieldNode(LocalityBinding lb, FlatSetFieldNode fsfn, boolean transaction, Hashtable currtable) { ---- Integer srctype=currtable.get(fsfn.getSrc()); ---- Integer dsttype=currtable.get(fsfn.getDst()); - --- boolean isnative=md.getModifiers().isNative(); --- boolean isjoin = md.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&!nodemd.getModifiers().isStatic()&&nodemd.numParameters()==0&&md.getSymbol().equals("join"); ------ ---- if (dsttype.equals(LOCAL)) { ---- if (fsfn.getField().isGlobal()) { ---- if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) ---- throw new Error("Writing possible local reference to global field in context: \n"+lb.getExplanation()); ---- } else { ---- if (!(srctype.equals(LOCAL)||srctype.equals(EITHER))) ---- throw new Error("Writing possible global reference to local object in context: \n"+lb.getExplanation()); ---- } ---- } else if (dsttype.equals(GLOBAL)) { ---- if (!transaction) ---- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); ---- //okay to store primitives in global object - if (srctype.equals(LOCAL) && fsfn.getField().getType().isPrimitive()) --- if (srctype.equals(LOCAL) && fsfn.getField().getType().isPrimitive() && ! fsfn.getField().getType().isArray()) ---- return; ---- if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) - throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()); --- throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()+" for FlatFieldNode "+fsfn); ---- } else if (dsttype.equals(EITHER)) { ---- if (srctype.equals(CONFLICT)) ---- throw new Error("Using reference that could be local or global in context:\n"+lb.getExplanation()); ---- } else if (dsttype.equals(CONFLICT)) { ---- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); --- LocalityBinding lb=new LocalityBinding(md, isatomic); --- if (isnative&&isatomic) { --- System.out.println("Don't call native methods in atomic blocks!"+currlb.getMethod()); --- } --- if (runmethodset==null||!runmethodset.contains(md)) { --- //Skip this part if it is a run method --- for(int i=0; i currtable) { ---- if (fn.isGlobal()&&!transaction) { ---- throw new Error("Allocating global object outside of transaction in context:"+lb.getExplanation()); ---- } ---- if (fn.isGlobal()) ---- currtable.put(fn.getDst(), GLOBAL); ---- else ---- currtable.put(fn.getDst(), LOCAL); ---- } --- if (fc.getThis()!=null) { --- Integer thistype=currtable.get(fc.getThis()); --- if (thistype==null) --- thistype=EITHER; ------- ---- void processOpNode(FlatOpNode fon, Hashtable currtable) { ---- /* Just propagate value */ --- Integer srcvalue=currtable.get(fon.getLeft()); --- if(runmethodset!=null&&runmethodset.contains(md)&&thistype.equals(LOCAL)) --- throw new Error("Starting thread on local object not allowed in context:\n"+currlb.getExplanation()); --- if(isjoin&&thistype.equals(LOCAL)) --- throw new Error("Joining thread on local object not allowed in context:\n"+currlb.getExplanation()); --- if(thistype.equals(CONFLICT)) --- throw new Error("Using type that can be either local or global in context:\n"+currlb.getExplanation()); --- if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic && !isjoin) --- throw new Error("Using global object outside of transaction in context:\n"+currlb.getExplanation()); --- if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin) --- throw new Error("Potential call to native method "+md+" on global objects:\n"+currlb.getExplanation()); --- lb.setGlobalThis(thistype); --- } --- //lb is built --- if (!discovered.containsKey(lb)) { --- if (isnative) --- lb.setGlobalReturn(LOCAL); --- else --- lb.setGlobalReturn(EITHER); --- lb.setParent(currlb); --- lbtovisit.add(lb); --- discovered.put(lb, lb); --- if (!classtolb.containsKey(lb.getMethod().getClassDesc())) --- classtolb.put(lb.getMethod().getClassDesc(), new HashSet()); --- classtolb.get(lb.getMethod().getClassDesc()).add(lb); --- if (!methodtolb.containsKey(lb.getMethod())) --- methodtolb.put(lb.getMethod(), new HashSet()); --- methodtolb.get(lb.getMethod()).add(lb); --- } else --- lb=discovered.get(lb); --- Integer returnval=lb.getGlobalReturn(); --- currreturnval=merge(returnval, currreturnval); --- if (!dependence.containsKey(lb)) --- dependence.put(lb, new HashSet()); --- dependence.get(lb).add(currlb); ---- --- if (srcvalue==null) { -- throw new Error(fon.getLeft()+" is undefined!"); - if (!fon.getLeft().getType().isPtr()) { - srcvalue=LOCAL; - } else - throw new Error(fon.getLeft()+" is undefined!"); --- } --- currtable.put(fon.getDest(), currtable.get(fon.getLeft())); - currtable.put(fon.getDest(), srcvalue); --- if (!calldep.containsKey(currlb)) --- calldep.put(currlb, new HashSet()); --- calldep.get(currlb).add(lb); --- } --- if (fc.getReturnTemp()!=null) { --- currtable.put(fc.getReturnTemp(), currreturnval); ------- } --- } ------- ---- void processCastNode(FlatCastNode fcn, Hashtable currtable) { ---- currtable.put(fcn.getDst(), currtable.get(fcn.getSrc())); --- void processFieldNode(LocalityBinding lb, FlatFieldNode ffn, boolean transaction, Hashtable currtable) { --- Integer type=currtable.get(ffn.getSrc()); --- TempDescriptor dst=ffn.getDst(); --- if (type.equals(LOCAL)) { --- if (ffn.getField().isGlobal()) --- currtable.put(dst,GLOBAL); --- else --- currtable.put(dst,LOCAL); --- } else if (type.equals(GLOBAL)) { --- if (!transaction) --- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); --- if (ffn.getField().getType().isPrimitive()&&!ffn.getField().getType().isArray()) --- currtable.put(dst, LOCAL); // primitives are local --- else --- currtable.put(dst, GLOBAL); --- } else if (type.equals(EITHER)) { --- if (ffn.getField().getType().isPrimitive()&&!ffn.getField().getType().isArray()) --- currtable.put(dst, LOCAL); // primitives are local --- else if (ffn.getField().isGlobal()) --- currtable.put(dst, GLOBAL); --- else --- currtable.put(dst, EITHER); --- } else if (type.equals(CONFLICT)) { --- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ------- } --- } ------- ---- void processLiteralNode(FlatLiteralNode fln, Hashtable currtable) { ---- //null is either ---- if (fln.getValue()==null) ---- currtable.put(fln.getDst(), EITHER); ---- else ---- currtable.put(fln.getDst(), LOCAL); --- //need to handle primitives --- void processSetFieldNode(LocalityBinding lb, FlatSetFieldNode fsfn, boolean transaction, Hashtable currtable) { --- Integer srctype=currtable.get(fsfn.getSrc()); --- Integer dsttype=currtable.get(fsfn.getDst()); --- --- if (dsttype.equals(LOCAL)) { --- if (fsfn.getField().isGlobal()) { --- if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) --- throw new Error("Writing possible local reference to global field in context: \n"+lb.getExplanation()); --- } else { --- if (!(srctype.equals(LOCAL)||srctype.equals(EITHER))) --- throw new Error("Writing possible global reference to local object in context: \n"+lb.getExplanation()); --- } --- } else if (dsttype.equals(GLOBAL)) { --- if (!transaction) --- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); --- //okay to store primitives in global object --- if (srctype.equals(LOCAL) && fsfn.getField().getType().isPrimitive() && !fsfn.getField().getType().isArray()) --- return; --- if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) --- throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()+" for FlatFieldNode "+fsfn); --- } else if (dsttype.equals(EITHER)) { --- if (srctype.equals(CONFLICT)) --- throw new Error("Using reference that could be local or global in context:\n"+lb.getExplanation()); --- } else if (dsttype.equals(CONFLICT)) { --- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ------- } --- } ------- ---- void processReturnNode(LocalityBinding lb, FlatReturnNode frn, Hashtable currtable) { ---- if(frn.getReturnTemp()!=null) { ---- Integer returntype=currtable.get(frn.getReturnTemp()); ---- lb.setGlobalReturn(merge(returntype, lb.getGlobalReturn())); ---- } --- void processNew(LocalityBinding lb, FlatNew fn, boolean transaction, Hashtable currtable) { --- if (fn.isGlobal()&&!transaction) { --- throw new Error("Allocating global object outside of transaction in context:"+lb.getExplanation()); ------- } --- if (fn.isGlobal()) --- currtable.put(fn.getDst(), GLOBAL); --- else --- currtable.put(fn.getDst(), LOCAL); --- } ------- ---- void processSetElementNode(LocalityBinding lb, FlatSetElementNode fsen, Hashtable currtable, boolean isatomic) { ---- Integer srctype=currtable.get(fsen.getSrc()); ---- Integer dsttype=currtable.get(fsen.getDst()); --- void processOpNode(FlatOpNode fon, Hashtable currtable) { --- /* Just propagate value */ --- Integer srcvalue=currtable.get(fon.getLeft()); ------- ---- if (dsttype.equals(LOCAL)) { ---- if (!(srctype.equals(LOCAL)||srctype.equals(EITHER))) -- throw new Error("Writing possible global reference to local object in context:\n"+lb.getExplanation()); -- throw new Error("Writing possible global reference to local object in context:\n"+lb.getExplanation()+fsen); ---- } else if (dsttype.equals(GLOBAL)) { -- if (srctype.equals(LOCAL) && fsen.getDst().getType().dereference().isPrimitive() && ! fsen.getDst().getType().dereference().isArray()) -- return; ---- if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) ---- throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()); ---- if (!isatomic) ---- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); ---- } else if (dsttype.equals(EITHER)) { ---- if (srctype.equals(CONFLICT)) ---- throw new Error("Using reference that could be local or global in context:\n"+lb.getExplanation()); ---- } else if (dsttype.equals(CONFLICT)) { ---- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ---- } --- if (srcvalue==null) { --- if (!fon.getLeft().getType().isPtr()) { --- srcvalue=LOCAL; --- } else --- throw new Error(fon.getLeft()+" is undefined!"); ------- } --- currtable.put(fon.getDest(), srcvalue); --- } ------- ---- void processElementNode(LocalityBinding lb, FlatElementNode fen, Hashtable currtable, boolean isatomic) { ---- Integer type=currtable.get(fen.getSrc()); ---- TempDescriptor dst=fen.getDst(); ---- if (type.equals(LOCAL)) { ---- currtable.put(dst,LOCAL); ---- } else if (type.equals(GLOBAL)) { ---- if (!isatomic) ---- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); -- currtable.put(dst, GLOBAL); -- if(fen.getSrc().getType().dereference().isPrimitive()&& -- !fen.getSrc().getType().dereference().isArray()) -- currtable.put(dst, LOCAL); -- else -- currtable.put(dst, GLOBAL); ---- } else if (type.equals(EITHER)) { -- currtable.put(dst, EITHER); -- if(fen.getSrc().getType().dereference().isPrimitive()&& -- !fen.getSrc().getType().dereference().isArray()) -- currtable.put(dst, LOCAL); -- else -- currtable.put(dst, EITHER); ---- } else if (type.equals(CONFLICT)) { ---- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ---- } --- void processCastNode(FlatCastNode fcn, Hashtable currtable) { --- currtable.put(fcn.getDst(), currtable.get(fcn.getSrc())); --- } --- --- void processLiteralNode(FlatLiteralNode fln, Hashtable currtable) { --- //null is either --- if (fln.getValue()==null) --- currtable.put(fln.getDst(), EITHER); --- else --- currtable.put(fln.getDst(), LOCAL); --- } --- --- void processReturnNode(LocalityBinding lb, FlatReturnNode frn, Hashtable currtable) { --- if(frn.getReturnTemp()!=null) { --- Integer returntype=currtable.get(frn.getReturnTemp()); --- lb.setGlobalReturn(merge(returntype, lb.getGlobalReturn())); ------- } --- } ------- ---- void processAtomicEnterNode(FlatAtomicEnterNode fen, Hashtable atomictable) { ---- int atomic=atomictable.get(fen).intValue(); ---- atomictable.put(fen, new Integer(atomic+1)); --- void processSetElementNode(LocalityBinding lb, FlatSetElementNode fsen, Hashtable currtable, boolean isatomic) { --- Integer srctype=currtable.get(fsen.getSrc()); --- Integer dsttype=currtable.get(fsen.getDst()); --- --- if (dsttype.equals(LOCAL)) { --- if (!(srctype.equals(LOCAL)||srctype.equals(EITHER))) --- throw new Error("Writing possible global reference to local object in context:\n"+lb.getExplanation()+fsen); --- } else if (dsttype.equals(GLOBAL)) { --- if (srctype.equals(LOCAL) && fsen.getDst().getType().dereference().isPrimitive() && !fsen.getDst().getType().dereference().isArray()) --- return; --- if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) --- throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()); --- if (!isatomic) --- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); --- } else if (dsttype.equals(EITHER)) { --- if (srctype.equals(CONFLICT)) --- throw new Error("Using reference that could be local or global in context:\n"+lb.getExplanation()); --- } else if (dsttype.equals(CONFLICT)) { --- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ------- } --- } ------- ---- void processAtomicExitNode(FlatAtomicExitNode fen, Hashtable atomictable) { ---- int atomic=atomictable.get(fen).intValue(); ---- atomictable.put(fen, new Integer(atomic-1)); --- void processElementNode(LocalityBinding lb, FlatElementNode fen, Hashtable currtable, boolean isatomic) { --- Integer type=currtable.get(fen.getSrc()); --- TempDescriptor dst=fen.getDst(); --- if (type.equals(LOCAL)) { --- currtable.put(dst,LOCAL); --- } else if (type.equals(GLOBAL)) { --- if (!isatomic) --- throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); --- if(fen.getSrc().getType().dereference().isPrimitive()&& --- !fen.getSrc().getType().dereference().isArray()) --- currtable.put(dst, LOCAL); --- else --- currtable.put(dst, GLOBAL); --- } else if (type.equals(EITHER)) { --- if(fen.getSrc().getType().dereference().isPrimitive()&& --- !fen.getSrc().getType().dereference().isArray()) --- currtable.put(dst, LOCAL); --- else --- currtable.put(dst, EITHER); --- } else if (type.equals(CONFLICT)) { --- throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); ------- } --- } ------- ---- private Hashtable> computeLiveTemps(FlatMethod fm) { ---- Hashtable> nodetotemps=new Hashtable>(); --- void processAtomicEnterNode(FlatAtomicEnterNode fen, Hashtable atomictable) { --- int atomic=atomictable.get(fen).intValue(); --- atomictable.put(fen, new Integer(atomic+1)); --- } ------- ---- Set toprocess=fm.getNodeSet(); --- void processAtomicExitNode(FlatAtomicExitNode fen, Hashtable atomictable) { --- int atomic=atomictable.get(fen).intValue(); --- atomictable.put(fen, new Integer(atomic-1)); --- } ------- ---- while(!toprocess.isEmpty()) { ---- FlatNode fn=toprocess.iterator().next(); ---- toprocess.remove(fn); --- private Hashtable> computeLiveTemps(FlatMethod fm) { --- Hashtable> nodetotemps=new Hashtable>(); ------- ---- List reads=Arrays.asList(fn.readsTemps()); - List writes=Arrays.asList(fn.readsTemps()); --- List writes=Arrays.asList(fn.writesTemps()); --- Set toprocess=fm.getNodeSet(); ------- ---- HashSet tempset=new HashSet(); ---- for(int i=0;i lbit=getLocalityBindings().iterator();lbit.hasNext();) { ---- LocalityBinding lb=lbit.next(); ---- computeTempstoSave(lb); ---- } ---- } --- List reads=Arrays.asList(fn.readsTemps()); --- List writes=Arrays.asList(fn.writesTemps()); ------- ---- /* Need to checkpoint all temps that could be read from along any ---- * path that are either: ---- 1) Written to by any assignment inside the transaction ---- 2) Read from a global temp. --- HashSet tempset=new HashSet(); --- for(int i=0; iflatatomicenternode->Set ---- */ --- private void computeTempstoSave() { --- for(Iterator lbit=getLocalityBindings().iterator(); lbit.hasNext();) { --- LocalityBinding lb=lbit.next(); --- computeTempstoSave(lb); --- } --- } ------- ---- private void computeTempstoSave(LocalityBinding lb) { ---- if (lb.isAtomic()) ---- return; ---- Hashtable atomictab=getAtomic(lb); ---- Hashtable> temptab=getNodeTempInfo(lb); ---- MethodDescriptor md=lb.getMethod(); ---- FlatMethod fm=state.getMethodFlat(md); --- /* Need to checkpoint all temps that could be read from along any --- * path that are either: --- 1) Written to by any assignment inside the transaction --- 2) Read from a global temp. - --- ---- Hashtable> nodetotemps=computeLiveTemps(fm); ---- Hashtable> nodetosavetemps=new Hashtable>(); ---- tempstosave.put(lb, nodetosavetemps); --- Generate tempstosave map from --- localitybinding->flatatomicenternode->Set --- */ - --- ---- Hashtable nodemap=new Hashtable(); - ---- HashSet toprocess=new HashSet(); ---- HashSet discovered=new HashSet(); ---- toprocess.add(fm); ---- discovered.add(fm); ---- while(!toprocess.isEmpty()) { ---- FlatNode fn=toprocess.iterator().next(); ---- toprocess.remove(fn); ---- boolean isatomic=atomictab.get(fn).intValue()>0; ---- if (isatomic&& ---- atomictab.get(fn.getPrev(0)).intValue()==0) { ---- assert(fn.getPrev(0).kind()==FKind.FlatAtomicEnterNode); ---- nodemap.put(fn, (FlatAtomicEnterNode)fn); ---- nodetosavetemps.put((FlatAtomicEnterNode)fn, new HashSet()); ---- } else if (isatomic) { ---- FlatAtomicEnterNode atomicnode=nodemap.get(fn); ---- Set livetemps=nodetotemps.get(fn); ---- List reads=Arrays.asList(fn.readsTemps()); ---- List writes=Arrays.asList(fn.readsTemps()); --- private void computeTempstoSave(LocalityBinding lb) { --- if (lb.isAtomic()) --- return; --- Hashtable atomictab=getAtomic(lb); --- Hashtable> temptab=getNodeTempInfo(lb); --- MethodDescriptor md=lb.getMethod(); --- FlatMethod fm=state.getMethodFlat(md); --- Hashtable> nodetotemps=computeLiveTemps(fm); --- Hashtable> nodetosavetemps=new Hashtable>(); --- tempstosave.put(lb, nodetosavetemps); --- Hashtable nodemap=new Hashtable(); --- HashSet toprocess=new HashSet(); --- HashSet discovered=new HashSet(); --- toprocess.add(fm); --- discovered.add(fm); --- while(!toprocess.isEmpty()) { --- FlatNode fn=toprocess.iterator().next(); --- toprocess.remove(fn); --- boolean isatomic=atomictab.get(fn).intValue()>0; --- if (isatomic&& --- atomictab.get(fn.getPrev(0)).intValue()==0) { --- assert(fn.getPrev(0).kind()==FKind.FlatAtomicEnterNode); --- nodemap.put(fn, (FlatAtomicEnterNode)fn); --- nodetosavetemps.put((FlatAtomicEnterNode)fn, new HashSet()); --- } else if (isatomic) { --- FlatAtomicEnterNode atomicnode=nodemap.get(fn); --- Set livetemps=nodetotemps.get(fn); --- List reads=Arrays.asList(fn.readsTemps()); --- List writes=Arrays.asList(fn.readsTemps()); ------- ---- for(Iterator tempit=livetemps.iterator();tempit.hasNext();) { ---- TempDescriptor tmp=tempit.next(); ---- if (writes.contains(tmp)) { - nodetosavetemps.get(fn).add(tmp); --- nodetosavetemps.get(atomicnode).add(tmp); ---- } else if (reads.contains(tmp)&&temptab.get(fn).get(tmp)==GLOBAL) { - nodetosavetemps.get(fn).add(tmp); --- nodetosavetemps.get(atomicnode).add(tmp); ---- } ---- } ---- } ---- for(int i=0;i tempit=livetemps.iterator(); tempit.hasNext();) { --- TempDescriptor tmp=tempit.next(); --- if (writes.contains(tmp)) { --- nodetosavetemps.get(atomicnode).add(tmp); --- } else if (reads.contains(tmp)&&temptab.get(fn).get(tmp)==GLOBAL) { --- nodetosavetemps.get(atomicnode).add(tmp); --- } --- } --- } --- for(int i=0; i"; --- else --- return "<"+getNode()+","+getTemp()+">"; ---- } --- public String toString() { --- if (getNode()==null) --- return ""; --- else --- return "<"+getNode()+","+getTemp()+">"; --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/Allocations.java index 0146dafc,0146dafc,0146dafc,0146dafc,d258f016,d258f016,d258f016..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/Allocations.java +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,27 -1,27 -1,27 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import Util.*; ------- -------public class Allocations extends Namer { ---- public Allocations() {} --- public Allocations() { --- } ------- ---- public String nodeLabel(GraphNode gn) { ---- return ""; ---- } ---- ---- public String nodeOption(GraphNode gn) { ---- FlagState fs=(FlagState)gn; ---- if (fs.isSourceNode()) ---- return "peripheries=2, URL=\"" + fs.getClassDescriptor().toString() + "_" + fs.getLabel() + ".html\""; ---- else ---- return ""; ---- } --- public String nodeLabel(GraphNode gn) { --- return ""; --- } ------- ---- public String edgeLabel(Edge e) { ---- return ""; ---- } --- public String nodeOption(GraphNode gn) { --- FlagState fs=(FlagState)gn; --- if (fs.isSourceNode()) --- return "peripheries=2, URL=\"" + fs.getClassDescriptor().toString() + "_" + fs.getLabel() + ".html\""; --- else --- return ""; --- } ------- ---- public String edgeOption(Edge e) { ---- return ""; ---- } --- public String edgeLabel(Edge e) { --- return ""; --- } --- --- public String edgeOption(Edge e) { --- return ""; --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/EGEdge.java index b4f7d004,12254037,12254037,12254037,0dd3984a,0dd3984a,0dd3984a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/EGEdge.java +++ /dev/null @@@@@@@@ -1,36 -1,20 -1,20 -1,20 -1,20 -1,20 -1,20 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; - import IR.*; - import Analysis.TaskStateAnalysis.*; - import IR.Tree.*; - import IR.Flat.*; -------import java.util.*; -------import Util.Edge; ---- ------- ---- public class EGEdge extends Edge{ - EGTaskNode target; - --- - - public EGEdge(EGTaskNode target){ --- FlagState fs; --- public EGEdge(FlagState fs, EGTaskNode target){ ---- super(target); - this.target = target; --- this.fs=fs; ---- } ---public class EGEdge extends Edge { --- FlagState fs; --- public EGEdge(FlagState fs, EGTaskNode target) { --- super(target); --- this.fs=fs; --- } ------- - public EGTaskNode getTarget(){ - return target; - } - - public int hashCode(){ - return target.hashCode(); - } - - public boolean equals(Object o) { - if (o instanceof EGEdge) { - EGEdge e=(EGEdge)o; - return e.target.equals(target); - } - return false; --- public FlagState getFS() { --- return fs; ---- } --- public FlagState getFS() { --- return fs; --- } ------- - --- public EGTaskNode getTarget(){ --- return (EGTaskNode) target; --- } --- public EGTaskNode getTarget() { --- return (EGTaskNode) target; --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/EGTaskNode.java index 59745582,169e52a4,169e52a4,169e52a4,7d1fe494,7d1fe494,7d1fe494..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/EGTaskNode.java +++ /dev/null @@@@@@@@ -1,169 -1,96 -1,96 -1,96 -1,96 -1,96 -1,96 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import Analysis.TaskStateAnalysis.*; -------import IR.*; -------import IR.Tree.*; -------import IR.Flat.*; -------import java.util.*; -------import Util.GraphNode; ------- - public class EGTaskNode extends TaskNode { ------public class EGTaskNode extends GraphNode { ---- private boolean source=false; - private int loopmarker=0; - private boolean multipleparams=false; - private boolean optional = false; - private boolean marked=false; - private boolean tomention=true; - private int type = 0; ---- private FlagState fs; --- private FlagState postfs; ---- private TaskDescriptor td; - protected HashSet edges = new HashSet(); - public EGTaskNode(){ - super("default"); - this.fs = null; - this.td = null; - } - - public EGTaskNode(String name){ - super(name); - this.fs = null; - this.td = null; --- private int index; --- private String name; --- private int uid; --- private static int nodeid; --- --- public EGTaskNode(String name, TaskDescriptor td, FlagState postfs){ --- this(name, null, td, -1, postfs); ---- } ---- - public EGTaskNode(String name, FlagState fs){ - super(name); --- public EGTaskNode(String name, FlagState fs, TaskDescriptor td, int index, FlagState postfs){ --- this.name=name; --- this.uid=nodeid++; ---- this.fs = fs; - this.td = null; --- this.td = td; --- this.index=index; --- this.postfs=postfs; ---- } ---- - public EGTaskNode(String name, TaskDescriptor td){ - super(name); - this.fs = null; - this.td = td; --- public String getTextLabel() { --- return "Task "+getName()+"["+fs+"]->["+postfs+"]"; ---- } ---- - public EGTaskNode(String name, FlagState fs, TaskDescriptor td){ - super(name); - this.fs = fs; - this.td = td; --- public String getName() { --- return name; ---- } - - public int hashCode(){ - return getLabel().hashCode(); --- --- public String getLabel() { --- return "N"+uid; ---- } ---- - public boolean equals(Object o){ - if(o instanceof EGTaskNode){ - EGTaskNode tn=(EGTaskNode) o; - return (tn.getLabel().compareTo(this.getLabel())==0) ? true : false; - } - return false; --- public int getIndex() { --- return index; ---- } ---- - public HashSet getEdgeSet(){ - return edges; --- public String toString() { --- return getTextLabel(); ---- } --- private boolean source=false; --- private FlagState fs; --- private FlagState postfs; --- private TaskDescriptor td; --- private int index; --- private String name; --- private int uid; --- private static int nodeid; ------- - public void addEdge(EGEdge newedge) { - newedge.setSource(this); - edges.add(newedge); - EGTaskNode tonode=newedge.getTarget(); - tonode.inedges.addElement(newedge); --- public FlagState getPostFS() { --- return postfs; --- } --- --- public boolean isRuntime() { --- return td==null&&getName().equals("Runtime"); ---- } --- public EGTaskNode(String name, TaskDescriptor td, FlagState postfs) { --- this(name, null, td, -1, postfs); --- } ------- - public Iterator edges(){ - return edges.iterator(); --- public EGTaskNode(String name, FlagState fs, TaskDescriptor td, int index, FlagState postfs) { --- this.name=name; --- this.uid=nodeid++; --- this.fs = fs; --- this.td = td; --- this.index=index; --- this.postfs=postfs; --- } ------ --- public boolean isOptional() { --- return (!isSource()&&td!=null&&td.isOptional(td.getParameter(index))); ---- } - --- public String getTextLabel() { --- return "Task "+getName()+"["+fs+"]->["+postfs+"]"; --- } ------ --- public String getName() { --- return name; --- } ------ ---- public TaskDescriptor getTD(){ ---- return td; ---- } ---- ---- public void setSource(){ ---- source = true; ---- } --- public String getLabel() { --- return "N"+uid; --- } ------- ---- public boolean isSource(){ ---- return source; ---- } --- public int getIndex() { --- return index; --- } ------- ---- public int getuid(){ ---- return uid; - } --- public String toString() { --- return getTextLabel(); --- } - --- - public void doSelfLoopMarking(){ - loopmarker=1; - } --- public FlagState getPostFS() { --- return postfs; --- } - --- - public void doLoopMarking(){ - loopmarker=2; - } - - public boolean isSelfLoop(){ - if (loopmarker==1) return true; - else return false; - } --- public boolean isRuntime() { --- return td==null&&getName().equals("Runtime"); --- } - --- - public boolean isLoop(){ - if (loopmarker==2) return true; - else return false; - } - --- - public void setMultipleParams(){ - multipleparams=true; ---- } --- public boolean isOptional() { --- return (!isSource()&&td!=null&&td.isOptional(td.getParameter(index))); --- } ------- ---- public boolean isMultipleParams(){ - return multipleparams; - } - - public void setOptional(){ - optional = true; - } - --- - public boolean isOptional(){ - return optional; - } --- public TaskDescriptor getTD() { --- return td; --- } - --- - public void mark(){ - marked = true; - } --- public void setSource() { --- source = true; --- } - --- - public void unMark(){ - marked = false; --- return getTD()!=null&&getTD().numParameters()>1; ---- } ---- - public boolean isMarked(){ - return marked; - } --- public boolean isSource() { --- return source; --- } - --- ---- public String getFSName(){ - if(fs == null) return "no flag"; - else return fs.getTextLabel(); --- if(fs == null) --- return "no flag"; --- else --- return fs.getTextLabel(); ---- } ---- ---- public FlagState getFS(){ ---- return fs; - } --- public int getuid() { --- return uid; --- } - --- - public void dontMention(){ - tomention = false; - } --- public boolean isMultipleParams() { --- return getTD()!=null&&getTD().numParameters()>1; --- } - --- - public boolean toMention(){ - return tomention; - } - - public void setAND(){ - type = 1; - } - - public void setOR(){ - type = 0; - } - - public int type(){ - return type; ---- } - --- public String getFSName() { --- if(fs == null) --- return "no flag"; --- else --- return fs.getTextLabel(); --- } - --- --- public FlagState getFS() { --- return fs; --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/ExecutionGraph.java index 493ac644,9046e2d7,9046e2d7,9046e2d7,36be0eb4,1155a6dd,1155a6dd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/ExecutionGraph.java +++ /dev/null @@@@@@@@ -1,286 -1,142 -1,142 -1,142 -1,142 -1,142 -1,142 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import java.util.*; -------import IR.State; -------import IR.SymbolTable; -------import IR.ClassDescriptor; -------import IR.TaskDescriptor; -------import java.io.File; -------import java.io.FileWriter; -------import java.io.FileOutputStream; -------import Util.Edge; ------- -------public class ExecutionGraph { - ---- private TaskAnalysis taskanalysis; ---- private State state; - private Hashtable graph; ---- private Hashtable executiongraph; - private SymbolTable tasks; - --- private HashSet marked; --- private HashSet processed; --- private TaskAnalysis taskanalysis; --- private State state; --- private Hashtable executiongraph; --- private HashSet marked; --- private HashSet processed; ------ ---- public ExecutionGraph(State state, TaskAnalysis ta){ ---- this.taskanalysis=ta; ---- this.state=state; - this.tasks = this.state. getTaskSymbolTable(); - this.graph=new Hashtable(); ---- this.executiongraph = new Hashtable(); --- this.marked=new HashSet(); --- this.processed=new HashSet(); ---- } --- public ExecutionGraph(State state, TaskAnalysis ta) { --- this.taskanalysis=ta; --- this.state=state; --- this.executiongraph = new Hashtable(); --- this.marked=new HashSet(); --- this.processed=new HashSet(); --- } ------- ---- public Hashtable getExecutionGraph(){ ---- return executiongraph; ---- } ---- ---- public void createExecutionGraph() throws java.io.IOException { - /*Explore the taskanalysis structure*/ - System.out.println("------- BUILDING THE EXECUTION GRAPH -------"); --- //Cycle through classes ---- Enumeration e=taskanalysis.flagstates.keys(); ---- ---- while (e.hasMoreElements()) { - System.out.println("\nBuilding class :"); ---- ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); - System.out.println("\t"+(cdtemp.getSymbol())+ "\n"); - exploreGraph(cdtemp); - test(); - adapt(cdtemp); --- HashSet graph=exploreGraph(cdtemp); --- adapt(cdtemp,graph); ---- } ---- printDOTFile(); - ---- } ---- - private void exploreGraph(ClassDescriptor cd) { - - LinkedList fifo = new LinkedList(); - Vector sourceNodeList = new Vector(); - Enumeration e; - graph.clear(); - - /* Search for starting nodes */ - Collection nodes = ((Hashtable)taskanalysis.flagstates.get(cd)).values(); - Iterator it = nodes.iterator(); --- private HashSet exploreGraph(ClassDescriptor cd) { --- LinkedList fifo = new LinkedList(); --- HashSet nodes=new HashSet(); --- Hashtable map=new Hashtable(); --- public Hashtable getExecutionGraph() { --- return executiongraph; --- } ------ --- // Go through nodes --- Iterator it = taskanalysis.getFlagStates(cd).iterator(); ---- while (it.hasNext()) { - FlagState fs = (FlagState)it.next(); - if(fs.isSourceNode()){ - sourceNodeList.addElement(fs); - } - } - - /* Perform the Breadth first search algorithm and build ExecutionGraph */ - FlagState fstemp, fstemp2; - Iterator sourceit = sourceNodeList.iterator(); - while( sourceit.hasNext() ){ - FlagState fs = (FlagState)sourceit.next(); - - fs.doMarking(); - fifo.addLast(fs); - - while ( !fifo.isEmpty() ){ - - fstemp = (FlagState)fifo.getFirst(); - fifo.removeFirst(); - - System.out.println("IN FS : "+fstemp.getTextLabel()); - - Iterator edges = fstemp.edges(); - if (edges.hasNext()){ - - //build corresponding nodes of the ExecutionGraph - createNode(fstemp); - - //add the other non marked (prevent looping) fses to the fifo - while(edges.hasNext()){ - --- FlagState fs = it.next(); --- if(fs.isSourceNode()) { --- for (Iterator allocit = ((Vector)fs.getAllocatingTasks()).iterator(); allocit.hasNext();) { --- TaskDescriptor alloctask=(TaskDescriptor)allocit.next(); --- EGTaskNode srcnode=new EGTaskNode(alloctask.getSymbol(),alloctask, fs); --- nodes.add(srcnode); --- srcnode.setSource(); --- for (Iterator edges = fs.edges(); edges.hasNext();){ ---- FEdge edge = (FEdge)edges.next(); - fstemp2 = (FlagState)edge.getTarget(); - - if ( !fstemp2.isMarked() ) { - fstemp2.doMarking(); - fifo.addLast(fstemp2); - } - } - - //if the flagstate is not entirely processed, back into fifo - if (!isFinished(fstemp)){ - fifo.addLast(fstemp); - } - } - - } - } - } - - private void createNode(FlagState fs){ - Enumeration allocatingtasks; - EGTaskNode tn; - EGTaskNode target; - FEdge edge; - //the idea is to look at the inedges to find the "parents" nodes. Then create the "children" and link them to the "parents". - if (fs.isSourceNode()){ - //in the case of sourcenode, "parents" are the allocating tasks - for (Iterator inedges = ((Vector)fs.getAllocatingTasks()).iterator(); inedges.hasNext();){ - String tname = new String(((TaskDescriptor)inedges.next()).getSymbol()); - //the hashkey for source EGTaskNodes is : nextfs+taskname. - String key1 = new String(fs.getTextLabel()+tname); - //get the parent - if (graph.containsKey(key1)){ - tn = (EGTaskNode)graph.get(key1); - } - else{//if not existing, create it - tn = new EGTaskNode(tname,(TaskDescriptor)tasks.get(tname)); - tn.setSource(); - } - //create the children. the key is : nextfs+taskname+previousfs (that ensures that only one node can have that key). - for (Iterator edges = fs.edges(); edges.hasNext();){ - edge = (FEdge)edges.next(); - target=new EGTaskNode(edge.getLabel(), fs, (TaskDescriptor)tasks.get(edge.getLabel())); - String key2 = new String(((FlagState)edge.getTarget()).getTextLabel()+target.getName()+((FlagState)edge.getSource()).getTextLabel()); - //mark if is self loop - if (((FlagState)edge.getTarget()).isMarked()){ - target.doSelfLoopMarking(); - } - //check if child already exists. if not, create it. - //link to the parent. - if (graph.containsKey(key2)){ - target = (EGTaskNode)graph.get(key2); - EGEdge newedge=new EGEdge(target); - tn.addEdge(newedge); - } - else { - EGEdge newedge=new EGEdge(target); - tn.addEdge(newedge); --- EGTaskNode targetnode=getNode(edge, map, nodes); --- EGEdge newedge=new EGEdge(fs, targetnode); --- srcnode.addEdge(newedge); ---- } - //put child in graph - graph.put(key2, target); ---- } - //put parent in graph - graph.put(key1, tn); ---- } - } - - for (Iterator inedges = fs.inedges(); inedges.hasNext();){ - //regular case, "parents" are the inedges. - FEdge in=(FEdge)inedges.next(); - if (!in.isProcessed()){ - //the key to search is : nextfs+taskname+previousfs. - String key1 = new String(fs.getTextLabel()+in.getLabel()+((FlagState)in.getSource()).getTextLabel()); - tn = (EGTaskNode)graph.get(key1); - //if the TaskNode does not exist, that means that we are in the case of a loop. - //The fs will not be entirely processed, will be put back in the fifo until the TaskNode has finaly been created. - if (tn != null){ - //same process than with the sourcenode. - for (Iterator edges = fs.edges(); edges.hasNext();){ - edge = (FEdge)edges.next(); - target=new EGTaskNode(edge.getLabel(), fs, (TaskDescriptor)tasks.get(edge.getLabel())); - String key2 = new String(((FlagState)edge.getTarget()).getTextLabel()+target.getName()+((FlagState)edge.getSource()).getTextLabel()); - if (((String)((FlagState)edge.getTarget()).getTextLabel()).compareTo(fs.getTextLabel())==0){ - target.doSelfLoopMarking(); - } - if (graph.containsKey(key2)){ - target = (EGTaskNode)graph.get(key2); - EGEdge newedge=new EGEdge(target); - tn.addEdge(newedge); - } - else { - EGEdge newedge=new EGEdge(target); - tn.addEdge(newedge); - } - graph.put(key2, target); - } - graph.put(key1, tn); - in.setProcessed(); --- for(Iterator init=fs.inedges();init.hasNext();) { --- FEdge inedge=(FEdge)init.next(); --- EGTaskNode srcnode=getNode(inedge, map, nodes); --- for(Iterator outit=fs.edges();outit.hasNext();) { --- FEdge outedge=(FEdge)outit.next(); --- EGTaskNode dstnode=getNode(outedge, map, nodes); --- EGEdge newedge=new EGEdge(fs,dstnode); --- srcnode.addEdge(newedge); ---- } ---- } - } - } --- public void createExecutionGraph() throws java.io.IOException { --- //Cycle through classes --- Enumeration e=taskanalysis.flagstates.keys(); ------ --- } --- return nodes; --- } ---- --- private EGTaskNode getNode(FEdge fedge, Hashtable map, HashSet nodes) { --- if (map.containsKey(fedge)) --- return map.get(fedge); --- EGTaskNode egnode=new EGTaskNode(fedge.getLabel(), (FlagState) fedge.getSource(), fedge.getTask(), fedge.getIndex(), (FlagState) fedge.getTarget()); --- map.put(fedge, egnode); --- nodes.add(egnode); --- return egnode; --- while (e.hasMoreElements()) { --- ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); --- HashSet graph=exploreGraph(cdtemp); --- adapt(cdtemp,graph); ------ } --- printDOTFile(); --- } ------ ---- //put the graph into executiongraph - private void adapt(ClassDescriptor cd) { - Vector tasknodes = new Vector(); - tasknodes.addAll(graph.values()); --- private void adapt(ClassDescriptor cd, HashSet nodes) { --- HashSet tasknodes = new HashSet(); --- tasknodes.addAll(nodes); ---- executiongraph.put(cd,tasknodes); ---- } --- private HashSet exploreGraph(ClassDescriptor cd) { --- LinkedList fifo = new LinkedList(); --- HashSet nodes=new HashSet(); --- Hashtable map=new Hashtable(); ------ ---- //print the contain of graph - private void test() { --- private void test(Hashtable graph) { ---- System.out.println("\nGraph contains :"); ---- Collection c = graph.values(); ---- for ( Iterator it = c.iterator(); it.hasNext();){ ---- EGTaskNode tn = (EGTaskNode)it.next(); ---- System.out.println(tn.getTextLabel()+" ID "+tn.getLabel()+" FS "+tn.getFSName()); --- // Go through nodes --- Iterator it = taskanalysis.getFlagStates(cd).iterator(); --- while (it.hasNext()) { --- FlagState fs = it.next(); --- if(fs.isSourceNode()) { --- for (Iterator allocit = ((Vector)fs.getAllocatingTasks()).iterator(); allocit.hasNext();) { --- TaskDescriptor alloctask=(TaskDescriptor)allocit.next(); --- EGTaskNode srcnode=new EGTaskNode(alloctask.getSymbol(),alloctask, fs); --- nodes.add(srcnode); --- srcnode.setSource(); - for (Iterator edges = fs.edges(); edges.hasNext();){ -- for (Iterator edges = fs.edges(); edges.hasNext();) { --- FEdge edge = (FEdge)edges.next(); --- EGTaskNode targetnode=getNode(edge, map, nodes); --- EGEdge newedge=new EGEdge(fs, targetnode); --- srcnode.addEdge(newedge); --- } - --- } - } - - //test if a flagstate has been entirely processed - private boolean isFinished(FlagState fs){ - - for (Iterator inedges = fs.inedges(); inedges.hasNext();){ - - FEdge in=(FEdge)inedges.next(); - - if (!in.isProcessed()){ - String key1 = new String(fs.getTextLabel()+in.getLabel()+((FlagState)in.getSource()).getTextLabel()); - - if (graph.get(key1)==null){ - //except for the case of self loop, if the pointed tn is not present, fs is not totally processed - if (((String)((FlagState)in.getSource()).getTextLabel()).compareTo(fs.getTextLabel())!=0){ - return false; - } - } - - } --- } --- for(Iterator init=fs.inedges(); init.hasNext();) { --- FEdge inedge=(FEdge)init.next(); --- EGTaskNode srcnode=getNode(inedge, map, nodes); --- for(Iterator outit=fs.edges(); outit.hasNext();) { --- FEdge outedge=(FEdge)outit.next(); --- EGTaskNode dstnode=getNode(outedge, map, nodes); --- EGEdge newedge=new EGEdge(fs,dstnode); --- srcnode.addEdge(newedge); ------- } - return true; ---- } --- } - --- ---- - //********DEBUG ---- //create dot files execution_classname_.dot ---- private void printDOTFile()throws java.io.IOException { ---- Enumeration e = executiongraph.keys(); ---- while (e.hasMoreElements()){ ---- createDOTFile((ClassDescriptor)e.nextElement()); ---- } ---- } ---- ---- private void createDOTFile(ClassDescriptor cd) throws java.io.IOException { - Vector v = (Vector)executiongraph.get(cd); --- Set s = (Set)executiongraph.get(cd); ---- java.io.PrintWriter output; ---- File dotfile_flagstates= new File("execution"+cd.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,true); --- FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); ---- output = new java.io.PrintWriter(dotstream, true); ---- output.println("digraph dotvisitor {"); ---- output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];"); ---- output.println("\tedge [fontsize=6];"); - traverse(output, v); --- traverse(output, s); ---- output.println("}\n"); ---- } ---- - private void traverse(java.io.PrintWriter output, Vector v) { --- private void traverse(java.io.PrintWriter output, Set v) { ---- EGTaskNode tn; ---- ---- for(Iterator it1 = v.iterator(); it1.hasNext();){ ---- tn = (EGTaskNode)it1.next(); ---- output.println("\t"+tn.getLabel()+" [label=\""+tn.getTextLabel()+"\""); - if (tn.isSelfLoop()) output.println(", shape=box"); ---- if (tn.isMultipleParams()) output.println(", color=blue"); ---- output.println("];"); - ---- ---- for(Iterator it2 = tn.edges();it2.hasNext();){ ---- output.println("\t"+tn.getLabel()+" -> "+((EGTaskNode)((EGEdge)it2.next()).getTarget()).getLabel()+";"); ---- } ---- } ------- } - //********************* - ---- } - - - - - --- return nodes; --- } - --- --- private EGTaskNode getNode(FEdge fedge, Hashtable map, HashSet nodes) { --- if (map.containsKey(fedge)) --- return map.get(fedge); --- EGTaskNode egnode=new EGTaskNode(fedge.getLabel(), (FlagState) fedge.getSource(), fedge.getTask(), fedge.getIndex(), (FlagState) fedge.getTarget()); --- map.put(fedge, egnode); --- nodes.add(egnode); --- return egnode; --- } - --- --- //put the graph into executiongraph --- private void adapt(ClassDescriptor cd, HashSet nodes) { --- HashSet tasknodes = new HashSet(); --- tasknodes.addAll(nodes); --- executiongraph.put(cd,tasknodes); --- } - --- --- //print the contain of graph --- private void test(Hashtable graph) { --- System.out.println("\nGraph contains :"); --- Collection c = graph.values(); - for ( Iterator it = c.iterator(); it.hasNext();){ -- for ( Iterator it = c.iterator(); it.hasNext();) { --- EGTaskNode tn = (EGTaskNode)it.next(); --- System.out.println(tn.getTextLabel()+" ID "+tn.getLabel()+" FS "+tn.getFSName()); --- } --- } - --- --- //create dot files execution_classname_.dot --- private void printDOTFile() throws java.io.IOException { --- Enumeration e = executiongraph.keys(); - while (e.hasMoreElements()){ -- while (e.hasMoreElements()) { --- createDOTFile((ClassDescriptor)e.nextElement()); --- } --- } - --- --- private void createDOTFile(ClassDescriptor cd) throws java.io.IOException { --- Set s = (Set)executiongraph.get(cd); --- java.io.PrintWriter output; --- File dotfile_flagstates= new File("execution"+cd.getSymbol()+".dot"); --- FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); --- output = new java.io.PrintWriter(dotstream, true); --- output.println("digraph dotvisitor {"); --- output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];"); --- output.println("\tedge [fontsize=6];"); --- traverse(output, s); --- output.println("}\n"); --- } - --- --- private void traverse(java.io.PrintWriter output, Set v) { --- EGTaskNode tn; - --- - for(Iterator it1 = v.iterator(); it1.hasNext();){ -- for(Iterator it1 = v.iterator(); it1.hasNext();) { --- tn = (EGTaskNode)it1.next(); --- output.println("\t"+tn.getLabel()+" [label=\""+tn.getTextLabel()+"\""); --- if (tn.isMultipleParams()) output.println(", color=blue"); --- output.println("];"); - --- - for(Iterator it2 = tn.edges(); it2.hasNext();){ -- for(Iterator it2 = tn.edges(); it2.hasNext();) { --- output.println("\t"+tn.getLabel()+" -> "+((EGTaskNode)((EGEdge)it2.next()).getTarget()).getLabel()+";"); --- } --- } --- } ---} diff --cc Robust/src/Analysis/TaskStateAnalysis/FEdge.java index 27599174,9ff73ecf,8cc8cde5,d91f921a,4b589b54,4b589b54,c81d8546..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/FEdge.java +++ /dev/null @@@@@@@@ -1,40 -1,142 -1,195 -1,197 -1,197 -1,197 -1,218 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import IR.*; ------ import Analysis.TaskStateAnalysis.*; ------ import IR.Tree.*; ------ import IR.Flat.*; -------import java.util.*; -------import Util.Edge; ------- -------/* Edge *****************/ ------- -------public class FEdge extends Edge { ------- ---- private String label; --- private TaskDescriptor td; --- private int parameterindex; --- --- // jzhou --- private int executeTime; --- private Hashtable newObjInfos; -- private int probability; -- private int invokeNum; -- private int expInvokeNum; --- --- public class NewObjInfo { --- int newRate; --- int probability; -- FlagState root; -- int invokeNum; --- --- public NewObjInfo() { --- newRate = 0; --- probability = 0; -- root = null; -- invokeNum = 0; --- } --- --- public NewObjInfo(int newRate, int probability) { --- this.newRate = newRate; --- this.probability = probability; --- } --- --- public int getNewRate() { --- return this.newRate; --- } --- --- public void setNewRate(int newRate) { --- this.newRate = newRate; --- } --- --- public int getProbability() { --- return this.probability; --- } --- --- public void setProbability(int probability) { --- this.probability = probability; --- } --- - public boolean equals(Object o) { -- public FlagState getRoot() { -- return root; -- } --- private String label; --- private TaskDescriptor td; --- private int parameterindex; ----- -- public void setRoot(FlagState root) { -- this.root = root; -- } --- // jzhou --- private int executeTime; --- private Hashtable newObjInfos; -- private int probability; - private double probability; --- private int invokeNum; --- private int expInvokeNum; - private boolean m_isbackedge; - private int m_taskexitindex; ----- -- public int getInvokeNum() { -- return invokeNum; -- } --- public class NewObjInfo { --- int newRate; -- int probability; - double probability; --- FlagState root; --- int invokeNum; ----- -- public void incInvokeNum() { -- this.invokeNum++; -- } --- public NewObjInfo() { --- newRate = 0; --- probability = 0; --- root = null; --- invokeNum = 0; --- } ----- -- public boolean equals(Object o) { --- if (o instanceof NewObjInfo) { --- NewObjInfo e=(NewObjInfo)o; --- if (e.newRate == this.newRate && - e.probability == this.probability) { -- e.probability == this.probability && -- e.invokeNum == this.invokeNum && -- e.root.equals(this.root)) { --- return true; --- } --- } --- return false; --- } -- public NewObjInfo(int newRate, int probability) { - public NewObjInfo(int newRate, double probability) { --- this.newRate = newRate; --- this.probability = probability; ------ } --- ---- /** Class Constructor ---- * ---- */ - public FEdge(FlagState target, String label) { --- public FEdge(FlagState target, String label, TaskDescriptor td, int parameterindex) { ---- super(target); ---- this.label = label; --- this.td=td; --- this.parameterindex=parameterindex; --- this.executeTime = -1; --- this.newObjInfos = null; -- this.probability = -1; -- this.invokeNum = 0; -- this.expInvokeNum = 0; --- --- public int getNewRate() { --- return this.newRate; ------- } -- --- --- public void setNewRate(int newRate) { --- this.newRate = newRate; --- } ----- ---- public int getProbability() { -- return probability; - public double getProbability() { --- return this.probability; ----- } ----- ---- public void setProbability(int probability) { -- this.probability = probability; - public void setProbability(double probability) { --- this.probability = probability; ----- } ----- ---- public String getLabel() { ---- return label; --- public FlagState getRoot() { --- return root; ------- } ---- ---- public int hashCode(){ - return target.hashCode()^label.hashCode(); -- int hashcode = label.hashCode()^target.hashCode()^source.hashCode()^td.hashCode()^parameterindex^executeTime; - int hashcode = label.hashCode()^target.hashCode()^source.hashCode()^parameterindex^executeTime; - if (td!=null) - hashcode^=td.hashCode(); --- if(newObjInfos != null) { --- hashcode ^= newObjInfos.hashCode(); --- } --- return hashcode; --- --- public void setRoot(FlagState root) { --- this.root = root; ------ } ------ --- public TaskDescriptor getTask() { --- return td; --- public int getInvokeNum() { --- return invokeNum; ------ } ------ --- public int getIndex() { --- return parameterindex; --- public void incInvokeNum() { --- this.invokeNum++; ------- } ---- --- ------- public boolean equals(Object o) { ---- if (o instanceof FEdge) { ---- FEdge e=(FEdge)o; - return e.label.equals(label)&& - e.target.equals(target); --- if (e.label.equals(label)&& --- e.target.equals(target)&& --- e.source.equals(source) && --- e.td==td&& --- e.parameterindex==parameterindex && --- e.executeTime == executeTime) { --- if(this.newObjInfos != null) { --- if(e.newObjInfos == null) { --- return false; --- } else { --- return e.newObjInfos.equals(this.newObjInfos); --- } --- } --- return true; --- } ---- } ---- return false; --- if (o instanceof NewObjInfo) { --- NewObjInfo e=(NewObjInfo)o; --- if (e.newRate == this.newRate && --- e.probability == this.probability && --- e.invokeNum == this.invokeNum && --- e.root.equals(this.root)) { --- return true; --- } --- } --- return false; ------- } --- } - --- --- --- public int getExeTime() { --- return this.executeTime; --- } --- --- public void setExeTime(int eTime) { --- this.executeTime = eTime; --- } --- --- public Hashtable getNewObjInfoHashtable() { --- return this.newObjInfos; --- } --- --- public NewObjInfo getNewObjInfo(ClassDescriptor cd) { --- if(this.newObjInfos == null) { --- return null; --- } --- return this.newObjInfos.get(cd); --- } ---- --- public void addNewObjInfo(ClassDescriptor cd, int newRate, int probability) { --- if(this.newObjInfos == null) { --- this.newObjInfos = new Hashtable(); --- } --- this.newObjInfos.put(cd, new NewObjInfo(newRate, probability)); -- } -- -- public void process() { -- this.invokeNum++; --- /** Class Constructor --- * --- */ --- public FEdge(FlagState target, String label, TaskDescriptor td, int parameterindex) { --- super(target); --- this.label = label; --- this.td=td; --- this.parameterindex=parameterindex; --- this.executeTime = -1; --- this.newObjInfos = null; --- this.probability = -1; --- this.invokeNum = 0; --- this.expInvokeNum = 0; - this.m_isbackedge = false; - this.m_taskexitindex = 0; --- } --- -- public int getProbability() { -- return probability; - public int getTaskExitIndex() { - return m_taskexitindex; --- } --- -- public void setProbability(int probability) { - public void setTaskExitIndex(int taskexitindex) { - this.m_taskexitindex = taskexitindex; - } - - public double getProbability() { - return this.probability; - } - - public void setProbability(double probability) { --- this.probability = probability; - } - - public boolean isbackedge() { - return m_isbackedge; - } - - public void setisbackedge(boolean isbackedge) { - this.m_isbackedge = isbackedge; --- } --- --- public String getLabel() { --- return label; --- } --- --- public int hashCode() { --- int hashcode = label.hashCode()^target.hashCode()^source.hashCode()^parameterindex^executeTime; --- if (td!=null) --- hashcode^=td.hashCode(); --- if(newObjInfos != null) { --- hashcode ^= newObjInfos.hashCode(); ----- } --- return hashcode; --- } ----- -- public int getInvokeNum() { -- return invokeNum; --- public TaskDescriptor getTask() { --- return td; --- } --- --- public int getIndex() { --- return parameterindex; --- } --- --- public boolean equals(Object o) { --- if (o instanceof FEdge) { --- FEdge e=(FEdge)o; --- if (e.label.equals(label)&& --- e.target.equals(target)&& --- e.source.equals(source) && --- e.td==td&& --- e.parameterindex==parameterindex && --- e.executeTime == executeTime) { --- if(this.newObjInfos != null) { --- if(e.newObjInfos == null) { --- return false; --- } else { --- return e.newObjInfos.equals(this.newObjInfos); --- } --- } --- return true; --- } ----- } --- return false; --- } ----- -- public int getInvokeNumGap() { -- return expInvokeNum - invokeNum; --- public int getExeTime() { --- return this.executeTime; --- } --- --- public void setExeTime(int eTime) { --- this.executeTime = eTime; --- } --- --- public Hashtable getNewObjInfoHashtable() { --- return this.newObjInfos; --- } --- --- public NewObjInfo getNewObjInfo(ClassDescriptor cd) { --- if(this.newObjInfos == null) { --- return null; ----- } --- return this.newObjInfos.get(cd); --- } ----- -- public void setExpInvokeNum(int expInvokeNum) { -- this.expInvokeNum = expInvokeNum; -- public void addNewObjInfo(ClassDescriptor cd, int newRate, int probability) { - public void addNewObjInfo(ClassDescriptor cd, int newRate, double probability) { --- if(this.newObjInfos == null) { --- this.newObjInfos = new Hashtable(); ------ } -- --- this.newObjInfos.put(cd, new NewObjInfo(newRate, probability)); --- } --- --- public void process() { --- this.invokeNum++; --- } --- --- public int getInvokeNum() { --- return invokeNum; --- } --- --- public int getInvokeNumGap() { -- return expInvokeNum - invokeNum; - return this.expInvokeNum - this.invokeNum; - } - - public int getInvokeNumGapByObj(int byObj) { - return this.expInvokeNum - (this.invokeNum/byObj); --- } --- --- public void setExpInvokeNum(int expInvokeNum) { --- this.expInvokeNum = expInvokeNum; --- } --- -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/FlagState.java index 4f7078ef,730bb740,06e4fdf5,4572dd50,9c975eb8,1ce4eaaf,58bd822f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java +++ /dev/null @@@@@@@@ -1,287 -1,355 -1,388 -1,472 -1,476 -1,475 -1,511 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; - import Analysis.Scheduling.ClassNode; ----- ----import Analysis.Scheduling.ScheduleEdge; -------import Analysis.TaskStateAnalysis.*; -------import IR.*; -------import IR.Tree.*; -------import IR.Flat.*; -------import java.util.*; -------import java.io.*; -------import Util.GraphNode; ------- ---- /** This class is used to hold the flag states that a class in the Bristlecone ---/** This class is used to hold the flag states that a class in the Bristlecone ------- * program can exist in, during runtime. ------- */ - public class FlagState extends GraphNode { ------public class FlagState extends GraphNode implements Cloneable { ---- public static final int ONETAG=1; ---- public static final int NOTAGS=0; ---- public static final int MULTITAGS=-1; - public static final int MAXTIME=10; ---- ---- private int uid; ---- private static int nodeid=0; --- public static final int ONETAG=1; --- public static final int NOTAGS=0; --- public static final int MULTITAGS=-1; --- public static final int MAXTIME=10; ------- ---- private final HashSet flagstate; ---- private final ClassDescriptor cd; ---- private final Hashtable tags; ---- private boolean issourcenode; ---- private Vector tasks; --- private int uid; --- private static int nodeid=0; - --- - private boolean marked=false; --- public static final int KLIMIT=2; ---- --- // jzhou - // for static scheduling --- private int executeTime; - private int visited4time; -- private int invokeNum; - // for building multicore codes - private int andmask; - private int checkmask; - private boolean setmask; - private int iuid; - //private boolean isolate; - //private Vector allys; --- private final HashSet flagstate; --- private final ClassDescriptor cd; --- private final Hashtable tags; --- private boolean issourcenode; --- private Vector tasks; --- public static final int KLIMIT=2; ------- ---- /** Class constructor ---- * Creates a new flagstate with all flags set to false. ---- * @param cd ClassDescriptor ---- */ ---- public FlagState(ClassDescriptor cd) { ---- this.flagstate=new HashSet(); ---- this.cd=cd; ---- this.tags=new Hashtable(); ---- this.uid=FlagState.nodeid++; ---- this.issourcenode=false; --- this.executeTime = -1; - this.visited4time = -1; -- this.invokeNum = 0; - this.andmask = 0; - this.checkmask = 0; - this.setmask = false; - this.iuid = 0; - //this.isolate = true; - //this.allys = null; ---- } --- // jzhou --- // for static scheduling --- private int executeTime; --- private int visited4time; --- private int invokeNum; - private int byObj; --- // for building multicore codes --- private int andmask; --- private int checkmask; --- private boolean setmask; --- private int iuid; --- //private boolean isolate; --- //private Vector allys; ------- ---- /** Class constructor ---- * Creates a new flagstate with flags set according to the HashSet. ---- * If the flag exists in the hashset, it's set to true else set to false. ---- * @param cd ClassDescriptor ---- * @param flagstate a HashSet containing FlagDescriptors ---- */ ---- private FlagState(HashSet flagstate, ClassDescriptor cd,Hashtable tags) { ---- this.flagstate=flagstate; ---- this.cd=cd; ---- this.tags=tags; ---- this.uid=FlagState.nodeid++; ---- this.issourcenode=false; - --- this.executeTime = -1; - this.visited4time = -1; -- this.invokeNum = 0; ---- } ---- ---- public int getuid() { ---- return uid; - - } --- /** Class constructor --- * Creates a new flagstate with all flags set to false. --- * @param cd ClassDescriptor --- */ --- public FlagState(ClassDescriptor cd) { --- this.flagstate=new HashSet(); --- this.cd=cd; --- this.tags=new Hashtable(); --- this.uid=FlagState.nodeid++; --- this.issourcenode=false; --- this.executeTime = -1; --- this.visited4time = -1; --- this.invokeNum = 0; - this.byObj = 0; --- this.andmask = 0; --- this.checkmask = 0; --- this.setmask = false; --- this.iuid = 0; --- //this.isolate = true; --- //this.allys = null; --- } - --- - public boolean isMarked() { - return marked; - - public int getiuid() { - return iuid++; - - } --- /** Class constructor --- * Creates a new flagstate with flags set according to the HashSet. --- * If the flag exists in the hashset, it's set to true else set to false. --- * @param cd ClassDescriptor --- * @param flagstate a HashSet containing FlagDescriptors --- */ --- private FlagState(HashSet flagstate, ClassDescriptor cd,Hashtable tags) { --- this.flagstate=flagstate; --- this.cd=cd; --- this.tags=tags; --- this.uid=FlagState.nodeid++; --- this.issourcenode=false; --- this.executeTime = -1; --- this.visited4time = -1; --- this.invokeNum = 0; --- } - ---- - public void doUnmarking() { - marked = false; - public boolean isSetmask() { - return setmask; ---- } --- public int getuid() { --- return uid; --- } ------- - public void doMarking() { - marked = true; - public void setSetmask(boolean setmask) { - this.setmask = setmask; - - } - --- public int getiuid() { --- return iuid++; --- } ---- ---- /** Accessor method ---- * @param fd FlagDescriptor ---- * @return true if the flagstate contains fd else false. ---- */ ---- public boolean get(FlagDescriptor fd) { ---- return flagstate.contains(fd); ---- } ---- ---- /** Checks if the flagstate is a source node. ---- * @return true if the flagstate is a sourcenode(i.e. Is the product of an allocation site). ---- */ ---- ---- public boolean isSourceNode(){ - return issourcenode; - } - - /** Sets the flagstate as a source node. --- return issourcenode; --- } --- --- /** Sets the flagstate as a source node. ---- */ - public void setAsSourceNode(){ - if(!issourcenode){ - issourcenode=true; - this.tasks=new Vector(); - } - } - - public void addAllocatingTask(TaskDescriptor task){ - tasks.add(task); - } --- public boolean isSetmask() { --- return setmask; --- } - --- - public Vector getAllocatingTasks(){ - return tasks; - } - --- public void setAsSourceNode(){ --- if(!issourcenode){ --- issourcenode=true; --- this.tasks=new Vector(); --- } --- } --- --- public void addAllocatingTask(TaskDescriptor task){ --- tasks.add(task); --- } --- --- public Vector getAllocatingTasks(){ --- return tasks; --- } --- ---- ---- public String toString() { ---- return cd.toString()+getTextLabel(); ---- } --- public void setSetmask(boolean setmask) { --- this.setmask = setmask; --- } ------- ---- /** @return Iterator over the flags in the flagstate. ---- */ ---- ---- public Iterator getFlags() { ---- return flagstate.iterator(); --- /** Accessor method --- * @param fd FlagDescriptor --- * @return true if the flagstate contains fd else false. --- */ --- public boolean get(FlagDescriptor fd) { --- return flagstate.contains(fd); --- } --- --- /** Checks if the flagstate is a source node. --- * @return true if the flagstate is a sourcenode(i.e. Is the product of an allocation site). --- */ --- --- public boolean isSourceNode() { --- return issourcenode; --- } --- --- /** Sets the flagstate as a source node. --- */ --- public void setAsSourceNode() { - if(!issourcenode){ -- if(!issourcenode) { --- issourcenode=true; --- this.tasks=new Vector(); ------- } --- } ------- ---- public int numFlags(){ ---- return flagstate.size(); --- public void addAllocatingTask(TaskDescriptor task) { --- tasks.add(task); --- } --- --- public Vector getAllocatingTasks() { --- return tasks; --- } --- --- --- public String toString() { --- return cd.toString()+getTextLabel(); --- } --- --- /** @return Iterator over the flags in the flagstate. --- */ --- --- public Iterator getFlags() { --- return flagstate.iterator(); --- } --- --- public int numFlags() { --- return flagstate.size(); --- } --- --- public FlagState[] setTag(TagDescriptor tag, boolean set) { --- HashSet newset1=(HashSet)flagstate.clone(); --- Hashtable newtags1=(Hashtable)tags.clone(); --- --- if (set) { --- int count=0; --- if (tags.containsKey(tag)) --- count=tags.get(tag).intValue(); --- if (count newtags1=(Hashtable)tags.clone(); --- --- if (set) { --- int count=0; --- if (tags.containsKey(tag)) --- count=tags.get(tag).intValue(); --- if (count newtags1=(Hashtable)tags.clone(); --- - if (tags.containsKey(tag)){ -- if (tags.containsKey(tag)) { --- //Code could try to remove flag that doesn't exist --- - switch (tags.get(tag).intValue()){ -- switch (tags.get(tag).intValue()) { --- case ONETAG: --- newtags1.put(tag,new Integer(MULTITAGS)); --- return new FlagState[] {this, new FlagState(newset1, cd, newtags1)}; --- --- case MULTITAGS: --- return new FlagState[] {this}; --- --- default: --- throw new Error(); --- } --- } else { --- newtags1.put(tag,new Integer(ONETAG)); --- return new FlagState[] {new FlagState(newset1,cd,newtags1)}; ------ } --- } ------ ---- public FlagState[] setTag(TagDescriptor tag){ --- public int getTagCount(TagDescriptor tag) { --- if (tags.containsKey(tag)) --- return tags.get(tag).intValue(); --- else return 0; --- } --- --- public int getTagCount(String tagtype) { --- return getTagCount(new TagDescriptor(tagtype)); --- } --- --- public FlagState[] clearTag(TagDescriptor tag) { - if (tags.containsKey(tag)){ - switch(tags.get(tag).intValue()){ -- if (tags.containsKey(tag)) { -- switch(tags.get(tag).intValue()) { --- case ONETAG: --- HashSet newset=(HashSet)flagstate.clone(); --- Hashtable newtags=(Hashtable)tags.clone(); --- newtags.remove(tag); --- return new FlagState[] {new FlagState(newset,cd,newtags)}; --- --- case MULTITAGS: --- //two possibilities - count remains 2 or becomes 1 --- //2 case ------- HashSet newset1=(HashSet)flagstate.clone(); ------- Hashtable newtags1=(Hashtable)tags.clone(); ---- ---- if (tags.containsKey(tag)){ ---- //Code could try to remove flag that doesn't exist ---- ---- switch (tags.get(tag).intValue()){ ---- case ONETAG: ---- newtags1.put(tag,new Integer(MULTITAGS)); ---- return new FlagState[] {this, new FlagState(newset1, cd, newtags1)}; ---- case MULTITAGS: ---- return new FlagState[] {this}; ---- default: ---- throw new Error(); ---- } ---- } else { ---- newtags1.put(tag,new Integer(ONETAG)); ---- return new FlagState[] {new FlagState(newset1,cd,newtags1)}; ---- } --- --- //1 case --- HashSet newset2=(HashSet)flagstate.clone(); --- Hashtable newtags2=(Hashtable)tags.clone(); --- newtags1.put(tag,new Integer(ONETAG)); --- return new FlagState[] {new FlagState(newset1, cd, newtags2), --- new FlagState(newset2, cd, newtags2)}; --- --- default: --- throw new Error(); --- } --- } else { --- throw new Error("Invalid Operation: Can not clear a tag that doesn't exist."); ------ } --- } ------ --- public int getTagCount(TagDescriptor tag) { --- if (tags.containsKey(tag)) --- return tags.get(tag).intValue(); --- else return 0; --- /** Creates a string description of the flagstate --- * e.g. a flagstate with five flags could look like 01001 --- * @param flags an array of flagdescriptors. --- * @return string representation of the flagstate. --- */ --- public String toString(FlagDescriptor[] flags) { --- StringBuffer sb = new StringBuffer(flagstate.size()); - for(int i=0; i < flags.length; i++) - { -- for(int i=0; i < flags.length; i++) { --- if (get(flags[i])) --- sb.append(1); --- else --- sb.append(0); ------- } ------- ---- public int getTagCount(String tagtype){ - for (Enumeration en=getTags();en.hasMoreElements();){ - TagDescriptor td=(TagDescriptor)en.nextElement(); - if (tagtype.equals(td.getSymbol())) - return tags.get(td).intValue(); //returns either ONETAG or MULTITAG - } - return NOTAGS; --- return getTagCount(new TagDescriptor(tagtype)); --- return new String(sb); --- } --- --- /** Accessor method --- * @return returns the classdescriptor of the flagstate. --- */ --- --- public ClassDescriptor getClassDescriptor() { --- return cd; --- } --- --- /** Sets the status of a specific flag in a flagstate after cloning it. --- * @param fd FlagDescriptor of the flag whose status is being set. --- * @param status boolean value --- * @return the new flagstate with fd set to status. --- */ --- --- public FlagState setFlag(FlagDescriptor fd, boolean status) { --- HashSet newset=(HashSet) flagstate.clone(); --- Hashtable newtags=(Hashtable)tags.clone(); --- if (status) --- newset.add(fd); - else if (newset.contains(fd)){ -- else if (newset.contains(fd)) { --- newset.remove(fd); ------- } ---- ---- public FlagState[] clearTag(TagDescriptor tag){ ---- if (tags.containsKey(tag)){ ---- switch(tags.get(tag).intValue()){ ---- case ONETAG: ---- HashSet newset=(HashSet)flagstate.clone(); ---- Hashtable newtags=(Hashtable)tags.clone(); ---- newtags.remove(tag); ---- return new FlagState[]{new FlagState(newset,cd,newtags)}; ---- ---- case MULTITAGS: ---- //two possibilities - count remains 2 or becomes 1 ---- //2 case ---- HashSet newset1=(HashSet)flagstate.clone(); ---- Hashtable newtags1=(Hashtable)tags.clone(); - --- --- ---- //1 case ---- HashSet newset2=(HashSet)flagstate.clone(); ---- Hashtable newtags2=(Hashtable)tags.clone(); ---- newtags1.put(tag,new Integer(ONETAG)); ---- return new FlagState[] {new FlagState(newset1, cd, newtags2), ---- new FlagState(newset2, cd, newtags2)}; ---- default: ---- throw new Error(); ---- } ---- } else { ---- throw new Error("Invalid Operation: Can not clear a tag that doesn't exist."); ---- } --- return new FlagState(newset, cd, newtags); --- } --- --- /** Tests for equality of two flagstate objects. --- */ --- --- public boolean equals(Object o) { --- if (o instanceof FlagState) { --- FlagState fs=(FlagState)o; --- if (fs.cd!=cd) --- return false; - if(fs.byObj != this.byObj) { - return false; - } --- return (fs.flagstate.equals(flagstate) & fs.tags.equals(tags)); ------- } ---- ---- /** Creates a string description of the flagstate ---- * e.g. a flagstate with five flags could look like 01001 ---- * @param flags an array of flagdescriptors. ---- * @return string representation of the flagstate. ---- */ - public String toString(FlagDescriptor[] flags) - { - StringBuffer sb = new StringBuffer(flagstate.size()); - for(int i=0;i < flags.length; i++) - { - if (get(flags[i])) - sb.append(1); - else - sb.append(0); - } - - return new String(sb); - } --- return false; --- } - --- --- public String toString(FlagDescriptor[] flags) --- { --- StringBuffer sb = new StringBuffer(flagstate.size()); --- for(int i=0;i < flags.length; i++) --- { --- if (get(flags[i])) --- sb.append(1); --- else --- sb.append(0); --- } --- --- return new String(sb); --- public int hashCode() { -- return cd.hashCode()^flagstate.hashCode()^tags.hashCode(); - return cd.hashCode()^flagstate.hashCode()^tags.hashCode()^byObj; --- } --- --- public String getLabel() { --- return "N"+uid; --- } --- --- public String getTextLabel() { --- String label=null; --- for(Iterator it=getFlags(); it.hasNext();) { --- FlagDescriptor fd=(FlagDescriptor) it.next(); --- if (label==null) --- label=fd.toString(); --- else --- label+=", "+fd.toString(); ------ } --- ---- /** Accessor method ---- * @return returns the classdescriptor of the flagstate. ---- */ ---- ---- public ClassDescriptor getClassDescriptor(){ ---- return cd; - for (Enumeration en_tags=getTags(); en_tags.hasMoreElements();){ -- for (Enumeration en_tags=getTags(); en_tags.hasMoreElements();) { --- TagDescriptor td=(TagDescriptor)en_tags.nextElement(); - switch (tags.get(td).intValue()){ -- switch (tags.get(td).intValue()) { --- case ONETAG: --- if (label==null) --- label=td.toString()+"(1)"; --- else --- label+=", "+td.toString()+"(1)"; --- break; --- --- case MULTITAGS: --- if (label==null) --- label=td.toString()+"(n)"; --- else --- label+=", "+td.toString()+"(n)"; --- break; --- --- default: --- break; --- } ------- } --- if (label==null) --- return " "; --- return label; --- } ------- ---- /** Sets the status of a specific flag in a flagstate after cloning it. ---- * @param fd FlagDescriptor of the flag whose status is being set. ---- * @param status boolean value ---- * @return the new flagstate with fd set to status. ---- */ ---- ---- public FlagState setFlag(FlagDescriptor fd, boolean status) { ---- HashSet newset=(HashSet) flagstate.clone(); ---- Hashtable newtags=(Hashtable)tags.clone(); ---- if (status) ---- newset.add(fd); ---- else if (newset.contains(fd)){ ---- newset.remove(fd); --- public Enumeration getTags() { --- return tags.keys(); --- } --- --- public int getExeTime() { --- try { --- if(this.executeTime == -1) { --- if(this.visited4time == -1) { --- this.visited4time = 0; --- calExeTime(); --- } else { --- // visited, this node is in a loop --- // TODO --- // currently set 10 as the largest time --- this.executeTime = FlagState.MAXTIME; ------- } ---- ---- return new FlagState(newset, cd, newtags); ---- } ---- ---- /** Tests for equality of two flagstate objects. ---- */ ---- ---- public boolean equals(Object o) { ---- if (o instanceof FlagState) { ---- FlagState fs=(FlagState)o; ---- if (fs.cd!=cd) ---- return false; ---- return (fs.flagstate.equals(flagstate) & fs.tags.equals(tags)); ---- } ---- return false; --- } --- } catch (Exception e) { --- e.printStackTrace(); --- System.exit(0); ------- } --- return this.executeTime; --- } ------- ---- public int hashCode() { ---- return cd.hashCode()^flagstate.hashCode()^tags.hashCode(); ---- } --- public void setExeTime(int exeTime) { --- this.executeTime = exeTime; --- } ------- ---- public String getLabel() { ---- return "N"+uid; ---- } - ---- - --- public int getAndmask() { --- return andmask; --- } - --- ---- public String getTextLabel() { ---- String label=null; ---- for(Iterator it=getFlags();it.hasNext();) { ---- FlagDescriptor fd=(FlagDescriptor) it.next(); ---- if (label==null) ---- label=fd.toString(); ---- else ---- label+=", "+fd.toString(); --- public void setAndmask(int andmask) { --- this.andmask = andmask; --- } --- --- public int getCheckmask() { --- return checkmask; --- } --- --- public void setCheckmask(int checkmask) { --- this.checkmask = checkmask; --- } --- --- public void calExeTime() throws Exception { --- Iterator it = this.edges(); --- if(it.hasNext()) { --- FEdge fe = (FEdge)it.next(); --- while((fe != null) && (fe.getTarget().equals(this))) { --- if(it.hasNext()) { --- fe = (FEdge)it.next(); --- } else { --- fe = null; ------- } ---- for (Enumeration en_tags=getTags();en_tags.hasMoreElements();){ - TagDescriptor td=(TagDescriptor)en_tags.nextElement(); - switch (tags.get(td).intValue()){ - case ONETAG: - if (label==null) - label=td.toString()+"(1)"; - else - label+=", "+td.toString()+"(1)"; - break; - case MULTITAGS: - if (label==null) - label=td.toString()+"(n)"; - else - label+=", "+td.toString()+"(n)"; - break; - default: - break; - } --- TagDescriptor td=(TagDescriptor)en_tags.nextElement(); --- switch (tags.get(td).intValue()){ --- case ONETAG: --- if (label==null) --- label=td.toString()+"(1)"; --- else --- label+=", "+td.toString()+"(1)"; --- break; --- case MULTITAGS: --- if (label==null) --- label=td.toString()+"(n)"; --- else --- label+=", "+td.toString()+"(n)"; --- break; --- default: --- break; --- } --- } --- if(fe == null) { --- this.executeTime = 0; --- } else { --- if(fe.getExeTime() == -1) { --- throw new Exception("Error: Uninitiate FEdge!"); ------- } ---- if (label==null) ---- return " "; ---- return label; --- this.executeTime = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); --- } --- } else { --- this.executeTime = 0; ------- } ---- ---- public Enumeration getTags(){ - return tags.keys(); --- return tags.keys(); --- while(it.hasNext()) { --- FEdge fe = (FEdge)it.next(); --- int temp = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); --- if(temp < this.executeTime) { --- this.executeTime = temp; --- } ------ } --- --- public int getExeTime() { --- try { --- if(this.executeTime == -1) { -- calExeTime(); - if(this.visited4time == -1) { - this.visited4time = 0; - calExeTime(); - } else { - // visited, this node is in a loop - // TODO - // currently set 10 as the largest time - this.executeTime = FlagState.MAXTIME; - } --- } --- } catch (Exception e) { --- e.printStackTrace(); --- System.exit(0); --- } --- return this.executeTime; --- } --- --- public Object clone() { --- FlagState o = null; --- try { --- o = (FlagState) super.clone(); - } catch(CloneNotSupportedException e){ -- } catch(CloneNotSupportedException e) { --- e.printStackTrace(); ------ } --- --- public void setExeTime(int exeTime) { --- this.executeTime = exeTime; --- o.uid = FlagState.nodeid++; --- o.edges = new Vector(); --- for(int i = 0; i < this.edges.size(); i++) { --- o.edges.addElement(this.edges.elementAt(i)); ------ } --- - public int getAndmask() { - return andmask; --- o.inedges = new Vector(); --- for(int i = 0; i < this.inedges.size(); i++) { --- o.inedges.addElement(this.inedges.elementAt(i)); ---- } - o.byObj = this.byObj; --- return o; --- } ---- - public void setAndmask(int andmask) { - this.andmask = andmask; - } --- public void init4Simulate() { --- this.invokeNum = 0; --- } ---- - public int getCheckmask() { - return checkmask; --- public FEdge process(TaskDescriptor td) { --- FEdge next = null; --- this.invokeNum++; --- // refresh all the expInvokeNum of each edge --- for(int i = 0; i < this.edges.size(); i++) { --- next = (FEdge) this.edges.elementAt(i); -- next.setExpInvokeNum((int)Math.round(this.invokeNum * (next.getProbability() / 100))); - if(this.byObj == 0) { - next.setExpInvokeNum((int)(Math.ceil(this.invokeNum * next.getProbability() / 100))); - } else { - next.setExpInvokeNum((int)(Math.ceil(((this.invokeNum - 1) / this.byObj + 1) * next.getProbability() / 100))); - } ---- } ---- - public void setCheckmask(int checkmask) { - this.checkmask = checkmask; --- // find the one with the biggest gap between its actual invoke time and the expected invoke time --- // and associated with task td --- int index = 0; --- int gap = 0; - double prob = 0; - boolean isbackedge = true; --- for(int i = 0; i < this.edges.size(); i++) { -- int temp = ((FEdge) this.edges.elementAt(index)).getInvokeNumGap(); - if((temp > gap) && (next.getTask().equals(td))){ - next = ((FEdge) this.edges.elementAt(i)); - int temp = (this.byObj == 0) ? next.getInvokeNumGap() : next.getInvokeNumGapByObj(this.byObj); - boolean exchange = false; -- if((temp > gap) && (next.getTask().equals(td))) { - exchange = true; - } else if(temp == gap) { - if(next.getProbability() > prob) { - exchange = true; - } else if(next.getProbability() == prob) { - if(!isbackedge && next.isbackedge()) { - // backedge has higher priority - exchange = true; - } - } - } - if(exchange) { --- index = i; --- gap = temp; - prob = next.getProbability(); - isbackedge = next.isbackedge(); --- } ---- } --- next = (FEdge) this.edges.elementAt(index); --- next.process(); ---- --- public void calExeTime() throws Exception { --- Iterator it = this.edges(); --- if(it.hasNext()) { --- FEdge fe = (FEdge)it.next(); -- if(fe.getExeTime() == -1) { -- throw new Exception("Error: Uninitiate FEdge!"); - while((fe != null) && (fe.getTarget().equals(this))) { - if(it.hasNext()) { - fe = (FEdge)it.next(); - } else { - fe = null; - } --- } -- this.executeTime = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); - if(fe == null) { - this.executeTime = 0; - } else { - if(fe.getExeTime() == -1) { - throw new Exception("Error: Uninitiate FEdge!"); - } - this.executeTime = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); - } --- } else { --- this.executeTime = 0; --- } --- while(it.hasNext()) { --- FEdge fe = (FEdge)it.next(); --- int temp = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); --- if(temp < this.executeTime) { --- this.executeTime = temp; --- } --- } --- } --- --- public Object clone() { --- FlagState o = null; --- try { --- o = (FlagState)super.clone(); --- } catch(CloneNotSupportedException e){ --- e.printStackTrace(); --- } --- o.uid = FlagState.nodeid++; --- o.edges = new Vector(); --- for(int i = 0; i < this.edges.size(); i++) { --- o.edges.addElement(this.edges.elementAt(i)); --- } --- o.inedges = new Vector(); --- for(int i = 0; i < this.inedges.size(); i++) { --- o.inedges.addElement(this.inedges.elementAt(i)); --- } --- return o; -- } -- -- public void init4Simulate() { -- this.invokeNum = 0; -- } -- -- public FEdge process(TaskDescriptor td) { -- FEdge next = null; -- this.invokeNum++; -- // refresh all the expInvokeNum of each edge -- for(int i = 0; i < this.edges.size(); i++) { -- next = (FEdge)this.edges.elementAt(i); -- next.setExpInvokeNum((int)Math.round(this.invokeNum * (next.getProbability() / 100))); -- } -- -- // find the one with the biggest gap between its actual invoke time and the expected invoke time -- // and associated with task td -- int index = 0; -- int gap = 0; -- for(int i = 0; i < this.edges.size(); i++) { -- int temp = ((FEdge)this.edges.elementAt(index)).getInvokeNumGap(); -- if((temp > gap) && (next.getTask().equals(td))){ -- index = i; -- gap = temp; -- } -- } -- next = (FEdge)this.edges.elementAt(index); -- next.process(); -- -- return next; - } --- return next; --- } ---- - /*public Vector getAllys() { - return allys; - } - public int getByObj() { - return byObj; - } - - public void setByObj(int byObj) { - this.byObj = byObj; - } - --- /*public Vector getAllys() { --- return allys; --- } ---- - public void addAlly(ScheduleEdge se) { - if(this.allys == null) { - assert(this.isolate == true); - this.isolate = false; - this.allys = new Vector(); - } - this.allys.addElement(se); ---- } --- public void addAlly(ScheduleEdge se) { --- if(this.allys == null) { --- assert(this.isolate == true); --- this.isolate = false; --- this.allys = new Vector(); --- } --- this.allys.addElement(se); --- } ---- - public boolean isIsolate() { - return isolate; - }*/ - --- public boolean isIsolate() { --- return isolate; --- }*/ --- -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/GarbageAnalysis.java index 46cdfb94,46cdfb94,46cdfb94,46cdfb94,c7c7aa84,c7c7aa84,c7c7aa84..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/GarbageAnalysis.java +++ /dev/null @@@@@@@@ -1,81 -1,81 -1,81 -1,81 -1,81 -1,81 -1,81 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import IR.*; -------import Util.Namer; -------import java.util.*; -------import Util.GraphNode; -------import Util.Edge; ------- -------public class GarbageAnalysis extends Namer { ---- State state; ---- TaskAnalysis taskanalysis; ---- HashSet garbagestates; ---- HashSet possiblegarbagestates; --- State state; --- TaskAnalysis taskanalysis; --- HashSet garbagestates; --- HashSet possiblegarbagestates; ------- ------- ---- public GarbageAnalysis(State state, TaskAnalysis taskanalysis) { ---- this.state=state; ---- this.taskanalysis=taskanalysis; ---- this.garbagestates=new HashSet(); ---- this.possiblegarbagestates=new HashSet(); ---- doAnalysis(); ---- } ---- ---- public void doAnalysis() { ---- for(Iterator it=state.getClassSymbolTable().getDescriptorsIterator();it.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor) it.next(); ---- if (taskanalysis.getFlagStates(cd)==null) ---- continue; ---- analyzeClass(cd); ---- } --- public GarbageAnalysis(State state, TaskAnalysis taskanalysis) { --- this.state=state; --- this.taskanalysis=taskanalysis; --- this.garbagestates=new HashSet(); --- this.possiblegarbagestates=new HashSet(); --- doAnalysis(); --- } --- --- public void doAnalysis() { --- for(Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); it.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor) it.next(); --- if (taskanalysis.getFlagStates(cd)==null) --- continue; --- analyzeClass(cd); ------- } --- } ------- ---- public void analyzeClass(ClassDescriptor cd) { ---- Set flagstatenodes=taskanalysis.getFlagStates(cd); ---- HashSet garbage=new HashSet(); ---- HashSet possiblegarbage=new HashSet(); --- public void analyzeClass(ClassDescriptor cd) { --- Set flagstatenodes=taskanalysis.getFlagStates(cd); --- HashSet garbage=new HashSet(); --- HashSet possiblegarbage=new HashSet(); ------- ---- for(Iterator fsit=flagstatenodes.iterator();fsit.hasNext();) { ---- FlagState fs=(FlagState)fsit.next(); ---- if (fs.numedges()==0) ---- garbage.add(fs); ---- } --- for(Iterator fsit=flagstatenodes.iterator(); fsit.hasNext();) { --- FlagState fs=(FlagState)fsit.next(); --- if (fs.numedges()==0) --- garbage.add(fs); --- } ------- ---- Stack tovisit=new Stack(); ---- tovisit.addAll(garbage); ---- possiblegarbage.addAll(garbage); ---- while(!tovisit.isEmpty()) { ---- FlagState fs=(FlagState)tovisit.pop(); ---- for(int i=0;i exitfses; ---- public Predicate predicate; ---- private static int nodeid=0; --- private int index; ---- private int uid; - - protected OptionalTaskDescriptor(TaskDescriptor td, HashSet flagstates, int depth, Predicate predicate){ ---public class OptionalTaskDescriptor { --- public TaskDescriptor td; --- public HashSet enterflagstates; --- public HashSet exitfses; --- public Predicate predicate; --- private static int nodeid=0; --- private int index; --- private int uid; ------ --- protected OptionalTaskDescriptor(TaskDescriptor td, int index, HashSet enterflagstates, Predicate predicate) { ---- this.td = td; - this.flagstates = flagstates; - this.depth = depth; --- this.enterflagstates = enterflagstates; ---- this.exitfses = new HashSet(); ---- this.predicate = predicate; - this.uid = OptionalTaskDescriptor.nodeid++; - --- this.index=index; ---- } ---- - public boolean equals(Object o){ --- public int hashCode() { --- return td.hashCode()^enterflagstates.hashCode()^predicate.hashCode()^index; --- } --- protected OptionalTaskDescriptor(TaskDescriptor td, int index, HashSet enterflagstates, Predicate predicate) { --- this.td = td; --- this.enterflagstates = enterflagstates; --- this.exitfses = new HashSet(); --- this.predicate = predicate; --- this.index=index; --- } ------ --- public boolean equals(Object o) { ---- if (o instanceof OptionalTaskDescriptor) { - OptionalTaskDescriptor otd = (OptionalTaskDescriptor) o; - if (this.td.getSymbol().compareTo(otd.td.getSymbol())==0) - if(this.flagstates.equals(otd.flagstates)) - if(this.predicate.equals(otd.predicate)) - return true; - return false; --- OptionalTaskDescriptor otd=(OptionalTaskDescriptor) o; --- if (otd.td==td&& --- otd.enterflagstates.equals(enterflagstates)&& --- otd.predicate.equals(predicate)&& --- otd.index==index) --- return true; ---- } - else return false; - --- return false; ---- } - - public int hashCode() { - return td.getSymbol().hashCode()+flagstates.hashCode()+predicate.hashCode(); --- public int hashCode() { --- return td.hashCode()^enterflagstates.hashCode()^predicate.hashCode()^index; --- } ------ --- public int getIndex() { --- return index; --- public boolean equals(Object o) { --- if (o instanceof OptionalTaskDescriptor) { --- OptionalTaskDescriptor otd=(OptionalTaskDescriptor) o; --- if (otd.td==td&& --- otd.enterflagstates.equals(enterflagstates)&& --- otd.predicate.equals(predicate)&& --- otd.index==index) --- return true; ------- } - --- return false; --- } ------ ---- public String tostring() { ---- return "Optional task "+td.getSymbol(); --- } --- public int getIndex() { --- return index; --- } ------ --- public void setuid() { --- uid=nodeid++; ---- } --- public String tostring() { --- return "Optional task "+td.getSymbol(); --- } ------- ---- public int getuid() { ---- return uid; ---- } --- public void setuid() { --- uid=nodeid++; --- } - --- - --- public int getuid() { --- return uid; --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/Predicate.java index b00b8984,7fefe6ec,7fefe6ec,7fefe6ec,ba679e5f,ba679e5f,ba679e5f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/Predicate.java +++ /dev/null @@@@@@@@ -1,34 -1,33 -1,33 -1,33 -1,33 -1,33 -1,33 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import java.util.*; -------import IR.*; -------import IR.Tree.*; -------import IR.Flat.*; -------import Util.Edge; ------- - public class Predicate{ - public Hashtable vardescriptors; - public Hashtable> flags; - public Hashtable tags; //if there is a tag change, we stop the analysis ------public class Predicate { --- public HashSet vardescriptors; --- public Hashtable> flags; --- public Hashtable tags; --- //if there is a tag change, we stop the analysis ---- ---- public Predicate(){ - this.vardescriptors = new Hashtable(); - this.flags = new Hashtable(); - this.tags = new Hashtable(); --- this.vardescriptors = new HashSet(); --- this.flags = new Hashtable>(); --- this.tags = new Hashtable(); ---- } --- public HashSet vardescriptors; --- public Hashtable> flags; --- public Hashtable tags; --- //if there is a tag change, we stop the analysis ------- - public boolean equals(Object o){ - if(o instanceof Predicate){ - Predicate p = (Predicate) o; - if(this.vardescriptors.equals(p.vardescriptors)) --- public boolean equals(Object o) { --- if (o instanceof Predicate) { --- Predicate p=(Predicate)o; --- if (vardescriptors.equals(p.vardescriptors)&& --- flags.equals(p.flags)&& --- tags.equals(p.tags)) ---- return true; - return false; ---- } - else return false; --- return false; ---- } --- public Predicate() { --- this.vardescriptors = new HashSet(); --- this.flags = new Hashtable>(); --- this.tags = new Hashtable(); --- } - --- - public int hashCode(){ --- public int hashCode() { ---- return vardescriptors.hashCode(); --- public boolean equals(Object o) { --- if (o instanceof Predicate) { --- Predicate p=(Predicate)o; --- if (vardescriptors.equals(p.vardescriptors)&& --- flags.equals(p.flags)&& --- tags.equals(p.tags)) --- return true; ------- } - - --- return false; --- } --- public int hashCode() { --- return vardescriptors.hashCode(); --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java index 8ecab55f,93961377,93961377,93961377,ed0e3609,220843ef,220843ef..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java +++ /dev/null @@@@@@@@ -1,872 -1,569 -1,569 -1,569 -1,568 -1,568 -1,568 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import java.util.*; -------import IR.*; -------import IR.Tree.*; -------import IR.Flat.*; -------import java.io.*; -------import java.io.File; -------import java.io.FileWriter; -------import java.io.FileOutputStream; -------import Util.Edge; ------- -------public class SafetyAnalysis { - ---- private Hashtable executiongraph; - private Hashtable> safeexecution; //to use to build code - private static final int OR = 0; - private static final int AND = 1; - private Hashtable reducedgraph; - private String classname; --- private Hashtable>> safeexecution; //to use to build code ---- private State state; ---- private TaskAnalysis taskanalysis; - private Hashtable optionaltaskdescriptors; --- private Hashtable> optionaltaskdescriptors; --- private Hashtable>> fstotimap; ---- ---- private ClassDescriptor processedclass; ---- - - public Hashtable> getResult(){ --- public Hashtable>> getResult() { ---- return safeexecution; ---- } --- private Hashtable executiongraph; --- private Hashtable>> safeexecution; //to use to build code --- private State state; --- private TaskAnalysis taskanalysis; --- private Hashtable> optionaltaskdescriptors; --- private Hashtable>> fstotimap; ------- - public Hashtable getOptionalTaskDescriptors(){ --- public Hashtable> getOptionalTaskDescriptors() { ---- return optionaltaskdescriptors; ---- } --- private ClassDescriptor processedclass; ------- - /*Structure that stores a possible optional - task which would be safe to execute and - the possible flagstates the object could - be in before executing the task during an - execution without failure*/ --- /* Structure that stores a possible optional task which would be --- safe to execute and the possible flagstates the object could be --- in before executing the task during an execution without --- failure*/ ---- ---- /*Constructor*/ - public SafetyAnalysis(Hashtable executiongraph, State state, TaskAnalysis taskanalysis){ --- public SafetyAnalysis(Hashtable executiongraph, State state, TaskAnalysis taskanalysis) { ---- this.executiongraph = executiongraph; ---- this.safeexecution = new Hashtable(); - this.reducedgraph = new Hashtable(); ---- this.state = state; ---- this.taskanalysis = taskanalysis; ---- this.optionaltaskdescriptors = new Hashtable(); --- this.fstotimap=new Hashtable>>(); ---- } ---- - /*finds the the source node in the execution graph*/ - private EGTaskNode findSourceNode(Vector nodes){ - for(Iterator it = nodes.iterator(); it.hasNext();){ - EGTaskNode tn = (EGTaskNode)it.next(); - if(tn.isSource()){ - return tn; --- /* Builds map of fs -> EGTasknodes that can fire on fs for class cd */ --- public Hashtable>> getResult() { --- return safeexecution; --- } ------ --- private Hashtable> buildMap(ClassDescriptor cd) { --- Hashtable> table=new Hashtable>(); --- for(Iterator it=((Set)executiongraph.get(cd)).iterator();it.hasNext();) { --- EGTaskNode node=(EGTaskNode)it.next(); --- if (node.getFS()!=null) { --- if (!table.containsKey(node.getFS())) --- table.put(node.getFS(), new HashSet()); --- table.get(node.getFS()).add(node); ---- } ---- } - return null; --- return table; ---- } - - /*returns the nodes corresponding to the tasks - that can fire with the object in flagstate - previousflagstate*/ - private Vector findEGTaskNode(String previousflagstate, Vector nodes){ - Vector tns = new Vector(); - for(Iterator it = nodes.iterator(); it.hasNext();){ - EGTaskNode tn = (EGTaskNode)it.next(); - if(tn.getFSName().compareTo(previousflagstate)==0) - tns.add(tn); --- public Hashtable> getOptionalTaskDescriptors() { --- return optionaltaskdescriptors; --- } ------ --- /* Structure that stores a possible optional task which would be --- safe to execute and the possible flagstates the object could be --- in before executing the task during an execution without --- failure*/ ------ --- public Set getOptions(FlagState fs, TaskDescriptor td, int index) { --- return fstotimap.get(fs).get(new TaskIndex(td, index)); --- } --- /*Constructor*/ --- public SafetyAnalysis(Hashtable executiongraph, State state, TaskAnalysis taskanalysis) { --- this.executiongraph = executiongraph; --- this.safeexecution = new Hashtable(); --- this.state = state; --- this.taskanalysis = taskanalysis; --- this.optionaltaskdescriptors = new Hashtable(); --- this.fstotimap=new Hashtable>>(); --- } ------ --- public Set getOptions(FlagState fs, TaskIndex ti) { --- return fstotimap.get(fs).get(ti); --- } --- /* Builds map of fs -> EGTasknodes that can fire on fs for class cd */ ------ --- public Set getTaskIndex(FlagState fs) { --- return fstotimap.get(fs).keySet(); --- private Hashtable> buildMap(ClassDescriptor cd) { --- Hashtable> table=new Hashtable>(); --- for(Iterator it=((Set)executiongraph.get(cd)).iterator(); it.hasNext();) { --- EGTaskNode node=(EGTaskNode)it.next(); --- if (node.getFS()!=null) { --- if (!table.containsKey(node.getFS())) --- table.put(node.getFS(), new HashSet()); --- table.get(node.getFS()).add(node); --- } ------ } --- return table; --- } ------ ------ --- /* Builds map of fs -> set of fs that depend on this fs */ --- public Set getOptions(FlagState fs, TaskDescriptor td, int index) { --- return fstotimap.get(fs).get(new TaskIndex(td, index)); --- } ------ --- private Hashtable> buildUseMap(ClassDescriptor cd) { --- Hashtable> table=new Hashtable>(); --- for(Iterator it=((Set)executiongraph.get(cd)).iterator();it.hasNext();) { --- EGTaskNode node=(EGTaskNode)it.next(); --- if (node.getFS()!=null) { --- if (!table.containsKey(node.getPostFS())) --- table.put(node.getPostFS(), new HashSet()); --- table.get(node.getPostFS()).add(node.getFS()); --- } ---- } - if(tns.size() == 0) - return null; - else if (tns.size() > 1){ - for(Iterator it = tns.iterator(); it.hasNext();){ - EGTaskNode tn = (EGTaskNode)it.next(); - tn.setAND(); --- return table; --- } --- public Set getOptions(FlagState fs, TaskIndex ti) { --- return fstotimap.get(fs).get(ti); --- } ------ --- public void doAnalysis() { --- Enumeration classit=taskanalysis.flagstates.keys(); --- --- while (classit.hasMoreElements()) { --- ClassDescriptor cd=(ClassDescriptor)classit.nextElement(); --- if (!executiongraph.containsKey(cd)) --- continue; --- Hashtable> fstootd=new Hashtable>(); --- safeexecution.put(cd, fstootd); --- public Set getTaskIndex(FlagState fs) { --- return fstotimap.get(fs).keySet(); --- } ------ --- optionaltaskdescriptors.put(cd, new Hashtable()); ------ --- Hashtable> fstoegmap=buildMap(cd); --- Hashtable> fsusemap=buildUseMap(cd); --- --- HashSet tovisit=new HashSet(); --- tovisit.addAll(taskanalysis.getFlagStates(cd)); --- /* Builds map of fs -> set of fs that depend on this fs */ ------ --- while(!tovisit.isEmpty()) { --- FlagState fs=tovisit.iterator().next(); --- tovisit.remove(fs); --- if (!fstoegmap.containsKey(fs)) --- continue;//This FS has no task that can trigger on it --- Set nodeset=fstoegmap.get(fs); --- analyzeFS(fs, nodeset, fstootd, fsusemap, tovisit); ---- } ---- } - return tns; --- printTEST(); --- private Hashtable> buildUseMap(ClassDescriptor cd) { --- Hashtable> table=new Hashtable>(); --- for(Iterator it=((Set)executiongraph.get(cd)).iterator(); it.hasNext();) { --- EGTaskNode node=(EGTaskNode)it.next(); --- if (node.getFS()!=null) { --- if (!table.containsKey(node.getPostFS())) --- table.put(node.getPostFS(), new HashSet()); --- table.get(node.getPostFS()).add(node.getFS()); --- } ------- } - - /*returns the executiongraph corresponding to the classname*/ - private Vector getConcernedClass( String classname ){ - Enumeration e = executiongraph.keys(); - while( e.hasMoreElements() ){ - ClassDescriptor cd = (ClassDescriptor)e.nextElement(); - if (classname.compareTo(cd.getSymbol())==0) - return (Vector)executiongraph.get(cd); --- return table; --- } ------ --- public void analyzeFS(FlagState fs, Set egset, Hashtable> fstootd, Hashtable> fsusemap, HashSet tovisit) { --- Hashtable> timap=new Hashtable>(); --- Set tiselfloops=new HashSet(); --- public void doAnalysis() { --- Enumeration classit=taskanalysis.flagstates.keys(); ------ --- for(Iterator egit=egset.iterator();egit.hasNext();) { --- EGTaskNode egnode=egit.next(); --- Set setotd; --- if (egnode.isOptional()) { --- setotd=new HashSet(); --- HashSet enterfsset=new HashSet(); --- enterfsset.add(fs); --- ClassDescriptor cd=fs.getClassDescriptor(); --- OptionalTaskDescriptor newotd=new OptionalTaskDescriptor(egnode.getTD(), egnode.getIndex(), enterfsset, new Predicate()); --- if(optionaltaskdescriptors.get(cd).containsKey(newotd)) { --- newotd = optionaltaskdescriptors.get(cd).get(newotd); --- } else { --- newotd.setuid(); --- resultingFS(newotd); --- optionaltaskdescriptors.get(cd).put(newotd, newotd); --- } --- setotd.add(newotd); --- } else if (tagChange(egnode)) { --- //Conservatively handle tag changes --- setotd=new HashSet(); --- } else if(egnode.isMultipleParams()) { --- if( goodMultiple(egnode)){ --- Predicate p=returnPredicate(egnode); --- Set oldsetotd; --- if (fstootd.containsKey(egnode.getPostFS())) --- oldsetotd=fstootd.get(egnode.getPostFS()); --- else --- oldsetotd=new HashSet(); --- setotd=new HashSet(); --- for(Iterator otdit=oldsetotd.iterator();otdit.hasNext();) { --- OptionalTaskDescriptor oldotd=otdit.next(); --- Predicate newp=combinePredicates(oldotd.predicate, p); --- OptionalTaskDescriptor newotd=new OptionalTaskDescriptor(oldotd.td, oldotd.getIndex(), oldotd.enterflagstates, newp); --- ClassDescriptor cd=fs.getClassDescriptor(); --- if(optionaltaskdescriptors.get(cd).containsKey(newotd)) { --- newotd = optionaltaskdescriptors.get(cd).get(newotd); --- } else { --- newotd.setuid(); --- resultingFS(newotd); --- optionaltaskdescriptors.get(cd).put(newotd, newotd); --- } --- setotd.add(newotd); --- } --- } else { --- //Can't propagate anything --- setotd=new HashSet(); --- } --- } else { --- if (fstootd.containsKey(egnode.getPostFS())) --- setotd=fstootd.get(egnode.getPostFS()); --- else --- setotd=new HashSet(); --- } --- TaskIndex ti=egnode.isRuntime()?new TaskIndex():new TaskIndex(egnode.getTD(), egnode.getIndex()); --- if (!ti.runtime) { --- //runtime edges don't do anything...don't have to take --- //them, can't predict when we can. --- if (state.selfloops.contains(egnode.getTD().getSymbol())) { --- System.out.println("Self loop for: "+egnode.getTD()+" "+egnode.getIndex()); --- if (timap.containsKey(ti)) { --- if (egnode.getPostFS()!=fs) { --- if (tiselfloops.contains(ti)) { --- //dump old self loop --- timap.put(ti, setotd); --- tiselfloops.remove(ti); --- } else { --- //standard and case --- timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor())); --- } --- } --- } else { --- //mark as self loop --- timap.put(ti, setotd); --- if (egnode.getPostFS()==fs) { --- tiselfloops.add(ti); --- } --- } --- } else if (timap.containsKey(ti)) { --- //AND case --- timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor())); --- } else { --- timap.put(ti, setotd); --- } --- } ---- } - return null; --- while (classit.hasMoreElements()) { --- ClassDescriptor cd=(ClassDescriptor)classit.nextElement(); --- if (!executiongraph.containsKey(cd)) --- continue; --- Hashtable> fstootd=new Hashtable>(); --- safeexecution.put(cd, fstootd); ------ --- //Combine all options --- HashSet set=new HashSet(); --- for(Iterator> it=timap.values().iterator();it.hasNext();) { --- Set otdset=it.next(); --- set.addAll(otdset); --- } --- optionaltaskdescriptors.put(cd, new Hashtable()); ------ --- if (!fstootd.containsKey(fs)|| --- !fstootd.get(fs).equals(set)) { --- fstootd.put(fs, set); --- //Requeue all flagstates that may use our updated results --- if (fsusemap.containsKey(fs)) { --- tovisit.addAll(fsusemap.get(fs)); --- } --- } --- fstotimap.put(fs, timap); ---- } - - /*Actual method used by the compiler. - It computes the analysis for every - possible flagstates of every classes*/ - public void buildPath() throws java.io.IOException { - /*Explore the taskanalysis structure*/ - System.out.println("------- ANALYSING OPTIONAL TASKS -------"); - Enumeration e=taskanalysis.flagstates.keys(); - - while (e.hasMoreElements()) { - System.out.println("\nAnalysing class :"); - processedclass=(ClassDescriptor)e.nextElement(); - classname = processedclass.getSymbol(); - Hashtable newhashtable = new Hashtable(); - optionaltaskdescriptors.put(processedclass, newhashtable); - Hashtable cdhashtable = new Hashtable(); --- Hashtable> fstoegmap=buildMap(cd); --- Hashtable> fsusemap=buildUseMap(cd); ------- - System.out.println("\t"+classname+ "\n"); - //get the graph result of executiongraph class - Vector nodes = new Vector(); - nodes = getConcernedClass( classname ); - if(nodes==null) { - System.out.println("Impossible to find "+classname+". Unexpected."); - continue; --- private HashSet createIntersection(Set A, Set B, ClassDescriptor cd){ --- HashSet result = new HashSet(); --- for(Iterator b_it = B.iterator(); b_it.hasNext();){ --- OptionalTaskDescriptor otd_b = (OptionalTaskDescriptor)b_it.next(); --- for(Iterator a_it = A.iterator(); a_it.hasNext();){ --- OptionalTaskDescriptor otd_a = (OptionalTaskDescriptor)a_it.next(); --- if(otd_a.td==otd_b.td&& --- otd_a.getIndex()==otd_b.getIndex()) { --- HashSet newfs = new HashSet(); --- newfs.addAll(otd_a.enterflagstates); --- newfs.addAll(otd_b.enterflagstates); --- OptionalTaskDescriptor newotd = new OptionalTaskDescriptor(otd_b.td, otd_b.getIndex(), newfs, combinePredicates(otd_a.predicate, otd_b.predicate)); --- if(optionaltaskdescriptors.get(cd).get(newotd)!=null){ --- newotd = optionaltaskdescriptors.get(cd).get(newotd); --- } else { --- newotd.setuid(); --- resultingFS(newotd); --- optionaltaskdescriptors.get(cd).put(newotd, newotd); --- } --- result.add(newotd); --- } ---- } - else if(nodes.size()==0){ - System.out.println("Nothing to do"); --- } --- return result; --- } --- --- // This method returns true if the only parameter whose flag is --- // modified is the tracked one --- HashSet tovisit=new HashSet(); --- tovisit.addAll(taskanalysis.getFlagStates(cd)); ------ --- private boolean goodMultiple(EGTaskNode tn){ --- TaskDescriptor td = tn.getTD(); --- FlatMethod fm = state.getMethodFlat(td); --- TempDescriptor tmp=fm.getParameter(tn.getIndex()); --- while(!tovisit.isEmpty()) { --- FlagState fs=tovisit.iterator().next(); --- tovisit.remove(fs); --- if (!fstoegmap.containsKey(fs)) --- continue; //This FS has no task that can trigger on it --- Set nodeset=fstoegmap.get(fs); --- analyzeFS(fs, nodeset, fstootd, fsusemap, tovisit); --- } --- } --- printTEST(); --- } ------ --- Set nodeset=fm.getNodeSet(); --- public void analyzeFS(FlagState fs, Set egset, Hashtable> fstootd, Hashtable> fsusemap, HashSet tovisit) { --- Hashtable> timap=new Hashtable>(); --- Set tiselfloops=new HashSet(); ------ --- for(Iterator nodeit=nodeset.iterator();nodeit.hasNext();) { --- FlatNode fn=nodeit.next(); --- if (fn.kind()==FKind.FlatFlagActionNode) { --- FlatFlagActionNode ffan=(FlatFlagActionNode)fn; --- if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { --- for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it_tfp.next(); --- TempDescriptor tempd = tfp.getTemp(); --- if(tempd!=tmp) --- return false; //return false if a taskexit modifies one of the other parameters --- } --- } --- } --- } --- return true; --- } --- --- private Predicate returnPredicate(EGTaskNode tn){ --- Predicate result = new Predicate(); --- TaskDescriptor td = tn.getTD(); --- for(int i=0; i flaglist = new HashSet(); --- flaglist.add(td.getFlag(vd)); --- result.flags.put(vd, flaglist); --- if (td.getTag(vd)!=null) --- result.tags.put(vd, td.getTag(vd)); --- } --- } --- return result; --- } --- --- private Predicate combinePredicates(Predicate A, Predicate B){ --- Predicate result = new Predicate(); --- result.vardescriptors.addAll(A.vardescriptors); --- result.flags.putAll(A.flags); --- result.tags.putAll(A.tags); --- Collection c = B.vardescriptors; --- for(Iterator varit = c.iterator(); varit.hasNext();){//maybe change that --- VarDescriptor vd = (VarDescriptor)varit.next(); --- if(result.vardescriptors.contains(vd)) --- System.out.println("Already in "); --- else { --- result.vardescriptors.add(vd); --- } --- for(Iterator egit=egset.iterator(); egit.hasNext();) { --- EGTaskNode egnode=egit.next(); --- Set setotd; --- if (egnode.isOptional()) { --- setotd=new HashSet(); --- HashSet enterfsset=new HashSet(); --- enterfsset.add(fs); --- ClassDescriptor cd=fs.getClassDescriptor(); --- OptionalTaskDescriptor newotd=new OptionalTaskDescriptor(egnode.getTD(), egnode.getIndex(), enterfsset, new Predicate()); --- if(optionaltaskdescriptors.get(cd).containsKey(newotd)) { --- newotd = optionaltaskdescriptors.get(cd).get(newotd); --- } else { --- newotd.setuid(); --- resultingFS(newotd); --- optionaltaskdescriptors.get(cd).put(newotd, newotd); ------ } --- Collection vardesc = result.vardescriptors; --- for(Iterator varit = vardesc.iterator(); varit.hasNext();){ --- VarDescriptor vd = (VarDescriptor)varit.next(); --- HashSet bflags = B.flags.get(vd); --- if( bflags == null ){ ---- continue; --- setotd.add(newotd); --- } else if (tagChange(egnode)) { --- //Conservatively handle tag changes --- setotd=new HashSet(); --- } else if(egnode.isMultipleParams()) { - if( goodMultiple(egnode)){ -- if( goodMultiple(egnode)) { --- Predicate p=returnPredicate(egnode); --- Set oldsetotd; --- if (fstootd.containsKey(egnode.getPostFS())) --- oldsetotd=fstootd.get(egnode.getPostFS()); --- else --- oldsetotd=new HashSet(); --- setotd=new HashSet(); --- for(Iterator otdit=oldsetotd.iterator(); otdit.hasNext();) { --- OptionalTaskDescriptor oldotd=otdit.next(); --- Predicate newp=combinePredicates(oldotd.predicate, p); --- OptionalTaskDescriptor newotd=new OptionalTaskDescriptor(oldotd.td, oldotd.getIndex(), oldotd.enterflagstates, newp); --- ClassDescriptor cd=fs.getClassDescriptor(); --- if(optionaltaskdescriptors.get(cd).containsKey(newotd)) { --- newotd = optionaltaskdescriptors.get(cd).get(newotd); ------ } else { --- if (result.flags.containsKey(vd)) --- ((HashSet)result.flags.get(vd)).addAll(bflags); --- else --- result.flags.put(vd, bflags); ---- } - - //mark the graph - EGTaskNode sourcenode = findSourceNode(nodes); - doGraphMarking(sourcenode); - createDOTFile( classname ); - reducedgraph.clear(); - - Collection fses = ((Hashtable)taskanalysis.flagstates.get(processedclass)).values(); - Iterator itfses = fses.iterator(); - while (itfses.hasNext()) { - FlagState fs = (FlagState)itfses.next(); - Hashtable fsresult = new Hashtable(); - //get the tasknodes possible to execute with the flagstate before failure - HashSet tempnodes = new HashSet(); - Vector tns = new Vector(); - System.out.println("Analysing "+fs.getTextLabel()); - tns = findEGTaskNode(fs.getTextLabel(), nodes); - if(tns==null) { - System.out.println("\tNo task corresponding, terminal FS"); - continue; - } - System.out.println("\tProcessing..."); - - //compute the result for all the nodes contained in tns. - //return the intersection of tns that are the same task and union for others. - - HashSet availabletasks = new HashSet(); - availabletasks = computeTns(tns); - - //removeDoubles(availabletasks); --- TagExpressionList btags = B.tags.get(vd); --- if( btags != null ){ --- if (result.tags.containsKey(vd)) --- System.out.println("Tag found but there should be nothing to do because same tag"); --- else --- result.tags.put(vd, btags); --- newotd.setuid(); --- resultingFS(newotd); --- optionaltaskdescriptors.get(cd).put(newotd, newotd); ------ } --- setotd.add(newotd); --- } --- } else { --- //Can't propagate anything --- setotd=new HashSet(); ------ } --- return result; --- } --- --- //////////////////// --- /* returns a set of the possible sets of flagstates --- resulting from the execution of the optional task. --- To do it with have to look for TaskExit FlatNodes --- in the IR. --- */ --- private void resultingFS(OptionalTaskDescriptor otd){ --- Stack stack = new Stack(); --- HashSet result = new HashSet(); --- FlatMethod fm = state.getMethodFlat((TaskDescriptor)otd.td); --- FlatNode fn = (FlatNode)fm; --- --- Stack nodestack=new Stack(); --- HashSet discovered=new HashSet(); --- nodestack.push(fm); --- discovered.add(fm); --- TempDescriptor temp=fm.getParameter(otd.getIndex()); --- --- //Iterating through the nodes --- while(!nodestack.isEmpty()) { --- FlatNode fn1 = (FlatNode) nodestack.pop(); --- if (fn1.kind()==FKind.FlatFlagActionNode) { --- FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; --- if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { --- HashSet tempset = new HashSet(); --- for(Iterator it_fs = otd.enterflagstates.iterator(); it_fs.hasNext();){ --- FlagState fstemp = (FlagState)it_fs.next(); --- Vector processed=new Vector(); --- --- for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it_tfp.next(); --- if (tfp.getTemp()==temp) --- fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); --- } --- --- processed.add(fstemp); --- //Process clears first --- --- for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { --- TempTagPair ttp=(TempTagPair)it_ttp.next(); --- --- if (temp==ttp.getTemp()) { --- Vector oldprocess=processed; --- processed=new Vector(); ---- - for(Iterator it = availabletasks.iterator(); it.hasNext();){ - OptionalTaskDescriptor otd = (OptionalTaskDescriptor)it.next(); - resultingFS(otd, classname); --- for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ --- FlagState fsworking=(FlagState)en.nextElement(); --- if (!ffan.getTagChange(ttp)){ --- processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag()))); --- } else processed.add(fsworking); --- } --- } --- } --- //Process sets next --- for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { --- TempTagPair ttp=(TempTagPair)it_ttp.next(); --- --- if (temp==ttp.getTemp()) { --- Vector oldprocess=processed; --- processed=new Vector(); --- --- for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ --- FlagState fsworking=(FlagState)en.nextElement(); --- if (ffan.getTagChange(ttp)){ --- processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); --- } else processed.add(fsworking); --- } --- } --- } --- //Add to exit states --- tempset.addAll(processed); --- } --- result.add(tempset); --- continue; // avoid queueing the return node if reachable ---- } - - cdhashtable.put(fs, availabletasks); --- } else if (fn1.kind()==FKind.FlatReturnNode) { --- result.add(otd.enterflagstates); --- } else { --- if (fstootd.containsKey(egnode.getPostFS())) --- setotd=fstootd.get(egnode.getPostFS()); --- else --- setotd=new HashSet(); --- } --- TaskIndex ti=egnode.isRuntime() ? new TaskIndex() : new TaskIndex(egnode.getTD(), egnode.getIndex()); --- if (!ti.runtime) { --- //runtime edges don't do anything...don't have to take --- //them, can't predict when we can. --- if (state.selfloops.contains(egnode.getTD().getSymbol())) { --- System.out.println("Self loop for: "+egnode.getTD()+" "+egnode.getIndex()); --- if (timap.containsKey(ti)) { --- if (egnode.getPostFS()!=fs) { --- if (tiselfloops.contains(ti)) { --- //dump old self loop --- timap.put(ti, setotd); --- tiselfloops.remove(ti); --- } else { --- //standard and case --- timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor())); --- } ------- } ---- - safeexecution.put(processedclass, cdhashtable); - --- /* Queue other nodes past this one */ --- for(int i=0;i set=new HashSet(); --- for(Iterator> it=timap.values().iterator(); it.hasNext();) { --- Set otdset=it.next(); --- set.addAll(otdset); --- } - --- - --- if (!fstootd.containsKey(fs)|| --- !fstootd.get(fs).equals(set)) { --- fstootd.put(fs, set); --- //Requeue all flagstates that may use our updated results --- if (fsusemap.containsKey(fs)) { --- tovisit.addAll(fsusemap.get(fs)); --- } - --- } - - /*Marks the executiongraph : - -optionals - -multiple - -AND and OR nodes - */ - private void doGraphMarking(EGTaskNode extremity) throws java.io.IOException{ - //detects if there is a loop or no more nodes to explore - if (extremity.isMarked() || !((Iterator)extremity.edges()).hasNext()){ - if (!((Iterator)extremity.edges()).hasNext()) extremity.mark(); - reducedgraph.put(extremity.getuid(), extremity); - } - else { - //do the marking - process(extremity); - reducedgraph.put(extremity.getuid(), extremity); - extremity.mark(); - //calls doGraphMarking recursively with the next nodes as params - for( Iterator it = extremity.edges(); it.hasNext(); ){ - EGEdge edge = (EGEdge)it.next(); - doGraphMarking((EGTaskNode)edge.getTarget()); - } --- fstotimap.put(fs, timap); --- } --- --- private HashSet createIntersection(Set A, Set B, ClassDescriptor cd) { --- HashSet result = new HashSet(); - for(Iterator b_it = B.iterator(); b_it.hasNext();){ -- for(Iterator b_it = B.iterator(); b_it.hasNext();) { --- OptionalTaskDescriptor otd_b = (OptionalTaskDescriptor)b_it.next(); - for(Iterator a_it = A.iterator(); a_it.hasNext();){ -- for(Iterator a_it = A.iterator(); a_it.hasNext();) { --- OptionalTaskDescriptor otd_a = (OptionalTaskDescriptor)a_it.next(); --- if(otd_a.td==otd_b.td&& --- otd_a.getIndex()==otd_b.getIndex()) { --- HashSet newfs = new HashSet(); --- newfs.addAll(otd_a.enterflagstates); --- newfs.addAll(otd_b.enterflagstates); --- OptionalTaskDescriptor newotd = new OptionalTaskDescriptor(otd_b.td, otd_b.getIndex(), newfs, combinePredicates(otd_a.predicate, otd_b.predicate)); - if(optionaltaskdescriptors.get(cd).get(newotd)!=null){ -- if(optionaltaskdescriptors.get(cd).get(newotd)!=null) { --- newotd = optionaltaskdescriptors.get(cd).get(newotd); --- } else { --- newotd.setuid(); --- resultingFS(newotd); --- optionaltaskdescriptors.get(cd).put(newotd, newotd); --- } --- result.add(newotd); - --- } - } - - private void process(EGTaskNode tn){ - testIfOptional(tn); - testIfAND(tn); - testIfNextIsSelfLoop(tn); - testIfRuntime(tn); - testIfMultiple(tn); --- } - --- } - - private void testIfOptional(EGTaskNode tn){ - for(Iterator edges = tn.edges(); edges.hasNext();){ - EGEdge edge = (EGEdge)edges.next(); - EGTaskNode nexttn = (EGTaskNode)edge.getTarget(); - if (nexttn.getTD()!=null) - if(nexttn.getTD().isOptional(classname)) - nexttn.setOptional(); --- return result; --- } --- --- // This method returns true if the only parameter whose flag is --- // modified is the tracked one --- --- private boolean goodMultiple(EGTaskNode tn) { --- TaskDescriptor td = tn.getTD(); --- FlatMethod fm = state.getMethodFlat(td); --- TempDescriptor tmp=fm.getParameter(tn.getIndex()); --- --- Set nodeset=fm.getNodeSet(); --- --- for(Iterator nodeit=nodeset.iterator(); nodeit.hasNext();) { --- FlatNode fn=nodeit.next(); --- if (fn.kind()==FKind.FlatFlagActionNode) { --- FlatFlagActionNode ffan=(FlatFlagActionNode)fn; --- if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { --- for(Iterator it_tfp=ffan.getTempFlagPairs(); it_tfp.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it_tfp.next(); --- TempDescriptor tempd = tfp.getTemp(); --- if(tempd!=tmp) --- return false; //return false if a taskexit modifies one of the other parameters --- } - --- } - } - - private void testIfMultiple(EGTaskNode tn){ - for(Iterator edges = tn.edges(); edges.hasNext();){ - EGEdge edge = (EGEdge)edges.next(); - EGTaskNode nexttn = (EGTaskNode)edge.getTarget(); - if (nexttn.getTD() == null ) return;//to be fixed - if( nexttn.getTD().numParameters() > 1 ){ - nexttn.setMultipleParams(); - } - } --- } - --- } - - //maybe a little bug to fix - private void testIfRuntime(EGTaskNode tn){ - for(Iterator edges = tn.edges(); edges.hasNext();){ - EGEdge edge = (EGEdge)edges.next(); - EGTaskNode nexttn = (EGTaskNode)edge.getTarget(); - if( ((String)nexttn.getName()).compareTo("Runtime") == 0 ) - nexttn.setAND(); - } --- return true; --- } --- --- private Predicate returnPredicate(EGTaskNode tn) { --- Predicate result = new Predicate(); --- TaskDescriptor td = tn.getTD(); --- for(int i=0; i flaglist = new HashSet(); --- flaglist.add(td.getFlag(vd)); --- result.flags.put(vd, flaglist); --- if (td.getTag(vd)!=null) --- result.tags.put(vd, td.getTag(vd)); --- } - --- } - - /*That correspond to the case where it is - not possible for us to choose a path of - execution. The optional task has to be - present in all the possible executions - at this point. So we mark the node as an - AND node.*/ - private void testIfAND(EGTaskNode tn){ - Vector vtemp = new Vector(); - Vector tomark = new Vector(); - for(Iterator edges = tn.edges(); edges.hasNext();){ - EGEdge edge = (EGEdge)edges.next(); - EGTaskNode nexttn = (EGTaskNode)edge.getTarget(); - int contains = 0; - for (Iterator it = vtemp.iterator(); it.hasNext();){ - EGTaskNode nexttn2 = (EGTaskNode)it.next(); - if (nexttn.getName()==nexttn2.getName()){ - contains = 1; - tomark.add(nexttn); - tomark.add(nexttn2); - } - } - if (contains == 0) vtemp.add(nexttn); - } - - for(Iterator it2 = tomark.iterator(); it2.hasNext();) - ((EGTaskNode)it2.next()).setAND(); --- return result; --- } --- --- private Predicate combinePredicates(Predicate A, Predicate B) { --- Predicate result = new Predicate(); --- result.vardescriptors.addAll(A.vardescriptors); --- result.flags.putAll(A.flags); --- result.tags.putAll(A.tags); --- Collection c = B.vardescriptors; - for(Iterator varit = c.iterator(); varit.hasNext();){ //maybe change that -- for(Iterator varit = c.iterator(); varit.hasNext();) { //maybe change that --- VarDescriptor vd = (VarDescriptor)varit.next(); --- if(result.vardescriptors.contains(vd)) --- System.out.println("Already in "); --- else { --- result.vardescriptors.add(vd); --- } - --- } - - //maybe little bug to fix - private void testIfNextIsSelfLoop(EGTaskNode tn){ - for(Iterator edges = tn.edges(); edges.hasNext();){ - EGEdge edge = (EGEdge)edges.next(); - EGTaskNode nexttn = (EGTaskNode)edge.getTarget(); - if(nexttn.isSelfLoop()) nexttn.setAND(); - } --- Collection vardesc = result.vardescriptors; - for(Iterator varit = vardesc.iterator(); varit.hasNext();){ -- for(Iterator varit = vardesc.iterator(); varit.hasNext();) { --- VarDescriptor vd = (VarDescriptor)varit.next(); --- HashSet bflags = B.flags.get(vd); - if( bflags == null ){ -- if( bflags == null ) { --- continue; --- } else { --- if (result.flags.containsKey(vd)) --- ((HashSet)result.flags.get(vd)).addAll(bflags); --- else --- result.flags.put(vd, bflags); --- } --- TagExpressionList btags = B.tags.get(vd); - if( btags != null ){ -- if( btags != null ) { --- if (result.tags.containsKey(vd)) --- System.out.println("Tag found but there should be nothing to do because same tag"); --- else --- result.tags.put(vd, btags); --- } - --- } - --- return result; --- } - --- - /*recursive method that returns a set of OptionalTaskDescriptors - The computation basically consist in returning the - intersection or union of sets depending on the nature - of the node : OR -> UNION - AND -> INTERSECTION - The method also looks for tag changes. - */ - private HashSet determineIfIsSafe(EGTaskNode tn, int depth, HashSet visited, Predicate predicate){ - Predicate temppredicate = new Predicate(); - if(tn == null) return null; - if(!tagChange(tn)){ - if(tn.isOptional()){ - HashSet temp = new HashSet(); - if( tn.isMultipleParams() ){ - if( goodMultiple(tn) ){ - temppredicate = combinePredicates(predicate, returnPredicate(tn)); - System.out.println("Good multiple, Optional "+tn.getName()); - } - else return temp; - } - else temppredicate = combinePredicates(temppredicate, predicate); - //if the tn is optional and there is no more nodes/presence of a loop - //create the OptionalTaskDescriptor and return it as a singleton. - if( !((Iterator)tn.edges()).hasNext() || tn.isSelfLoop()){ - HashSet fstemp = new HashSet(); - fstemp.add(tn.getFS()); - OptionalTaskDescriptor otd = new OptionalTaskDescriptor(tn.getTD(), fstemp, depth, temppredicate); - //System.out.println("Create Optionaltaskdescriptor number "+otd.getuid()+" hascode "+otd.hashCode()); - if(optionaltaskdescriptors.get(processedclass).get(otd)!=null){ - otd = (OptionalTaskDescriptor)((Hashtable)optionaltaskdescriptors.get(processedclass)).get(otd); - } - else optionaltaskdescriptors.get(processedclass).put(otd, otd); - temp.add(otd); - return temp; - } - else if(visited.contains(tn)){ - return temp; - } - //else compute the edges, create the OptionalTaskDescriptor and add it to the set. - else{ - int newdepth = depth + 1; - visited.add(tn); - HashSet newhashset = new HashSet(visited); - HashSet fstemp = new HashSet(); - fstemp.add(tn.getFS()); - OptionalTaskDescriptor otd = new OptionalTaskDescriptor(tn.getTD(), fstemp, depth, temppredicate); - //System.out.println("Create Optionaltaskdescriptor number "+otd.getuid()+" hascode "+otd.hashCode()); - if(optionaltaskdescriptors.get(processedclass).get(otd)!=null){ - otd = (OptionalTaskDescriptor)((Hashtable)optionaltaskdescriptors.get(processedclass)).get(otd); - } - else optionaltaskdescriptors.get(processedclass).put(otd, otd); - temp = computeEdges(tn, newdepth, newhashset, temppredicate); - temp.add(otd); - return temp; - } - } - else{ - HashSet temp = new HashSet(); - if( tn.isMultipleParams() ){ - if( goodMultiple(tn) ){ - temppredicate = combinePredicates(predicate, returnPredicate(tn)); - System.out.println("Good multiple, not Optional "+tn.getName()); - } - else{ - System.out.println("Bad multiple, not Optional "+tn.getName()); - return temp; - } - } - else temppredicate = combinePredicates(temppredicate, predicate); - //if not optional but terminal just return an empty set. - if( !((Iterator)tn.edges()).hasNext() || visited.contains(tn) || tn.isSelfLoop()){ - return temp; - } - //if not terminal return the computation of the edges. - else{ - int newdepth = depth + 1; - visited.add(tn); - HashSet newhashset = new HashSet(visited); - return computeEdges(tn, newdepth, newhashset, temppredicate); - } - } - } - //if there has been a tag change return an empty set. - else{ - HashSet temp = new HashSet(); - return temp; - } - } --- //////////////////// --- /* returns a set of the possible sets of flagstates --- resulting from the execution of the optional task. --- To do it with have to look for TaskExit FlatNodes --- in the IR. --- */ --- private void resultingFS(OptionalTaskDescriptor otd) { --- Stack stack = new Stack(); --- HashSet result = new HashSet(); --- FlatMethod fm = state.getMethodFlat((TaskDescriptor)otd.td); --- FlatNode fn = (FlatNode)fm; - --- - private boolean goodMultiple(EGTaskNode tn){ - TaskDescriptor td = tn.getTD(); - HashSet classes = new HashSet(); - for(int i = 0 ; i processed=new Vector(); --- --- for(Iterator it_tfp=ffan.getTempFlagPairs(); it_tfp.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it_tfp.next(); --- if (tfp.getTemp()==temp) --- fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); ------- } ---- } ---- return false; - } - --- - - private HashSet computeEdges(EGTaskNode tn, int depth, HashSet visited, Predicate predicate){ - Hashtable andlist = new Hashtable(); - Vector orlist = new Vector(); - for(Iterator edges = tn.edges(); edges.hasNext();){ - EGTaskNode tntemp = (EGTaskNode)((EGEdge)edges.next()).getTarget(); - if(tntemp.type() == OR) orlist.add(tntemp); - else if(tntemp.type() == AND){ - if(andlist.containsKey(tntemp.getName())){ - ((Vector)andlist.get(tntemp.getName())).add(tntemp);} - else{ - Vector vector = new Vector(); - vector.add(tntemp); - andlist.put(tntemp.getName(), vector); --- processed.add(fstemp); --- //Process clears first --- --- for(Iterator it_ttp=ffan.getTempTagPairs(); it_ttp.hasNext();) { --- TempTagPair ttp=(TempTagPair)it_ttp.next(); --- --- if (temp==ttp.getTemp()) { --- Vector oldprocess=processed; --- processed=new Vector(); --- - for (Enumeration en=oldprocess.elements(); en.hasMoreElements();){ -- for (Enumeration en=oldprocess.elements(); en.hasMoreElements();) { --- FlagState fsworking=(FlagState)en.nextElement(); - if (!ffan.getTagChange(ttp)){ -- if (!ffan.getTagChange(ttp)) { --- processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag()))); --- } else processed.add(fsworking); - --- } --- } - --- } - } - - return (createUnion(computeOrVector(orlist, depth, visited, predicate), computeAndList(andlist, depth, visited, predicate))); - } --- //Process sets next --- for(Iterator it_ttp=ffan.getTempTagPairs(); it_ttp.hasNext();) { --- TempTagPair ttp=(TempTagPair)it_ttp.next(); - --- - private HashSet computeTns(Vector tns){ - Hashtable andlist = new Hashtable(); - Vector orlist = new Vector(); - for(Iterator nodes = tns.iterator(); nodes.hasNext();){ - EGTaskNode tntemp = (EGTaskNode)nodes.next(); - if(tntemp.type() == OR) orlist.add(tntemp); - else if(tntemp.type() == AND){ - if(andlist.containsKey(tntemp.getName())){ - ((Vector)andlist.get(tntemp.getName())).add(tntemp);} - else{ - Vector vector = new Vector(); - vector.add(tntemp); - andlist.put(tntemp.getName(), vector); --- if (temp==ttp.getTemp()) { --- Vector oldprocess=processed; --- processed=new Vector(); --- - for (Enumeration en=oldprocess.elements(); en.hasMoreElements();){ -- for (Enumeration en=oldprocess.elements(); en.hasMoreElements();) { --- FlagState fsworking=(FlagState)en.nextElement(); - if (ffan.getTagChange(ttp)){ -- if (ffan.getTagChange(ttp)) { --- processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); --- } else processed.add(fsworking); - --- } --- } - --- } --- //Add to exit states --- tempset.addAll(processed); --- } --- result.add(tempset); --- continue; // avoid queueing the return node if reachable - --- } - - return (createUnion(computeOrVector(orlist, 0), computeAndList(andlist, 0))); --- } else if (fn1.kind()==FKind.FlatReturnNode) { --- result.add(otd.enterflagstates); --- } - --- - } - - private HashSet computeOrVector( Vector orlist, int depth, HashSet visited, Predicate predicate){ - if(orlist.isEmpty()){ - HashSet temp = new HashSet(); - return temp; - } - else{ - HashSet temp = new HashSet(); - for(Iterator tns = orlist.iterator(); tns.hasNext();){ - EGTaskNode tn = (EGTaskNode)tns.next(); - temp = createUnion(determineIfIsSafe(tn, depth, visited, predicate), temp); - } - return temp; --- /* Queue other nodes past this one */ --- for(int i=0; i "+tn2.getLabel()+";"); - } - } - } - - //////////////////// - /* returns a set of the possible sets of flagstates - resulting from the execution of the optional task. - To do it with have to look for TaskExit FlatNodes - in the IR. - */ - private void resultingFS(OptionalTaskDescriptor otd, String classname){ - Stack stack = new Stack(); - HashSet result = new HashSet(); - FlatMethod fm = state.getMethodFlat((TaskDescriptor)otd.td); - FlatNode fn = (FlatNode)fm; - - Stack nodestack=new Stack(); - HashSet discovered=new HashSet(); - nodestack.push(fm); - discovered.add(fm); - - //Iterating through the nodes - while(!nodestack.isEmpty()) { - FlatNode fn1 = (FlatNode) nodestack.pop(); - if (fn1.kind()==FKind.FlatFlagActionNode) { - FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; - if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { - //*** - //System.out.println("TASKEXIT"); - //*** - HashSet tempset = new HashSet(); - for(Iterator it_fs = otd.flagstates.iterator(); it_fs.hasNext();){ - FlagState fstemp = (FlagState)it_fs.next(); - for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it_tfp.next(); - TempDescriptor td = tfp.getTemp(); - if (((String)((ClassDescriptor)((TypeDescriptor)td.getType()).getClassDesc()).getSymbol()).compareTo(classname)==0){ - fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); - } - } - //System.out.println("new flag : "+fstemp.getTextLabel()); - tempset.add(fstemp); - } - result.add(tempset); - continue; // avoid queueing the return node if reachable - } - }else if (fn1.kind()==FKind.FlatReturnNode) { - //*** - //System.out.println("RETURN NODE REACHABLE WITHOUT TASKEXITS"); - //*** - result.add(otd.flagstates); - } - - /* Queue other nodes past this one */ - for(int i=0;i "+tn2.getLabel()+";"); --- } --- } --- } ---} diff --cc Robust/src/Analysis/TaskStateAnalysis/TEdge.java index bd54738b,bd54738b,bd54738b,bd54738b,84e00c8d,84e00c8d,84e00c8d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TEdge.java +++ /dev/null @@@@@@@@ -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import IR.*; -------import Analysis.TaskStateAnalysis.*; -------import IR.Tree.*; -------import IR.Flat.*; -------import java.util.*; -------import Util.Edge; ------- ------- ---- public class TEdge extends Edge{ ---- ---- public TEdge(TaskNode target){ ---- super(target); ---- } ---- ---- public int hashCode(){ ---- return target.hashCode(); ---- } ---- ---- ---- public boolean equals(Object o) { ---- if (o instanceof TEdge) { ---- TEdge e=(TEdge)o; ---- return e.target.equals(target); ---- } ---- return false; ---public class TEdge extends Edge { --- --- public TEdge(TaskNode target) { --- super(target); --- } --- --- public int hashCode() { --- return target.hashCode(); --- } --- --- --- public boolean equals(Object o) { --- if (o instanceof TEdge) { --- TEdge e=(TEdge)o; --- return e.target.equals(target); ------- } --- return false; --- } ------- ---- --- -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java index 93840a16,82f3d713,82f3d713,e1f0613b,2d8b8fd7,2d8b8fd7,2d8b8fd7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java +++ /dev/null @@@@@@@@ -1,223 -1,223 -1,223 -1,229 -1,229 -1,229 -1,229 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; ------- -------import java.util.Hashtable; -------import java.util.Stack; -------import java.util.Set; -------import java.util.HashSet; -------import java.util.Iterator; -------import java.util.Arrays; ----import java.util.Vector; ---- -------import Util.Edge; -------import Analysis.CallGraph.CallGraph; -------import IR.SymbolTable; -------import IR.State; -------import IR.TagDescriptor; -------import IR.TaskDescriptor; -------import IR.MethodDescriptor; -------import IR.Flat.*; ------- -------public class TagAnalysis { ---- State state; ---- Hashtable flagmap; ---- Stack tovisit; ---- Hashtable discovered; ---- Hashtable tasktotagbindings; ---- Hashtable tasktoflagstates; ---- CallGraph callgraph; --- State state; --- Hashtable flagmap; --- Stack tovisit; --- Hashtable discovered; --- Hashtable tasktotagbindings; --- Hashtable tasktoflagstates; --- CallGraph callgraph; ------- ---- public TagAnalysis(State state, CallGraph callgraph) { ---- this.state=state; ---- this.flagmap=new Hashtable(); ---- this.discovered=new Hashtable(); ---- this.tovisit=new Stack(); ---- this.tasktoflagstates=new Hashtable(); ---- this.tasktotagbindings=new Hashtable(); ---- this.callgraph=callgraph; ---- doAnalysis(); ---- } --- public TagAnalysis(State state, CallGraph callgraph) { --- this.state=state; --- this.flagmap=new Hashtable(); --- this.discovered=new Hashtable(); --- this.tovisit=new Stack(); --- this.tasktoflagstates=new Hashtable(); --- this.tasktotagbindings=new Hashtable(); --- this.callgraph=callgraph; --- doAnalysis(); --- } ------- ---- public Set getFlagStates(TaskDescriptor task) { ---- return (Set)tasktoflagstates.get(task); ---- } --- public Set getFlagStates(TaskDescriptor task) { --- return (Set)tasktoflagstates.get(task); --- } ------- ---- private void doAnalysis() { ---- Set rootset=computeRootSet(); ---- computeTagBindings(rootset); ---- TagBinding.SCC scc=TagBinding.DFS.computeSCC(discovered.keySet()); ---- for(int i=0;i targetFStates = ffan.getTargetFStates4NewObj(ffantemp.getType().getClassDesc()); ---- FlagState fs=new FlagState(ffantemp.getType().getClassDesc()); ---- for(Iterator it=ffan.getTempFlagPairs();it.hasNext();) { ---- TempFlagPair tfp=(TempFlagPair)it.next(); ---- if (ffan.getFlagChange(tfp)) ---- fs=fs.setFlag(tfp.getFlag(), true); ---- else ---- fs=fs.setFlag(tfp.getFlag(), false); ---- } ---- ---- HashSet fsset=new HashSet(); ---- fsset.add(fs); --- Iterator it=ffan.getTempFlagPairs(); --- if (it.hasNext()) { --- TempFlagPair tfp=(TempFlagPair)it.next(); --- ffantemp=tfp.getTemp(); --- } else { --- it=ffan.getTempTagPairs(); --- if (!it.hasNext()) --- throw new Error(); --- TempTagPair ttp=(TempTagPair)it.next(); --- ffantemp=ttp.getTemp(); --- } --- } --- Vector targetFStates = ffan.getTargetFStates4NewObj(ffantemp.getType().getClassDesc()); --- FlagState fs=new FlagState(ffantemp.getType().getClassDesc()); --- for(Iterator it=ffan.getTempFlagPairs(); it.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it.next(); --- if (ffan.getFlagChange(tfp)) --- fs=fs.setFlag(tfp.getFlag(), true); --- else --- fs=fs.setFlag(tfp.getFlag(), false); --- } ------- ---- for(Iterator it=ffan.getTempTagPairs();it.hasNext();) { ---- HashSet oldfsset=fsset; ---- fsset=new HashSet(); ---- ---- TempTagPair ttp=(TempTagPair)it.next(); ---- if (ffan.getTagChange(ttp)) { ---- TagDescriptor tag=ttp.getTag(); ---- if (tag==null&¶mmap!=null&¶mmap.containsKey(ttp.getTagTemp())) { ---- tag=(TagDescriptor)parammap.get(ttp.getTagTemp()); ---- } ---- for(Iterator setit=oldfsset.iterator();setit.hasNext();) { ---- FlagState fs2=(FlagState)setit.next(); ---- fsset.addAll(Arrays.asList(fs2.setTag(tag))); ---- } ---- } else ---- throw new Error("Don't clear tag in new object allocation"); ---- } --- HashSet fsset=new HashSet(); --- fsset.add(fs); ------- ---- for(Iterator setit=fsset.iterator();setit.hasNext();) { ---- FlagState fs2=(FlagState)setit.next(); ---- if (!flagmap.containsKey(fs2)) ---- flagmap.put(fs2,fs2); ---- else ---- fs2=(FlagState) flagmap.get(fs2); ---- newflags.add(fs2); - if(!targetFStates.contains(fs2)) { - targetFStates.addElement(fs2); - } ---- } --- for(Iterator it=ffan.getTempTagPairs(); it.hasNext();) { --- HashSet oldfsset=fsset; --- fsset=new HashSet(); --- --- TempTagPair ttp=(TempTagPair)it.next(); --- if (ffan.getTagChange(ttp)) { --- TagDescriptor tag=ttp.getTag(); --- if (tag==null&¶mmap!=null&¶mmap.containsKey(ttp.getTagTemp())) { --- tag=(TagDescriptor)parammap.get(ttp.getTagTemp()); --- } --- for(Iterator setit=oldfsset.iterator(); setit.hasNext();) { --- FlagState fs2=(FlagState)setit.next(); --- fsset.addAll(Arrays.asList(fs2.setTag(tag))); --- } --- } else --- throw new Error("Don't clear tag in new object allocation"); --- } --- --- for(Iterator setit=fsset.iterator(); setit.hasNext();) { --- FlagState fs2=(FlagState)setit.next(); --- if (!flagmap.containsKey(fs2)) --- flagmap.put(fs2,fs2); --- else --- fs2=(FlagState) flagmap.get(fs2); --- newflags.add(fs2); --- if(!targetFStates.contains(fs2)) { --- targetFStates.addElement(fs2); ------- } --- } ------- } --- } ------- } ---- } ---- ---- private void computeTagBindings(Set roots) { ---- tovisit.addAll(roots); - --- ---- for(Iterator it=roots.iterator();it.hasNext();) { ---- TagBinding tb=(TagBinding)it.next(); ---- discovered.put(tb,tb); ---- } --- } ------- ---- while(!tovisit.empty()) { ---- TagBinding tb=(TagBinding) tovisit.pop(); ---- MethodDescriptor md=tb.getMethod(); ---- FlatMethod fm=state.getMethodFlat(md); ---- /* Build map from temps -> tagdescriptors */ ---- Hashtable parammap=new Hashtable(); ---- int offset=md.isStatic()?0:1; --- private void computeTagBindings(Set roots) { --- tovisit.addAll(roots); ------- --- for(Iterator it=roots.iterator(); it.hasNext();) { --- TagBinding tb=(TagBinding)it.next(); --- discovered.put(tb,tb); --- } ------- ---- for(int i=0;i=0) { ---- TagDescriptor tag=tb.getBinding(offsetindex); --- while(!tovisit.empty()) { --- TagBinding tb=(TagBinding) tovisit.pop(); --- MethodDescriptor md=tb.getMethod(); --- FlatMethod fm=state.getMethodFlat(md); --- /* Build map from temps -> tagdescriptors */ --- Hashtable parammap=new Hashtable(); --- int offset=md.isStatic() ? 0 : 1; ------- ---- if (tag!=null) { ---- parammap.put(temp,tag); ---- } ---- } ---- } ------- ---- HashSet newtags=new HashSet(); ---- ---- computeCallsFlags(fm, parammap, newtags, tb.getAllocations()); --- for(int i=0; i=0) { --- TagDescriptor tag=tb.getBinding(offsetindex); ------- ---- for(Iterator tagit=newtags.iterator();tagit.hasNext();) { ---- TagBinding newtag=(TagBinding)tagit.next(); ---- Edge e=new Edge(newtag); ---- tb.addEdge(e); ---- } --- if (tag!=null) { --- parammap.put(temp,tag); --- } ------- } --- } --- --- HashSet newtags=new HashSet(); --- --- computeCallsFlags(fm, parammap, newtags, tb.getAllocations()); --- --- for(Iterator tagit=newtags.iterator(); tagit.hasNext();) { --- TagBinding newtag=(TagBinding)tagit.next(); --- Edge e=new Edge(newtag); --- tb.addEdge(e); --- } ------- } --- } -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/TagBinding.java index e7360b96,e7360b96,e7360b96,e7360b96,adc81a5a,adc81a5a,adc81a5a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TagBinding.java +++ /dev/null @@@@@@@@ -1,66 -1,66 -1,66 -1,66 -1,66 -1,66 -1,66 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import IR.MethodDescriptor; -------import IR.TagDescriptor; -------import Util.GraphNode; -------import java.util.HashSet; -------import java.util.Set; ------- -------public class TagBinding extends GraphNode { ---- private MethodDescriptor md; ---- private TagDescriptor[] tdarray; ---- private HashSet allocations; --- private MethodDescriptor md; --- private TagDescriptor[] tdarray; --- private HashSet allocations; ------- ---- public TagBinding(MethodDescriptor md) { ---- this.md=md; ---- tdarray=new TagDescriptor[md.numParameters()]; ---- allocations=new HashSet(); ---- } --- public TagBinding(MethodDescriptor md) { --- this.md=md; --- tdarray=new TagDescriptor[md.numParameters()]; --- allocations=new HashSet(); --- } ------- ---- public String toString() { ---- String st=md.toString(); ---- for(int i=0;i toprocess; ---- TagAnalysis taganalysis; ---- Hashtable cdtorootnodes; --- Hashtable tdToFEdges; --- State state; --- Hashtable flagstates; --- Hashtable flags; --- Hashtable extern_flags; --- Queue toprocess; --- TagAnalysis taganalysis; --- Hashtable cdtorootnodes; --- Hashtable tdToFEdges; ------- ---- TypeUtil typeutil; --- TypeUtil typeutil; ------- ---- /** ---- * Class Constructor ---- * ---- * @param state a flattened State object ---- * @see State ---- */ - public TaskAnalysis(State state, TagAnalysis taganalysis) - { --- public TaskAnalysis(State state, TagAnalysis taganalysis) { ---- this.state=state; ---- this.typeutil=new TypeUtil(state); ---- this.taganalysis=taganalysis; - ---- } ---- - /** Builds a table of flags for each class in the Bristlecone program. - * It creates two hashtables: one which holds the ClassDescriptors and arrays of - * FlagDescriptors as key-value pairs; the other holds the ClassDescriptor and the - * number of external flags for that specific class. --- /** Builds a table of flags for each class in the Bristlecone --- * program. It creates two hashtables: one which holds the --- * ClassDescriptors and arrays of * FlagDescriptors as key-value --- * pairs; the other holds the ClassDescriptor and the * number of --- * external flags for that specific class. --- /** --- * Class Constructor --- * --- * @param state a flattened State object --- * @see State --- */ --- public TaskAnalysis(State state, TagAnalysis taganalysis) { --- this.state=state; --- this.typeutil=new TypeUtil(state); --- this.taganalysis=taganalysis; --- } --- --- /** Builds a table of flags for each class in the Bristlecone --- * program. It creates two hashtables: one which holds the --- * ClassDescriptors and arrays of * FlagDescriptors as key-value --- * pairs; the other holds the ClassDescriptor and the * number of --- * external flags for that specific class. --- */ --- --- private void getFlagsfromClasses() { --- flags=new Hashtable(); --- extern_flags = new Hashtable(); --- --- /** Iterate through the classes used in the program to build --- * the table of flags ------- */ --- for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator(); it_classes.hasNext();) { ------- ---- private void getFlagsfromClasses() { ---- flags=new Hashtable(); ---- extern_flags = new Hashtable(); ---- - /** Iterate through the classes used in the program to build the table of flags --- /** Iterate through the classes used in the program to build --- * the table of flags ---- */ ---- for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { ---- ---- ClassDescriptor cd = (ClassDescriptor)it_classes.next(); ---- Vector vFlags=new Vector(); ---- FlagDescriptor flag[]; ---- int ctr=0; ---- ---- ---- /* Adding the flags of the super class */ - if (cd.getSuper()!=null) { - ClassDescriptor superdesc=cd.getSuperDesc(); - - for(Iterator it_cflags=superdesc.getFlags();it_cflags.hasNext();) { --- ClassDescriptor tmp=cd; --- while(tmp!=null) { --- for(Iterator it_cflags=tmp.getFlags();it_cflags.hasNext();) { ---- FlagDescriptor fd = (FlagDescriptor)it_cflags.next(); ---- vFlags.add(fd); ---- } --- tmp=tmp.getSuperDesc(); ---- } --- ClassDescriptor cd = (ClassDescriptor)it_classes.next(); --- Vector vFlags=new Vector(); --- FlagDescriptor flag[]; --- int ctr=0; ------- - for(Iterator it_cflags=cd.getFlags();it_cflags.hasNext();) { - FlagDescriptor fd = (FlagDescriptor)it_cflags.next(); - vFlags.add(fd); - } ------- ---- if (vFlags.size()!=0) { ---- flag=new FlagDescriptor[vFlags.size()]; ---- ---- for(int i=0;i < vFlags.size() ; i++) { ---- if (((FlagDescriptor)vFlags.get(i)).getExternal()) { ---- flag[ctr]=(FlagDescriptor)vFlags.get(i); ---- vFlags.remove(flag[ctr]); ---- ctr++; ---- } ---- } ---- for(int i=0;i < vFlags.size() ; i++) { ---- flag[i+ctr]=(FlagDescriptor)vFlags.get(i); ---- } ---- extern_flags.put(cd,new Integer(ctr)); ---- flags.put(cd,flag); ---- ---- } --- /* Adding the flags of the super class */ --- ClassDescriptor tmp=cd; --- while(tmp!=null) { --- for(Iterator it_cflags=tmp.getFlags(); it_cflags.hasNext();) { --- FlagDescriptor fd = (FlagDescriptor)it_cflags.next(); --- vFlags.add(fd); ------- } ---- } - /** Method which starts up the analysis - * --- /** Method which starts up the analysis ---- */ ---- ---- public void taskAnalysis() throws java.io.IOException { ---- flagstates=new Hashtable(); ---- Hashtable sourcenodes; ---- cdtorootnodes=new Hashtable(); --- tdToFEdges=new Hashtable(); ---- ---- getFlagsfromClasses(); ---- ---- int externs; ---- toprocess=new LinkedList(); ---- ---- for(Iterator it_classes=(Iterator)flags.keys();it_classes.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor)it_classes.next(); ---- externs=((Integer)extern_flags.get(cd)).intValue(); ---- FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); ---- flagstates.put(cd,new Hashtable()); ---- cdtorootnodes.put(cd,new Vector()); ---- } ---- ---- ---- ClassDescriptor startupobject=typeutil.getClass(TypeUtil.StartupClass); ---- ---- sourcenodes=(Hashtable)flagstates.get(startupobject); ---- FlagState fsstartup=new FlagState(startupobject); ---- ---- ---- FlagDescriptor[] fd=(FlagDescriptor[])flags.get(startupobject); ---- ---- fsstartup=fsstartup.setFlag(fd[0],true); ---- fsstartup.setAsSourceNode(); ---- ((Vector)cdtorootnodes.get(startupobject)).add(fsstartup); --- tmp=tmp.getSuperDesc(); --- } ------- ---- sourcenodes.put(fsstartup,fsstartup); ---- toprocess.add(fsstartup); ---- - /** Looping through the flagstates in the toprocess queue to perform the state analysis */ --- /** Looping through the flagstates in the toprocess queue to --- * perform the state analysis */ ---- while (!toprocess.isEmpty()) { ---- FlagState trigger=toprocess.poll(); ---- createPossibleRuntimeStates(trigger); ---- ---- analyseTasks(trigger); --- --- if (vFlags.size()!=0) { --- flag=new FlagDescriptor[vFlags.size()]; --- --- for(int i=0; i < vFlags.size() ; i++) { --- if (((FlagDescriptor)vFlags.get(i)).getExternal()) { --- flag[ctr]=(FlagDescriptor)vFlags.get(i); --- vFlags.remove(flag[ctr]); --- ctr++; --- } ------- } ---- ---- /** Creating DOT files */ ---- Enumeration e=flagstates.keys(); ---- ---- while (e.hasMoreElements()) { ---- ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); ---- createDOTfile(cdtemp); --- for(int i=0; i < vFlags.size() ; i++) { --- flag[i+ctr]=(FlagDescriptor)vFlags.get(i); ------- } --- extern_flags.put(cd,new Integer(ctr)); --- flags.put(cd,flag); --- --- } ------- } ---- ---- ---- /** Analyses the set of tasks based on the given flagstate, checking ---- * to see which tasks are triggered and what new flagstates are created ---- * from the base flagstate. ---- * @param fs A FlagState object which is used to analyse the task ---- * @see FlagState ---- */ --- } --- /** Method which starts up the analysis --- */ ------- ---- private void analyseTasks(FlagState fs) { --- public void taskAnalysis() throws java.io.IOException { --- flagstates=new Hashtable(); --- Hashtable sourcenodes; --- cdtorootnodes=new Hashtable(); --- tdToFEdges=new Hashtable(); --- --- getFlagsfromClasses(); --- --- int externs; --- toprocess=new LinkedList(); --- --- for(Iterator it_classes=(Iterator)flags.keys(); it_classes.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor)it_classes.next(); --- externs=((Integer)extern_flags.get(cd)).intValue(); --- FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); --- flagstates.put(cd,new Hashtable()); --- cdtorootnodes.put(cd,new Vector()); --- } --- --- --- ClassDescriptor startupobject=typeutil.getClass(TypeUtil.StartupClass); --- --- sourcenodes=(Hashtable)flagstates.get(startupobject); --- FlagState fsstartup=new FlagState(startupobject); --- --- --- FlagDescriptor[] fd=(FlagDescriptor[])flags.get(startupobject); --- --- fsstartup=fsstartup.setFlag(fd[0],true); --- fsstartup.setAsSourceNode(); --- ((Vector)cdtorootnodes.get(startupobject)).add(fsstartup); --- --- sourcenodes.put(fsstartup,fsstartup); --- toprocess.add(fsstartup); --- --- /** Looping through the flagstates in the toprocess queue to --- * perform the state analysis */ --- while (!toprocess.isEmpty()) { --- FlagState trigger=toprocess.poll(); --- createPossibleRuntimeStates(trigger); --- --- analyseTasks(trigger); --- } --- --- /** Creating DOT files */ --- Enumeration e=flagstates.keys(); --- --- while (e.hasMoreElements()) { --- ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); --- createDOTfile(cdtemp); --- } --- } --- --- --- /** Analyses the set of tasks based on the given flagstate, checking --- * to see which tasks are triggered and what new flagstates are created --- * from the base flagstate. --- * @param fs A FlagState object which is used to analyse the task --- * @see FlagState --- */ --- --- private void analyseTasks(FlagState fs) { ------- ClassDescriptor cd=fs.getClassDescriptor(); ------- Hashtable sourcenodes=(Hashtable)flagstates.get(cd); ---- ---- for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();) { ---- TaskDescriptor td = (TaskDescriptor)it_tasks.next(); ---- String taskname=td.getSymbol(); ---- - /** counter to keep track of the number of parameters (of the task being analyzed) that - * are satisfied by the flagstate. --- if(!tdToFEdges.containsKey(td)) { --- tdToFEdges.put(td, new Vector()); --- --- for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator(); it_tasks.hasNext();) { --- TaskDescriptor td = (TaskDescriptor)it_tasks.next(); --- String taskname=td.getSymbol(); --- --- if(!tdToFEdges.containsKey(td)) { --- tdToFEdges.put(td, new Vector()); --- } --- --- /** counter to keep track of the number of parameters (of the --- * task being analyzed) that are satisfied by the flagstate. --- */ --- int trigger_ctr=0; --- TempDescriptor temp=null; --- FlatMethod fm = state.getMethodFlat(td); --- int parameterindex=0; --- --- for(int i=0; i < td.numParameters(); i++) { --- FlagExpressionNode fen=td.getFlag(td.getParameter(i)); --- TagExpressionList tel=td.getTag(td.getParameter(i)); --- --- /** Checking to see if the parameter is of the same --- * type/class as the flagstate's and also if the --- * flagstate fs triggers the given task*/ --- --- if (typeutil.isSuperorType(td.getParamType(i).getClassDesc(),cd) --- && isTaskTrigger_flag(fen,fs) --- && isTaskTrigger_tag(tel,fs)) { --- temp=fm.getParameter(i); --- parameterindex=i; --- trigger_ctr++; ------ } --- } ------ --- /** counter to keep track of the number of parameters (of the --- * task being analyzed) that are satisfied by the flagstate. ---- */ ---- int trigger_ctr=0; ---- TempDescriptor temp=null; ---- FlatMethod fm = state.getMethodFlat(td); - --- int parameterindex=0; --- if (trigger_ctr==0) //Look at next task --- continue; ------ ---- for(int i=0; i < td.numParameters(); i++) { ---- FlagExpressionNode fen=td.getFlag(td.getParameter(i)); ---- TagExpressionList tel=td.getTag(td.getParameter(i)); ---- - /** Checking to see if the parameter is of the same type/class as the - * flagstate's and also if the flagstate fs triggers the given task*/ --- /** Checking to see if the parameter is of the same --- * type/class as the flagstate's and also if the --- * flagstate fs triggers the given task*/ --- if (trigger_ctr>1) --- System.out.println("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task:"+fs + " in "+td); ------ ---- if (typeutil.isSuperorType(td.getParamType(i).getClassDesc(),cd) ---- && isTaskTrigger_flag(fen,fs) ---- && isTaskTrigger_tag(tel,fs)) { ---- temp=fm.getParameter(i); --- parameterindex=i; ---- trigger_ctr++; ---- } --- --- Set newstates=taganalysis.getFlagStates(td); --- for(Iterator fsit=newstates.iterator(); fsit.hasNext();) { --- FlagState fsnew=(FlagState) fsit.next(); --- System.out.println("SOURCE:"+fsnew); --- --- if (!((Hashtable)flagstates.get(fsnew.getClassDescriptor())).containsKey(fsnew)) { --- ((Hashtable)flagstates.get(fsnew.getClassDescriptor())).put(fsnew, fsnew); --- toprocess.add(fsnew); --- } else { --- fsnew=((Hashtable)flagstates.get(fsnew.getClassDescriptor())).get(fsnew); ------- } ---- ---- if (trigger_ctr==0) //Look at next task ---- continue; ---- ---- if (trigger_ctr>1) - throw new Error("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task."); --- System.out.println("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task:"+fs + " in "+td); ---- ---- ---- Set newstates=taganalysis.getFlagStates(td); ---- for(Iterator fsit=newstates.iterator();fsit.hasNext();) { ---- FlagState fsnew=(FlagState) fsit.next(); - fsnew.setAsSourceNode(); - fsnew.addAllocatingTask(td); - ((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).add(fsnew); --- System.out.println("SOURCE:"+fsnew); ---- ---- if (! ((Hashtable)flagstates.get(fsnew.getClassDescriptor())).containsKey(fsnew)) { ---- ((Hashtable)flagstates.get(fsnew.getClassDescriptor())).put(fsnew, fsnew); ---- toprocess.add(fsnew); --- } else { --- fsnew=((Hashtable)flagstates.get(fsnew.getClassDescriptor())).get(fsnew); ---- } --- fsnew.setAsSourceNode(); --- fsnew.addAllocatingTask(td); --- fsnew.setAsSourceNode(); --- fsnew.addAllocatingTask(td); ------ -- ((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).add(fsnew); - if(!((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).contains(fsnew)) { - ((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).add(fsnew); - } --- if(!((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).contains(fsnew)) { --- ((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).add(fsnew); ------- } ---- ---- Stack nodestack=new Stack(); ---- HashSet discovered=new HashSet(); ---- nodestack.push(fm); ---- discovered.add(fm); ---- //Iterating through the nodes ---- ---- while(!nodestack.isEmpty()) { ---- FlatNode fn1 = (FlatNode) nodestack.pop(); ---- ---- if (fn1.kind()==FKind.FlatReturnNode) { ---- /* Self edge */ - FEdge newedge=new FEdge(fs, taskname); --- FEdge newedge=new FEdge(fs, taskname, td, parameterindex); --- ((Vector)tdToFEdges.get(td)).add(newedge); ---- fs.addEdge(newedge); ---- continue; ---- } else if (fn1.kind()==FKind.FlatFlagActionNode) { ---- FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; ---- if (ffan.getTaskType() == FlatFlagActionNode.PRE) { ---- if (ffan.getTempFlagPairs().hasNext()||ffan.getTempTagPairs().hasNext()) ---- throw new Error("PRE FlagActions not supported"); ---- ---- } else if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { ---- Vector fsv_taskexit=evalTaskExitNode(ffan,cd,fs,temp); - Vector initFStates = ffan.getInitFStates(temp.getType().getClassDesc()); - if(!initFStates.contains(fs)) { - initFStates.addElement(fs); - } - Vector targetFStates = ffan.getTargetFStates(fs); ---- for(Enumeration en=fsv_taskexit.elements();en.hasMoreElements();){ ---- FlagState fs_taskexit=(FlagState)en.nextElement(); ---- if (!sourcenodes.containsKey(fs_taskexit)) { ---- toprocess.add(fs_taskexit); ---- } ---- //seen this node already ---- fs_taskexit=canonicalizeFlagState(sourcenodes,fs_taskexit); - FEdge newedge=new FEdge(fs_taskexit,taskname); --- FEdge newedge=new FEdge(fs_taskexit,taskname, td, parameterindex); --- ((Vector)tdToFEdges.get(td)).add(newedge); ---- fs.addEdge(newedge); - - if(!targetFStates.contains(fs_taskexit)) { - targetFStates.addElement(fs_taskexit); - } ---- } ---- continue; ---- } --- } --- --- Stack nodestack=new Stack(); --- HashSet discovered=new HashSet(); --- nodestack.push(fm); --- discovered.add(fm); --- //Iterating through the nodes --- --- while(!nodestack.isEmpty()) { --- FlatNode fn1 = (FlatNode) nodestack.pop(); --- --- if (fn1.kind()==FKind.FlatReturnNode) { --- /* Self edge */ --- FEdge newedge=new FEdge(fs, taskname, td, parameterindex); --- ((Vector)tdToFEdges.get(td)).add(newedge); --- fs.addEdge(newedge); - newedge.setisbackedge(true); --- continue; --- } else if (fn1.kind()==FKind.FlatFlagActionNode) { --- FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; --- if (ffan.getTaskType() == FlatFlagActionNode.PRE) { --- if (ffan.getTempFlagPairs().hasNext()||ffan.getTempTagPairs().hasNext()) --- throw new Error("PRE FlagActions not supported"); --- --- } else if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { --- Vector fsv_taskexit=evalTaskExitNode(ffan,cd,fs,temp); --- Vector initFStates = ffan.getInitFStates(temp.getType().getClassDesc()); --- if(!initFStates.contains(fs)) { --- initFStates.addElement(fs); ------- } ---- /* Queue other nodes past this one */ ---- for(int i=0;i targetFStates = ffan.getTargetFStates(fs); - for(Enumeration en=fsv_taskexit.elements(); en.hasMoreElements();){ -- for(Enumeration en=fsv_taskexit.elements(); en.hasMoreElements();) { --- FlagState fs_taskexit=(FlagState)en.nextElement(); --- if (!sourcenodes.containsKey(fs_taskexit)) { --- toprocess.add(fs_taskexit); --- } --- //seen this node already --- fs_taskexit=canonicalizeFlagState(sourcenodes,fs_taskexit); --- FEdge newedge=new FEdge(fs_taskexit,taskname, td, parameterindex); - newedge.setTaskExitIndex(ffan.getTaskExitIndex()); --- ((Vector)tdToFEdges.get(td)).add(newedge); --- fs.addEdge(newedge); --- --- if(!targetFStates.contains(fs_taskexit)) { --- targetFStates.addElement(fs_taskexit); --- } ------- } --- continue; --- } --- } --- /* Queue other nodes past this one */ --- for(int i=0; itrue if fs satisfies the boolean expression ------- denoted by fen else false. ------- */ ------- ------- -- private boolean isTaskTrigger_flag(FlagExpressionNode fen,FlagState fs) { -- public static boolean isTaskTrigger_flag(FlagExpressionNode fen,FlagState fs) { --- public static boolean isTaskTrigger_flag(FlagExpressionNode fen,FlagState fs) { ------- if (fen==null) ---- return true; --- return true; ------- else if (fen instanceof FlagNode) ---- return fs.get(((FlagNode)fen).getFlag()); --- return fs.get(((FlagNode)fen).getFlag()); ------- else ---- switch (((FlagOpNode)fen).getOp().getOp()) { ---- case Operation.LOGIC_AND: ---- return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) && (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); ---- case Operation.LOGIC_OR: ---- return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) || (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); ---- case Operation.LOGIC_NOT: ---- return !(isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)); ---- default: ---- return false; ---- } ---- } --- switch (((FlagOpNode)fen).getOp().getOp()) { --- case Operation.LOGIC_AND: --- return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) && (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); ------- ---- private boolean isTaskTrigger_tag(TagExpressionList tel, FlagState fs){ ---- ---- if (tel!=null){ ---- for (int i=0;i evalTaskExitNode(FlatFlagActionNode ffan,ClassDescriptor cd,FlagState fs, TempDescriptor temp){ ---- FlagState fstemp=fs; ---- Vector processed=new Vector(); --- default: --- return false; --- } --- } ------- ---- //Process the flag changes ---- ---- for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { ---- TempFlagPair tfp=(TempFlagPair)it_tfp.next(); ---- if (temp==tfp.getTemp()) ---- fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); ---- } ---- ---- //Process the tag changes --- private boolean isTaskTrigger_tag(TagExpressionList tel, FlagState fs) { ------- ---- processed.add(fstemp); ---- ---- //Process clears first ---- for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { ---- TempTagPair ttp=(TempTagPair)it_ttp.next(); ---- ---- if (temp==ttp.getTemp()) { ---- Vector oldprocess=processed; ---- processed=new Vector(); - if (tel!=null){ - for (int i=0; i oldprocess=processed; ---- processed=new Vector(); --- } --- } --- return true; --- } ------- ---- for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ ---- FlagState fsworking=(FlagState)en.nextElement(); ---- if (ffan.getTagChange(ttp)){ ---- processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); ---- } else processed.add(fsworking); ---- } ---- } ---- } ---- return processed; ---- } ---- ------- ---- private FlagState canonicalizeFlagState(Hashtable sourcenodes, FlagState fs){ ---- if (sourcenodes.containsKey(fs)) ---- return (FlagState)sourcenodes.get(fs); ---- else{ ---- sourcenodes.put(fs,fs); ---- return fs; --- private Vector evalTaskExitNode(FlatFlagActionNode ffan,ClassDescriptor cd,FlagState fs, TempDescriptor temp) { --- FlagState fstemp=fs; --- Vector processed=new Vector(); --- --- //Process the flag changes --- --- for(Iterator it_tfp=ffan.getTempFlagPairs(); it_tfp.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it_tfp.next(); --- if (temp==tfp.getTemp()) --- fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); --- } --- --- //Process the tag changes --- --- processed.add(fstemp); --- --- //Process clears first --- for(Iterator it_ttp=ffan.getTempTagPairs(); it_ttp.hasNext();) { --- TempTagPair ttp=(TempTagPair)it_ttp.next(); --- --- if (temp==ttp.getTemp()) { --- Vector oldprocess=processed; --- processed=new Vector(); --- - for (Enumeration en=oldprocess.elements(); en.hasMoreElements();){ -- for (Enumeration en=oldprocess.elements(); en.hasMoreElements();) { --- FlagState fsworking=(FlagState)en.nextElement(); - if (!ffan.getTagChange(ttp)){ -- if (!ffan.getTagChange(ttp)) { --- processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag()))); --- } else processed.add(fsworking); ------- } --- } ------- } --- //Process sets next --- for(Iterator it_ttp=ffan.getTempTagPairs(); it_ttp.hasNext();) { --- TempTagPair ttp=(TempTagPair)it_ttp.next(); ------- ---- /** Creates a DOT file using the flagstates for a given class ---- * @param cd ClassDescriptor of the class ---- * @throws java.io.IOException ---- * @see ClassDescriptor ---- */ ---- ---- public void createDOTfile(ClassDescriptor cd) throws java.io.IOException { ---- File dotfile_flagstates= new File("graph"+cd.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,true); --- FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); ---- FlagState.DOTVisitor.visit(dotstream,((Hashtable)flagstates.get(cd)).values()); --- if (temp==ttp.getTemp()) { --- Vector oldprocess=processed; --- processed=new Vector(); --- - for (Enumeration en=oldprocess.elements(); en.hasMoreElements();){ -- for (Enumeration en=oldprocess.elements(); en.hasMoreElements();) { --- FlagState fsworking=(FlagState)en.nextElement(); - if (ffan.getTagChange(ttp)){ -- if (ffan.getTagChange(ttp)) { --- processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); --- } else processed.add(fsworking); --- } --- } ------- } --- return processed; --- } ------- ---- /** Returns the flag states for the class descriptor. */ - public Set getFlagStates(ClassDescriptor cd) { --- public Set getFlagStates(ClassDescriptor cd) { ---- if (flagstates.containsKey(cd)) - return ((Hashtable)flagstates.get(cd)).keySet(); --- return ((Hashtable)flagstates.get(cd)).keySet(); ---- else - return null; --- return new HashSet(); --- --- private FlagState canonicalizeFlagState(Hashtable sourcenodes, FlagState fs) { --- if (sourcenodes.containsKey(fs)) --- return (FlagState)sourcenodes.get(fs); - else{ -- else { --- sourcenodes.put(fs,fs); --- return fs; ------- } --- } ------- --- /** Creates a DOT file using the flagstates for a given class --- * @param cd ClassDescriptor of the class --- * @throws java.io.IOException --- * @see ClassDescriptor --- */ ------- ---- private void createPossibleRuntimeStates(FlagState fs) { --- public void createDOTfile(ClassDescriptor cd) throws java.io.IOException { --- File dotfile_flagstates= new File("graph"+cd.getSymbol()+".dot"); --- FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); --- FlagState.DOTVisitor.visit(dotstream,((Hashtable)flagstates.get(cd)).values()); --- } --- --- /** Returns the flag states for the class descriptor. */ --- public Set getFlagStates(ClassDescriptor cd) { --- if (flagstates.containsKey(cd)) --- return ((Hashtable)flagstates.get(cd)).keySet(); --- else --- return new HashSet(); --- } --- --- --- private void createPossibleRuntimeStates(FlagState fs) { - --- ClassDescriptor cd = fs.getClassDescriptor(); - --- Hashtable sourcenodes=(Hashtable)flagstates.get(cd); - FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); --- FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); - --- int externs=((Integer)extern_flags.get(cd)).intValue(); - --- - --- if(externs==0) - return; --- return; - --- - --- int noOfIterations=(1< sourcenodes=(Hashtable)flagstates.get(cd); --- FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); --- int externs=((Integer)extern_flags.get(cd)).intValue(); ---- - FlagState fstemp=fs; --- if(externs==0) --- return; ---- - for(int i=0; i < externs;i++) { - fstemp=fstemp.setFlag(fd[i],BoolValTable[i]); - } - if (!sourcenodes.containsKey(fstemp)) - toprocess.add(fstemp); --- for(int k=0; k alltasknodes; ---- ---- //Colors ---- String colors[]={"red","blue","green","brown","orange","pink","black","grey","olivedrab","yellow"}; --- TaskAnalysis taskanalysis; --- State state; --- Hashtable cdtonodes; --- Hashtable nodes; --- Hashtable alltasknodes; ------- ---- public TaskGraph(State state, TaskAnalysis taskanalysis) { ---- this.state=state; ---- this.taskanalysis=taskanalysis; ---- this.cdtonodes=new Hashtable(); ---- this.alltasknodes=new Hashtable(); --- //Colors --- String colors[]={"red","blue","green","brown","orange","pink","black","grey","olivedrab","yellow"}; ------- ---- for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor) classit.next(); ---- if (cd.hasFlags()) ---- produceTaskNodes(cd); ---- } ---- produceAllTaskNodes(); --- public TaskGraph(State state, TaskAnalysis taskanalysis) { --- this.state=state; --- this.taskanalysis=taskanalysis; --- this.cdtonodes=new Hashtable(); --- this.alltasknodes=new Hashtable(); --- --- for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); classit.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor) classit.next(); --- if (cd.hasFlags()) --- produceTaskNodes(cd); ------- } ---- ---- ---- public void createDOTfiles() { ---- for(Iterator it_classes=(Iterator)cdtonodes.keys();it_classes.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor) it_classes.next(); ---- Set tasknodes=getTaskNodes(cd); ---- if (tasknodes!=null) { ---- try { ---- File dotfile_tasknodes=new File("graph"+cd.getSymbol()+"_task.dot"); ---- FileOutputStream dotstream=new FileOutputStream(dotfile_tasknodes,true); ---- TaskNode.DOTVisitor.visit(dotstream,tasknodes); ---- } catch(Exception e) { ---- e.printStackTrace(); ---- throw new Error(); ---- } ---- } --- produceAllTaskNodes(); --- } --- --- --- public void createDOTfiles() { --- for(Iterator it_classes=(Iterator)cdtonodes.keys(); it_classes.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor) it_classes.next(); --- Set tasknodes=getTaskNodes(cd); --- if (tasknodes!=null) { --- try { --- File dotfile_tasknodes=new File("graph"+cd.getSymbol()+"_task.dot"); --- FileOutputStream dotstream=new FileOutputStream(dotfile_tasknodes,true); --- TaskNode.DOTVisitor.visit(dotstream,tasknodes); --- } catch(Exception e) { --- e.printStackTrace(); --- throw new Error(); ------- } --- } ------- } --- } ------- ---- /** Returns the set of TaskNodes for the class descriptor cd */ --- /** Returns the set of TaskNodes for the class descriptor cd */ ------- ---- public Set getTaskNodes(ClassDescriptor cd) { ---- if (cdtonodes.containsKey(cd)) ---- return ((Hashtable)cdtonodes.get(cd)).keySet(); ---- else ---- return null; --- public Set getTaskNodes(ClassDescriptor cd) { --- if (cdtonodes.containsKey(cd)) --- return ((Hashtable)cdtonodes.get(cd)).keySet(); --- else --- return null; --- } --- --- private TaskNode canonicalizeTaskNode(Hashtable nodes, TaskNode node) { --- if (nodes.containsKey(node)) --- return (TaskNode)nodes.get(node); - else{ -- else { --- nodes.put(node,node); --- return (TaskNode)node; ------- } --- } ------- ---- private TaskNode canonicalizeTaskNode(Hashtable nodes, TaskNode node){ ---- if (nodes.containsKey(node)) ---- return (TaskNode)nodes.get(node); ---- else{ ---- nodes.put(node,node); ---- return (TaskNode)node; --- private void produceTaskNodes(ClassDescriptor cd) { --- Set fsnodes=taskanalysis.getFlagStates(cd); --- if (fsnodes==null) --- return; --- --- Hashtable tasknodes=new Hashtable(); --- cdtonodes.put(cd, tasknodes); --- --- for(Iterator it=fsnodes.iterator(); it.hasNext();) { --- FlagState fs=(FlagState)it.next(); --- Iterator it_inedges=fs.inedges(); --- TaskNode tn,sn; --- --- if (fs.isSourceNode()) { --- Vector src=fs.getAllocatingTasks(); --- for(Iterator it2=src.iterator(); it2.hasNext();) { --- TaskDescriptor td=(TaskDescriptor)it2.next(); --- sn=new TaskNode(td.getSymbol()); - if(fs.edges().hasNext()){ -- if(fs.edges().hasNext()) { --- addEdges(fs,sn,tasknodes); --- } ------- } ---- } ---- ---- private void produceTaskNodes(ClassDescriptor cd) { ---- Set fsnodes=taskanalysis.getFlagStates(cd); ---- if (fsnodes==null) ---- return; ---- ---- Hashtable tasknodes=new Hashtable(); ---- cdtonodes.put(cd, tasknodes); --- } ------- ---- for(Iterator it=fsnodes.iterator();it.hasNext();) { ---- FlagState fs=(FlagState)it.next(); ---- Iterator it_inedges=fs.inedges(); ---- TaskNode tn,sn; ---- ---- if (fs.isSourceNode()) { - sn=new TaskNode("Start Node"); --- Vector src=fs.getAllocatingTasks(); --- for(Iterator it2=src.iterator();it2.hasNext();) { --- TaskDescriptor td=(TaskDescriptor)it2.next(); --- sn=new TaskNode(td.getSymbol()); ---- if(fs.edges().hasNext()){ ---- addEdges(fs,sn,tasknodes); ---- } --- } ---- } ---- ---- while(it_inedges.hasNext()){ ---- ---- FEdge inedge=(FEdge)it_inedges.next(); ---- tn=new TaskNode(inedge.getLabel()); ---- if(fs.edges().hasNext()){ ---- addEdges(fs,tn,tasknodes); ---- } ---- } - while(it_inedges.hasNext()){ -- while(it_inedges.hasNext()) { --- --- FEdge inedge=(FEdge)it_inedges.next(); --- tn=new TaskNode(inedge.getLabel()); - if(fs.edges().hasNext()){ -- if(fs.edges().hasNext()) { --- addEdges(fs,tn,tasknodes); ------- } --- } ------- } ---- ---- private void produceAllTaskNodes(){ ---- alltasknodes=new Hashtable(); ---- ---- for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();){ ---- TaskDescriptor td=(TaskDescriptor)it_tasks.next(); ---- TaskNode tn=new TaskNode(td.getSymbol()); ---- alltasknodes.put(tn,tn); ---- } ---- TaskNode tn_runtime=new TaskNode("Runtime"); ---- alltasknodes.put(tn_runtime,tn_runtime); ---- ---- int ColorID=0; ---- for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext()&&ColorID<10;) { ---- ClassDescriptor cd=(ClassDescriptor) classit.next(); ---- Set fsnodes; ---- ---- if (cd.hasFlags()&&((fsnodes=taskanalysis.getFlagStates(cd))!=null)){ ---- // ---- System.out.println("\nWorking on fses of Class: "+cd.getSymbol()); ---- // ---- for(Iterator it=fsnodes.iterator();it.hasNext();) { ---- FlagState fs=(FlagState)it.next(); ---- // ---- System.out.println("Evaluating fs: "+fs.getTextLabel()); ---- // ---- Iterator it_inedges=fs.inedges(); ---- TaskNode tn,sn; ---- ---- ---- if (fs.isSourceNode()){ ---- // ---- System.out.println("A sourcenode"); ---- // ---- if(fs.edges().hasNext()){ ---- Vector allocatingtasks=fs.getAllocatingTasks(); ---- // ---- if (allocatingtasks.iterator().hasNext()) ---- System.out.println("has been allocated by "+allocatingtasks.size()+" tasks"); ---- // ---- for(Iterator it_at=allocatingtasks.iterator();it_at.hasNext();){ ---- TaskDescriptor allocatingtd=(TaskDescriptor)it_at.next(); ---- // ---- System.out.println(allocatingtd.getSymbol()); ---- // ---- tn=new TaskNode(allocatingtd.getSymbol()); ---- ---- addEdges(fs,tn,alltasknodes,ColorID); ---- } ---- } ---- } ---- ---- while(it_inedges.hasNext()){ ---- FEdge inedge=(FEdge)it_inedges.next(); ---- tn=new TaskNode(inedge.getLabel()); ---- if(fs.edges().hasNext()){ ---- addEdges(fs,tn,alltasknodes,ColorID); ---- } ---- } ---- } ---- ColorID++; ---- } ---- ---- } ---- } ---- ---- public Set getAllTaskNodes(){ ---- return alltasknodes.keySet(); ---- } ---- ---- ---- ---- ---- ---- ---- ---- ---- /* private void mergeAllNodes(){ ---- Hashtable alltasks=new Hashtable(); ---- for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor) classit.next(); ---- Set tnodes=((Hashtable)cdtonodes.get(cd)).keyset(); ---- while (it_tnodes=tnodes.iterator();it_nodes.hasNext()){ ---- TaskNode tn=it_nodes.next(); ---- if (alltasks.containsKey(tn)){ ---- while(tn. ---- } ---- } ---- ---- ---- ---- --- } --- --- private void produceAllTaskNodes() { --- alltasknodes=new Hashtable(); --- - for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator(); it_tasks.hasNext();){ -- for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator(); it_tasks.hasNext();) { --- TaskDescriptor td=(TaskDescriptor)it_tasks.next(); --- TaskNode tn=new TaskNode(td.getSymbol()); --- alltasknodes.put(tn,tn); ------- } ---- ---- */ ---- ---- private void addEdges(FlagState fs, TaskNode tn,Hashtable tasknodes){ ---- ---- // Hashtable tasknodes=(Hashtable)cdtonodes.get(fs.getClassDescriptor()); ---- tn=(TaskNode)canonicalizeTaskNode(tasknodes, tn); ---- for (Iterator it_edges=fs.edges();it_edges.hasNext();){ ---- TaskNode target=new TaskNode(((FEdge)it_edges.next()).getLabel()); ---- target=(TaskNode)canonicalizeTaskNode(tasknodes,target); --- TaskNode tn_runtime=new TaskNode("Runtime"); --- alltasknodes.put(tn_runtime,tn_runtime); ------- ---- TEdge newedge=new TEdge(target); ---- if (! tn.edgeExists(newedge)) ---- tn.addEdge(newedge); ---- } --- int ColorID=0; --- for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); classit.hasNext()&&ColorID<10;) { --- ClassDescriptor cd=(ClassDescriptor) classit.next(); --- Set fsnodes; ------- ---- } ---- ---- private void addEdges(FlagState fs, TaskNode tn,Hashtable tasknodes,int ColorID){ ---- ---- tn=(TaskNode)canonicalizeTaskNode(tasknodes, tn); ---- for (Iterator it_edges=fs.edges();it_edges.hasNext();){ ---- TaskNode target=new TaskNode(((FEdge)it_edges.next()).getLabel()); ---- target=(TaskNode)canonicalizeTaskNode(tasknodes,target); - if (cd.hasFlags()&&((fsnodes=taskanalysis.getFlagStates(cd))!=null)){ -- if (cd.hasFlags()&&((fsnodes=taskanalysis.getFlagStates(cd))!=null)) { --- // --- System.out.println("\nWorking on fses of Class: "+cd.getSymbol()); --- // --- for(Iterator it=fsnodes.iterator(); it.hasNext();) { --- FlagState fs=(FlagState)it.next(); --- // --- System.out.println("Evaluating fs: "+fs.getTextLabel()); --- // --- Iterator it_inedges=fs.inedges(); --- TaskNode tn,sn; ------- ---- TEdge newedge=new TEdge(target); ---- newedge.setDotNodeParameters("style=bold, color = "+colors[ColorID]); ---- if (! tn.edgeExists(newedge)) ---- tn.addEdge(newedge); --- - if (fs.isSourceNode()){ -- if (fs.isSourceNode()) { --- // --- System.out.println("A sourcenode"); --- // - if(fs.edges().hasNext()){ -- if(fs.edges().hasNext()) { --- Vector allocatingtasks=fs.getAllocatingTasks(); --- // --- if (allocatingtasks.iterator().hasNext()) --- System.out.println("has been allocated by "+allocatingtasks.size()+" tasks"); --- // - for(Iterator it_at=allocatingtasks.iterator(); it_at.hasNext();){ -- for(Iterator it_at=allocatingtasks.iterator(); it_at.hasNext();) { --- TaskDescriptor allocatingtd=(TaskDescriptor)it_at.next(); --- // --- System.out.println(allocatingtd.getSymbol()); --- // --- tn=new TaskNode(allocatingtd.getSymbol()); --- --- addEdges(fs,tn,alltasknodes,ColorID); --- } ------- } --- } ------- - while(it_inedges.hasNext()){ -- while(it_inedges.hasNext()) { --- FEdge inedge=(FEdge)it_inedges.next(); --- tn=new TaskNode(inedge.getLabel()); - if(fs.edges().hasNext()){ -- if(fs.edges().hasNext()) { --- addEdges(fs,tn,alltasknodes,ColorID); --- } --- } ------- } ---- --- ColorID++; --- } --- --- } --- } --- --- public Set getAllTaskNodes() { --- return alltasknodes.keySet(); --- } --- --- --- --- --- --- --- --- --- /* private void mergeAllNodes(){ --- Hashtable alltasks=new Hashtable(); --- for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor) classit.next(); --- Set tnodes=((Hashtable)cdtonodes.get(cd)).keyset(); --- while (it_tnodes=tnodes.iterator();it_nodes.hasNext()){ --- TaskNode tn=it_nodes.next(); --- if (alltasks.containsKey(tn)){ --- while(tn. --- } --- } --- --- --- --- --- } --- --- */ --- --- private void addEdges(FlagState fs, TaskNode tn,Hashtable tasknodes) { --- --- // Hashtable tasknodes=(Hashtable)cdtonodes.get(fs.getClassDescriptor()); --- tn=(TaskNode)canonicalizeTaskNode(tasknodes, tn); - for (Iterator it_edges=fs.edges(); it_edges.hasNext();){ -- for (Iterator it_edges=fs.edges(); it_edges.hasNext();) { --- TaskNode target=new TaskNode(((FEdge)it_edges.next()).getLabel()); --- target=(TaskNode)canonicalizeTaskNode(tasknodes,target); --- --- TEdge newedge=new TEdge(target); --- if (!tn.edgeExists(newedge)) --- tn.addEdge(newedge); --- } --- --- } --- --- private void addEdges(FlagState fs, TaskNode tn,Hashtable tasknodes,int ColorID) { --- --- tn=(TaskNode)canonicalizeTaskNode(tasknodes, tn); - for (Iterator it_edges=fs.edges(); it_edges.hasNext();){ -- for (Iterator it_edges=fs.edges(); it_edges.hasNext();) { --- TaskNode target=new TaskNode(((FEdge)it_edges.next()).getLabel()); --- target=(TaskNode)canonicalizeTaskNode(tasknodes,target); --- --- TEdge newedge=new TEdge(target); --- newedge.setDotNodeParameters("style=bold, color = "+colors[ColorID]); --- if (!tn.edgeExists(newedge)) --- tn.addEdge(newedge); --- } --- --- } --- -------} diff --cc Robust/src/Analysis/TaskStateAnalysis/TaskNode.java index 7ee1c36f,7ee1c36f,7ee1c36f,7ee1c36f,2b776c8e,2b776c8e,2b776c8e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskNode.java +++ /dev/null @@@@@@@@ -1,76 -1,76 -1,76 -1,76 -1,76 -1,76 -1,76 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import Analysis.TaskStateAnalysis.*; -------import IR.*; -------import IR.Tree.*; -------import IR.Flat.*; -------import java.util.*; -------import java.io.*; -------import Util.GraphNode; ------- -------public class TaskNode extends GraphNode { ---- ---- private final String name; ---- protected int uid; ---- private static int nodeid=0; ---- // private int loopmarker=0; ---- //private boolean multipleparams=false; ---- /**Class Constructor ---- * Creates a new TaskNode using the TaskDescriptor. ---- * @param tasknode TaskDescriptor ---- */ ---- public TaskNode(String name){ ---- this.name=name; ---- this.uid=TaskNode.nodeid++; ---- } ---- ---- /**Returns the string representation of the node ---- * @return string representation of the tasknode (e.g "Task foo") ---- */ ---- public String getTextLabel() { ---- return "Task "+name; ---- } ---- ---- public String getLabel() { ---- return "N"+uid; ---- } ------- ---- public String getName(){ ---- return name; ---- } --- private final String name; --- protected int uid; --- private static int nodeid=0; --- // private int loopmarker=0; --- //private boolean multipleparams=false; --- /**Class Constructor --- * Creates a new TaskNode using the TaskDescriptor. --- * @param tasknode TaskDescriptor --- */ --- public TaskNode(String name) { --- this.name=name; --- this.uid=TaskNode.nodeid++; --- } ------- ---- // public int getuid(){ ---- //return uid; ---- //} ---- ---- ---- /**toString method. ---- * @return string representation of the tasknode (e.g "Task foo") ---- */ ---- public String toString(){ ---- return getTextLabel(); ---- } ---- ---- public int hashCode(){ ---- return name.hashCode(); ---- ---- } ---- ---- public boolean equals(Object o) { ---- if (o instanceof TaskNode) { ---- TaskNode tn=(TaskNode)o; ---- return (tn.name.equals(name)); ---- } ---- return false; ---- } ---- ---- public boolean edgeExists(TEdge newedge){ ---- if(edges.isEmpty()) ---- return false; ---- else ---- return edges.contains(newedge); --- /**Returns the string representation of the node --- * @return string representation of the tasknode (e.g "Task foo") --- */ --- public String getTextLabel() { --- return "Task "+name; --- } --- --- public String getLabel() { --- return "N"+uid; --- } --- --- public String getName() { --- return name; --- } --- --- // public int getuid(){ --- //return uid; --- //} --- --- --- /**toString method. --- * @return string representation of the tasknode (e.g "Task foo") --- */ --- public String toString() { --- return getTextLabel(); --- } --- --- public int hashCode() { --- return name.hashCode(); --- --- } --- --- public boolean equals(Object o) { --- if (o instanceof TaskNode) { --- TaskNode tn=(TaskNode)o; --- return (tn.name.equals(name)); ------- } ---- --- return false; --- } --- --- public boolean edgeExists(TEdge newedge) { --- if(edges.isEmpty()) --- return false; --- else --- return edges.contains(newedge); --- } --- -------} ---- ---- ---- --- --- --- diff --cc Robust/src/Analysis/TaskStateAnalysis/TaskNodeNamer.java index 4b6bf769,4b6bf769,4b6bf769,4b6bf769,3585d529,3585d529,3585d529..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskNodeNamer.java +++ /dev/null @@@@@@@@ -1,15 -1,15 -1,15 -1,15 -1,16 -1,16 -1,16 +1,0 @@@@@@@@ -------package Analysis.TaskStateAnalysis; -------import Util.*; ------- ---- public class TaskNodeNamer extends Namer{ ---- public TaskNodeNamer(){} ---public class TaskNodeNamer extends Namer { --- public TaskNodeNamer() { --- } ------- ---- public String nodeLabel(GraphNode gn){ ---- return ""; ---- } --- public String nodeLabel(GraphNode gn) { --- return ""; --- } ------- ---- public String nodeOption(GraphNode gn){ ---- return "URL=\""+gn.getName()+".html\""; ---- } --- public String nodeOption(GraphNode gn) { --- return "URL=\""+gn.getName()+".html\""; --- } ------- ---- } ---} diff --cc Robust/src/Benchmarks/BankApp/BankAccount.java index b3067f0f,b3067f0f,b3067f0f,b3067f0f,b3067f0f,b3067f0f,b3067f0f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankApp/BankAccount.java +++ /dev/null @@@@@@@@ -1,70 -1,70 -1,70 -1,70 -1,70 -1,70 -1,70 +1,0 @@@@@@@@ -------public class BankAccount -------{ ------- //can't init here, won't compile, do it in the constructor ------- ------- //nine digits ------- String AccountNumber; //field #1 ------- ------- //account owner's name ------- //always 10 chars ------- //pad with @ ------- String FirstName; //field #2 ------- String MiddleName; //field #3 ------- String LastName; //field #4 ------- ------- //1 == Savings ------- //2 == Checking ------- //3 == Teller ------- String AccountType; //field #5 ------- ------- //ints only, should use floats in the future ------- //1234567890 ------- //assumes balance does is never negative ------- //always 10 chars ------- //pad with @ ------- String Balance; //field #6 ------- ------- //four digits ------- String PIN; //field #7 ------- ------- public BankAccount() ------- { ------- ------- } ------- ------- public BankAccount(String account, String first, String middle, String last, String type, String balance, String pin) ------- { ------- if(account != null) ------- AccountNumber = account; ------- if(first != null) ------- FirstName = first; ------- if(middle != null) ------- MiddleName = middle; ------- if(last != null) ------- LastName = last; ------- if(type != null) ------- AccountType = type; ------- if(balance != null) ------- Balance = balance; ------- if(pin != null) ------- PIN = pin; ------- } ------- ------- public void modifyAccount(String account, String first, String middle, String last, String type, String balance, String pin) ------- { ------- if(account != null) ------- AccountNumber = account; ------- if(first != null) ------- FirstName = first; ------- if(middle != null) ------- MiddleName = middle; ------- if(last != null) ------- LastName = last; ------- if(type != null) ------- AccountType = type; ------- if(balance != null) ------- Balance = balance; ------- if(pin != null) ------- PIN = pin; ------- } -------} diff --cc Robust/src/Benchmarks/BankApp/BankApp.java index 7d9bb9af,7d9bb9af,7d9bb9af,7d9bb9af,7d9bb9af,7d9bb9af,7d9bb9af..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankApp/BankApp.java +++ /dev/null @@@@@@@@ -1,357 -1,357 -1,357 -1,357 -1,357 -1,357 -1,357 +1,0 @@@@@@@@ -------//Banking Application Server ------- -------/* Startup object is generated with the initialstate flag set by the ------- * system to start the computation up */ ------- -------task Startup(StartupObject s{initialstate}) -------{ ------- System.printString("Starting\n"); ------- ServerSocket ss = new ServerSocket(8080); ------- System.printString("Creating ServerSocket\n"); ------- BankDatabase Bank = new BankDatabase(){DatabaseInit}; ------- taskexit(s{!initialstate}); /* Turns initial state flag off, so this task won't refire */ -------} ------- -------task AcceptConnection(ServerSocket ss{SocketPending}) -------{ ------- BankAppSocket bas = new BankAppSocket(){BASocketInit}; ------- ss.accept(bas); ------- System.printString("Connected\n"); -------} ------- -------//i think this task could probably be broken up into smaller tasks -------task ProcessRequest(BankAppSocket bas{IOPending && BASocketInit}, BankDatabase Bank{DatabaseInit}) -------{ ------- String message = new String(bas.receive()); ------- //System.printString(message); ------- ------- //login ------- if(message.startsWith("1")) ------- { ------- String account = message.subString(1, 10); ------- String pin = message.subString(10, 14); ------- ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account) && Bank.database[i].PIN.equals(pin)) ------- { ------- bas.send("Login OK"); ------- //System.printString("Login OK"); ------- } ------- else ------- { ------- bas.send("Login Error"); ------- //System.printString("Login Error"); ------- } ------- } ------- } ------- //logout ------- else if(message.startsWith("2")) ------- { ------- String account = message.subString(1, 10); ------- ------- //find the account ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- { ------- bas.send("Logout OK"); ------- //System.printString("Logout OK"); ------- } ------- else ------- { ------- bas.send("Logout Error"); ------- //System.printString("Logout Error"); ------- } ------- } ------- } ------- //create ------- else if(message.startsWith("3")) ------- { ------- String account = message.subString(1, 10); ------- String first = message.subString(10, 20); ------- String middle = message.subString(20, 30); ------- String last = message.subString(30, 40); ------- String type = message.subString(40, 41); ------- String balance = message.subString(41, 51); ------- String pin = message.subString(51, 55); ------- ------- //find first empty space ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals("@@@@@@@@@")) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- //should check for input errors first but... ------- Bank.database[id].AccountNumber = first; ------- Bank.database[id].FirstName = middle; ------- Bank.database[id].MiddleName = last; ------- Bank.database[id].LastName = last; ------- Bank.database[id].AccountType = type; ------- Bank.database[id].Balance = balance; ------- Bank.database[id].PIN = pin; ------- ------- Bank.numOfAccounts++; ------- ------- bas.send(Bank.database[id].AccountNumber); ------- //System.printString(Bank.database[id].AccountNumber); ------- } ------- else ------- { ------- bas.send("Create Error"); ------- //System.printString("Create Error"); ------- } ------- } ------- //delete ------- else if(message.startsWith("4")) ------- { ------- String account = message.subString(1, 10); ------- ------- //find the account ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- Bank.database[id].AccountNumber = "@@@@@@@@@@"; ------- Bank.database[id].FirstName = "@@@@@@@@@@"; ------- Bank.database[id].MiddleName = "@@@@@@@@@@"; ------- Bank.database[id].LastName = "@@@@@@@@@@"; ------- Bank.database[id].AccountType = "@"; ------- Bank.database[id].Balance = "@@@@@@@@@@"; ------- Bank.database[id].PIN = "@@@@"; ------- Bank.numOfAccounts--; ------- ------- bas.send("Close Account OK"); ------- //System.printString("Close Account OK"); ------- } ------- else ------- { ------- bas.send("Close Account Error"); ------- //System.printString("Close Account Error"); ------- } ------- } ------- //modify ------- else if(message.startsWith("5")) ------- { ------- String account = message.subString(1, 10); ------- String field = message.subString(10, 11); ------- //two digits 00-99 ------- String numBytes = message.subString(11, 13); ------- String data = message.subString(13, 13 + Integer.parseInt(numBytes)); ------- ------- //find the account ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- //maybe shouldn't allow changes to some of these fields ------- if(field.equals("1")) ------- { ------- Bank.database[id].AccountNumber = data; ------- } ------- else if(field.equals("2")) ------- { ------- Bank.database[id].FirstName = data; ------- } ------- else if(field.equals("3")) ------- { ------- Bank.database[id].MiddleName = data; ------- } ------- else if(field.equals("4")) ------- { ------- Bank.database[id].LastName = data; ------- } ------- else if(field.equals("5")) ------- { ------- Bank.database[id].AccountType = data; ------- } ------- else if(field.equals("6")) ------- { ------- Bank.database[id].Balance = data; ------- } ------- else if(field.equals("7")) ------- { ------- Bank.database[id].PIN = data; ------- } ------- ------- bas.send("Modify OK"); ------- //System.printString("Modify OK"); ------- } ------- else ------- { ------- bas.send("Modify Error"); ------- //System.printString("Modify Error"); ------- } ------- } ------- //check account info ------- else if(message.startsWith("6")) ------- { ------- String account = message.subString(1, 10); ------- ------- //find the account ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- StringBuffer strBuffer = new StringBuffer(Bank.database[id].AccountNumber); ------- strBuffer.append(Bank.database[id].FirstName); ------- strBuffer.append(Bank.database[id].MiddleName); ------- strBuffer.append(Bank.database[id].LastName); ------- strBuffer.append(Bank.database[id].AccountType); ------- strBuffer.append(Bank.database[id].Balance); ------- strBuffer.append(Bank.database[id].PIN); ------- ------- bas.send(strBuffer.toString()); ------- //System.printString(strBuffer.toString()); ------- } ------- else ------- { ------- bas.send("Check Account Info Error"); ------- //System.printString("Check Account Info Error"); ------- } ------- ------- } ------- //deposit ------- //more string operations or a Float Object could be useful here ------- else if(message.startsWith("7")) ------- { ------- String account = message.subString(1, 10); ------- //two digits 00-99 ------- //dollar part only ------- String numBytes = message.subString(10, 12); ------- //get dollars ------- String data = message.subString(12, 12 + Integer.parseInt(numBytes)); ------- ------- ------- //find the account ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- Integer sum = new Integer(Integer.parseInt(Bank.database[id].Balance) + Integer.parseInt(data)); ------- ------- StringBuffer sumBuffer = new StringBuffer(sum.toString()); ------- ------- int padding = 10 - sumBuffer.length(); ------- ------- for(int i = 0; i < padding; i++) ------- { ------- sumBuffer.append("@"); ------- } ------- ------- //assumes no overflow ------- Bank.database[id].Balance = sumBuffer.toString(); ------- ------- bas.send("Deposit OK"); ------- //System.printString("Deposit OK"); ------- } ------- else ------- { ------- bas.send("Deposit Error"); ------- //System.printString("Deposit Error"); ------- } ------- } ------- //withdraw ------- else if(message.startsWith("8")) ------- { ------- String account = message.subString(1, 10); ------- //two digits 00-99 ------- //dollar part only ------- String numBytes = message.subString(10, 12); ------- //get dollars ------- String data = message.subString(12, 12 + Integer.parseInt(numBytes)); ------- ------- //find the account ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- Integer difference = new Integer(Integer.parseInt(Bank.database[id].Balance) - Integer.parseInt(data)); ------- ------- if(difference.intValue() >= 0) ------- { ------- StringBuffer difBuffer = new StringBuffer(difference.toString()); ------- ------- int padding = 10 - difBuffer.length(); ------- ------- for(int i = 0; i < padding; i++) ------- { ------- difBuffer.append("@"); ------- } ------- ------- //assumes no overflow ------- Bank.database[id].Balance = difBuffer.toString(); ------- ------- bas.send("Withdraw OK"); ------- //System.printString("Withdraw OK"); ------- } ------- else ------- { ------- bas.send("Overdraw Error"); ------- //System.printString("Overdraw Error"); ------- } ------- } ------- else ------- { ------- bas.send("Withdraw Error"); ------- //System.printString("Withdraw Error"); ------- } ------- } ------- //check balance ------- else if(message.startsWith("9")) ------- { ------- String account = message.subString(1, 10); ------- ------- int id = -1; ------- for(int i = 0; i < Bank.numOfAccounts; i++) ------- { ------- if(Bank.database[i].AccountNumber.equals(account)) ------- id = i; ------- } ------- ------- if(id != -1) ------- { ------- bas.send(Bank.database[id].Balance); ------- //System.printString(Bank.database[id].Balance); ------- } ------- else ------- { ------- bas.send("Check Balance Error"); ------- //System.printString("Check Balance Error"); ------- } ------- } ------- else ------- { ------- bas.send("Message Error"); ------- //System.printString("Message Error"); ------- } -------} diff --cc Robust/src/Benchmarks/BankApp/BankAppRead.dat index 57754948,57754948,57754948,57754948,57754948,57754948,57754948..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankApp/BankAppRead.dat +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------101010101Tony@@@@@@Stone@@@@@Smith@@@@@2123456@@@@8888 diff --cc Robust/src/Benchmarks/BankApp/BankAppSocket.java index cca10826,cca10826,cca10826,cca10826,cca10826,cca10826,cca10826..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankApp/BankAppSocket.java +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 -1,26 +1,0 @@@@@@@@ -------public class BankAppSocket extends Socket -------{ ------- flag BASocketInit; ------- ------- public BankAppSocket() ------- { ------- ------- } ------- ------- public void send(String message) ------- { ------- write(message.getBytes()); ------- } ------- ------- public String receive() ------- { ------- byte buffer[] = new byte[64]; ------- ------- int numbytes = read(buffer); ------- ------- //it's subString() not substring() like in Java ------- String message = (new String(buffer)).subString(0, numbytes); ------- ------- return message; ------- } -------} diff --cc Robust/src/Benchmarks/BankApp/BankAppWrite.dat index 57754948,57754948,57754948,57754948,57754948,57754948,57754948..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankApp/BankAppWrite.dat +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------101010101Tony@@@@@@Stone@@@@@Smith@@@@@2123456@@@@8888 diff --cc Robust/src/Benchmarks/BankApp/BankDatabase.java index 9b4ff94d,9b4ff94d,9b4ff94d,9b4ff94d,9b4ff94d,9b4ff94d,9b4ff94d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankApp/BankDatabase.java +++ /dev/null @@@@@@@@ -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 +1,0 @@@@@@@@ -------public class BankDatabase -------{ ------- flag DatabaseInit; ------- ------- BankAccount[] database; ------- int numOfAccounts; ------- ------- public BankDatabase() ------- { ------- //6 pre-created accounts ------- numOfAccounts = 6; ------- ------- //10 account limit ------- database = new BankAccount[10]; ------- ------- for(int i = 0; i < 10; i++) ------- { ------- database[i] = new BankAccount(); ------- } ------- ------- //some hardcoded values ------- database[0].modifyAccount("123456789", "John@@@@@@", "Q@@@@@@@@@", "Public@@@@", "1", "256000001@", "2007"); ------- database[1].modifyAccount("987654321", "Nancy@@@@@", "H@@@@@@@@@", "Private@@@", "2", "166@@@@@@@", "1234"); ------- database[2].modifyAccount("000111000", "Paul@@@@@@", "Wellington", "Franks@@@@", "1", "454225@@@@", "0000"); ------- database[3].modifyAccount("211411911", "Felix@@@@@", "the@@@@@@@", "Cat@@@@@@@", "3", "0@@@@@@@@@", "9999"); ------- database[4].modifyAccount("111000111", "Paul@@@@@@", "Wellington", "Franks@@@@", "2", "1128989@@@", "0000"); ------- //empty ------- database[5].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); ------- database[6].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); ------- database[7].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); ------- database[8].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); ------- database[9].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); ------- ------- //test read into database[5] ------- ReadFile(5); ------- ------- //test write from database[5] ------- WriteFile(database[5].AccountNumber, database[5].FirstName, database[5].MiddleName, database[5].LastName, database[5].AccountType, database[5].Balance, database[5].PIN); ------- } ------- ------- /* what, no destructor? ------- public ~BankDatabase() ------- { ------- //test write from database[5] ------- }*/ ------- ------- public void ReadFile(int index) ------- { ------- //need to check if read/write works the way I think it does ------- String filename="BankAppRead.dat"; ------- FileInputStream fis = new FileInputStream(filename); ------- ------- byte account[] = new byte[9]; ------- byte first[] = new byte[10]; ------- byte middle[] = new byte[10]; ------- byte last[] = new byte[10]; ------- byte type[] = new byte[1]; ------- byte balance[] = new byte[10]; ------- byte pin[] = new byte[4]; ------- ------- //read one account for now ------- fis.read(account); ------- fis.read(first); ------- fis.read(middle); ------- fis.read(last); ------- fis.read(type); ------- fis.read(balance); ------- fis.read(pin); ------- ------- fis.close(); ------- ------- String S1 = new String(account); ------- //System.printString(S1); ------- String S2 = new String(first); ------- //System.printString(S2); ------- String S3 = new String(middle); ------- //System.printString(S3); ------- String S4 = new String(last); ------- //System.printString(S4); ------- String S5 = new String(type); ------- //System.printString(S5); ------- String S6 = new String(balance); ------- //System.printString(S6); ------- String S7 = new String(pin); ------- //System.printString(S7); ------- ------- //read into one account for now ------- database[index].modifyAccount(S1, S2, S3, S4, S5, S6, S7); ------- } ------- ------- public void WriteFile(String account, String first, String middle, String last, String type, String balance, String pin) ------- { ------- String filename="BankAppWrite.dat"; ------- FileOutputStream fos = new FileOutputStream(filename); ------- ------- //write one account for now ------- fos.write(account.getBytes()); ------- fos.write(first.getBytes()); ------- fos.write(middle.getBytes()); ------- fos.write(last.getBytes()); ------- fos.write(type.getBytes()); ------- fos.write(balance.getBytes()); ------- fos.write(pin.getBytes()); ------- ------- fos.close(); ------- } -------} diff --cc Robust/src/Benchmarks/BankAppJava/BankAppClientTeller.java index a74c0b3b,a74c0b3b,a74c0b3b,a74c0b3b,a74c0b3b,a74c0b3b,a74c0b3b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankAppJava/BankAppClientTeller.java +++ /dev/null @@@@@@@@ -1,374 -1,374 -1,374 -1,374 -1,374 -1,374 -1,374 +1,0 @@@@@@@@ -------// Bank App in Java ------- -------// Author: Danish Lakhani ------- -------// BankAppServer - Bank Application Server that services one client at a time ------- -------import java.io.*; -------import java.net.*; -------import java.util.*; ------- -------class BankAppClientTeller -------{ ------- static int SUCCESS = 0; ------- static int ERROR = 1; ------- ------- static int LOGIN_ACCOUNT = 1; ------- static int LOGIN_PIN = 2; ------- ------- static int ACCOUNT_SAVINGS = 1; ------- static int ACCOUNT_CHECKING = 2; ------- static int ACCOUNT_TELLER = 3; ------- ------- private Socket mySocket = null; ------- private PrintWriter out = null; ------- private BufferedReader in = null; ------- private static int serverPort = 44444; ------- ------- public BankAppClientTeller() ------- { ------- } ------- ------- private void establishConnection() ------- throws IOException ------- { ------- System.out.println("Connecting to server..."); ------- mySocket = new Socket("localhost", serverPort); ------- out = new PrintWriter(mySocket.getOutputStream(), true); ------- in = new BufferedReader(new InputStreamReader(mySocket.getInputStream())); ------- System.out.println("Connection Established!"); ------- } ------- ------- private void closeConnection() ------- throws IOException ------- { ------- if (out != null) ------- out.close(); ------- if (in != null) ------- in.close(); ------- if (mySocket != null) ------- mySocket.close(); ------- } ------- ------- private void displayMenu() ------- { ------- System.out.println("\nBankAppClientTeller"); ------- System.out.println("----------------"); ------- System.out.println("1. Login"); ------- System.out.println("2. Logout"); ------- System.out.println("3. Deposit"); ------- System.out.println("4. Withdraw"); ------- System.out.println("5. Check Balance"); ------- System.out.println("6. Open Account"); ------- System.out.println("7. Close Account"); ------- System.out.println("8. Modify Account"); ------- System.out.println("9. Check Account Info"); ------- System.out.println("0. Exit\n"); ------- System.out.print("Enter Choice: "); ------- return; ------- } ------- ------- private void startClient() ------- throws IOException ------- { ------- int clientQuit = 0; ------- int status = SUCCESS; ------- int isConnected = 0; ------- boolean loggedIn = false; ------- BufferedReader local_in = new BufferedReader(new InputStreamReader(System.in)); ------- while (clientQuit == 0) ------- { ------- if (!loggedIn) ------- establishConnection(); ------- isConnected = 1; ------- while (isConnected == 1) ------- { ------- displayMenu(); ------- String input = local_in.readLine(); ------- int selection = Integer.parseInt(input); ------- String response; ------- switch (selection) ------- { ------- case 0: ------- System.out.println("Exitting..."); ------- out.println("EXIT"); ------- System.exit(0); ------- break; ------- case 1: ------- System.out.println("Login"); ------- out.println("LOGIN"); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- System.out.print("Enter account number: "); ------- String accountNumber = local_in.readLine(); ------- System.out.print("Enter PIN: "); ------- String pinNumber = local_in.readLine(); ------- out.println(accountNumber); ------- out.println(pinNumber); ------- response = in.readLine(); ------- if (response.equals(accountNumber)) ------- { ------- System.out.println("Login Successful! Account: " + response); ------- loggedIn = true; ------- } ------- else ------- { ------- System.out.println(response); ------- } ------- } ------- else ------- { ------- System.out.println(response); ------- } ------- break; ------- case 2: ------- System.out.println("Logout"); ------- out.println("LOGOUT"); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- response = in.readLine(); ------- System.out.println("Logout Successful! Account: " + response); ------- } ------- else ------- { ------- System.out.println(response); ------- } ------- break; ------- case 3: ------- System.out.println("Deposit"); ------- out.println("TELLERDEPOSIT"); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- System.out.print("Enter Account Number: "); ------- String accNum = local_in.readLine(); ------- out.println(accNum); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- System.out.print("Enter Deposit Amount: "); ------- String depAmount = local_in.readLine(); ------- out.println(depAmount); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- response = in.readLine(); ------- } ------- } ------- System.out.println(response); ------- break; ------- case 4: ------- System.out.println("Withdraw"); ------- out.println("TELLERWITHDRAW"); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- System.out.print("Enter Account Number: "); ------- String accNum = local_in.readLine(); ------- out.println(accNum); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- System.out.print("Enter Withdrawal Amount: "); ------- String wdAmount = local_in.readLine(); ------- out.println(wdAmount); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- response = in.readLine(); ------- } ------- } ------- System.out.println(response); ------- break; ------- case 5: ------- System.out.println("Check Balance"); ------- out.println("TELLERCHECK"); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- { ------- System.out.print("Enter Account Number: "); ------- String accNum = local_in.readLine(); ------- out.println(accNum); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- response = in.readLine(); ------- } ------- System.out.println(response); ------- break; ------- case 6: ------- System.out.println("Account Open"); ------- out.println("TELLEROPEN"); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- System.out.print("Enter Account Number: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter First Name: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter Middle Name: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter Last Name: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter Account Type: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter Initial Balance: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter PIN: "); ------- out.println(local_in.readLine()); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- response = in.readLine(); ------- System.out.println(response); ------- break; ------- case 7: ------- System.out.println("Account Close"); ------- out.println("TELLERCLOSE"); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- System.out.print("Enter Account Number: "); ------- out.println(local_in.readLine()); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- response = in.readLine(); ------- System.out.println(response); ------- break; ------- case 8: ------- System.out.println("Modify Account"); ------- out.println("TELLERMODIFY"); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- System.out.print("Enter Account Number: "); ------- String accNum = local_in.readLine(); ------- out.println(accNum); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- int done = 0; ------- while (done == 0) ------- { ------- System.out.println("1. Change Name"); ------- System.out.println("2. Change Type"); ------- System.out.println("3. Change PIN"); ------- System.out.println("4. Change Balance"); ------- System.out.println("5. Done\n"); ------- System.out.print("Enter Choice: "); ------- int choice = Integer.parseInt(local_in.readLine()); ------- switch (choice) ------- { ------- case 1: ------- out.println("CHANGENAME"); ------- System.out.print("Enter New First Name: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter New Middle Name: "); ------- out.println(local_in.readLine()); ------- System.out.print("Enter New Last Name: "); ------- out.println(local_in.readLine()); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- } ------- break; ------- case 2: ------- out.println("CHANGETYPE"); ------- System.out.print("Enter New Account Type: "); ------- out.println(local_in.readLine()); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- } ------- break; ------- case 3: ------- out.println("CHANGEPIN"); ------- System.out.print("Enter New PIN: "); ------- out.println(local_in.readLine()); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- } ------- break; ------- case 4: ------- out.println("CHANGEBALANCE"); ------- System.out.print("Enter New Balance: "); ------- out.println(local_in.readLine()); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- } ------- break; ------- case 5: ------- done = 1; ------- out.println("DONE"); ------- break; ------- default: ------- System.out.println("Invalid selection"); ------- break; ------- } ------- } ------- response = in.readLine(); ------- System.out.println(response); ------- break; ------- case 9: ------- System.out.println("View Account"); ------- out.println("TELLERVIEW"); ------- response = in.readLine(); ------- if (!response.equals("OK")) ------- { ------- System.out.println(response); ------- break; ------- } ------- System.out.print("Enter Account Number: "); ------- String accNumber = local_in.readLine(); ------- out.println(accNumber); ------- response = in.readLine(); ------- if (response.equals("OK")) ------- response = in.readLine(); ------- System.out.println(response); ------- break; ------- default: ------- System.out.println("Invalid Selection"); ------- break; ------- } ------- System.out.println("Press Enter to Continue..."); ------- local_in.readLine(); ------- } ------- } ------- } ------- ------- public static void main(String [] args) ------- throws IOException ------- { ------- System.out.println("BankAppClientTeller in Java"); ------- BankAppClientTeller client = new BankAppClientTeller(); ------- client.startClient(); ------- } -------} diff --cc Robust/src/Benchmarks/BankAppJava/BankAppServer.java index 0ebf40b1,0ebf40b1,0ebf40b1,0ebf40b1,0ebf40b1,0ebf40b1,0ebf40b1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankAppJava/BankAppServer.java +++ /dev/null @@@@@@@@ -1,697 -1,697 -1,697 -1,697 -1,697 -1,697 -1,697 +1,0 @@@@@@@@ -------// Bank App in Java ------- -------// Author: Danish Lakhani ------- -------// BankAppServer - Bank Application Server that services one client at a time ------- -------import java.io.*; -------import java.net.*; -------import java.util.*; ------- -------class BankAppServer -------{ ------- static int SUCCESS = 0; ------- static int ERROR = 1; ------- ------- static int LOGIN_ACCOUNT = 1; ------- static int LOGIN_PIN = 2; ------- ------- static int ACCOUNT_SAVINGS = 1; ------- static int ACCOUNT_CHECKING = 2; ------- static int ACCOUNT_TELLER = 3; ------- ------- private ServerSocket serverSocket = null; ------- private Socket clientSocket = null; ------- private PrintWriter out = null; ------- private BufferedReader in = null; ------- private static int serverPort = 44444; ------- private AccountDatabase accounts = null; ------- ------- private boolean isLoggedIn = false; ------- private Integer activeAccount = 0; ------- private Integer tellerCode = 0; ------- ------- public BankAppServer() ------- { -------// initializeServer(); ------- } ------- ------- private void initializeServer() ------- { ------- //Initialize Database ------- accounts = new AccountDatabase(); ------- ------- //Initialize Server Socket ------- System.out.print("Creating Server Socket..."); ------- try { ------- serverSocket = new ServerSocket(serverPort); ------- } catch (IOException e) { ------- System.out.println("Cannot listen on port " + serverPort); ------- System.exit(-1); ------- } ------- System.out.println("Done"); ------- } ------- ------- private void establishConnection() ------- throws IOException ------- { ------- System.out.print("Waiting for connection..."); ------- try { ------- clientSocket = serverSocket.accept(); ------- } catch (IOException e) { ------- System.out.println("Accept failed"); ------- System.exit(-1); ------- } ------- out = new PrintWriter(clientSocket.getOutputStream(), true); ------- in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); ------- System.out.println("Connection Established!"); ------- } ------- ------- private int authenticateUser(Integer accountNumber, Integer pin) ------- { ------- if (!accounts.accountExists(accountNumber)) ------- return LOGIN_ACCOUNT; ------- if (accounts.getPin(accountNumber) != pin) ------- return LOGIN_PIN; ------- return SUCCESS; ------- } ------- ------- private int login() ------- throws IOException ------- { ------- out.println("OK"); ------- Integer accountNumber = new Integer(in.readLine()); ------- System.out.println("Account number: " + accountNumber); ------- Integer pin = new Integer(in.readLine()); ------- System.out.println("PIN: " + pin); ------- System.out.println("Authenticating..."); ------- int status = authenticateUser(accountNumber, pin); ------- if (status == SUCCESS) ------- { ------- out.println(accountNumber); ------- isLoggedIn = true; ------- tellerCode = 0; ------- activeAccount = 0; ------- if (accounts.isTeller(accountNumber)) ------- tellerCode = accountNumber; ------- else ------- activeAccount = accountNumber; ------- System.out.println("Logged Success"); ------- return SUCCESS; ------- } ------- else { ------- if (status == LOGIN_ACCOUNT) ------- out.println("ERROR: login failed: Account " + accountNumber + " does not exist."); ------- else ------- out.println("ERROR: login failed: Incorrect pin."); ------- } ------- System.out.println("Login Failed"); ------- return ERROR; ------- } ------- ------- private void closeConnection() ------- throws IOException ------- { ------- out.close(); ------- in.close(); ------- clientSocket.close(); -------// serverSocket.close(); ------- } ------- ------- private void processDeposit(Integer accountNumber) throws IOException ------- { ------- String inVal; ------- if (!accounts.accountExists(accountNumber)) ------- { ------- out.println("ERROR: Account " + accountNumber + " not found."); ------- return; ------- } ------- ------- out.println("OK"); ------- ------- //Get Deposit Amount ------- inVal = in.readLine(); ------- Double depAmount = new Double(inVal); ------- if (depAmount <= 0) ------- { ------- out.println("ERROR: Negative or zero deposit amount"); ------- return; ------- } ------- ------- accounts.deposit(accountNumber, depAmount); ------- out.println("OK"); ------- out.println("$" + depAmount + " deposited successfully! Account: " + accountNumber + " New Balance: " + accounts.getBalance(accountNumber)); ------- return; ------- } ------- ------- private void processWithdrawal(Integer accountNumber) throws IOException ------- { ------- String inVal; ------- if (!accounts.accountExists(accountNumber)) ------- { ------- out.println("ERROR: Account " + accountNumber + " not found."); ------- return; ------- } ------- ------- out.println("OK"); ------- ------- //Get withdrawal amount ------- inVal = in.readLine(); ------- Double wdAmount = new Double(inVal); ------- if (wdAmount <= 0) ------- { ------- out.println("ERROR: Negative or zero withdrawal amount"); ------- return; ------- } -------// else if (wdAmount > accounts.getBalance(accountNumber)) -------// { -------// out.println("ERROR: Insufficient funds. Balance = " + accounts.getBalance(accountNumber)); -------// return; -------// } ------- ------- accounts.withdraw(accountNumber, wdAmount); ------- out.println("OK"); ------- out.println("$" + wdAmount + " withdrawn successfully! Account: " + accountNumber + " New Balance: " + accounts.getBalance(accountNumber)); ------- return; ------- } ------- ------- private void processBalanceCheck(Integer accountNumber) ------- { ------- out.println("OK"); ------- out.println("Account: " + accountNumber + " Balance: " + accounts.getBalance(accountNumber)); ------- return; ------- } ------- ------- private void startServer() ------- throws IOException ------- { ------- int serverQuit = 0; ------- int status = SUCCESS; ------- int isConnected = 0; ------- initializeServer(); ------- while (serverQuit == 0) ------- { ------- establishConnection(); ------- isConnected = 1; ------- accounts.loadDatabase(); ------- while (isConnected == 1) ------- { ------- System.out.println("Waiting for request..."); ------- // Wait for requests ------- String request = in.readLine(); ------- if (request == null) ------- continue; ------- ------- System.out.println("Request: " + request); ------- ------- // Service requests ------- if (request.equals("EXIT")) ------- { ------- accounts.storeDatabase(); ------- isLoggedIn = false; ------- activeAccount = 0; ------- tellerCode = 0; ------- closeConnection(); ------- isConnected = 0; ------- continue; ------- } ------- ------- if (request.equals("LOGIN")) ------- { ------- if (isLoggedIn) ------- { ------- out.println("ERROR: Already logged in. Please logout."); ------- continue; ------- } ------- status = login(); ------- if (status == ERROR) ------- { -------// isConnected = 0; ------- continue; ------- } ------- } ------- ------- if (!isLoggedIn) ------- { ------- out.println("ERROR: Not logged in"); ------- continue; ------- } ------- ------- if (request.equals("LOGOUT")) ------- { ------- out.println("OK"); ------- if (tellerCode == 0) ------- out.println(activeAccount); ------- else ------- out.println(tellerCode); ------- accounts.storeDatabase(); ------- isLoggedIn = false; ------- activeAccount = 0; ------- tellerCode = 0; -------// closeConnection(); -------// isConnected = 0; ------- } ------- ------- if (request.equals("DEPOSIT")) ------- { ------- processDeposit(activeAccount); ------- } ------- ------- if (request.equals("WITHDRAW")) ------- { ------- processWithdrawal(activeAccount); ------- } ------- ------- if (request.equals("CHECK")) ------- { ------- processBalanceCheck(activeAccount); ------- } ------- ------- if (request.equals("TELLERDEPOSIT")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer acc = new Integer(in.readLine()); ------- processDeposit(acc); ------- } ------- ------- if (request.equals("TELLERWITHDRAW")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer acc = new Integer(in.readLine()); ------- processWithdrawal(acc); ------- } ------- ------- if (request.equals("TELLERCHECK")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer acc = new Integer(in.readLine()); ------- processBalanceCheck(acc); ------- } ------- ------- if (request.equals("TELLEROPEN")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer accNum = new Integer(in.readLine()); ------- String fName = in.readLine(); ------- String mName = in.readLine(); ------- String lName = in.readLine(); ------- Integer accType = new Integer(in.readLine()); ------- Double bal = new Double(in.readLine()); ------- Integer pNum = new Integer(in.readLine()); ------- status = accounts.openAccount(accNum, fName, mName, lName, accType, bal, pNum); ------- if (status == ERROR) ------- { ------- out.println("ERROR: Account " + accNum + " already exists."); ------- continue; ------- } ------- out.println("OK"); ------- out.println("Account Number: " + accNum + " " + ------- "Customer Name: " + fName + " " + mName + " " + lName + " " + ------- "Account Type: " + ((accType == ACCOUNT_SAVINGS)?"SAVINGS":(accType == ACCOUNT_CHECKING)?"CHECKING":"TELLER") + " " + ------- "Balance: $" + bal + " " + ------- "PIN: " + pNum + " "); ------- } ------- ------- if (request.equals("TELLERCLOSE")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer accNum = new Integer(in.readLine()); ------- status = accounts.closeAccount(accNum); ------- if (status == ERROR) ------- { ------- out.println("ERROR: Account " + accNum + " does not exist."); ------- continue; ------- } ------- out.println("OK"); ------- out.println("Account " + accNum + " closed successfully"); ------- } ------- ------- if (request.equals("TELLERMODIFY")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer accNum = new Integer(in.readLine()); ------- if (!accounts.accountExists(accNum)) ------- { ------- out.println("ERROR: Account " + accNum + " does not exist."); ------- continue; ------- } ------- out.println("OK"); ------- String inVal; ------- while (!(inVal = in.readLine()).equals("DONE")) ------- { ------- if (inVal.equals("CHANGENAME")) ------- { ------- String fName = in.readLine(); ------- String mName = in.readLine(); ------- String lName = in.readLine(); ------- accounts.modifyName(accNum, fName, mName, lName); ------- out.println("OK"); ------- } ------- else if (inVal.equals("CHANGETYPE")) ------- { ------- Integer newType = new Integer(in.readLine()); ------- if (newType.intValue() < 1 || newType.intValue() > 3) ------- { ------- out.println("ERROR: Invalid account type: " + newType + ". Must be 1-3."); ------- continue; ------- } ------- accounts.modifyType(accNum, newType); ------- out.println("OK"); ------- } ------- else if (inVal.equals("CHANGEPIN")) ------- { ------- Integer newPin = new Integer(in.readLine()); ------- if ((newPin < 0) || (newPin > 9999)) ------- { ------- out.println("ERROR: Invalid pin " + newPin + ". Must be 0000-9999."); ------- continue; ------- } ------- accounts.modifyPin(accNum, newPin); ------- out.println("OK"); ------- } ------- else if (inVal.equals("CHANGEBALANCE")) ------- { ------- Double newBal = new Double(in.readLine()); ------- accounts.modifyBalance(accNum, newBal); ------- out.println("OK"); ------- } ------- } ------- out.println("Account Number: " + accNum + " " + ------- "Customer Name: " + accounts.nameString(accNum) + " " + ------- "Account Type: " + accounts.typeString(accNum) + " " + ------- "Balance: $" + accounts.getBalance(accNum) + " " + ------- "PIN: " + accounts.getPin(accNum) + " "); ------- } ------- ------- if (request.equals("TELLERVIEW")) ------- { ------- if (tellerCode == 0) ------- { ------- out.println("ERROR: Teller not logged in"); ------- continue; ------- } ------- out.println("OK"); ------- Integer accNum = new Integer(in.readLine()); ------- if (!accounts.accountExists(accNum)) ------- { ------- out.println("ERROR: Account " + accNum + " does not exist."); ------- continue; ------- } ------- out.println("OK"); ------- out.println("Account Number: " + accNum + " " + ------- "Customer Name: " + accounts.nameString(accNum) + " " + ------- "Account Type: " + accounts.typeString(accNum) + " " + ------- "Balance: $" + accounts.getBalance(accNum) + " " + ------- "PIN: " + accounts.getPin(accNum) + " "); ------- } ------- } ------- } ------- } ------- ------- public static void main(String [] args) ------- throws IOException ------- { ------- System.out.println("BankAppServer in Java"); ------- BankAppServer server = new BankAppServer(); ------- server.startServer(); ------- } -------} ------- -------class AccountEntry -------{ ------- Integer accountNumber; ------- String firstName; ------- String middleName; ------- String lastName; ------- Integer accountType; ------- Double balance; ------- Integer pin; ------- ------- public AccountEntry(Integer accNum, String fName, String mName, String lName, Integer accType, Double bal, Integer pNum) ------- { ------- accountNumber = accNum; ------- firstName = fName; ------- middleName = mName; ------- lastName = lName; ------- accountType = accType; ------- balance = bal; ------- pin = pNum; ------- } -------} ------- ------- -------class AccountDatabase -------{ ------- static int ACCOUNT_SAVINGS = 1; ------- static int ACCOUNT_CHECKING = 2; ------- static int ACCOUNT_TELLER = 3; ------- static int SUCCESS = 0; ------- static int ERROR = 1; ------- ------- static String dbfilename = "accts.txt"; ------- ------- Vector entries = null; ------- ------- public AccountDatabase() ------- { ------- entries = new Vector(); ------- } ------- ------- public void loadDatabase() ------- { ------- entries.removeAllElements(); ------- try { ------- BufferedReader fin = new BufferedReader(new FileReader(dbfilename)); ------- String str; ------- while ((str = fin.readLine()) != null) ------- { ------- Integer accNum = new Integer(str); ------- String fName = fin.readLine(); ------- String mName = fin.readLine(); ------- String lName = fin.readLine(); ------- Integer accType = new Integer(fin.readLine()); ------- Double bal = new Double(fin.readLine()); ------- Integer pNum = new Integer(fin.readLine()); ------- AccountEntry newEntry = new AccountEntry(accNum, fName, mName, lName, accType, bal, pNum); ------- entries.add(newEntry); ------- } ------- fin.close(); ------- } catch (IOException e) { ------- System.out.println("Cannot open database file"); ------- System.exit(-1); ------- } ------- printAccounts(); ------- } ------- ------- public void storeDatabase() ------- { ------- try { ------- BufferedWriter fout = new BufferedWriter(new FileWriter(dbfilename)); ------- for (int i = 0; i < entries.size(); i++) ------- { ------- AccountEntry acc = (AccountEntry)entries.elementAt(i); ------- fout.write(acc.accountNumber.toString()); ------- fout.newLine(); ------- fout.write(acc.firstName); ------- fout.newLine(); ------- fout.write(acc.middleName); ------- fout.newLine(); ------- fout.write(acc.lastName); ------- fout.newLine(); ------- fout.write(acc.accountType.toString()); ------- fout.newLine(); ------- fout.write(acc.balance.toString()); ------- fout.newLine(); ------- fout.write(acc.pin.toString()); ------- fout.newLine(); ------- } ------- fout.close(); ------- } catch (IOException e) { ------- System.out.println("Cannot write to database file"); ------- System.exit(-1); ------- } ------- } ------- ------- public AccountEntry getAccount(Integer accNum) ------- { ------- for (int i = 0; i < entries.size(); i++) ------- { ------- AccountEntry acc = (AccountEntry)entries.elementAt(i); ------- if (acc.accountNumber.equals(accNum)) ------- return acc; ------- } ------- return null; ------- } ------- ------- public void deposit(Integer accNum, Double amount) ------- { ------- AccountEntry acc = getAccount(accNum); ------- acc.balance += amount; ------- } ------- ------- public void withdraw(Integer accNum, Double amount) ------- { ------- AccountEntry acc = getAccount(accNum); ------- acc.balance -= amount; ------- } ------- ------- public Double getBalance(Integer accNum) ------- { ------- AccountEntry acc = getAccount(accNum); ------- return acc.balance; ------- } ------- ------- public int getPin(Integer accNum) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- return acc.pin.intValue(); ------- return -1; ------- } ------- ------- public boolean accountExists(Integer accNum) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- return true; ------- return false; ------- } ------- ------- public boolean isTeller(Integer accNum) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc.accountType.equals(ACCOUNT_TELLER)) ------- return true; ------- return false; ------- } ------- ------- public Integer openAccount(Integer accNum, String fName, String mName, String lName, Integer accType, Double bal, Integer pNum) ------- { ------- if (accountExists(accNum)) ------- return ERROR; ------- AccountEntry acc = new AccountEntry(accNum, fName, mName, lName, accType, bal, pNum); ------- entries.add(acc); ------- return SUCCESS; ------- } ------- ------- public Integer closeAccount(Integer accNum) ------- { ------- if (accountExists(accNum)) ------- { ------- AccountEntry acc = getAccount(accNum); ------- entries.remove(acc); ------- return SUCCESS; ------- } ------- else ------- return ERROR; ------- } ------- ------- public String nameString(Integer accNum) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- { ------- return (acc.firstName + " " + acc.middleName + " " + acc.lastName); ------- } ------- return ""; ------- } ------- ------- public String typeString(Integer accNum) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- { ------- return ((acc.accountType == ACCOUNT_SAVINGS)?"SAVINGS":(acc.accountType == ACCOUNT_CHECKING)?"CHECKING":"TELLER"); ------- } ------- return ""; ------- } ------- ------- public void modifyName(Integer accNum, String fName, String mName, String lName) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- { ------- acc.firstName = fName; ------- acc.middleName = mName; ------- acc.lastName = lName; ------- } ------- return; ------- } ------- ------- public void modifyType(Integer accNum, Integer newType) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- { ------- acc.accountType = newType; ------- } ------- return; ------- } ------- ------- public void modifyPin(Integer accNum, Integer newPin) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- { ------- acc.pin = newPin; ------- } ------- return; ------- } ------- ------- public void modifyBalance(Integer accNum, Double newBal) ------- { ------- AccountEntry acc = getAccount(accNum); ------- if (acc != null) ------- { ------- acc.balance = newBal; ------- } ------- return; ------- } ------- ------- public void printAccounts() ------- { ------- System.out.println("entries.size = " + entries.size()); ------- for (int i = 0; i < entries.size(); i++) ------- { ------- System.out.println("Entry " + i); ------- AccountEntry acc = entries.elementAt(i); ------- System.out.println("1 " + acc.accountNumber.toString()); ------- System.out.println("2 " + acc.firstName); ------- System.out.println("3 " + acc.middleName); ------- System.out.println("4 " + acc.lastName); ------- System.out.println("5 " + acc.accountType.toString()); ------- System.out.println("6 " + acc.balance.toString()); ------- System.out.println("7 " + acc.pin.toString()); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/BankAppJava/BankAppTestClient.java index a2cc7f1b,a2cc7f1b,a2cc7f1b,a2cc7f1b,a2cc7f1b,a2cc7f1b,a2cc7f1b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankAppJava/BankAppTestClient.java +++ /dev/null @@@@@@@@ -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 +1,0 @@@@@@@@ -------// Bank App in Java ------- -------// Author: Danish Lakhani ------- -------import java.io.*; -------import java.net.*; ------- -------class BankAppTestClient -------{ ------- public static void main(String [] args) ------- throws IOException ------- { ------- BufferedReader local_in = new BufferedReader(new InputStreamReader(System.in)); ------- String sendline; ------- ------- System.out.println("Client"); ------- ------- sendline = local_in.readLine(); -------if (sendline == null) ------- sendline = "localhost"; ------- System.out.println("Connecting to server..."); ------- Socket mySocket = new Socket(sendline, 8000); ------- ------- System.out.println("Connected!!"); ------- ------- PrintWriter out = new PrintWriter(mySocket.getOutputStream(), true); ------- BufferedReader in = new BufferedReader(new InputStreamReader(mySocket.getInputStream())); ------- ------- ------- ------- while (true) ------- { ------- System.out.print("Send: "); ------- sendline = local_in.readLine(); ------- ------- if (!sendline.equals("no")) ------- { ------- out.println(sendline); ------- } ------- else ------- { ------- System.out.print("Reading: "); ------- String inString = in.readLine(); ------- System.out.println(inString); ------- } ------- } ------- } -------} diff --cc Robust/src/Benchmarks/BankAppJava/accts.txt index b75b5be0,b75b5be0,b75b5be0,b75b5be0,b75b5be0,b75b5be0,b75b5be0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/BankAppJava/accts.txt +++ /dev/null @@@@@@@@ -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------1111 -------Danish -------Salim -------Lakhani -------1 -------2000.0 -------1234 -------1000 -------Danish -------Teller -------Lakhani -------3 -------0.0 -------2000 diff --cc Robust/src/Benchmarks/Chat/BRISTLECONE index 4e3d652a,4e3d652a,4e3d652a,4e3d652a,4e3d652a,4e3d652a,4e3d652a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/BRISTLECONE +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ --------initializerandom -injectinstructionfailures 45 0.0001667 10 -debugtask diff --cc Robust/src/Benchmarks/Chat/ChatServer.java index 773a1340,773a1340,773a1340,773a1340,773a1340,773a1340,773a1340..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/ChatServer.java +++ /dev/null @@@@@@@@ -1,35 -1,35 -1,35 -1,35 -1,35 -1,35 -1,35 +1,0 @@@@@@@@ -------task Startup(StartupObject s{initialstate}) { ------- System.printString("Chat Server Benchmark"); ------- RoomObject ro=new RoomObject() {Initialized}; ------- ServerSocket ss=new ServerSocket(8000); ------- taskexit(s{!initialstate}); -------} ------- -------task AcceptConnection(ServerSocket ss{SocketPending}) { ------- ChatSocket cs=new ChatSocket() {Initialized}; ------- ss.accept(cs); ------- cs.write("Please choose a chatroom".getBytes()); -------} ------- -------task ReadRequest(ChatSocket cs{Initialized && IOPending}) { ------- if (cs.processRead()) { ------- taskexit(cs{!Initialized, ProcessRoom}); ------- } -------} ------- -------task ProcessRoom(ChatSocket cs{ProcessRoom}, RoomObject ro{Initialized}) { ------- cs.processRoom(ro); ------- taskexit(cs{!ProcessRoom, InRoom}); -------} ------- -------task Message(ChatSocket cs{InRoom && IOPending}) { ------- byte buffer[]=new byte[1024]; ------- int length=cs.read(buffer); ------- Message m=new Message(buffer, length, cs){}; -------} ------- -------task SendMessage(Message m{!Sent}) { ------- String st=(new String(m.buffer)).subString(0, m.length); ------- m.cs.room.sendToRoom(m.cs,st.getBytes()); ------- taskexit(m {Sent}); -------} diff --cc Robust/src/Benchmarks/Chat/ChatSocket.java index e7252f3b,e7252f3b,e7252f3b,e7252f3b,e7252f3b,e7252f3b,e7252f3b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/ChatSocket.java +++ /dev/null @@@@@@@@ -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 +1,0 @@@@@@@@ -------public class ChatSocket extends Socket { ------- flag Initialized; ------- flag ProcessRoom; ------- flag InRoom; ------- Room room; ------- String roomrequest; ------- ------- public ChatSocket() { ------- } ------- ------- public boolean processRead() { ------- byte buffer[]=new byte[1024]; ------- int length=read(buffer); ------- String st=new String(buffer); ------- String curr=st.subString(0, length); ------- if (roomrequest!=null) { ------- StringBuffer sb=new StringBuffer(roomrequest); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- roomrequest=curr; ------- if (roomrequest.indexOf("\n")>=0) { ------- return true; ------- } ------- return false; ------- } ------- public void processRoom(RoomObject ro) { ------- ro.getChatRoom(roomrequest).addParticipant(this); ------- } -------} diff --cc Robust/src/Benchmarks/Chat/Message.java index 92db626d,92db626d,92db626d,92db626d,92db626d,92db626d,92db626d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/Message.java +++ /dev/null @@@@@@@@ -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 +1,0 @@@@@@@@ -------public class Message { ------- flag Sent; ------- ChatSocket cs; ------- byte buffer[]; ------- int length; ------- ------- public Message(byte[] b, int l, ChatSocket cs) { ------- this.cs=cs; ------- this.buffer=b; ------- this.length=l; ------- } -------} diff --cc Robust/src/Benchmarks/Chat/NetsClient.java index 8fcb8192,8fcb8192,8fcb8192,8fcb8192,8fcb8192,8fcb8192,8fcb8192..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/NetsClient.java +++ /dev/null @@@@@@@@ -1,148 -1,148 -1,148 -1,148 -1,148 -1,148 -1,148 +1,0 @@@@@@@@ -------import java.awt.*; -------import java.io.*; -------import java.net.*; -------import java.util.*; ------- -------public class NetsClient extends Thread { ------- ------- static boolean debug; ------- ------- public static void main(String argv[]) { ------- ------- String host=null; ------- int numberofclients=0; ------- int numberofmessages=0; ------- int groups=0; ------- int port=4321; ------- ------- NetsClient.debug=false; ------- try { ------- host=argv[0]; ------- port=Integer.parseInt(argv[1]); ------- numberofclients=Integer.parseInt(argv[2]); ------- numberofmessages=Integer.parseInt(argv[3]); ------- groups=Integer.parseInt(argv[4]); ------- } ------- catch (Exception e) { ------- System.out.println("NetsClient host port numberofclients numberofmessages debugflag"); ------- } ------- try { ------- NetsClient.debug=(Integer.parseInt(argv[5])==1); ------- } catch (Exception e) {} ------- ------- NetsClient[][] tarray=new NetsClient[groups][numberofclients]; ------- for (int g=0;g0) { ------- int nchar=in.read(); ------- if (nchar==10) ------- lines++; ------- } ------- } ------- pout.flush(); ------- long time=System.currentTimeMillis(); ------- while((System.currentTimeMillis()-time)<8*1000) { ------- if(in.available()>0) { ------- int nchar=in.read(); ------- time=System.currentTimeMillis(); ------- if (nchar==10) ------- lines++; ------- } else try {Thread.sleep(2);} catch (Exception e) {} ------- } ------- } ------- ------- catch (UnknownHostException e ) {System.out.println("can't find host"); } ------- catch ( IOException e ) {System.out.println("Error connecting to host");} ------- ------- } ------- -------} // end of client class diff --cc Robust/src/Benchmarks/Chat/Room.java index 938137c2,938137c2,938137c2,938137c2,938137c2,938137c2,938137c2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/Room.java +++ /dev/null @@@@@@@@ -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 +1,0 @@@@@@@@ -------public class Room { ------- String name; ------- HashSet participants; ------- public Room(String n) { ------- name=n; ------- participants=new HashSet(); ------- } ------- ------- void addParticipant(ChatSocket cs) { ------- participants.add(cs); ------- cs.room=this; ------- } ------- ------- void sendToRoom(ChatSocket caller, byte [] message) { ------- HashMapIterator hmi=participants.iterator(); ------- while(hmi.hasNext()) { ------- ChatSocket cs=(ChatSocket) hmi.next(); ------- if (cs!=caller) ------- cs.write(message); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/Chat/RoomObject.java index dd002813,dd002813,dd002813,dd002813,dd002813,dd002813,dd002813..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/RoomObject.java +++ /dev/null @@@@@@@@ -1,15 -1,15 -1,15 -1,15 -1,15 -1,15 -1,15 +1,0 @@@@@@@@ -------public class RoomObject { ------- flag Initialized; ------- HashMap rooms; ------- public RoomObject() { ------- rooms=new HashMap(); ------- } ------- ------- Room getChatRoom(String name) { ------- if (rooms.containsKey(name)) ------- return (Room) rooms.get(name); ------- Room r=new Room(name); ------- rooms.put(name, r); ------- return r; ------- } -------} diff --cc Robust/src/Benchmarks/Chat/analyze.java index fb376c1e,fb376c1e,fb376c1e,fb376c1e,fb376c1e,fb376c1e,fb376c1e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Chat/analyze.java +++ /dev/null @@@@@@@@ -1,21 -1,21 -1,21 -1,21 -1,21 -1,21 -1,21 +1,0 @@@@@@@@ -------import java.io.*; -------public class analyze { ------- public static void main(String[] q) { ------- int sum=0; ------- int count=0; ------- try { ------- BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ------- while(true) { ------- String s=br.readLine(); ------- String x=s.substring(6,s.indexOf(' ',6)); ------- ------- sum+=(new Integer(x)).intValue(); ------- count++; ------- System.out.println(sum+" "+(((double)sum)/count)); ------- } ------- } catch(Exception e) {} ------- } ------- ------- ------- -------} diff --cc Robust/src/Benchmarks/Chat/doall index c2f94651,c2f94651,c2f94651,c2f94651,c2f94651,c2f94651,c2f94651..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/Chat/doall +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------#!/bin/bash -------./runtest.sh taskchat.bin &> tasklog -------mkdir task -------mv *.log task -------./runtest.sh threadchat.bin &> threadlog -------mkdir thread -------mv *.log thread diff --cc Robust/src/Benchmarks/Chat/runtest.sh index 81be1579,81be1579,81be1579,81be1579,81be1579,81be1579,81be1579..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/Chat/runtest.sh +++ /dev/null @@@@@@@@ -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 +1,0 @@@@@@@@ -------#!/bin/bash -------let i=0 -------while [ $i -le 100 ]; -------do -------./$1 &> $i.log & -------sleep 1 -------java NetsClient 127.0.0.1 8000 2 50 8 1 -------killall -SIGUSR2 $1 -------sleep 1 -------killall -9 $1 -------let "i+=1" -------done diff --cc Robust/src/Benchmarks/ChatJava/ChatServer.java index 3c724215,3c724215,3c724215,3c724215,3c724215,3c724215,3c724215..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatJava/ChatServer.java +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------public class ChatServer { ------- ------- public static int main(String arg[]) { ------- System.printString("Chat Server Benchmark"); ------- RoomObject ro=new RoomObject(); ------- ServerSocket ss=new ServerSocket(8000); ------- acceptConnection(ss,ro); ------- } ------- ------- public static void acceptConnection(ServerSocket ss, RoomObject ro) { ------- while(true) { ------- Socket s=ss.accept(); ------- ChatThread cs=new ChatThread(s, ro); ------- cs.start(); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/ChatJava/ChatThread.java index af0d5ade,af0d5ade,af0d5ade,af0d5ade,af0d5ade,af0d5ade,af0d5ade..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatJava/ChatThread.java +++ /dev/null @@@@@@@@ -1,57 -1,57 -1,57 -1,57 -1,57 -1,57 -1,57 +1,0 @@@@@@@@ -------public class ChatThread extends Thread { ------- Room room; ------- String roomrequest; ------- Socket sock; ------- RoomObject ro; ------- ------- public ChatThread(Socket sock, RoomObject ro) { ------- this.sock=sock; ------- this.ro=ro; ------- } ------- ------- public void run() { ------- sock.write("Please choose a chatroom".getBytes()); ------- ReadRequest(); ------- ProcessRoom(); ------- while(true) ------- Message(); ------- } ------- ------- public void ReadRequest() { ------- while (!processRead()) ------- ; ------- } ------- ------- private void ProcessRoom() { ------- processRoom(ro); ------- } ------- ------- public void Message() { ------- byte buffer[]=new byte[1024]; ------- int length=sock.read(buffer); ------- if (length>0) { ------- String st=(new String(buffer)).subString(0, length); ------- room.sendToRoom(this, st.getBytes()); ------- } ------- } ------- ------- public boolean processRead() { ------- byte buffer[]=new byte[1024]; ------- int length=sock.read(buffer); ------- String st=new String(buffer); ------- String curr=st.subString(0, length); ------- if (roomrequest!=null) { ------- StringBuffer sb=new StringBuffer(roomrequest); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- roomrequest=curr; ------- if (roomrequest.indexOf("\n")>=0) { ------- return true; ------- } ------- return false; ------- } ------- public void processRoom(RoomObject ro) { ------- ro.getChatRoom(roomrequest).addParticipant(this); ------- } -------} diff --cc Robust/src/Benchmarks/ChatJava/Room.java index d43d83c2,d43d83c2,d43d83c2,d43d83c2,d43d83c2,d43d83c2,d43d83c2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatJava/Room.java +++ /dev/null @@@@@@@@ -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 +1,0 @@@@@@@@ -------public class Room { ------- String name; ------- HashSet participants; ------- public Room(String n) { ------- name=n; ------- participants=new HashSet(); ------- } ------- ------- synchronized void addParticipant(ChatThread cs) { ------- participants.add(cs); ------- cs.room=this; ------- } ------- ------- synchronized void sendToRoom(ChatThread caller, byte [] message) { ------- HashMapIterator hmi=participants.iterator(); ------- while(hmi.hasNext()) { ------- ChatThread cs=(ChatThread) hmi.next(); ------- if (cs!=caller) ------- cs.sock.write(message); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/ChatJava/RoomObject.java index 015a402a,015a402a,015a402a,015a402a,015a402a,015a402a,015a402a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatJava/RoomObject.java +++ /dev/null @@@@@@@@ -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------public class RoomObject { ------- HashMap rooms; ------- public RoomObject() { ------- rooms=new HashMap(); ------- } ------- ------- synchronized Room getChatRoom(String name) { ------- if (rooms.containsKey(name)) ------- return (Room) rooms.get(name); ------- Room r=new Room(name); ------- rooms.put(name, r); ------- return r; ------- } -------} diff --cc Robust/src/Benchmarks/ChatTag/ChatServer.java index 184d75bb,184d75bb,184d75bb,184d75bb,184d75bb,184d75bb,184d75bb..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatTag/ChatServer.java +++ /dev/null @@@@@@@@ -1,36 -1,36 -1,36 -1,36 -1,36 -1,36 -1,36 +1,0 @@@@@@@@ -------task Startup(StartupObject s{initialstate}) { ------- System.printString("Chat Server Benchmark"); ------- RoomObject ro=new RoomObject() {Initialized}; ------- ServerSocket ss=new ServerSocket(8000); ------- taskexit(s{!initialstate}); -------} ------- -------task AcceptConnection(ServerSocket ss{SocketPending}) { ------- tag t=new tag(link); ------- ChatSocket cs=new ChatSocket() {Initialized}{t}; ------- cs.sock=ss.accept(t); ------- cs.sock.write("Please choose a chatroom".getBytes()); -------} ------- -------task ReadRequest(ChatSocket cs{Initialized}{link l}, Socket s{IOPending}{link l}) { ------- if (cs.processRead(s)) { ------- taskexit(cs{!Initialized, ProcessRoom}); ------- } -------} ------- -------task ProcessRoom(ChatSocket cs{ProcessRoom}, RoomObject ro{Initialized}) { ------- cs.processRoom(ro); ------- taskexit(cs{!ProcessRoom, InRoom}); -------} ------- -------task Message(ChatSocket cs{InRoom}{link l}, Socket s{IOPending}{link l}) { ------- byte buffer[]=new byte[1024]; ------- int length=s.read(buffer); ------- Message m=new Message(buffer, length, cs){}; -------} ------- -------task SendMessage(Message m{!Sent}) { ------- String st=(new String(m.buffer)).subString(0, m.length); ------- m.cs.room.sendToRoom(m.cs,st.getBytes()); ------- taskexit(m {Sent}); -------} diff --cc Robust/src/Benchmarks/ChatTag/ChatSocket.java index 9923f91d,9923f91d,9923f91d,9923f91d,9923f91d,9923f91d,9923f91d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatTag/ChatSocket.java +++ /dev/null @@@@@@@@ -1,31 -1,31 -1,31 -1,31 -1,31 -1,31 -1,31 +1,0 @@@@@@@@ -------public class ChatSocket { ------- flag Initialized; ------- flag ProcessRoom; ------- flag InRoom; ------- Room room; ------- String roomrequest; ------- Socket sock; ------- ------- public ChatSocket() { ------- } ------- ------- public boolean processRead(Socket s) { ------- byte buffer[]=new byte[1024]; ------- int length=s.read(buffer); ------- String st=new String(buffer); ------- String curr=st.subString(0, length); ------- if (roomrequest!=null) { ------- StringBuffer sb=new StringBuffer(roomrequest); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- roomrequest=curr; ------- if (roomrequest.indexOf("\n")>=0) { ------- return true; ------- } ------- return false; ------- } ------- public void processRoom(RoomObject ro) { ------- ro.getChatRoom(roomrequest).addParticipant(this); ------- } -------} diff --cc Robust/src/Benchmarks/ChatTag/Message.java index 92db626d,92db626d,92db626d,92db626d,92db626d,92db626d,92db626d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatTag/Message.java +++ /dev/null @@@@@@@@ -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 +1,0 @@@@@@@@ -------public class Message { ------- flag Sent; ------- ChatSocket cs; ------- byte buffer[]; ------- int length; ------- ------- public Message(byte[] b, int l, ChatSocket cs) { ------- this.cs=cs; ------- this.buffer=b; ------- this.length=l; ------- } -------} diff --cc Robust/src/Benchmarks/ChatTag/Room.java index 470680a8,470680a8,470680a8,470680a8,470680a8,470680a8,470680a8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatTag/Room.java +++ /dev/null @@@@@@@@ -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 -1,22 +1,0 @@@@@@@@ -------public class Room { ------- String name; ------- HashSet participants; ------- public Room(String n) { ------- name=n; ------- participants=new HashSet(); ------- } ------- ------- void addParticipant(ChatSocket cs) { ------- participants.add(cs); ------- cs.room=this; ------- } ------- ------- void sendToRoom(ChatSocket caller, byte [] message) { ------- HashMapIterator hmi=participants.iterator(); ------- while(hmi.hasNext()) { ------- ChatSocket cs=(ChatSocket) hmi.next(); ------- if (cs!=caller) ------- cs.sock.write(message); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/ChatTag/RoomObject.java index dd002813,dd002813,dd002813,dd002813,dd002813,dd002813,dd002813..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/ChatTag/RoomObject.java +++ /dev/null @@@@@@@@ -1,15 -1,15 -1,15 -1,15 -1,15 -1,15 -1,15 +1,0 @@@@@@@@ -------public class RoomObject { ------- flag Initialized; ------- HashMap rooms; ------- public RoomObject() { ------- rooms=new HashMap(); ------- } ------- ------- Room getChatRoom(String name) { ------- if (rooms.containsKey(name)) ------- return (Room) rooms.get(name); ------- Room r=new Room(name); ------- rooms.put(name, r); ------- return r; ------- } -------} diff --cc Robust/src/Benchmarks/Spider/BR/Query.java index 82b031fa,82b031fa,82b031fa,82b031fa,82b031fa,82b031fa,82b031fa..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/BR/Query.java +++ /dev/null @@@@@@@@ -1,84 -1,84 -1,84 -1,84 -1,84 -1,84 -1,84 +1,0 @@@@@@@@ -------public class Query extends Socket { ------- flag requested; ------- flag processed; ------- flag received; ------- public int state; ------- ------- private String hostname; ------- private String path; ------- ------- private StringBuffer response; ------- ------- public Query(String hostname, String path) { ------- this.hostname=hostname; ------- this.path=path; ------- response=new StringBuffer(); ------- state=0; ------- } ------- ------- public void makeConnection() { ------- InetAddress address=InetAddress.getByName(hostname); ------- int port=80; ------- fd=nativeBind(address.getAddress(), port); ------- nativeConnect(fd, address.getAddress(), port); ------- } ------- ------- public String getHostName() { ------- return hostname; ------- } ------- ------- public String getPath() { ------- return path; ------- } ------- ------- public void outputFile() { ------- StringBuffer sb=new StringBuffer(hostname); ------- sb.append(path); ------- FileOutputStream fos=new FileOutputStream(sb.toString().replace('/','#')); ------- fos.write(response.toString().getBytes()); ------- fos.close(); ------- } ------- ------- public String makewebcanonical(String page) { ------- StringBuffer b=new StringBuffer(getHostName(page)); ------- b.append("/"); ------- b.append(getPathName(page)); ------- return b.toString(); ------- } ------- ------- public String getHostName(String page) { ------- String http=new String("http://"); ------- if (page.indexOf(http)==-1) { ------- return getHostName(); ------- } else { ------- int beginindex=page.indexOf(http)+http.length(); ------- int endindex=page.indexOf('/',beginindex+1); ------- if ((beginindex==-1)) { ------- System.printString("ERROR"); ------- } ------- if (endindex==-1) ------- endindex=page.length(); ------- return page.subString(beginindex, endindex); ------- } ------- } ------- ------- public String getPathName(String page) { ------- String http=new String("http://"); ------- if (page.indexOf(http)==-1) { ------- String path=getPath(); ------- int lastindex=path.lastindexOf('/'); ------- if (lastindex==-1) ------- return page; ------- ------- StringBuffer sb=new StringBuffer(path.subString(0,lastindex+1)); ------- sb.append(page); ------- return sb.toString(); ------- } else { ------- int beginindex=page.indexOf(http)+http.length(); ------- int nextindex=page.indexOf('/',beginindex+1); ------- if ((beginindex==-1)||(nextindex==-1)) ------- return new String("index.html"); ------- return page.subString(nextindex+1, page.length()-1); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/Spider/BR/QueryList.java index 90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/BR/QueryList.java +++ /dev/null @@@@@@@@ -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------public class QueryList { ------- flag initialized; ------- HashSet queries; ------- ------- public QueryList() { ------- queries=new HashSet(); ------- } ------- public boolean checkQuery(String x) { ------- return queries.contains(x); ------- } ------- public void addQuery(String x) { ------- queries.add(x); ------- } -------} diff --cc Robust/src/Benchmarks/Spider/BR/Spider.java index e0b6eddb,e0b6eddb,e0b6eddb,e0b6eddb,e0b6eddb,e0b6eddb,e0b6eddb..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/BR/Spider.java +++ /dev/null @@@@@@@@ -1,103 -1,103 -1,103 -1,103 -1,103 -1,103 -1,103 +1,0 @@@@@@@@ -------task Startup(StartupObject s {initialstate}) { ------- String firstmachine=s.parameters[0]; ------- String firstpage=s.parameters[1]; ------- QueryList ql=new QueryList() {initialized}; ------- Query firstquery=new Query(firstmachine, firstpage){}; ------- taskexit(s{!initialstate}); -------} ------- -------task requestQuery(Query q{!requested}) { ------- String hostname=q.getHostName(); ------- q.makeConnection(); ------- StringBuffer req=new StringBuffer("GET "); ------- req.append("/"); ------- req.append(q.getPath()); ------- req.append(" HTTP/1.1\r\nHost:"); ------- req.append(q.getHostName()); ------- req.append("\r\n\r\n"); ------- q.write(req.toString().getBytes()); ------- taskexit(q{requested}); -------} ------- -------task readResponse(Query q{requested && ! received && IOPending}) { ------- // state 0 - nothing ------- // state 1 - \r ------- // state 2 - \r\n ------- // state 3 - \r\n\r ------- // state 4 - \r\n\r\n ------- if (q.state<4) { ------- if (q.state==0) { ------- byte[] b=new byte[1]; ------- int numchars=q.read(b); ------- if ((numchars==1) && (b[0]=='\r')) ------- q.state++; ------- } else if (q.state==1) { ------- byte[] b=new byte[1]; ------- int numchars=q.read(b); ------- if (numchars==1) { ------- if (b[0]=='\n') ------- q.state++; ------- else ------- q.state=0; ------- } ------- } else if (q.state==2) { ------- byte[] b=new byte[1]; ------- int numchars=q.read(b); ------- if (numchars==1) { ------- if (b[0]=='\r') ------- q.state++; ------- else ------- q.state=0; ------- } ------- } else if (q.state==3) { ------- byte[] b=new byte[1]; ------- int numchars=q.read(b); ------- if (numchars==1) { ------- if (b[0]=='\n') ------- q.state++; ------- else ------- q.state=0; ------- } ------- } ------- } else { ------- byte[] buffer=new byte[1024]; ------- int numchars=q.read(buffer); ------- if (numchars==0) { ------- q.close(); ------- taskexit(q{received}); ------- } else { ------- String curr=(new String(buffer)).subString(0,numchars); ------- q.response.append(curr); ------- } ------- } -------} ------- -------task processPage(Query q{received&&!processed}, QueryList ql{initialized}) { ------- int index=0; ------- String href=new String("href=\""); ------- String searchstr=q.response.toString(); ------- boolean cont=true; ------- q.outputFile(); ------- ------- while(cont) { ------- int mindex=searchstr.indexOf(href,index); ------- if (mindex!=-1) { ------- ------- int endquote=searchstr.indexOf('"', mindex+href.length()); ------- if (endquote!=-1) { ------- String match=searchstr.subString(mindex+href.length(), endquote); ------- String match2=q.makewebcanonical(match); ------- if (match2!=null&&!ql.checkQuery(match2)) { ------- ql.addQuery(match2); ------- System.printString(q.getHostName(match)); ------- System.printString(" "); ------- System.printString(q.getPathName(match)); ------- System.printString("\n"); ------- Query newq=new Query(q.getHostName(match), q.getPathName(match)){}; ------- } ------- index=endquote; ------- } else cont=false; ------- } else cont=false; ------- } ------- taskexit(q{processed}); -------} diff --cc Robust/src/Benchmarks/Spider/BRTag/Query.java index 338f7d92,338f7d92,338f7d92,338f7d92,338f7d92,338f7d92,338f7d92..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/BRTag/Query.java +++ /dev/null @@@@@@@@ -1,84 -1,84 -1,84 -1,84 -1,84 -1,84 -1,84 +1,0 @@@@@@@@ -------public class Query { ------- flag requested; ------- flag processed; ------- flag received; ------- public int state; ------- ------- private String hostname; ------- private String path; ------- ------- private StringBuffer response; ------- ------- public Query(String hostname, String path) { ------- this.hostname=hostname; ------- this.path=path; ------- response=new StringBuffer(); ------- state=0; ------- } ------- ------- public void makeConnection(Socket s) { ------- InetAddress address=InetAddress.getByName(hostname); ------- int port=80; ------- s.fd=Socket.nativeBind(address.getAddress(), port); ------- s.nativeConnect(s.fd, address.getAddress(), port); ------- } ------- ------- public String getHostName() { ------- return hostname; ------- } ------- ------- public String getPath() { ------- return path; ------- } ------- ------- public void outputFile() { ------- StringBuffer sb=new StringBuffer(hostname); ------- sb.append(path); ------- FileOutputStream fos=new FileOutputStream(sb.toString().replace('/','#')); ------- fos.write(response.toString().getBytes()); ------- fos.close(); ------- } ------- ------- public String makewebcanonical(String page) { ------- StringBuffer b=new StringBuffer(getHostName(page)); ------- b.append("/"); ------- b.append(getPathName(page)); ------- return b.toString(); ------- } ------- ------- public String getHostName(String page) { ------- String http=new String("http://"); ------- if (page.indexOf(http)==-1) { ------- return getHostName(); ------- } else { ------- int beginindex=page.indexOf(http)+http.length(); ------- int endindex=page.indexOf('/',beginindex+1); ------- if ((beginindex==-1)) { ------- System.printString("ERROR"); ------- } ------- if (endindex==-1) ------- endindex=page.length(); ------- return page.subString(beginindex, endindex); ------- } ------- } ------- ------- public String getPathName(String page) { ------- String http=new String("http://"); ------- if (page.indexOf(http)==-1) { ------- String path=getPath(); ------- int lastindex=path.lastindexOf('/'); ------- if (lastindex==-1) ------- return page; ------- ------- StringBuffer sb=new StringBuffer(path.subString(0,lastindex+1)); ------- sb.append(page); ------- return sb.toString(); ------- } else { ------- int beginindex=page.indexOf(http)+http.length(); ------- int nextindex=page.indexOf('/',beginindex+1); ------- if ((beginindex==-1)||(nextindex==-1)) ------- return new String("index.html"); ------- return page.subString(nextindex+1, page.length()-1); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/Spider/BRTag/QueryList.java index 90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe,90dc9dfe..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/BRTag/QueryList.java +++ /dev/null @@@@@@@@ -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------public class QueryList { ------- flag initialized; ------- HashSet queries; ------- ------- public QueryList() { ------- queries=new HashSet(); ------- } ------- public boolean checkQuery(String x) { ------- return queries.contains(x); ------- } ------- public void addQuery(String x) { ------- queries.add(x); ------- } -------} diff --cc Robust/src/Benchmarks/Spider/BRTag/Spider.java index e3fd3679,e3fd3679,e3fd3679,e3fd3679,e3fd3679,e3fd3679,e3fd3679..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/BRTag/Spider.java +++ /dev/null @@@@@@@@ -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 -1,107 +1,0 @@@@@@@@ -------task Startup(StartupObject s {initialstate}) { ------- String firstmachine=s.parameters[0]; ------- String firstpage=s.parameters[1]; ------- QueryList ql=new QueryList() {initialized}; ------- tag t=new tag(connect); ------- Socket sock=new Socket(){}{t}; ------- Query firstquery=new Query(firstmachine, firstpage){}{t}; ------- taskexit(s{!initialstate}); -------} ------- -------task requestQuery(Query q{!requested}{connect t}, Socket s{}{connect t}) { ------- String hostname=q.getHostName(); ------- q.makeConnection(s); ------- StringBuffer req=new StringBuffer("GET "); ------- req.append("/"); ------- req.append(q.getPath()); ------- req.append(" HTTP/1.1\r\nHost:"); ------- req.append(q.getHostName()); ------- req.append("\r\n\r\n"); ------- s.write(req.toString().getBytes()); ------- taskexit(q{requested}); -------} ------- -------task readResponse(Query q{requested && ! received}{connect t},Socket s{IOPending}{connect t}) { ------- // state 0 - nothing ------- // state 1 - \r ------- // state 2 - \r\n ------- // state 3 - \r\n\r ------- // state 4 - \r\n\r\n ------- if (q.state<4) { ------- if (q.state==0) { ------- byte[] b=new byte[1]; ------- int numchars=s.read(b); ------- if ((numchars==1) && (b[0]=='\r')) ------- q.state++; ------- } else if (q.state==1) { ------- byte[] b=new byte[1]; ------- int numchars=s.read(b); ------- if (numchars==1) { ------- if (b[0]=='\n') ------- q.state++; ------- else ------- q.state=0; ------- } ------- } else if (q.state==2) { ------- byte[] b=new byte[1]; ------- int numchars=s.read(b); ------- if (numchars==1) { ------- if (b[0]=='\r') ------- q.state++; ------- else ------- q.state=0; ------- } ------- } else if (q.state==3) { ------- byte[] b=new byte[1]; ------- int numchars=s.read(b); ------- if (numchars==1) { ------- if (b[0]=='\n') ------- q.state++; ------- else ------- q.state=0; ------- } ------- } ------- } else { ------- byte[] buffer=new byte[1024]; ------- int numchars=s.read(buffer); ------- if (numchars==0) { ------- s.close(); ------- taskexit(q{received}); ------- } else { ------- String curr=(new String(buffer)).subString(0,numchars); ------- q.response.append(curr); ------- } ------- } -------} ------- -------task processPage(Query q{received&&!processed}, QueryList ql{initialized}) { ------- int index=0; ------- String href=new String("href=\""); ------- String searchstr=q.response.toString(); ------- boolean cont=true; ------- q.outputFile(); ------- ------- while(cont) { ------- int mindex=searchstr.indexOf(href,index); ------- if (mindex!=-1) { ------- ------- int endquote=searchstr.indexOf('"', mindex+href.length()); ------- if (endquote!=-1) { ------- String match=searchstr.subString(mindex+href.length(), endquote); ------- String match2=q.makewebcanonical(match); ------- if (match2!=null&&!ql.checkQuery(match2)) { ------- ql.addQuery(match2); ------- System.printString(q.getHostName(match)); ------- System.printString(" "); ------- System.printString(q.getPathName(match)); ------- System.printString("\n"); ------- tag t=new tag(connect); ------- Socket s=new Socket(){}{t}; ------- Query newq=new Query(q.getHostName(match), q.getPathName(match)){}{t}; ------- } ------- index=endquote; ------- } else cont=false; ------- } else cont=false; ------- } ------- taskexit(q{processed}); -------} diff --cc Robust/src/Benchmarks/Spider/Java/Query.java index 3fba0a39,3fba0a39,3fba0a39,3fba0a39,3fba0a39,3fba0a39,3fba0a39..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/Java/Query.java +++ /dev/null @@@@@@@@ -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 +1,0 @@@@@@@@ -------public class Query { ------- private String hostname; ------- private String path; ------- ------- private StringBuffer response; ------- ------- public Query(String hostname, String path) { ------- this.hostname=hostname; ------- this.path=path; ------- response=new StringBuffer(); ------- } ------- ------- public String getHostName() { ------- return hostname; ------- } ------- ------- public String getPath() { ------- return path; ------- } ------- ------- public void outputFile() { ------- StringBuffer sb=new StringBuffer(hostname); ------- sb.append(path); ------- FileOutputStream fos=new FileOutputStream(sb.toString().replace('/','#')); ------- fos.write(response.toString().getBytes()); ------- fos.close(); ------- } ------- ------- public String makewebcanonical(String page) { ------- StringBuffer b=new StringBuffer(getHostName(page)); ------- b.append("/"); ------- b.append(getPathName(page)); ------- return b.toString(); ------- } ------- ------- public String getHostName(String page) { ------- String http=new String("http://"); ------- if (page.indexOf(http)==-1) { ------- return getHostName(); ------- } else { ------- int beginindex=page.indexOf(http)+http.length(); ------- int endindex=page.indexOf('/',beginindex+1); ------- if ((beginindex==-1)) { ------- System.printString("ERROR"); ------- } ------- if (endindex==-1) ------- endindex=page.length(); ------- return page.subString(beginindex, endindex); ------- } ------- } ------- ------- public String getPathName(String page) { ------- String http=new String("http://"); ------- if (page.indexOf(http)==-1) { ------- String path=getPath(); ------- int lastindex=path.lastindexOf('/'); ------- if (lastindex==-1) ------- return page; ------- ------- StringBuffer sb=new StringBuffer(path.subString(0,lastindex+1)); ------- sb.append(page); ------- return sb.toString(); ------- } else { ------- int beginindex=page.indexOf(http)+http.length(); ------- int nextindex=page.indexOf('/',beginindex+1); ------- if ((beginindex==-1)||(nextindex==-1)) ------- return new String("index.html"); ------- return page.subString(nextindex+1, page.length()); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/Spider/Java/QueryList.java index 00d66e3a,00d66e3a,00d66e3a,00d66e3a,00d66e3a,00d66e3a,00d66e3a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/Java/QueryList.java +++ /dev/null @@@@@@@@ -1,13 -1,13 -1,13 -1,13 -1,13 -1,13 -1,13 +1,0 @@@@@@@@ -------public class QueryList { ------- HashSet queries; ------- ------- public QueryList() { ------- queries=new HashSet(); ------- } ------- public boolean checkQuery(String x) { ------- return queries.contains(x); ------- } ------- public void addQuery(String x) { ------- queries.add(x); ------- } -------} diff --cc Robust/src/Benchmarks/Spider/Java/QueryQueue.java index f379e1dd,f379e1dd,f379e1dd,f379e1dd,f379e1dd,f379e1dd,f379e1dd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/Java/QueryQueue.java +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------public class QueryQueue { ------- HashSet queries; ------- ------- public QueryQueue() { ------- queries=new HashSet(); ------- } ------- public synchronized Query getQuery() { ------- if (queries.isEmpty()) ------- return null; ------- Query q=(Query) queries.iterator().next(); ------- queries.remove(q); ------- return q; ------- } ------- public synchronized void addQuery(Query x) { ------- queries.add(x); ------- } -------} diff --cc Robust/src/Benchmarks/Spider/Java/QueryThread.java index 6bf2d085,6bf2d085,6bf2d085,6bf2d085,6bf2d085,6bf2d085,6bf2d085..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/Java/QueryThread.java +++ /dev/null @@@@@@@@ -1,129 -1,129 -1,129 -1,129 -1,129 -1,129 -1,129 +1,0 @@@@@@@@ -------public class QueryThread extends Thread { ------- QueryQueue toprocess; ------- QueryList ql; ------- public QueryThread(QueryQueue qq, QueryList ql) { ------- toprocess=qq; ------- this.ql=ql; ------- } ------- ------- public void run() { ------- while(true) { ------- Query q=null; ------- while(q==null) { ------- q=toprocess.getQuery(); ------- if (q==null) ------- Thread.sleep(2); ------- } ------- String hostname=q.getHostName(); ------- System.printString("Processing "); ------- System.printString(hostname); ------- System.printString(" "); ------- System.printString(q.getPath()); ------- System.printString("\n"); ------- Socket s=new Socket(hostname, 80); ------- requestQuery(q, s); ------- readResponse(q, s); ------- q.outputFile(); ------- processPage(q, ql); ------- s.close(); ------- } ------- } ------- ------- void requestQuery(Query q, Socket sock) { ------- StringBuffer req=new StringBuffer("GET "); ------- req.append("/"); ------- req.append(q.getPath()); ------- req.append(" HTTP/1.1\r\nHost:"); ------- req.append(q.getHostName()); ------- req.append("\r\n\r\n"); ------- sock.write(req.toString().getBytes()); ------- } ------- ------- void readResponse(Query q, Socket sock) { ------- // state 0 - nothing ------- // state 1 - \r ------- // state 2 - \r\n ------- // state 3 - \r\n\r ------- // state 4 - \r\n\r\n ------- int state=0; ------- while(true) { ------- if (state<4) { ------- if (state==0) { ------- byte[] b=new byte[1]; ------- int numchars=sock.read(b); ------- if ((numchars==1)) { ------- if (b[0]=='\r') { ------- state++; ------- } ------- } else ------- return; ------- } else if (state==1) { ------- byte[] b=new byte[1]; ------- int numchars=sock.read(b); ------- if (numchars==1) { ------- if (b[0]=='\n') ------- state++; ------- else ------- state=0; ------- } else return; ------- } else if (state==2) { ------- byte[] b=new byte[1]; ------- int numchars=sock.read(b); ------- if (numchars==1) { ------- if (b[0]=='\r') ------- state++; ------- else ------- state=0; ------- } else return; ------- } else if (state==3) { ------- byte[] b=new byte[1]; ------- int numchars=sock.read(b); ------- if (numchars==1) { ------- if (b[0]=='\n') ------- state++; ------- else ------- state=0; ------- } else return; ------- } ------- } else { ------- byte[] buffer=new byte[1024]; ------- int numchars=sock.read(buffer); ------- if (numchars==0) ------- return; ------- else { ------- String curr=(new String(buffer)).subString(0,numchars); ------- q.response.append(curr); ------- } ------- } ------- } ------- } ------- ------- void processPage(Query q, QueryList ql) { ------- int index=0; ------- String href=new String("href=\""); ------- String searchstr=q.response.toString(); ------- boolean cont=true; ------- while(cont) { ------- int mindex=searchstr.indexOf(href,index); ------- if (mindex!=-1) { ------- ------- int endquote=searchstr.indexOf('"', mindex+href.length()); ------- if (endquote!=-1) { ------- String match=searchstr.subString(mindex+href.length(), endquote); ------- String match2=q.makewebcanonical(match); ------- if (match2!=null&&!ql.checkQuery(match2)) { ------- ql.addQuery(match2); ------- System.printString(q.getHostName(match)); ------- System.printString(" "); ------- System.printString(q.getPathName(match)); ------- System.printString("\n"); ------- Query newq=new Query(q.getHostName(match), q.getPathName(match)); ------- toprocess.addQuery(newq); ------- } ------- index=endquote; ------- } else cont=false; ------- } else cont=false; ------- } ------- } ------- -------} diff --cc Robust/src/Benchmarks/Spider/Java/Spider.java index fbe6648e,fbe6648e,fbe6648e,fbe6648e,fbe6648e,fbe6648e,fbe6648e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/Java/Spider.java +++ /dev/null @@@@@@@@ -1,23 -1,23 -1,23 -1,23 -1,23 -1,23 -1,23 +1,0 @@@@@@@@ -------public class Spider { ------- ------- ------- ------- public static void main(String[] parameters) { ------- String firstmachine=parameters[0]; ------- String firstpage=parameters[1]; ------- QueryList ql=new QueryList(); ------- QueryQueue toprocess=new QueryQueue(); ------- Query firstquery=new Query(firstmachine, firstpage); ------- toprocess.addQuery(firstquery); ------- QueryThread qt1=new QueryThread(toprocess, ql); ------- qt1.start(); ------- QueryThread qt2=new QueryThread(toprocess, ql); ------- qt2.start(); ------- QueryThread qt3=new QueryThread(toprocess, ql); ------- qt3.start(); ------- while(true) ------- Thread.sleep(1000000); ------- } ------- ------- -------} diff --cc Robust/src/Benchmarks/Spider/dotest index 18d006cc,18d006cc,18d006cc,18d006cc,18d006cc,18d006cc,18d006cc..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/Spider/dotest +++ /dev/null @@@@@@@@ -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 +1,0 @@@@@@@@ -------#!/bin/bash -------mkdir $1 -------cd $1 -------../$2 127.0.0.1 test/0.html &> log & -------fcount=`ls -al 127*` -------let "count=0" -------while true -------do -------sleep 60 -------fnewcount=`ls -al 127*` -------if [ "$fnewcount" != "$fcount" ] ------- then ------- let "count=0" ------- fcount="$fnewcount" -------fi -------let "count+=1" -------if [ $count = "3" ] -------then -------break -------fi -------done -------killall -SIGUSR2 $2 -------sleep 1 -------killall -9 $2 -------cd .. diff --cc Robust/src/Benchmarks/Spider/tests/generate.java index 0710a702,0710a702,0710a702,0710a702,0710a702,0710a702,0710a702..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/Spider/tests/generate.java +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------import java.io.*; ------- -------public class generate { ------- public static void main(String x[]) { ------- int MAX=100; ------- int current=0; ------- int currentref=1; ------- while(current2) ------- break; ------- int cc=currentref%MAX; ------- String reffile=cc+".html"; ------- ps.println(""+reffile+""); ------- currentref++; ------- } ------- current++; ------- fos.close(); ------- } catch (Exception e) {e.printStackTrace();} ------- } ------- } ------- ------- -------} diff --cc Robust/src/Benchmarks/Spider/testscript index f5683509,f5683509,f5683509,f5683509,f5683509,f5683509,f5683509..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/Spider/testscript +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ -------#!/bin/bash -------let i=62 -------while [ $i -le 100 ] -------do -------./dotest THREAD$i threadspider.bin -------./dotest TASK$i taskspider.bin -------let "i+=1" -------done diff --cc Robust/src/Benchmarks/TTT/Board.java index 8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTT/Board.java +++ /dev/null @@@@@@@@ -1,93 -1,93 -1,93 -1,93 -1,93 -1,93 -1,93 +1,0 @@@@@@@@ -------public class Board { ------- // TicTacToe Board flags ------- flag init; ------- ------- int[][] board; ------- ------- int winningplayer; ------- ------- public Board() { ------- winningplayer = -1; ------- board = new int[3][3]; ------- for (int i = 0; i < 3; i++) ------- for (int j = 0; j < 3; j++) ------- board[i][j] = 0; ------- } ------- ------- public int makeMove(int row, int col) { ------- if (boardFull() == 1) { ------- winningplayer = 0; ------- return 2; ------- } ------- if (board[row][col] != 0) { // Space taken ------- return -1; ------- } ------- else { ------- board[row][col] = 1; ------- if (checkForWin(1) == 1) { // Check if player won ------- winningplayer = 1; ------- return 2; ------- } ------- // Computer makes move ------- if (computerMakeMove() == 1) { // If made move successful ------- if (checkForWin(2) == 1) { // Check if computer won ------- winningplayer = 2; ------- return 2; ------- } ------- } ------- else { // Board full, no winner ------- winningplayer = 0; ------- return 2; ------- } ------- } ------- return 1; ------- } ------- ------- public int boardFull() { ------- for (int i = 0; i < 3; i++) ------- for (int j = 0; j < 3; j++) ------- if (board[i][j] == 0) ------- return 0; ------- return 1; ------- } ------- ------- public int computerMakeMove() { ------- for (int i = 0; i < 3; i++) ------- for (int j = 0; j < 3; j++) ------- if (board[i][j] == 0) { ------- board[i][j] = 2; ------- return 1; ------- } ------- return 0; ------- } ------- ------- public int checkForWin(int p) { ------- // Add logic for checking if player p wins ------- // Horiz ------- ------- if ((board[0][0] == p) && (board[0][1] == p) && (board[0][2] == p) || ------- (board[1][0] == p) && (board[1][1] == p) && (board[1][2] == p) || ------- (board[2][0] == p) && (board[2][1] == p) && (board[2][2] == p)) { ------- return 1; ------- } ------- ------- // Vert ------- if ((board[0][0] == p) && (board[1][0] == p) && (board[2][0] == p) || ------- (board[0][1] == p) && (board[1][1] == p) && (board[2][1] == p) || ------- (board[0][2] == p) && (board[1][2] == p) && (board[2][2] == p)) { ------- return 1; ------- } ------- ------- //Diag ------- if ((board[0][0] == p) && (board[1][1] == p) && (board[2][2] == p) || ------- (board[0][2] == p) && (board[1][1] == p) && (board[2][0] == p)) { ------- return 1; ------- } ------- ------- return 0; ------- } ------- ------- public int winner() { ------- return winningplayer; ------- } -------} diff --cc Robust/src/Benchmarks/TTT/TTTServer.java index 30bb7064,30bb7064,30bb7064,30bb7064,30bb7064,30bb7064,30bb7064..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTT/TTTServer.java +++ /dev/null @@@@@@@@ -1,58 -1,58 -1,58 -1,58 -1,58 -1,58 -1,58 +1,0 @@@@@@@@ -------/* Startup object is generated with the initialstate flag set by the ------- * system to start the computation up */ ------- -------// Create ServerSocket -------task Startup(StartupObject s {initialstate}) { ------- System.printString("TTT Server Starting...\n"); ------- ServerSocket ss = new ServerSocket(8000); ------- System.printString("Creating ServerSocket\n"); ------- Board tttBoard = new Board() {init}; ------- taskexit(s {!initialstate}); // Turn off initial state flag -------} ------- -------//Listen for a request and accept request -------task AcceptConnection(ServerSocket ss{SocketPending}) { ------- System.printString("Waiting for connection...\n"); ------- TTTServerSocket ttts = new TTTServerSocket() {TTTSInitialize}; ------- System.printString("Calling accept...\n"); ------- ss.accept(ttts); ------- System.printString("Connected...\n"); -------} ------- -------// Process incoming requests -------task ProcessRequest(TTTServerSocket ttts{IOPending && TTTSInitialize}) { ------- System.printString("Request received..."); ------- int action = ttts.receive(); ------- if (action == 1) { // Make move ------- taskexit(ttts {MakeMove}); ------- } ------- else { // Send Error ------- taskexit(ttts {SendError}); ------- } -------} ------- -------task ProcessMove(TTTServerSocket ttts{MakeMove}, Board tttBoard{init}) { ------- System.printString("Processing player's move..."); ------- int result = tttBoard.makeMove(ttts.getRow(), ttts.getCol()); ------- if (result == 1) { //Move made, send board display ------- taskexit(ttts {!MakeMove, SendBoard}); ------- } ------- else if (result == 2) { //Move made, game over ------- taskexit(ttts {!MakeMove, SendDone}); ------- } ------- else {// Error ------- taskexit(ttts {!MakeMove, SendError}); ------- } -------} ------- -------task SendBoardDisplay(TTTServerSocket ttts{SendBoard}, Board tttBoard{init}) { ------- ttts.sendBoardDisplay(tttBoard); -------} ------- -------task GameOver(TTTServerSocket ttts{SendDone}, Board tttBoard{init}) { ------- ttts.sendDone(tttBoard.winner()); -------} ------- -------task SendErrorMessage(TTTServerSocket ttts{SendError}, Board tttBoard{init}) { ------- ttts.sendError(); -------} diff --cc Robust/src/Benchmarks/TTT/TTTServerSocket.java index 577a248a,577a248a,577a248a,577a248a,577a248a,577a248a,577a248a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTT/TTTServerSocket.java +++ /dev/null @@@@@@@@ -1,101 -1,101 -1,101 -1,101 -1,101 -1,101 -1,101 +1,0 @@@@@@@@ -------public class TTTServerSocket extends Socket { ------- // TTTServerSocket flags ------- flag TTTSInitialize; ------- ------- flag MakeMove; ------- flag SendError; ------- flag SendBoard; ------- flag SendDone; ------- ------- String request; ------- int row, col; ------- ------- //Constructor ------- public TTTServerSocket(){ ------- System.printString("Constructing TTTServerSocket....\n"); ------- } ------- ------- public int receive() ------- { ------- byte b1[] = new byte[1024]; ------- read(b1); ------- request = new String(b1); ------- System.printString("request: "); ------- System.printString(request); ------- if (parseTransaction() == 1) { ------- return 1; ------- } ------- return 0; ------- } ------- ------- // Parse request ------- public int parseTransaction(){ ------- int start = request.indexOf('_'); ------- String s = request.subString(start+1); -------//_move:3:3 ------- if (s.startsWith("move")==true){ ------- //Get row ------- int i1 = s.indexOf(':'); ------- String rowStr = new String(s.subString(i1+1, i1+2)); ------- row = Integer.parseInt(rowStr); ------- ------- //Get col ------- String s2 = new String(s.subString(i1+2)); ------- int i2 = s2.indexOf(':'); ------- String colStr = new String(s.subString(i2+1, i2+2)); ------- col = Integer.parseInt(colStr); ------- return 1; ------- ------- } ------- // Error transaction ------- return -1; ------- } ------- ------- public int getRow(){ ------- return row; ------- } ------- public int getCol(){ ------- return col; ------- } ------- ------- public void sendBoardDisplay(Board theBoard) { ------- StringBuffer line1 = new String ("display_"); ------- ------- for (int i = 0; i < 3; i++) { ------- for (int j = 0; j < 3; j++) { ------- if (theBoard.board[i][j] == 1) ------- line1.append("X"); ------- else if (theBoard.board[i][j] == 2) ------- line1.append("O"); ------- else ------- line1.append("-"); ------- } ------- line1.append("_"); ------- } ------- String towrite = new String(line1); ------- write(towrite.getBytes()); ------- return; ------- } ------- ------- public void sendDone(int winner) { ------- StringBuffer line1 = new String ("done_"); ------- if (winner == 0) ------- line1.append("tie"); ------- else if (winner == 1) ------- line1.append("player"); ------- else ------- line1.append("computer"); ------- ------- String towrite = new String(line1); ------- write(towrite.getBytes()); ------- return; ------- } ------- ------- public void sendError() { ------- StringBuffer line1 = new String ("error_wrongmove"); ------- ------- String towrite = new String(line1); ------- write(towrite.getBytes()); ------- return; ------- } -------} diff --cc Robust/src/Benchmarks/TTTJava/TTTServer.java index 8806080e,8806080e,8806080e,8806080e,8806080e,8806080e,8806080e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTTJava/TTTServer.java +++ /dev/null @@@@@@@@ -1,293 -1,293 -1,293 -1,293 -1,293 -1,293 -1,293 +1,0 @@@@@@@@ -------import java.net.*; -------import java.io.*; ------- -------public class TTTServer -------{ ------- //the tictactoe game board ------- //2d 3x3 char array ------- private static char[][] board; ------- //keeps track of how many turns have past ------- private static int numOfTurns; ------- //ints used to store the location of the cell the user will input ------- private static int row; ------- private static int col; ------- private static boolean notDone; ------- ------- private static void resetGame() ------- { ------- numOfTurns = 0; ------- row = 0; ------- col = 0; ------- ------- for(int i = 0; i < 3; i++) ------- { ------- for(int j = 0; j < 3; j++) ------- { ------- board[i][j] = ' '; ------- } ------- } ------- } ------- ------- private static void displayBoard() ------- { ------- System.out.println("--------------------"); ------- System.out.println("[R,C][ 1 ][ 2 ][ 3 ]"); ------- System.out.println("--------------------"); ------- System.out.println("[ 1 ]| " + board[0][0] + " | " + board[0][1] + ------- " | " + board[0][2] + " | "); ------- System.out.println("--------------------"); ------- System.out.println("[ 2 ]| " + board[1][0] + " | " + board[1][1] + ------- " | " + board[1][2] + " | "); ------- System.out.println("--------------------"); ------- System.out.println("[ 3 ]| " + board[2][0] + " | " + board[2][1] + ------- " | " + board[2][2] + " | "); ------- System.out.println("--------------------"); ------- } ------- ------- //put the move on the board and update numOfTurns ------- private static void markMove(char xo) ------- { ------- board[row - 1][col - 1] = xo; ------- numOfTurns++; ------- } ------- ------- //check for a winner or a tie ------- //true == winner or tie ------- private static boolean checkWinner(char xo) ------- { ------- //horizontal win ------- if(board[0][0] == xo && board[0][0] == board[0][1] && ------- board[0][1] == board[0][2]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //horizontal win ------- else if(board[1][0] == xo && board[1][0] == board[1][1] && ------- board[1][1] == board[1][2]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //horizontal win ------- else if(board[2][0] == xo && board[2][0] == board[2][1] && ------- board[2][1] == board[2][2]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //vertial win ------- else if(board[0][0] == xo && board[0][0] == board[1][0] && ------- board[1][0] == board[2][0]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //vertial win ------- else if(board[0][1] == xo && board[0][1] == board[1][1] && ------- board[1][1] == board[2][1]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //vertial win ------- else if(board[0][2] == xo && board[0][2] == board[1][2] && ------- board[1][2] == board[2][2]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //diagonal win ------- else if(board[0][0] == xo && board[0][0] == board[1][1] && ------- board[1][1] == board[2][2]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //diagonal win ------- else if(board[0][2] == xo && board[0][2] == board[1][1] && ------- board[1][1] == board[2][0]) ------- { ------- System.out.println(xo + " is the winner!"); ------- return true; ------- } ------- //tie game ------- //board is full ------- else if(numOfTurns == 9) ------- { ------- System.out.println("Tie Game!"); ------- return true; ------- } ------- //no winner yet ------- else ------- return false; ------- } ------- ------- //the logic that happens for each turn for X or O ------- public static void turnLogic(char xo, int r, int c) ------- { ------- if(xo == 'X') ------- { ------- System.out.println("\n" + xo + "'s turn."); ------- System.out.println("Please enter your move as two separate integers: "); ------- //-1 -1 to quit ------- row = readInt(); ------- col = readInt(); ------- System.out.println("\nYou entered (" + row + "," + col + ")\n"); ------- } ------- else if(xo == 'O') ------- { ------- System.out.println("\n" + xo + "'s turn."); ------- row = r; ------- col = c; ------- } ------- ------- markMove(xo); ------- displayBoard(); ------- ------- //check for a winner and quit cond. ------- if(checkWinner(xo) || (row == -1 && col == -1)) ------- notDone = false; ------- } ------- ------- public static void main(String[] args) ------- { ------- //the sockets to be used ------- ServerSocket mySocket = null; ------- Socket myConnection= null; ------- //string that will hold the message to be received and sent ------- String myString = null; ------- //input buffer ------- BufferedReader myInput = null; ------- //output buffer ------- PrintStream myOutput = null; ------- //loop variable ------- notDone = true; ------- ------- board = new char[3][3]; ------- resetGame(); ------- ------- //start server ------- try ------- { ------- //create new socket ------- mySocket = new ServerSocket(8080); ------- System.out.println("Server Port: " + mySocket.getLocalPort()); ------- ------- displayBoard(); ------- ------- //accept incoming tcp connection ------- myConnection = mySocket.accept(); ------- ------- //create and read the message from the client to the input buffer ------- myInput = new BufferedReader(new InputStreamReader(myConnection.getInputStream())); ------- ------- //create and print the message to the output buffer ------- myOutput = new PrintStream(myConnection.getOutputStream()); ------- ------- //loop for nine times at most ------- while(numOfTurns != 9 && notDone == true) ------- { ------- switch(numOfTurns % 2) ------- { ------- //even case ------- case 0: ------- turnLogic('X', 0, 0); ------- myOutput.println(row + " " + col); ------- break; ------- ------- //odd case ------- case 1: ------- myString = myInput.readLine(); ------- ------- //was "quit" received? ------- if(myString.equals("quit")) ------- { ------- notDone = false; ------- } ------- else ------- { ------- int r = Integer.parseInt(myString.substring(0, 1)); ------- int c = Integer.parseInt(myString.substring(2, 3)); ------- turnLogic('O', r, c); ------- } ------- break; ------- ------- //should not happen ------- default: ------- System.out.println("Program Error!"); ------- break; ------- } ------- } ------- ------- //close buffers ------- myInput.close(); ------- myOutput.close(); ------- ------- //close socket ------- myConnection.close(); ------- } ------- catch(IOException e) ------- { ------- System.err.println(e); ------- System.exit(1); ------- } ------- } ------- ------- //some good stuff to read user ints, maybe too much? ------- public static int readInt() throws NumberFormatException ------- { ------- String inputString = null; ------- inputString = readWord(); ------- ------- return Integer.parseInt(inputString); ------- } ------- ------- //read a lot ------- public static String readWord() ------- { ------- String result = ""; ------- char next; ------- ------- next = readChar(); ------- while (Character.isWhitespace(next)) ------- next = readChar(); ------- ------- while(!(Character.isWhitespace(next))) ------- { ------- result = result + next; ------- next = readChar(); ------- } ------- ------- if (next == '\r') ------- { ------- next = readChar(); ------- ------- if (next != '\n') ------- { ------- System.err.println("Error."); ------- System.exit(1); ------- } ------- } ------- ------- return result; ------- } ------- ------- //read one ------- public static char readChar() ------- { ------- int charAsInt = -1; ------- ------- try ------- { ------- charAsInt = System.in.read(); ------- } ------- catch(IOException e) ------- { ------- System.err.println(e); ------- System.exit(1); ------- } ------- ------- return (char)charAsInt; ------- } -------} diff --cc Robust/src/Benchmarks/TTTTag/Board.java index 8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88,8f4a3d88..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTTTag/Board.java +++ /dev/null @@@@@@@@ -1,93 -1,93 -1,93 -1,93 -1,93 -1,93 -1,93 +1,0 @@@@@@@@ -------public class Board { ------- // TicTacToe Board flags ------- flag init; ------- ------- int[][] board; ------- ------- int winningplayer; ------- ------- public Board() { ------- winningplayer = -1; ------- board = new int[3][3]; ------- for (int i = 0; i < 3; i++) ------- for (int j = 0; j < 3; j++) ------- board[i][j] = 0; ------- } ------- ------- public int makeMove(int row, int col) { ------- if (boardFull() == 1) { ------- winningplayer = 0; ------- return 2; ------- } ------- if (board[row][col] != 0) { // Space taken ------- return -1; ------- } ------- else { ------- board[row][col] = 1; ------- if (checkForWin(1) == 1) { // Check if player won ------- winningplayer = 1; ------- return 2; ------- } ------- // Computer makes move ------- if (computerMakeMove() == 1) { // If made move successful ------- if (checkForWin(2) == 1) { // Check if computer won ------- winningplayer = 2; ------- return 2; ------- } ------- } ------- else { // Board full, no winner ------- winningplayer = 0; ------- return 2; ------- } ------- } ------- return 1; ------- } ------- ------- public int boardFull() { ------- for (int i = 0; i < 3; i++) ------- for (int j = 0; j < 3; j++) ------- if (board[i][j] == 0) ------- return 0; ------- return 1; ------- } ------- ------- public int computerMakeMove() { ------- for (int i = 0; i < 3; i++) ------- for (int j = 0; j < 3; j++) ------- if (board[i][j] == 0) { ------- board[i][j] = 2; ------- return 1; ------- } ------- return 0; ------- } ------- ------- public int checkForWin(int p) { ------- // Add logic for checking if player p wins ------- // Horiz ------- ------- if ((board[0][0] == p) && (board[0][1] == p) && (board[0][2] == p) || ------- (board[1][0] == p) && (board[1][1] == p) && (board[1][2] == p) || ------- (board[2][0] == p) && (board[2][1] == p) && (board[2][2] == p)) { ------- return 1; ------- } ------- ------- // Vert ------- if ((board[0][0] == p) && (board[1][0] == p) && (board[2][0] == p) || ------- (board[0][1] == p) && (board[1][1] == p) && (board[2][1] == p) || ------- (board[0][2] == p) && (board[1][2] == p) && (board[2][2] == p)) { ------- return 1; ------- } ------- ------- //Diag ------- if ((board[0][0] == p) && (board[1][1] == p) && (board[2][2] == p) || ------- (board[0][2] == p) && (board[1][1] == p) && (board[2][0] == p)) { ------- return 1; ------- } ------- ------- return 0; ------- } ------- ------- public int winner() { ------- return winningplayer; ------- } -------} diff --cc Robust/src/Benchmarks/TTTTag/TTTServer.java index e7288a0d,e7288a0d,e7288a0d,e7288a0d,e7288a0d,e7288a0d,e7288a0d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTTTag/TTTServer.java +++ /dev/null @@@@@@@@ -1,66 -1,66 -1,66 -1,66 -1,66 -1,66 -1,66 +1,0 @@@@@@@@ -------/* Startup object is generated with the initialstate flag set by the ------- * system to start the computation up */ ------- -------// Create ServerSocket -------task Startup(StartupObject s {initialstate}) { ------- System.printString("TTT Server Starting...\n"); ------- ServerSocket ss = new ServerSocket(8000); ------- System.printString("Creating ServerSocket\n"); ------- Board tttBoard = new Board() {init}; ------- taskexit(s {!initialstate}); // Turn off initial state flag -------} ------- -------//Listen for a request and accept request -------task AcceptConnection(ServerSocket ss{SocketPending}) { ------- System.printString("Waiting for connection...\n"); ------- tag t=new tag(connect); ------- TTTServerSocket ttts = new TTTServerSocket() {ReceiveRequest}{t}; ------- System.printString("Calling accept...\n"); ------- ss.accept(t); ------- System.printString("Connected...\n"); -------} ------- -------// Process incoming requests -------task ProcessRequest(TTTServerSocket ttts{ReceiveRequest}{connect l}, Socket s{IOPending}{connect l}) { ------- System.printString("Request received..."); ------- int action = ttts.receive(s); ------- if (action == 1) { // Make move ------- taskexit(ttts {!ReceiveRequest,MakeMove}); ------- } ------- else { // Send Error ------- taskexit(ttts {!ReceiveRequest,SendError}); ------- } -------} ------- -------task ProcessMove(TTTServerSocket ttts{MakeMove}, Board tttBoard{init}) { ------- System.printString("Processing player's move..."); ------- int result = tttBoard.makeMove(ttts.getRow(), ttts.getCol()); ------- if (result == 1) { //Move made, send board display ------- taskexit(ttts {!MakeMove, SendBoard}); ------- } ------- else if (result == 2) { //Move made, game over ------- taskexit(ttts {!MakeMove, SendDone}); ------- } ------- else {// Error ------- taskexit(ttts {!MakeMove, SendError}); ------- } -------} ------- -------task SendBoardDisplay(TTTServerSocket ttts{SendBoard}{connect l}, Board tttBoard{init}, Socket s{}{connect l}) { ------- ttts.sendBoardDisplay(tttBoard, s); ------- taskexit(ttts {/*!SendBoard,*/ ReceiveRequest}); ------- -------} ------- -------task GameOver(TTTServerSocket ttts{SendDone}{connect l}, Board tttBoard{init}, Socket s{}{connect l}) { ------- ttts.sendDone(tttBoard.winner(), s); -------// taskexit(ttts {!SendDone},tttBoard{!init}); ------- -------} ------- -------task SendErrorMessage(TTTServerSocket ttts{SendError}{connect l}, Board tttBoard{init}, Socket s{}{connect l}) { ------- //System.printString("Error\n"); ------- ttts.sendError(s); ------- taskexit(ttts {/*!SendError,*/ ReceiveRequest}); ------- -------} diff --cc Robust/src/Benchmarks/TTTTag/TTTServerSocket.java index d0bc5bd9,d0bc5bd9,d0bc5bd9,d0bc5bd9,d0bc5bd9,d0bc5bd9,d0bc5bd9..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/TTTTag/TTTServerSocket.java +++ /dev/null @@@@@@@@ -1,109 -1,109 -1,109 -1,109 -1,109 -1,109 -1,109 +1,0 @@@@@@@@ -------public class TTTServerSocket { ------- // TTTServerSocket flags ------- flag ReceiveRequest; ------- ------- flag MakeMove; ------- flag SendError; ------- flag SendBoard; ------- flag SendDone; ------- ------- String request; ------- int row, col; ------- ------- //Constructor ------- public TTTServerSocket(){ ------- System.printString("Constructing TTTServerSocket....\n"); ------- } ------- ------- public int receive(Socket s) ------- { ------- byte b1[] = new byte[1024]; ------- s.read(b1); ------- request = new String(b1); ------- System.printString("request: "); ------- System.printString(request); ------- if (parseTransaction() == 1) { ------- System.printString(request); ------- return 1; ------- } ------- System.printString("Error receiving...\n"); ------- return 0; ------- } ------- ------- // Parse request ------- public int parseTransaction(){ ------- int start = request.indexOf('_'); ------- //System.printString("start parse"); ------- String s = request.subString(start+1); ------- //System.printString("before checking the string"); -------//_move:3:3 ------- if (s.startsWith("move")==true){ ------- //Get row ------- int i1 = s.indexOf(':'); ------- String rowStr = new String(s.subString(i1+1, i1+2)); ------- row = Integer.parseInt(rowStr); ------- ------- //System.printString("row"); ------- ------- //Get col ------- String s2 = new String(s.subString(i1+2)); ------- int i2 = s2.indexOf(':'); ------- String colStr = new String(s2.subString(i2+1, i2+2)); ------- col = Integer.parseInt(colStr); ------- return 1; ------- ------- ------- ------- } ------- // Error transaction ------- return -1; ------- } ------- ------- public int getRow(){ ------- return row; ------- } ------- public int getCol(){ ------- return col; ------- } ------- ------- public void sendBoardDisplay(Board theBoard, Socket s) { ------- StringBuffer line1 = new StringBuffer("\n\n"); ------- ------- for (int i = 0; i < 3; i++) { ------- for (int j = 0; j < 3; j++) { ------- if (theBoard.board[i][j] == 1) ------- line1.append("X"); ------- else if (theBoard.board[i][j] == 2) ------- line1.append("O"); ------- else ------- line1.append("-"); ------- } ------- line1.append("\n"); ------- } ------- String towrite = new String(line1); ------- s.write(towrite.getBytes()); ------- return; ------- } ------- ------- public void sendDone(int winner, Socket s) { ------- StringBuffer line1 = new StringBuffer ("done_"); ------- if (winner == 0) ------- line1.append("tie"); ------- else if (winner == 1) ------- line1.append("player"); ------- else ------- line1.append("computer"); ------- ------- String towrite = new String(line1); ------- s.write(towrite.getBytes()); ------- return; ------- } ------- ------- public void sendError(Socket s) { ------- StringBuffer line1 = new StringBuffer ("error_wrongmove"); ------- ------- String towrite = new String(line1); ------- s.write(towrite.getBytes()); ------- return; ------- } -------} diff --cc Robust/src/Benchmarks/WebServer/Inventory.java index 74756956,74756956,74756956,74756956,74756956,74756956,74756956..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/Inventory.java +++ /dev/null @@@@@@@@ -1,91 -1,91 -1,91 -1,91 -1,91 -1,91 -1,91 +1,0 @@@@@@@@ -------public class Inventory { ------- // Inventory flags ------- flag TransInitialize; ------- ------- // Transaction variables ------- int numitems; ------- HashMap map; ------- int balance; ------- ------- // Constructor ------- public Inventory(){ ------- map = new HashMap(); ------- balance=100000; ------- } ------- ------- public Inventory(int howmany) { ------- numitems = howmany;// howmany keeps track of the number of items ------- // in the inventory ------- map = new HashMap(); ------- } ------- ------- // Add item to a list of inventory ------- public int additem(String name, int quantity, int price){ ------- ItemInfo newitem = new ItemInfo(quantity, price); ------- balance-=quantity*price; ------- ------- // Get the item from hash ------- if (map.containsKey(name) == false) { ------- map.put(name, newitem); ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- i.quantity += quantity; ------- i.price = price; ------- map.put(name, i); ------- } ------- return 0; ------- } ------- ------- // Buy item from a given list of inventory ------- public int buyitem(String name, int quantity){ ------- if (map.containsKey(name) == false) { ------- // System.printString("Error - Item does not exist"); ------- return -1; ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- if (i.quantity == 0) { ------- // System.printString("Error - Item unavailable"); ------- return -1; ------- } ------- if ((i.quantity-quantity) < 0 ) { ------- // System.printString("Error - Available qty is less: Cannot Buy\n"); ------- return -1; ------- } else { ------- i.quantity -= quantity; ------- map.put(name, i); ------- balance+=quantity*i.price; ------- return i.price; ------- } ------- } ------- return 0; ------- } ------- ------- //Display the inventory list ------- //Display the inventory list ------- public synchronized void inventory(Socket s){ ------- HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item ------- HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap ------- int totalvalue=balance; ------- while (i.hasNext() == true) { ------- StringBuffer sb = new StringBuffer(""); ------- Object o = i.next(); ------- String name = o.toString(); ------- ItemInfo oo = (ItemInfo) j.next(); ------- sb.append(name); ------- sb.append(" "); ------- Integer q = new Integer(oo.quantity); ------- sb.append(q.toString()); ------- sb.append(" "); ------- Integer p = new Integer(oo.price); ------- sb.append(p.toString()); ------- sb.append("\n"); ------- totalvalue+=oo.quantity*oo.price; ------- s.write(sb.toString().getBytes()); ------- } ------- StringBuffer sb=new StringBuffer(""); ------- sb.append("Total value: "); ------- sb.append((new Integer(totalvalue)).toString()); ------- sb.append("\n"); ------- s.write(sb.toString().getBytes()); ------- } -------} diff --cc Robust/src/Benchmarks/WebServer/ItemInfo.java index 18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/ItemInfo.java +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ -------class ItemInfo { ------- int quantity; ------- int price; ------- ItemInfo(int x, int y) { ------- quantity = x; ------- price = y; ------- } -------} diff --cc Robust/src/Benchmarks/WebServer/Logger.java index a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/Logger.java +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------public class Logger { ------- //Logger flag ------- flag Initialize; ------- FileOutputStream fos; ------- ------- ------- //Constructor ------- public Logger(){ ------- fos=new FileOutputStream("request.log");//Open request.log file ------- } ------- ------- //Logs filename as per client requests ------- public void logrequest(String filename){ ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.write(filename.getBytes()); ------- fos.flush(); ------- } ------- ------- public void logrequest(){ ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.flush(); ------- } ------- ------- public void closerequest() { ------- fos.close(); ------- } -------} diff --cc Robust/src/Benchmarks/WebServer/WebServerExample.java index 664465a5,664465a5,664465a5,664465a5,664465a5,664465a5,664465a5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/WebServerExample.java +++ /dev/null @@@@@@@@ -1,111 -1,111 -1,111 -1,111 -1,111 -1,111 -1,111 +1,0 @@@@@@@@ -------/* Startup object is generated with the initialstate flag set by the ------- * system to start the computation up */ ------- -------// Create New ServerSocket -------task Startup(StartupObject s {initialstate}) { -------// System.printString("W> Starting\n"); ------- ServerSocket ss = new ServerSocket(9000); -------// System.printString("W> Creating ServerSocket\n"); ------- Logger log = new Logger() {Initialize}; ------- Inventory inventorylist = new Inventory(){TransInitialize}; ------- taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -------} ------- -------//Listen for a request and accept request -------task AcceptConnection(ServerSocket ss{SocketPending}) { -------// System.printString("W> Waiting for connection...\n"); ------- WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}; ------- ss.accept(web); -------// System.printString("W> Connected... \n"); -------} ------- -------// Process the incoming http request -------task ProcessRequest(WebServerSocket web{IOPending && WebInitialize}) { -------//task ProcessRequest(WebServerSocket web{IOPending}) { ------- //System.printString("W> Inside ProcessRequest... \n"); ------- if (web.clientrequest()) { ------- if(web.checktrans()==false) ------- // Not special transaction , do normal filesending ------- taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true ------- else ------- // Invoke special inventory transaction ------- taskexit(web {TransPending, LogPending,!WebInitialize}); ------- } -------} ------- -------//Do the WriteIO on server socket and send the requested file to Client -------task SendFile(WebServerSocket web{WritePending}) { -------// System.printString("W> Inside SendFile ... \n"); ------- web.sendfile(); ------- web.close(); ------- taskexit(web {!WritePending}); -------} ------- -------// Log the Client request -------task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { -------//Task fired when both -------// LogPending and Initialize flags are true -------// System.printString("L > Inside logrequest\n"); ------- log.logrequest(web.filename); ------- taskexit(web {!LogPending}); -------} ------- -------//Transaction on Inventory -------task Transaction(WebServerSocket web{TransPending}, Inventory inventorylist{TransInitialize}){ //Task for WebServerTransactions -------// System.printString("T > Inside Transaction\n"); ------- // Parse ------- int op = web.parseTransaction(); ------- // Check for the kind of operation ------- if (op == 0 ) { /* Add */ -------// System.printString("DEBUG > Calling add transaction\n"); ------- Integer qty = new Integer(web.parsed[2]); ------- Integer price = new Integer(web.parsed[3]); ------- int ret = inventorylist.additem(web.parsed[1], qty.intValue(), price.intValue()); ------- if (ret == 0) { ------- web.httpresponse(); ------- StringBuffer s = new StringBuffer("Added Item "); ------- s.append(web.parsed[1]); ------- s.append(" Quantity "); ------- s.append(web.parsed[2]); ------- s.append(" Price "); ------- s.append(web.parsed[3]); ------- s.append("\n"); ------- String towrite = new String(s); ------- web.write(towrite.getBytes()); ------- } else { ------- web.httpresponse(); ------- String s = new String("Error encountered"); ------- web.write(s.getBytes()); ------- } ------- } else if (op == 1) { /* Buy */ -------// System.printString("DEBUG > Calling buy transaction\n"); ------- Integer qty = new Integer(web.parsed[2]); ------- int ret = inventorylist.buyitem(web.parsed[1], qty.intValue()); ------- if (ret >= 0) { ------- web.httpresponse(); ------- StringBuffer s = new StringBuffer("Bought item "); ------- s.append(web.parsed[1]); ------- s.append(" Quantity "); ------- s.append(web.parsed[2]); ------- s.append(" Cost "); ------- Integer cost = new Integer(ret*qty.intValue()); ------- String c = cost.toString(); ------- s.append(c); ------- String towrite = new String(s); ------- web.write(towrite.getBytes()); ------- } else { ------- web.httpresponse(); ------- String s = new String("Error encountered"); ------- web.write(s.getBytes()); ------- } ------- } else if (op == 2) { /* Inventory */ -------// System.printString("DEBUG > Calling inventory transaction\n"); ------- web.httpresponse(); ------- inventorylist.inventory(web); ------- } else { /* Error */ -------// System.printString("T > Error - Unknown transaction\n"); ------- } ------- //Invoke close operations ------- web.close(); ------- taskexit(web {!TransPending}); -------} diff --cc Robust/src/Benchmarks/WebServer/WebServerSocket.java index 8fa20041,8fa20041,8fa20041,8fa20041,8fa20041,8fa20041,8fa20041..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/WebServerSocket.java +++ /dev/null @@@@@@@@ -1,141 -1,141 -1,141 -1,141 -1,141 -1,141 -1,141 +1,0 @@@@@@@@ -------public class WebServerSocket extends Socket { ------- // Websocket flag ------- flag LogPending; ------- flag WritePending; ------- flag TransPending; ------- flag WebInitialize; ------- ------- //Filename requested by the client ------- String filename; ------- String[] parsed; ------- String prefix; ------- ------- //Constructor ------- public WebServerSocket(){ ------- parsed = new String[4]; ------- } ------- ------- //Send the http header for web browser display ------- public void httpresponse(){ ------- StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); ------- header.append("Content-type: text/html\n"); ------- header.append("\n\n"); ------- String temp_str = new String(header); ------- write(temp_str.getBytes()); ------- return; ------- ------- } ------- ------- // Send the html file , read from file one byte at a time ------- public void sendfile() { ------- StringBuffer req_file = new StringBuffer("./htmlfiles/"); ------- req_file.append(filename); ------- String filepath = new String(req_file); ------- FileInputStream def_file = new FileInputStream(filepath); ------- int status = def_file.getfd();//Checks if the file is present in ------- //current directory ------- httpresponse(); ------- if (status == -1){ ------- StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if ------- // file not found ------- response.append(filename); ------- String buffer = new String(response); ------- write(buffer.getBytes()); ------- def_file.close(); ------- return; ------- } ------- byte buf[] = new byte[16]; ------- int ret; ------- ------- while ((ret = def_file.read(buf)) > 0) {// Read from file and write ------- // one byte at a time into the socket ------- byte tosend[] = new byte[ret]; ------- for (int i = 0; i < ret; i++) { ------- tosend[i] = buf[i]; ------- } ------- write(tosend); ------- //String str = new String(tosend); ------- } ------- def_file.close(); ------- } ------- ------- //Read the client request and extract the filename from it ------- public boolean clientrequest(){ ------- byte b1[] = new byte[1024]; ------- int numbytes=read(b1);//Read client request from web server socket ------- String curr=(new String(b1)).subString(0, numbytes); ------- if (prefix!=null) { ------- StringBuffer sb=new StringBuffer(prefix); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- prefix=curr; ------- if(prefix.indexOf("\r\n\r\n")>=0) { ------- ------- int index = prefix.indexOf('/');//Parse the GET client request to find filename ------- int end = prefix.indexOf('H'); ------- filename = prefix.subString((index+1), (end-1)); ------- return true; ------- } ------- return false; ------- } ------- ------- // Parse for the prefix in the client request ------- // This is helpful to find if the prefix is a special transaction ------- public boolean checktrans(){ ------- if (filename.startsWith("trans") == true) { ------- return true; ------- } else { ------- return false; ------- } ------- } ------- ------- //Parse for the substrings in the filename and use it to obtain the ------- //kind of operation, name of item, quantity of item, price of item ------- //e.g. trans_add_car_2_10000 is the filename ------- //store in the parsed[] string , add,car,2,1000 ------- public int parseTransaction(){ ------- int start = filename.indexOf('_'); ------- String s = filename.subString(start+1); ------- ------- if (s.startsWith("add")==true){ ------- // System.printString("DEBUG > ADD\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = new String(s.subString(0,i1)); ------- ------- int i2 = s.indexOf('_',i1+1); ------- parsed[1] = new String(s.subString(i1+1,i2)); ------- ------- int i3 = s.indexOf('_',i2+1); ------- parsed[2] = new String(s.subString(i2+1,i3)); ------- ------- String s3 = s.subString(i3+1); ------- parsed[3] = s3; ------- ------- return 0; ------- ------- } ------- if (s.startsWith("buy")==true){ ------- // System.printString("DEBUG > BUY\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = s.subString(0,i1); ------- ------- int i2 = s.indexOf('_', i1+1); ------- parsed[1] = s.subString(i1+1,i2); ------- ------- String s2 = s.subString(i2+1); ------- parsed[2] = s2; ------- ------- parsed[3] = ""; ------- ------- return 1; ------- } ------- if (s.startsWith("inventory")==true){ ------- // System.printString("DEBUG > INVENTORY\n"); ------- return 2; ------- ------- } ------- // Error transaction ------- return -1; ------- } -------} diff --cc Robust/src/Benchmarks/WebServer/Workload/batch/difference.sh index 2328bba1,2328bba1,2328bba1,2328bba1,2328bba1,2328bba1,2328bba1..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/difference.sh +++ /dev/null @@@@@@@@ -1,32 -1,32 -1,32 -1,32 -1,32 -1,32 -1,32 +1,0 @@@@@@@@ -------#!/bin/sh ------- -------rm result_inventory -------#For every trans_inventory* file remove the lines starting with pre and sort the file -------for file in `ls trans_inventory*` -------do ------- echo "Doing $file" ------- grep -v pre $file > ${file}.nopre ------- sort -n ${file}.nopre > runs/${file}.sorted -------done ------- -------\rm *.nopre -------cd runs -------let x=0; -------#for every sorted file created above diff it with the orginial file called pure/trans_inventory.sorted and print the total success or failures occured -------for file in `ls *sorted` -------do ------- echo -n "Diffing $file..."; ------- diff $file ./pure/trans_inventory.sorted ------- if [ $? -ne 0 ] ------- then ------- let "x+=1"; ------- else ------- echo " success "; ------- fi -------done ------- -------echo "RESULT: x is $x"; -------echo -n "RESULT: Total files compared is " -------ls *sorted | wc -l ------- -------cd .. diff --cc Robust/src/Benchmarks/WebServer/Workload/batch/pure/trans_inventory.sorted index 5cb507b4,5cb507b4,5cb507b4,5cb507b4,5cb507b4,5cb507b4,5cb507b4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/pure/trans_inventory.sorted +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ ------- -------book 258 50 -------bread 9590 4 -------car 39 10000 -------coke 2620 5 -------pen 601 5 -------soap 42 7 diff --cc Robust/src/Benchmarks/WebServer/Workload/batch/run.sh index 60523901,60523901,60523901,60523901,60523901,60523901,60523901..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/run.sh +++ /dev/null @@@@@@@@ -1,31 -1,31 -1,31 -1,31 -1,31 -1,31 -1,31 +1,0 @@@@@@@@ -------#!/bin/bash ------- -------let i=0; #Keeps count of number of times the server is launched ------- -------rm output #Errors and total number of run count are redirected to this file ------- -------#Sets the BRISTLECONE parameter with a certain instruction count, probability and -------#number of failures that can be injected -------export BRISTLECONE="-initializerandom -injectinstructionfailures 10 0.00001667 1 -debugtask" -------rm -rf results -------mkdir results -------cd results -------while [ $i -le 299 ]; # The number of runs -------do ------- ../trans.bin & #Launch server executable in background ------- sleep 2; ------- ../Workload/workloaderror 127.0.0.1 2>/dev/null & #Run the first workload ------- echo $i >> output; ------- sleep 5; ------- process=`ps | grep workloaderror | grep -v grep | awk '{print $1}'` ------- kill -9 $process #Kill the first workload ------- if [ $? -eq 0 ] #Launch the second worload only if the Failure is injected in the first workload ------- then ------- ../Workload/workloadtrans 127.0.0.1 2>/dev/null ------- else ------- echo "No Fault Injected" >> output ------- fi; ------- let "i+=1"; ------- ps | grep trans | grep -v grep | awk '{print $1}' | xargs kill -9 #Kill the server ------- sleep 1; -------done diff --cc Robust/src/Benchmarks/WebServer/Workload/batch/run2.sh index 4da6c32e,4da6c32e,4da6c32e,4da6c32e,4da6c32e,4da6c32e,4da6c32e..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/run2.sh +++ /dev/null @@@@@@@@ -1,64 -1,64 -1,64 -1,64 -1,64 -1,64 -1,64 +1,0 @@@@@@@@ -------#!/bin/bash ------- -------let i=0; #Keeps count of number of times the server is launched ------- -------rm output #Errors and total number of run count are redirected to this file ------- -------#Sets the BRISTLECONE parameter with a certain instruction count, probability and -------#number of failures that can be injected -------#export BRISTLECONE="-initializerandom -injectinstructionfailures 10 0.00001667 1 -debugtask" -------export BRISTLECONE="-initializerandom -injectinstructionfailures 35 0.00001667 50" -------rm -rf results -------mkdir results -------cd results -------while [ $i -le 201 ]; # The number of runs ------- do ------- mkdir trial$i ------- cd trial$i ------- let errorcount=0 ------- let count=0 ------- ../../trans.bin &> log & #Launch server executable in background ------- sleep 2; ------- ../../Workload/workload 127.0.0.1 2>/dev/null & #Run the first workload ------- echo $i >> ../output; ------- while true ------- do ------- process=`ps | grep wget | grep -v grep | awk '{print $1}'` ------- sleep 1 ------- process2=`ps | grep wget | grep -v grep | awk '{print $1}'` ------- if [ "$process" != "" ] ------- then ------- if [ "$process" = "$process2" ] ------- then ------- let "count=1" ------- kill -9 $process #Kill the first workload ------- if [ $? -eq 0 ] #Launch the second worload only if the Failure is injected in the first workload ------- then ------- let "errorcount+=1" ------- fi ------- fi -------else ------- if [ "$process2" != "" ] ------- then ------- let "count=1" ------- else ------- let "count+=1" ------- if [ $count == 30 ] ------- then ------- break ------- fi ------- fi ------- fi -------done -------echo Errorcount=$errorcount >> ../output -------let "i+=1"; -------process=`ps | grep workload | grep -v grep | awk '{print $1}'` -------kill -9 $process -------process=`ps | grep trans | grep -v grep | awk '{print $1}'` -------cat ../../gdbquery | gdb ../../trans.bin $process &> output -------kill -1 $process -------sleep 1 -------kill $process -------sleep 1; -------cd .. -------done diff --cc Robust/src/Benchmarks/WebServer/Workload/generate.java index 95a0bf33,95a0bf33,95a0bf33,95a0bf33,95a0bf33,95a0bf33,95a0bf33..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/Workload/generate.java +++ /dev/null @@@@@@@@ -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------public class generate { ------- ------- public static void main(String x[]) { ------- int j=1; ------- int cost=1; ------- System.out.println("#!/bin/bash"); ------- for(int i=0;i<2200;i++) { ------- int price=cost*50; ------- int jbuy=j-1; ------- System.out.println("wget http://$1:9000/trans_add_f"+i+"_"+j+"_"+price); ------- System.out.println("wget http://$1:9000/trans_buy_f"+i+"_"+jbuy); ------- if (cost>3) cost=1; else cost++; ------- if (j>4) j=1; else j++; ------- } ------- System.out.println("wget http://$1:9000/trans_inventory"); ------- } ------- ------- -------} diff --cc Robust/src/Benchmarks/WebServer/Workload/workload index 56cd778b,56cd778b,56cd778b,56cd778b,56cd778b,56cd778b,56cd778b..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/workload +++ /dev/null @@@@@@@@ -1,4402 -1,4402 -1,4402 -1,4402 -1,4402 -1,4402 -1,4402 +1,0 @@@@@@@@ -------#!/bin/bash -------wget http://$1:9000/trans_add_f0_1_50 -------wget http://$1:9000/trans_buy_f0_0 -------wget http://$1:9000/trans_add_f1_2_100 -------wget http://$1:9000/trans_buy_f1_1 -------wget http://$1:9000/trans_add_f2_3_150 -------wget http://$1:9000/trans_buy_f2_2 -------wget http://$1:9000/trans_add_f3_4_200 -------wget http://$1:9000/trans_buy_f3_3 -------wget http://$1:9000/trans_add_f4_5_50 -------wget http://$1:9000/trans_buy_f4_4 -------wget http://$1:9000/trans_add_f5_1_100 -------wget http://$1:9000/trans_buy_f5_0 -------wget http://$1:9000/trans_add_f6_2_150 -------wget http://$1:9000/trans_buy_f6_1 -------wget http://$1:9000/trans_add_f7_3_200 -------wget http://$1:9000/trans_buy_f7_2 -------wget http://$1:9000/trans_add_f8_4_50 -------wget http://$1:9000/trans_buy_f8_3 -------wget http://$1:9000/trans_add_f9_5_100 -------wget http://$1:9000/trans_buy_f9_4 -------wget http://$1:9000/trans_add_f10_1_150 -------wget http://$1:9000/trans_buy_f10_0 -------wget http://$1:9000/trans_add_f11_2_200 -------wget http://$1:9000/trans_buy_f11_1 -------wget http://$1:9000/trans_add_f12_3_50 -------wget http://$1:9000/trans_buy_f12_2 -------wget http://$1:9000/trans_add_f13_4_100 -------wget http://$1:9000/trans_buy_f13_3 -------wget http://$1:9000/trans_add_f14_5_150 -------wget http://$1:9000/trans_buy_f14_4 -------wget http://$1:9000/trans_add_f15_1_200 -------wget http://$1:9000/trans_buy_f15_0 -------wget http://$1:9000/trans_add_f16_2_50 -------wget http://$1:9000/trans_buy_f16_1 -------wget http://$1:9000/trans_add_f17_3_100 -------wget http://$1:9000/trans_buy_f17_2 -------wget http://$1:9000/trans_add_f18_4_150 -------wget http://$1:9000/trans_buy_f18_3 -------wget http://$1:9000/trans_add_f19_5_200 -------wget http://$1:9000/trans_buy_f19_4 -------wget http://$1:9000/trans_add_f20_1_50 -------wget http://$1:9000/trans_buy_f20_0 -------wget http://$1:9000/trans_add_f21_2_100 -------wget http://$1:9000/trans_buy_f21_1 -------wget http://$1:9000/trans_add_f22_3_150 -------wget http://$1:9000/trans_buy_f22_2 -------wget http://$1:9000/trans_add_f23_4_200 -------wget http://$1:9000/trans_buy_f23_3 -------wget http://$1:9000/trans_add_f24_5_50 -------wget http://$1:9000/trans_buy_f24_4 -------wget http://$1:9000/trans_add_f25_1_100 -------wget http://$1:9000/trans_buy_f25_0 -------wget http://$1:9000/trans_add_f26_2_150 -------wget http://$1:9000/trans_buy_f26_1 -------wget http://$1:9000/trans_add_f27_3_200 -------wget http://$1:9000/trans_buy_f27_2 -------wget http://$1:9000/trans_add_f28_4_50 -------wget http://$1:9000/trans_buy_f28_3 -------wget http://$1:9000/trans_add_f29_5_100 -------wget http://$1:9000/trans_buy_f29_4 -------wget http://$1:9000/trans_add_f30_1_150 -------wget http://$1:9000/trans_buy_f30_0 -------wget http://$1:9000/trans_add_f31_2_200 -------wget http://$1:9000/trans_buy_f31_1 -------wget http://$1:9000/trans_add_f32_3_50 -------wget http://$1:9000/trans_buy_f32_2 -------wget http://$1:9000/trans_add_f33_4_100 -------wget http://$1:9000/trans_buy_f33_3 -------wget http://$1:9000/trans_add_f34_5_150 -------wget http://$1:9000/trans_buy_f34_4 -------wget http://$1:9000/trans_add_f35_1_200 -------wget http://$1:9000/trans_buy_f35_0 -------wget http://$1:9000/trans_add_f36_2_50 -------wget http://$1:9000/trans_buy_f36_1 -------wget http://$1:9000/trans_add_f37_3_100 -------wget http://$1:9000/trans_buy_f37_2 -------wget http://$1:9000/trans_add_f38_4_150 -------wget http://$1:9000/trans_buy_f38_3 -------wget http://$1:9000/trans_add_f39_5_200 -------wget http://$1:9000/trans_buy_f39_4 -------wget http://$1:9000/trans_add_f40_1_50 -------wget http://$1:9000/trans_buy_f40_0 -------wget http://$1:9000/trans_add_f41_2_100 -------wget http://$1:9000/trans_buy_f41_1 -------wget http://$1:9000/trans_add_f42_3_150 -------wget http://$1:9000/trans_buy_f42_2 -------wget http://$1:9000/trans_add_f43_4_200 -------wget http://$1:9000/trans_buy_f43_3 -------wget http://$1:9000/trans_add_f44_5_50 -------wget http://$1:9000/trans_buy_f44_4 -------wget http://$1:9000/trans_add_f45_1_100 -------wget http://$1:9000/trans_buy_f45_0 -------wget http://$1:9000/trans_add_f46_2_150 -------wget http://$1:9000/trans_buy_f46_1 -------wget http://$1:9000/trans_add_f47_3_200 -------wget http://$1:9000/trans_buy_f47_2 -------wget http://$1:9000/trans_add_f48_4_50 -------wget http://$1:9000/trans_buy_f48_3 -------wget http://$1:9000/trans_add_f49_5_100 -------wget http://$1:9000/trans_buy_f49_4 -------wget http://$1:9000/trans_add_f50_1_150 -------wget http://$1:9000/trans_buy_f50_0 -------wget http://$1:9000/trans_add_f51_2_200 -------wget http://$1:9000/trans_buy_f51_1 -------wget http://$1:9000/trans_add_f52_3_50 -------wget http://$1:9000/trans_buy_f52_2 -------wget http://$1:9000/trans_add_f53_4_100 -------wget http://$1:9000/trans_buy_f53_3 -------wget http://$1:9000/trans_add_f54_5_150 -------wget http://$1:9000/trans_buy_f54_4 -------wget http://$1:9000/trans_add_f55_1_200 -------wget http://$1:9000/trans_buy_f55_0 -------wget http://$1:9000/trans_add_f56_2_50 -------wget http://$1:9000/trans_buy_f56_1 -------wget http://$1:9000/trans_add_f57_3_100 -------wget http://$1:9000/trans_buy_f57_2 -------wget http://$1:9000/trans_add_f58_4_150 -------wget http://$1:9000/trans_buy_f58_3 -------wget http://$1:9000/trans_add_f59_5_200 -------wget http://$1:9000/trans_buy_f59_4 -------wget http://$1:9000/trans_add_f60_1_50 -------wget http://$1:9000/trans_buy_f60_0 -------wget http://$1:9000/trans_add_f61_2_100 -------wget http://$1:9000/trans_buy_f61_1 -------wget http://$1:9000/trans_add_f62_3_150 -------wget http://$1:9000/trans_buy_f62_2 -------wget http://$1:9000/trans_add_f63_4_200 -------wget http://$1:9000/trans_buy_f63_3 -------wget http://$1:9000/trans_add_f64_5_50 -------wget http://$1:9000/trans_buy_f64_4 -------wget http://$1:9000/trans_add_f65_1_100 -------wget http://$1:9000/trans_buy_f65_0 -------wget http://$1:9000/trans_add_f66_2_150 -------wget http://$1:9000/trans_buy_f66_1 -------wget http://$1:9000/trans_add_f67_3_200 -------wget http://$1:9000/trans_buy_f67_2 -------wget http://$1:9000/trans_add_f68_4_50 -------wget http://$1:9000/trans_buy_f68_3 -------wget http://$1:9000/trans_add_f69_5_100 -------wget http://$1:9000/trans_buy_f69_4 -------wget http://$1:9000/trans_add_f70_1_150 -------wget http://$1:9000/trans_buy_f70_0 -------wget http://$1:9000/trans_add_f71_2_200 -------wget http://$1:9000/trans_buy_f71_1 -------wget http://$1:9000/trans_add_f72_3_50 -------wget http://$1:9000/trans_buy_f72_2 -------wget http://$1:9000/trans_add_f73_4_100 -------wget http://$1:9000/trans_buy_f73_3 -------wget http://$1:9000/trans_add_f74_5_150 -------wget http://$1:9000/trans_buy_f74_4 -------wget http://$1:9000/trans_add_f75_1_200 -------wget http://$1:9000/trans_buy_f75_0 -------wget http://$1:9000/trans_add_f76_2_50 -------wget http://$1:9000/trans_buy_f76_1 -------wget http://$1:9000/trans_add_f77_3_100 -------wget http://$1:9000/trans_buy_f77_2 -------wget http://$1:9000/trans_add_f78_4_150 -------wget http://$1:9000/trans_buy_f78_3 -------wget http://$1:9000/trans_add_f79_5_200 -------wget http://$1:9000/trans_buy_f79_4 -------wget http://$1:9000/trans_add_f80_1_50 -------wget http://$1:9000/trans_buy_f80_0 -------wget http://$1:9000/trans_add_f81_2_100 -------wget http://$1:9000/trans_buy_f81_1 -------wget http://$1:9000/trans_add_f82_3_150 -------wget http://$1:9000/trans_buy_f82_2 -------wget http://$1:9000/trans_add_f83_4_200 -------wget http://$1:9000/trans_buy_f83_3 -------wget http://$1:9000/trans_add_f84_5_50 -------wget http://$1:9000/trans_buy_f84_4 -------wget http://$1:9000/trans_add_f85_1_100 -------wget http://$1:9000/trans_buy_f85_0 -------wget http://$1:9000/trans_add_f86_2_150 -------wget http://$1:9000/trans_buy_f86_1 -------wget http://$1:9000/trans_add_f87_3_200 -------wget http://$1:9000/trans_buy_f87_2 -------wget http://$1:9000/trans_add_f88_4_50 -------wget http://$1:9000/trans_buy_f88_3 -------wget http://$1:9000/trans_add_f89_5_100 -------wget http://$1:9000/trans_buy_f89_4 -------wget http://$1:9000/trans_add_f90_1_150 -------wget http://$1:9000/trans_buy_f90_0 -------wget http://$1:9000/trans_add_f91_2_200 -------wget http://$1:9000/trans_buy_f91_1 -------wget http://$1:9000/trans_add_f92_3_50 -------wget http://$1:9000/trans_buy_f92_2 -------wget http://$1:9000/trans_add_f93_4_100 -------wget http://$1:9000/trans_buy_f93_3 -------wget http://$1:9000/trans_add_f94_5_150 -------wget http://$1:9000/trans_buy_f94_4 -------wget http://$1:9000/trans_add_f95_1_200 -------wget http://$1:9000/trans_buy_f95_0 -------wget http://$1:9000/trans_add_f96_2_50 -------wget http://$1:9000/trans_buy_f96_1 -------wget http://$1:9000/trans_add_f97_3_100 -------wget http://$1:9000/trans_buy_f97_2 -------wget http://$1:9000/trans_add_f98_4_150 -------wget http://$1:9000/trans_buy_f98_3 -------wget http://$1:9000/trans_add_f99_5_200 -------wget http://$1:9000/trans_buy_f99_4 -------wget http://$1:9000/trans_add_f100_1_50 -------wget http://$1:9000/trans_buy_f100_0 -------wget http://$1:9000/trans_add_f101_2_100 -------wget http://$1:9000/trans_buy_f101_1 -------wget http://$1:9000/trans_add_f102_3_150 -------wget http://$1:9000/trans_buy_f102_2 -------wget http://$1:9000/trans_add_f103_4_200 -------wget http://$1:9000/trans_buy_f103_3 -------wget http://$1:9000/trans_add_f104_5_50 -------wget http://$1:9000/trans_buy_f104_4 -------wget http://$1:9000/trans_add_f105_1_100 -------wget http://$1:9000/trans_buy_f105_0 -------wget http://$1:9000/trans_add_f106_2_150 -------wget http://$1:9000/trans_buy_f106_1 -------wget http://$1:9000/trans_add_f107_3_200 -------wget http://$1:9000/trans_buy_f107_2 -------wget http://$1:9000/trans_add_f108_4_50 -------wget http://$1:9000/trans_buy_f108_3 -------wget http://$1:9000/trans_add_f109_5_100 -------wget http://$1:9000/trans_buy_f109_4 -------wget http://$1:9000/trans_add_f110_1_150 -------wget http://$1:9000/trans_buy_f110_0 -------wget http://$1:9000/trans_add_f111_2_200 -------wget http://$1:9000/trans_buy_f111_1 -------wget http://$1:9000/trans_add_f112_3_50 -------wget http://$1:9000/trans_buy_f112_2 -------wget http://$1:9000/trans_add_f113_4_100 -------wget http://$1:9000/trans_buy_f113_3 -------wget http://$1:9000/trans_add_f114_5_150 -------wget http://$1:9000/trans_buy_f114_4 -------wget http://$1:9000/trans_add_f115_1_200 -------wget http://$1:9000/trans_buy_f115_0 -------wget http://$1:9000/trans_add_f116_2_50 -------wget http://$1:9000/trans_buy_f116_1 -------wget http://$1:9000/trans_add_f117_3_100 -------wget http://$1:9000/trans_buy_f117_2 -------wget http://$1:9000/trans_add_f118_4_150 -------wget http://$1:9000/trans_buy_f118_3 -------wget http://$1:9000/trans_add_f119_5_200 -------wget http://$1:9000/trans_buy_f119_4 -------wget http://$1:9000/trans_add_f120_1_50 -------wget http://$1:9000/trans_buy_f120_0 -------wget http://$1:9000/trans_add_f121_2_100 -------wget http://$1:9000/trans_buy_f121_1 -------wget http://$1:9000/trans_add_f122_3_150 -------wget http://$1:9000/trans_buy_f122_2 -------wget http://$1:9000/trans_add_f123_4_200 -------wget http://$1:9000/trans_buy_f123_3 -------wget http://$1:9000/trans_add_f124_5_50 -------wget http://$1:9000/trans_buy_f124_4 -------wget http://$1:9000/trans_add_f125_1_100 -------wget http://$1:9000/trans_buy_f125_0 -------wget http://$1:9000/trans_add_f126_2_150 -------wget http://$1:9000/trans_buy_f126_1 -------wget http://$1:9000/trans_add_f127_3_200 -------wget http://$1:9000/trans_buy_f127_2 -------wget http://$1:9000/trans_add_f128_4_50 -------wget http://$1:9000/trans_buy_f128_3 -------wget http://$1:9000/trans_add_f129_5_100 -------wget http://$1:9000/trans_buy_f129_4 -------wget http://$1:9000/trans_add_f130_1_150 -------wget http://$1:9000/trans_buy_f130_0 -------wget http://$1:9000/trans_add_f131_2_200 -------wget http://$1:9000/trans_buy_f131_1 -------wget http://$1:9000/trans_add_f132_3_50 -------wget http://$1:9000/trans_buy_f132_2 -------wget http://$1:9000/trans_add_f133_4_100 -------wget http://$1:9000/trans_buy_f133_3 -------wget http://$1:9000/trans_add_f134_5_150 -------wget http://$1:9000/trans_buy_f134_4 -------wget http://$1:9000/trans_add_f135_1_200 -------wget http://$1:9000/trans_buy_f135_0 -------wget http://$1:9000/trans_add_f136_2_50 -------wget http://$1:9000/trans_buy_f136_1 -------wget http://$1:9000/trans_add_f137_3_100 -------wget http://$1:9000/trans_buy_f137_2 -------wget http://$1:9000/trans_add_f138_4_150 -------wget http://$1:9000/trans_buy_f138_3 -------wget http://$1:9000/trans_add_f139_5_200 -------wget http://$1:9000/trans_buy_f139_4 -------wget http://$1:9000/trans_add_f140_1_50 -------wget http://$1:9000/trans_buy_f140_0 -------wget http://$1:9000/trans_add_f141_2_100 -------wget http://$1:9000/trans_buy_f141_1 -------wget http://$1:9000/trans_add_f142_3_150 -------wget http://$1:9000/trans_buy_f142_2 -------wget http://$1:9000/trans_add_f143_4_200 -------wget http://$1:9000/trans_buy_f143_3 -------wget http://$1:9000/trans_add_f144_5_50 -------wget http://$1:9000/trans_buy_f144_4 -------wget http://$1:9000/trans_add_f145_1_100 -------wget http://$1:9000/trans_buy_f145_0 -------wget http://$1:9000/trans_add_f146_2_150 -------wget http://$1:9000/trans_buy_f146_1 -------wget http://$1:9000/trans_add_f147_3_200 -------wget http://$1:9000/trans_buy_f147_2 -------wget http://$1:9000/trans_add_f148_4_50 -------wget http://$1:9000/trans_buy_f148_3 -------wget http://$1:9000/trans_add_f149_5_100 -------wget http://$1:9000/trans_buy_f149_4 -------wget http://$1:9000/trans_add_f150_1_150 -------wget http://$1:9000/trans_buy_f150_0 -------wget http://$1:9000/trans_add_f151_2_200 -------wget http://$1:9000/trans_buy_f151_1 -------wget http://$1:9000/trans_add_f152_3_50 -------wget http://$1:9000/trans_buy_f152_2 -------wget http://$1:9000/trans_add_f153_4_100 -------wget http://$1:9000/trans_buy_f153_3 -------wget http://$1:9000/trans_add_f154_5_150 -------wget http://$1:9000/trans_buy_f154_4 -------wget http://$1:9000/trans_add_f155_1_200 -------wget http://$1:9000/trans_buy_f155_0 -------wget http://$1:9000/trans_add_f156_2_50 -------wget http://$1:9000/trans_buy_f156_1 -------wget http://$1:9000/trans_add_f157_3_100 -------wget http://$1:9000/trans_buy_f157_2 -------wget http://$1:9000/trans_add_f158_4_150 -------wget http://$1:9000/trans_buy_f158_3 -------wget http://$1:9000/trans_add_f159_5_200 -------wget http://$1:9000/trans_buy_f159_4 -------wget http://$1:9000/trans_add_f160_1_50 -------wget http://$1:9000/trans_buy_f160_0 -------wget http://$1:9000/trans_add_f161_2_100 -------wget http://$1:9000/trans_buy_f161_1 -------wget http://$1:9000/trans_add_f162_3_150 -------wget http://$1:9000/trans_buy_f162_2 -------wget http://$1:9000/trans_add_f163_4_200 -------wget http://$1:9000/trans_buy_f163_3 -------wget http://$1:9000/trans_add_f164_5_50 -------wget http://$1:9000/trans_buy_f164_4 -------wget http://$1:9000/trans_add_f165_1_100 -------wget http://$1:9000/trans_buy_f165_0 -------wget http://$1:9000/trans_add_f166_2_150 -------wget http://$1:9000/trans_buy_f166_1 -------wget http://$1:9000/trans_add_f167_3_200 -------wget http://$1:9000/trans_buy_f167_2 -------wget http://$1:9000/trans_add_f168_4_50 -------wget http://$1:9000/trans_buy_f168_3 -------wget http://$1:9000/trans_add_f169_5_100 -------wget http://$1:9000/trans_buy_f169_4 -------wget http://$1:9000/trans_add_f170_1_150 -------wget http://$1:9000/trans_buy_f170_0 -------wget http://$1:9000/trans_add_f171_2_200 -------wget http://$1:9000/trans_buy_f171_1 -------wget http://$1:9000/trans_add_f172_3_50 -------wget http://$1:9000/trans_buy_f172_2 -------wget http://$1:9000/trans_add_f173_4_100 -------wget http://$1:9000/trans_buy_f173_3 -------wget http://$1:9000/trans_add_f174_5_150 -------wget http://$1:9000/trans_buy_f174_4 -------wget http://$1:9000/trans_add_f175_1_200 -------wget http://$1:9000/trans_buy_f175_0 -------wget http://$1:9000/trans_add_f176_2_50 -------wget http://$1:9000/trans_buy_f176_1 -------wget http://$1:9000/trans_add_f177_3_100 -------wget http://$1:9000/trans_buy_f177_2 -------wget http://$1:9000/trans_add_f178_4_150 -------wget http://$1:9000/trans_buy_f178_3 -------wget http://$1:9000/trans_add_f179_5_200 -------wget http://$1:9000/trans_buy_f179_4 -------wget http://$1:9000/trans_add_f180_1_50 -------wget http://$1:9000/trans_buy_f180_0 -------wget http://$1:9000/trans_add_f181_2_100 -------wget http://$1:9000/trans_buy_f181_1 -------wget http://$1:9000/trans_add_f182_3_150 -------wget http://$1:9000/trans_buy_f182_2 -------wget http://$1:9000/trans_add_f183_4_200 -------wget http://$1:9000/trans_buy_f183_3 -------wget http://$1:9000/trans_add_f184_5_50 -------wget http://$1:9000/trans_buy_f184_4 -------wget http://$1:9000/trans_add_f185_1_100 -------wget http://$1:9000/trans_buy_f185_0 -------wget http://$1:9000/trans_add_f186_2_150 -------wget http://$1:9000/trans_buy_f186_1 -------wget http://$1:9000/trans_add_f187_3_200 -------wget http://$1:9000/trans_buy_f187_2 -------wget http://$1:9000/trans_add_f188_4_50 -------wget http://$1:9000/trans_buy_f188_3 -------wget http://$1:9000/trans_add_f189_5_100 -------wget http://$1:9000/trans_buy_f189_4 -------wget http://$1:9000/trans_add_f190_1_150 -------wget http://$1:9000/trans_buy_f190_0 -------wget http://$1:9000/trans_add_f191_2_200 -------wget http://$1:9000/trans_buy_f191_1 -------wget http://$1:9000/trans_add_f192_3_50 -------wget http://$1:9000/trans_buy_f192_2 -------wget http://$1:9000/trans_add_f193_4_100 -------wget http://$1:9000/trans_buy_f193_3 -------wget http://$1:9000/trans_add_f194_5_150 -------wget http://$1:9000/trans_buy_f194_4 -------wget http://$1:9000/trans_add_f195_1_200 -------wget http://$1:9000/trans_buy_f195_0 -------wget http://$1:9000/trans_add_f196_2_50 -------wget http://$1:9000/trans_buy_f196_1 -------wget http://$1:9000/trans_add_f197_3_100 -------wget http://$1:9000/trans_buy_f197_2 -------wget http://$1:9000/trans_add_f198_4_150 -------wget http://$1:9000/trans_buy_f198_3 -------wget http://$1:9000/trans_add_f199_5_200 -------wget http://$1:9000/trans_buy_f199_4 -------wget http://$1:9000/trans_add_f200_1_50 -------wget http://$1:9000/trans_buy_f200_0 -------wget http://$1:9000/trans_add_f201_2_100 -------wget http://$1:9000/trans_buy_f201_1 -------wget http://$1:9000/trans_add_f202_3_150 -------wget http://$1:9000/trans_buy_f202_2 -------wget http://$1:9000/trans_add_f203_4_200 -------wget http://$1:9000/trans_buy_f203_3 -------wget http://$1:9000/trans_add_f204_5_50 -------wget http://$1:9000/trans_buy_f204_4 -------wget http://$1:9000/trans_add_f205_1_100 -------wget http://$1:9000/trans_buy_f205_0 -------wget http://$1:9000/trans_add_f206_2_150 -------wget http://$1:9000/trans_buy_f206_1 -------wget http://$1:9000/trans_add_f207_3_200 -------wget http://$1:9000/trans_buy_f207_2 -------wget http://$1:9000/trans_add_f208_4_50 -------wget http://$1:9000/trans_buy_f208_3 -------wget http://$1:9000/trans_add_f209_5_100 -------wget http://$1:9000/trans_buy_f209_4 -------wget http://$1:9000/trans_add_f210_1_150 -------wget http://$1:9000/trans_buy_f210_0 -------wget http://$1:9000/trans_add_f211_2_200 -------wget http://$1:9000/trans_buy_f211_1 -------wget http://$1:9000/trans_add_f212_3_50 -------wget http://$1:9000/trans_buy_f212_2 -------wget http://$1:9000/trans_add_f213_4_100 -------wget http://$1:9000/trans_buy_f213_3 -------wget http://$1:9000/trans_add_f214_5_150 -------wget http://$1:9000/trans_buy_f214_4 -------wget http://$1:9000/trans_add_f215_1_200 -------wget http://$1:9000/trans_buy_f215_0 -------wget http://$1:9000/trans_add_f216_2_50 -------wget http://$1:9000/trans_buy_f216_1 -------wget http://$1:9000/trans_add_f217_3_100 -------wget http://$1:9000/trans_buy_f217_2 -------wget http://$1:9000/trans_add_f218_4_150 -------wget http://$1:9000/trans_buy_f218_3 -------wget http://$1:9000/trans_add_f219_5_200 -------wget http://$1:9000/trans_buy_f219_4 -------wget http://$1:9000/trans_add_f220_1_50 -------wget http://$1:9000/trans_buy_f220_0 -------wget http://$1:9000/trans_add_f221_2_100 -------wget http://$1:9000/trans_buy_f221_1 -------wget http://$1:9000/trans_add_f222_3_150 -------wget http://$1:9000/trans_buy_f222_2 -------wget http://$1:9000/trans_add_f223_4_200 -------wget http://$1:9000/trans_buy_f223_3 -------wget http://$1:9000/trans_add_f224_5_50 -------wget http://$1:9000/trans_buy_f224_4 -------wget http://$1:9000/trans_add_f225_1_100 -------wget http://$1:9000/trans_buy_f225_0 -------wget http://$1:9000/trans_add_f226_2_150 -------wget http://$1:9000/trans_buy_f226_1 -------wget http://$1:9000/trans_add_f227_3_200 -------wget http://$1:9000/trans_buy_f227_2 -------wget http://$1:9000/trans_add_f228_4_50 -------wget http://$1:9000/trans_buy_f228_3 -------wget http://$1:9000/trans_add_f229_5_100 -------wget http://$1:9000/trans_buy_f229_4 -------wget http://$1:9000/trans_add_f230_1_150 -------wget http://$1:9000/trans_buy_f230_0 -------wget http://$1:9000/trans_add_f231_2_200 -------wget http://$1:9000/trans_buy_f231_1 -------wget http://$1:9000/trans_add_f232_3_50 -------wget http://$1:9000/trans_buy_f232_2 -------wget http://$1:9000/trans_add_f233_4_100 -------wget http://$1:9000/trans_buy_f233_3 -------wget http://$1:9000/trans_add_f234_5_150 -------wget http://$1:9000/trans_buy_f234_4 -------wget http://$1:9000/trans_add_f235_1_200 -------wget http://$1:9000/trans_buy_f235_0 -------wget http://$1:9000/trans_add_f236_2_50 -------wget http://$1:9000/trans_buy_f236_1 -------wget http://$1:9000/trans_add_f237_3_100 -------wget http://$1:9000/trans_buy_f237_2 -------wget http://$1:9000/trans_add_f238_4_150 -------wget http://$1:9000/trans_buy_f238_3 -------wget http://$1:9000/trans_add_f239_5_200 -------wget http://$1:9000/trans_buy_f239_4 -------wget http://$1:9000/trans_add_f240_1_50 -------wget http://$1:9000/trans_buy_f240_0 -------wget http://$1:9000/trans_add_f241_2_100 -------wget http://$1:9000/trans_buy_f241_1 -------wget http://$1:9000/trans_add_f242_3_150 -------wget http://$1:9000/trans_buy_f242_2 -------wget http://$1:9000/trans_add_f243_4_200 -------wget http://$1:9000/trans_buy_f243_3 -------wget http://$1:9000/trans_add_f244_5_50 -------wget http://$1:9000/trans_buy_f244_4 -------wget http://$1:9000/trans_add_f245_1_100 -------wget http://$1:9000/trans_buy_f245_0 -------wget http://$1:9000/trans_add_f246_2_150 -------wget http://$1:9000/trans_buy_f246_1 -------wget http://$1:9000/trans_add_f247_3_200 -------wget http://$1:9000/trans_buy_f247_2 -------wget http://$1:9000/trans_add_f248_4_50 -------wget http://$1:9000/trans_buy_f248_3 -------wget http://$1:9000/trans_add_f249_5_100 -------wget http://$1:9000/trans_buy_f249_4 -------wget http://$1:9000/trans_add_f250_1_150 -------wget http://$1:9000/trans_buy_f250_0 -------wget http://$1:9000/trans_add_f251_2_200 -------wget http://$1:9000/trans_buy_f251_1 -------wget http://$1:9000/trans_add_f252_3_50 -------wget http://$1:9000/trans_buy_f252_2 -------wget http://$1:9000/trans_add_f253_4_100 -------wget http://$1:9000/trans_buy_f253_3 -------wget http://$1:9000/trans_add_f254_5_150 -------wget http://$1:9000/trans_buy_f254_4 -------wget http://$1:9000/trans_add_f255_1_200 -------wget http://$1:9000/trans_buy_f255_0 -------wget http://$1:9000/trans_add_f256_2_50 -------wget http://$1:9000/trans_buy_f256_1 -------wget http://$1:9000/trans_add_f257_3_100 -------wget http://$1:9000/trans_buy_f257_2 -------wget http://$1:9000/trans_add_f258_4_150 -------wget http://$1:9000/trans_buy_f258_3 -------wget http://$1:9000/trans_add_f259_5_200 -------wget http://$1:9000/trans_buy_f259_4 -------wget http://$1:9000/trans_add_f260_1_50 -------wget http://$1:9000/trans_buy_f260_0 -------wget http://$1:9000/trans_add_f261_2_100 -------wget http://$1:9000/trans_buy_f261_1 -------wget http://$1:9000/trans_add_f262_3_150 -------wget http://$1:9000/trans_buy_f262_2 -------wget http://$1:9000/trans_add_f263_4_200 -------wget http://$1:9000/trans_buy_f263_3 -------wget http://$1:9000/trans_add_f264_5_50 -------wget http://$1:9000/trans_buy_f264_4 -------wget http://$1:9000/trans_add_f265_1_100 -------wget http://$1:9000/trans_buy_f265_0 -------wget http://$1:9000/trans_add_f266_2_150 -------wget http://$1:9000/trans_buy_f266_1 -------wget http://$1:9000/trans_add_f267_3_200 -------wget http://$1:9000/trans_buy_f267_2 -------wget http://$1:9000/trans_add_f268_4_50 -------wget http://$1:9000/trans_buy_f268_3 -------wget http://$1:9000/trans_add_f269_5_100 -------wget http://$1:9000/trans_buy_f269_4 -------wget http://$1:9000/trans_add_f270_1_150 -------wget http://$1:9000/trans_buy_f270_0 -------wget http://$1:9000/trans_add_f271_2_200 -------wget http://$1:9000/trans_buy_f271_1 -------wget http://$1:9000/trans_add_f272_3_50 -------wget http://$1:9000/trans_buy_f272_2 -------wget http://$1:9000/trans_add_f273_4_100 -------wget http://$1:9000/trans_buy_f273_3 -------wget http://$1:9000/trans_add_f274_5_150 -------wget http://$1:9000/trans_buy_f274_4 -------wget http://$1:9000/trans_add_f275_1_200 -------wget http://$1:9000/trans_buy_f275_0 -------wget http://$1:9000/trans_add_f276_2_50 -------wget http://$1:9000/trans_buy_f276_1 -------wget http://$1:9000/trans_add_f277_3_100 -------wget http://$1:9000/trans_buy_f277_2 -------wget http://$1:9000/trans_add_f278_4_150 -------wget http://$1:9000/trans_buy_f278_3 -------wget http://$1:9000/trans_add_f279_5_200 -------wget http://$1:9000/trans_buy_f279_4 -------wget http://$1:9000/trans_add_f280_1_50 -------wget http://$1:9000/trans_buy_f280_0 -------wget http://$1:9000/trans_add_f281_2_100 -------wget http://$1:9000/trans_buy_f281_1 -------wget http://$1:9000/trans_add_f282_3_150 -------wget http://$1:9000/trans_buy_f282_2 -------wget http://$1:9000/trans_add_f283_4_200 -------wget http://$1:9000/trans_buy_f283_3 -------wget http://$1:9000/trans_add_f284_5_50 -------wget http://$1:9000/trans_buy_f284_4 -------wget http://$1:9000/trans_add_f285_1_100 -------wget http://$1:9000/trans_buy_f285_0 -------wget http://$1:9000/trans_add_f286_2_150 -------wget http://$1:9000/trans_buy_f286_1 -------wget http://$1:9000/trans_add_f287_3_200 -------wget http://$1:9000/trans_buy_f287_2 -------wget http://$1:9000/trans_add_f288_4_50 -------wget http://$1:9000/trans_buy_f288_3 -------wget http://$1:9000/trans_add_f289_5_100 -------wget http://$1:9000/trans_buy_f289_4 -------wget http://$1:9000/trans_add_f290_1_150 -------wget http://$1:9000/trans_buy_f290_0 -------wget http://$1:9000/trans_add_f291_2_200 -------wget http://$1:9000/trans_buy_f291_1 -------wget http://$1:9000/trans_add_f292_3_50 -------wget http://$1:9000/trans_buy_f292_2 -------wget http://$1:9000/trans_add_f293_4_100 -------wget http://$1:9000/trans_buy_f293_3 -------wget http://$1:9000/trans_add_f294_5_150 -------wget http://$1:9000/trans_buy_f294_4 -------wget http://$1:9000/trans_add_f295_1_200 -------wget http://$1:9000/trans_buy_f295_0 -------wget http://$1:9000/trans_add_f296_2_50 -------wget http://$1:9000/trans_buy_f296_1 -------wget http://$1:9000/trans_add_f297_3_100 -------wget http://$1:9000/trans_buy_f297_2 -------wget http://$1:9000/trans_add_f298_4_150 -------wget http://$1:9000/trans_buy_f298_3 -------wget http://$1:9000/trans_add_f299_5_200 -------wget http://$1:9000/trans_buy_f299_4 -------wget http://$1:9000/trans_add_f300_1_50 -------wget http://$1:9000/trans_buy_f300_0 -------wget http://$1:9000/trans_add_f301_2_100 -------wget http://$1:9000/trans_buy_f301_1 -------wget http://$1:9000/trans_add_f302_3_150 -------wget http://$1:9000/trans_buy_f302_2 -------wget http://$1:9000/trans_add_f303_4_200 -------wget http://$1:9000/trans_buy_f303_3 -------wget http://$1:9000/trans_add_f304_5_50 -------wget http://$1:9000/trans_buy_f304_4 -------wget http://$1:9000/trans_add_f305_1_100 -------wget http://$1:9000/trans_buy_f305_0 -------wget http://$1:9000/trans_add_f306_2_150 -------wget http://$1:9000/trans_buy_f306_1 -------wget http://$1:9000/trans_add_f307_3_200 -------wget http://$1:9000/trans_buy_f307_2 -------wget http://$1:9000/trans_add_f308_4_50 -------wget http://$1:9000/trans_buy_f308_3 -------wget http://$1:9000/trans_add_f309_5_100 -------wget http://$1:9000/trans_buy_f309_4 -------wget http://$1:9000/trans_add_f310_1_150 -------wget http://$1:9000/trans_buy_f310_0 -------wget http://$1:9000/trans_add_f311_2_200 -------wget http://$1:9000/trans_buy_f311_1 -------wget http://$1:9000/trans_add_f312_3_50 -------wget http://$1:9000/trans_buy_f312_2 -------wget http://$1:9000/trans_add_f313_4_100 -------wget http://$1:9000/trans_buy_f313_3 -------wget http://$1:9000/trans_add_f314_5_150 -------wget http://$1:9000/trans_buy_f314_4 -------wget http://$1:9000/trans_add_f315_1_200 -------wget http://$1:9000/trans_buy_f315_0 -------wget http://$1:9000/trans_add_f316_2_50 -------wget http://$1:9000/trans_buy_f316_1 -------wget http://$1:9000/trans_add_f317_3_100 -------wget http://$1:9000/trans_buy_f317_2 -------wget http://$1:9000/trans_add_f318_4_150 -------wget http://$1:9000/trans_buy_f318_3 -------wget http://$1:9000/trans_add_f319_5_200 -------wget http://$1:9000/trans_buy_f319_4 -------wget http://$1:9000/trans_add_f320_1_50 -------wget http://$1:9000/trans_buy_f320_0 -------wget http://$1:9000/trans_add_f321_2_100 -------wget http://$1:9000/trans_buy_f321_1 -------wget http://$1:9000/trans_add_f322_3_150 -------wget http://$1:9000/trans_buy_f322_2 -------wget http://$1:9000/trans_add_f323_4_200 -------wget http://$1:9000/trans_buy_f323_3 -------wget http://$1:9000/trans_add_f324_5_50 -------wget http://$1:9000/trans_buy_f324_4 -------wget http://$1:9000/trans_add_f325_1_100 -------wget http://$1:9000/trans_buy_f325_0 -------wget http://$1:9000/trans_add_f326_2_150 -------wget http://$1:9000/trans_buy_f326_1 -------wget http://$1:9000/trans_add_f327_3_200 -------wget http://$1:9000/trans_buy_f327_2 -------wget http://$1:9000/trans_add_f328_4_50 -------wget http://$1:9000/trans_buy_f328_3 -------wget http://$1:9000/trans_add_f329_5_100 -------wget http://$1:9000/trans_buy_f329_4 -------wget http://$1:9000/trans_add_f330_1_150 -------wget http://$1:9000/trans_buy_f330_0 -------wget http://$1:9000/trans_add_f331_2_200 -------wget http://$1:9000/trans_buy_f331_1 -------wget http://$1:9000/trans_add_f332_3_50 -------wget http://$1:9000/trans_buy_f332_2 -------wget http://$1:9000/trans_add_f333_4_100 -------wget http://$1:9000/trans_buy_f333_3 -------wget http://$1:9000/trans_add_f334_5_150 -------wget http://$1:9000/trans_buy_f334_4 -------wget http://$1:9000/trans_add_f335_1_200 -------wget http://$1:9000/trans_buy_f335_0 -------wget http://$1:9000/trans_add_f336_2_50 -------wget http://$1:9000/trans_buy_f336_1 -------wget http://$1:9000/trans_add_f337_3_100 -------wget http://$1:9000/trans_buy_f337_2 -------wget http://$1:9000/trans_add_f338_4_150 -------wget http://$1:9000/trans_buy_f338_3 -------wget http://$1:9000/trans_add_f339_5_200 -------wget http://$1:9000/trans_buy_f339_4 -------wget http://$1:9000/trans_add_f340_1_50 -------wget http://$1:9000/trans_buy_f340_0 -------wget http://$1:9000/trans_add_f341_2_100 -------wget http://$1:9000/trans_buy_f341_1 -------wget http://$1:9000/trans_add_f342_3_150 -------wget http://$1:9000/trans_buy_f342_2 -------wget http://$1:9000/trans_add_f343_4_200 -------wget http://$1:9000/trans_buy_f343_3 -------wget http://$1:9000/trans_add_f344_5_50 -------wget http://$1:9000/trans_buy_f344_4 -------wget http://$1:9000/trans_add_f345_1_100 -------wget http://$1:9000/trans_buy_f345_0 -------wget http://$1:9000/trans_add_f346_2_150 -------wget http://$1:9000/trans_buy_f346_1 -------wget http://$1:9000/trans_add_f347_3_200 -------wget http://$1:9000/trans_buy_f347_2 -------wget http://$1:9000/trans_add_f348_4_50 -------wget http://$1:9000/trans_buy_f348_3 -------wget http://$1:9000/trans_add_f349_5_100 -------wget http://$1:9000/trans_buy_f349_4 -------wget http://$1:9000/trans_add_f350_1_150 -------wget http://$1:9000/trans_buy_f350_0 -------wget http://$1:9000/trans_add_f351_2_200 -------wget http://$1:9000/trans_buy_f351_1 -------wget http://$1:9000/trans_add_f352_3_50 -------wget http://$1:9000/trans_buy_f352_2 -------wget http://$1:9000/trans_add_f353_4_100 -------wget http://$1:9000/trans_buy_f353_3 -------wget http://$1:9000/trans_add_f354_5_150 -------wget http://$1:9000/trans_buy_f354_4 -------wget http://$1:9000/trans_add_f355_1_200 -------wget http://$1:9000/trans_buy_f355_0 -------wget http://$1:9000/trans_add_f356_2_50 -------wget http://$1:9000/trans_buy_f356_1 -------wget http://$1:9000/trans_add_f357_3_100 -------wget http://$1:9000/trans_buy_f357_2 -------wget http://$1:9000/trans_add_f358_4_150 -------wget http://$1:9000/trans_buy_f358_3 -------wget http://$1:9000/trans_add_f359_5_200 -------wget http://$1:9000/trans_buy_f359_4 -------wget http://$1:9000/trans_add_f360_1_50 -------wget http://$1:9000/trans_buy_f360_0 -------wget http://$1:9000/trans_add_f361_2_100 -------wget http://$1:9000/trans_buy_f361_1 -------wget http://$1:9000/trans_add_f362_3_150 -------wget http://$1:9000/trans_buy_f362_2 -------wget http://$1:9000/trans_add_f363_4_200 -------wget http://$1:9000/trans_buy_f363_3 -------wget http://$1:9000/trans_add_f364_5_50 -------wget http://$1:9000/trans_buy_f364_4 -------wget http://$1:9000/trans_add_f365_1_100 -------wget http://$1:9000/trans_buy_f365_0 -------wget http://$1:9000/trans_add_f366_2_150 -------wget http://$1:9000/trans_buy_f366_1 -------wget http://$1:9000/trans_add_f367_3_200 -------wget http://$1:9000/trans_buy_f367_2 -------wget http://$1:9000/trans_add_f368_4_50 -------wget http://$1:9000/trans_buy_f368_3 -------wget http://$1:9000/trans_add_f369_5_100 -------wget http://$1:9000/trans_buy_f369_4 -------wget http://$1:9000/trans_add_f370_1_150 -------wget http://$1:9000/trans_buy_f370_0 -------wget http://$1:9000/trans_add_f371_2_200 -------wget http://$1:9000/trans_buy_f371_1 -------wget http://$1:9000/trans_add_f372_3_50 -------wget http://$1:9000/trans_buy_f372_2 -------wget http://$1:9000/trans_add_f373_4_100 -------wget http://$1:9000/trans_buy_f373_3 -------wget http://$1:9000/trans_add_f374_5_150 -------wget http://$1:9000/trans_buy_f374_4 -------wget http://$1:9000/trans_add_f375_1_200 -------wget http://$1:9000/trans_buy_f375_0 -------wget http://$1:9000/trans_add_f376_2_50 -------wget http://$1:9000/trans_buy_f376_1 -------wget http://$1:9000/trans_add_f377_3_100 -------wget http://$1:9000/trans_buy_f377_2 -------wget http://$1:9000/trans_add_f378_4_150 -------wget http://$1:9000/trans_buy_f378_3 -------wget http://$1:9000/trans_add_f379_5_200 -------wget http://$1:9000/trans_buy_f379_4 -------wget http://$1:9000/trans_add_f380_1_50 -------wget http://$1:9000/trans_buy_f380_0 -------wget http://$1:9000/trans_add_f381_2_100 -------wget http://$1:9000/trans_buy_f381_1 -------wget http://$1:9000/trans_add_f382_3_150 -------wget http://$1:9000/trans_buy_f382_2 -------wget http://$1:9000/trans_add_f383_4_200 -------wget http://$1:9000/trans_buy_f383_3 -------wget http://$1:9000/trans_add_f384_5_50 -------wget http://$1:9000/trans_buy_f384_4 -------wget http://$1:9000/trans_add_f385_1_100 -------wget http://$1:9000/trans_buy_f385_0 -------wget http://$1:9000/trans_add_f386_2_150 -------wget http://$1:9000/trans_buy_f386_1 -------wget http://$1:9000/trans_add_f387_3_200 -------wget http://$1:9000/trans_buy_f387_2 -------wget http://$1:9000/trans_add_f388_4_50 -------wget http://$1:9000/trans_buy_f388_3 -------wget http://$1:9000/trans_add_f389_5_100 -------wget http://$1:9000/trans_buy_f389_4 -------wget http://$1:9000/trans_add_f390_1_150 -------wget http://$1:9000/trans_buy_f390_0 -------wget http://$1:9000/trans_add_f391_2_200 -------wget http://$1:9000/trans_buy_f391_1 -------wget http://$1:9000/trans_add_f392_3_50 -------wget http://$1:9000/trans_buy_f392_2 -------wget http://$1:9000/trans_add_f393_4_100 -------wget http://$1:9000/trans_buy_f393_3 -------wget http://$1:9000/trans_add_f394_5_150 -------wget http://$1:9000/trans_buy_f394_4 -------wget http://$1:9000/trans_add_f395_1_200 -------wget http://$1:9000/trans_buy_f395_0 -------wget http://$1:9000/trans_add_f396_2_50 -------wget http://$1:9000/trans_buy_f396_1 -------wget http://$1:9000/trans_add_f397_3_100 -------wget http://$1:9000/trans_buy_f397_2 -------wget http://$1:9000/trans_add_f398_4_150 -------wget http://$1:9000/trans_buy_f398_3 -------wget http://$1:9000/trans_add_f399_5_200 -------wget http://$1:9000/trans_buy_f399_4 -------wget http://$1:9000/trans_add_f400_1_50 -------wget http://$1:9000/trans_buy_f400_0 -------wget http://$1:9000/trans_add_f401_2_100 -------wget http://$1:9000/trans_buy_f401_1 -------wget http://$1:9000/trans_add_f402_3_150 -------wget http://$1:9000/trans_buy_f402_2 -------wget http://$1:9000/trans_add_f403_4_200 -------wget http://$1:9000/trans_buy_f403_3 -------wget http://$1:9000/trans_add_f404_5_50 -------wget http://$1:9000/trans_buy_f404_4 -------wget http://$1:9000/trans_add_f405_1_100 -------wget http://$1:9000/trans_buy_f405_0 -------wget http://$1:9000/trans_add_f406_2_150 -------wget http://$1:9000/trans_buy_f406_1 -------wget http://$1:9000/trans_add_f407_3_200 -------wget http://$1:9000/trans_buy_f407_2 -------wget http://$1:9000/trans_add_f408_4_50 -------wget http://$1:9000/trans_buy_f408_3 -------wget http://$1:9000/trans_add_f409_5_100 -------wget http://$1:9000/trans_buy_f409_4 -------wget http://$1:9000/trans_add_f410_1_150 -------wget http://$1:9000/trans_buy_f410_0 -------wget http://$1:9000/trans_add_f411_2_200 -------wget http://$1:9000/trans_buy_f411_1 -------wget http://$1:9000/trans_add_f412_3_50 -------wget http://$1:9000/trans_buy_f412_2 -------wget http://$1:9000/trans_add_f413_4_100 -------wget http://$1:9000/trans_buy_f413_3 -------wget http://$1:9000/trans_add_f414_5_150 -------wget http://$1:9000/trans_buy_f414_4 -------wget http://$1:9000/trans_add_f415_1_200 -------wget http://$1:9000/trans_buy_f415_0 -------wget http://$1:9000/trans_add_f416_2_50 -------wget http://$1:9000/trans_buy_f416_1 -------wget http://$1:9000/trans_add_f417_3_100 -------wget http://$1:9000/trans_buy_f417_2 -------wget http://$1:9000/trans_add_f418_4_150 -------wget http://$1:9000/trans_buy_f418_3 -------wget http://$1:9000/trans_add_f419_5_200 -------wget http://$1:9000/trans_buy_f419_4 -------wget http://$1:9000/trans_add_f420_1_50 -------wget http://$1:9000/trans_buy_f420_0 -------wget http://$1:9000/trans_add_f421_2_100 -------wget http://$1:9000/trans_buy_f421_1 -------wget http://$1:9000/trans_add_f422_3_150 -------wget http://$1:9000/trans_buy_f422_2 -------wget http://$1:9000/trans_add_f423_4_200 -------wget http://$1:9000/trans_buy_f423_3 -------wget http://$1:9000/trans_add_f424_5_50 -------wget http://$1:9000/trans_buy_f424_4 -------wget http://$1:9000/trans_add_f425_1_100 -------wget http://$1:9000/trans_buy_f425_0 -------wget http://$1:9000/trans_add_f426_2_150 -------wget http://$1:9000/trans_buy_f426_1 -------wget http://$1:9000/trans_add_f427_3_200 -------wget http://$1:9000/trans_buy_f427_2 -------wget http://$1:9000/trans_add_f428_4_50 -------wget http://$1:9000/trans_buy_f428_3 -------wget http://$1:9000/trans_add_f429_5_100 -------wget http://$1:9000/trans_buy_f429_4 -------wget http://$1:9000/trans_add_f430_1_150 -------wget http://$1:9000/trans_buy_f430_0 -------wget http://$1:9000/trans_add_f431_2_200 -------wget http://$1:9000/trans_buy_f431_1 -------wget http://$1:9000/trans_add_f432_3_50 -------wget http://$1:9000/trans_buy_f432_2 -------wget http://$1:9000/trans_add_f433_4_100 -------wget http://$1:9000/trans_buy_f433_3 -------wget http://$1:9000/trans_add_f434_5_150 -------wget http://$1:9000/trans_buy_f434_4 -------wget http://$1:9000/trans_add_f435_1_200 -------wget http://$1:9000/trans_buy_f435_0 -------wget http://$1:9000/trans_add_f436_2_50 -------wget http://$1:9000/trans_buy_f436_1 -------wget http://$1:9000/trans_add_f437_3_100 -------wget http://$1:9000/trans_buy_f437_2 -------wget http://$1:9000/trans_add_f438_4_150 -------wget http://$1:9000/trans_buy_f438_3 -------wget http://$1:9000/trans_add_f439_5_200 -------wget http://$1:9000/trans_buy_f439_4 -------wget http://$1:9000/trans_add_f440_1_50 -------wget http://$1:9000/trans_buy_f440_0 -------wget http://$1:9000/trans_add_f441_2_100 -------wget http://$1:9000/trans_buy_f441_1 -------wget http://$1:9000/trans_add_f442_3_150 -------wget http://$1:9000/trans_buy_f442_2 -------wget http://$1:9000/trans_add_f443_4_200 -------wget http://$1:9000/trans_buy_f443_3 -------wget http://$1:9000/trans_add_f444_5_50 -------wget http://$1:9000/trans_buy_f444_4 -------wget http://$1:9000/trans_add_f445_1_100 -------wget http://$1:9000/trans_buy_f445_0 -------wget http://$1:9000/trans_add_f446_2_150 -------wget http://$1:9000/trans_buy_f446_1 -------wget http://$1:9000/trans_add_f447_3_200 -------wget http://$1:9000/trans_buy_f447_2 -------wget http://$1:9000/trans_add_f448_4_50 -------wget http://$1:9000/trans_buy_f448_3 -------wget http://$1:9000/trans_add_f449_5_100 -------wget http://$1:9000/trans_buy_f449_4 -------wget http://$1:9000/trans_add_f450_1_150 -------wget http://$1:9000/trans_buy_f450_0 -------wget http://$1:9000/trans_add_f451_2_200 -------wget http://$1:9000/trans_buy_f451_1 -------wget http://$1:9000/trans_add_f452_3_50 -------wget http://$1:9000/trans_buy_f452_2 -------wget http://$1:9000/trans_add_f453_4_100 -------wget http://$1:9000/trans_buy_f453_3 -------wget http://$1:9000/trans_add_f454_5_150 -------wget http://$1:9000/trans_buy_f454_4 -------wget http://$1:9000/trans_add_f455_1_200 -------wget http://$1:9000/trans_buy_f455_0 -------wget http://$1:9000/trans_add_f456_2_50 -------wget http://$1:9000/trans_buy_f456_1 -------wget http://$1:9000/trans_add_f457_3_100 -------wget http://$1:9000/trans_buy_f457_2 -------wget http://$1:9000/trans_add_f458_4_150 -------wget http://$1:9000/trans_buy_f458_3 -------wget http://$1:9000/trans_add_f459_5_200 -------wget http://$1:9000/trans_buy_f459_4 -------wget http://$1:9000/trans_add_f460_1_50 -------wget http://$1:9000/trans_buy_f460_0 -------wget http://$1:9000/trans_add_f461_2_100 -------wget http://$1:9000/trans_buy_f461_1 -------wget http://$1:9000/trans_add_f462_3_150 -------wget http://$1:9000/trans_buy_f462_2 -------wget http://$1:9000/trans_add_f463_4_200 -------wget http://$1:9000/trans_buy_f463_3 -------wget http://$1:9000/trans_add_f464_5_50 -------wget http://$1:9000/trans_buy_f464_4 -------wget http://$1:9000/trans_add_f465_1_100 -------wget http://$1:9000/trans_buy_f465_0 -------wget http://$1:9000/trans_add_f466_2_150 -------wget http://$1:9000/trans_buy_f466_1 -------wget http://$1:9000/trans_add_f467_3_200 -------wget http://$1:9000/trans_buy_f467_2 -------wget http://$1:9000/trans_add_f468_4_50 -------wget http://$1:9000/trans_buy_f468_3 -------wget http://$1:9000/trans_add_f469_5_100 -------wget http://$1:9000/trans_buy_f469_4 -------wget http://$1:9000/trans_add_f470_1_150 -------wget http://$1:9000/trans_buy_f470_0 -------wget http://$1:9000/trans_add_f471_2_200 -------wget http://$1:9000/trans_buy_f471_1 -------wget http://$1:9000/trans_add_f472_3_50 -------wget http://$1:9000/trans_buy_f472_2 -------wget http://$1:9000/trans_add_f473_4_100 -------wget http://$1:9000/trans_buy_f473_3 -------wget http://$1:9000/trans_add_f474_5_150 -------wget http://$1:9000/trans_buy_f474_4 -------wget http://$1:9000/trans_add_f475_1_200 -------wget http://$1:9000/trans_buy_f475_0 -------wget http://$1:9000/trans_add_f476_2_50 -------wget http://$1:9000/trans_buy_f476_1 -------wget http://$1:9000/trans_add_f477_3_100 -------wget http://$1:9000/trans_buy_f477_2 -------wget http://$1:9000/trans_add_f478_4_150 -------wget http://$1:9000/trans_buy_f478_3 -------wget http://$1:9000/trans_add_f479_5_200 -------wget http://$1:9000/trans_buy_f479_4 -------wget http://$1:9000/trans_add_f480_1_50 -------wget http://$1:9000/trans_buy_f480_0 -------wget http://$1:9000/trans_add_f481_2_100 -------wget http://$1:9000/trans_buy_f481_1 -------wget http://$1:9000/trans_add_f482_3_150 -------wget http://$1:9000/trans_buy_f482_2 -------wget http://$1:9000/trans_add_f483_4_200 -------wget http://$1:9000/trans_buy_f483_3 -------wget http://$1:9000/trans_add_f484_5_50 -------wget http://$1:9000/trans_buy_f484_4 -------wget http://$1:9000/trans_add_f485_1_100 -------wget http://$1:9000/trans_buy_f485_0 -------wget http://$1:9000/trans_add_f486_2_150 -------wget http://$1:9000/trans_buy_f486_1 -------wget http://$1:9000/trans_add_f487_3_200 -------wget http://$1:9000/trans_buy_f487_2 -------wget http://$1:9000/trans_add_f488_4_50 -------wget http://$1:9000/trans_buy_f488_3 -------wget http://$1:9000/trans_add_f489_5_100 -------wget http://$1:9000/trans_buy_f489_4 -------wget http://$1:9000/trans_add_f490_1_150 -------wget http://$1:9000/trans_buy_f490_0 -------wget http://$1:9000/trans_add_f491_2_200 -------wget http://$1:9000/trans_buy_f491_1 -------wget http://$1:9000/trans_add_f492_3_50 -------wget http://$1:9000/trans_buy_f492_2 -------wget http://$1:9000/trans_add_f493_4_100 -------wget http://$1:9000/trans_buy_f493_3 -------wget http://$1:9000/trans_add_f494_5_150 -------wget http://$1:9000/trans_buy_f494_4 -------wget http://$1:9000/trans_add_f495_1_200 -------wget http://$1:9000/trans_buy_f495_0 -------wget http://$1:9000/trans_add_f496_2_50 -------wget http://$1:9000/trans_buy_f496_1 -------wget http://$1:9000/trans_add_f497_3_100 -------wget http://$1:9000/trans_buy_f497_2 -------wget http://$1:9000/trans_add_f498_4_150 -------wget http://$1:9000/trans_buy_f498_3 -------wget http://$1:9000/trans_add_f499_5_200 -------wget http://$1:9000/trans_buy_f499_4 -------wget http://$1:9000/trans_add_f500_1_50 -------wget http://$1:9000/trans_buy_f500_0 -------wget http://$1:9000/trans_add_f501_2_100 -------wget http://$1:9000/trans_buy_f501_1 -------wget http://$1:9000/trans_add_f502_3_150 -------wget http://$1:9000/trans_buy_f502_2 -------wget http://$1:9000/trans_add_f503_4_200 -------wget http://$1:9000/trans_buy_f503_3 -------wget http://$1:9000/trans_add_f504_5_50 -------wget http://$1:9000/trans_buy_f504_4 -------wget http://$1:9000/trans_add_f505_1_100 -------wget http://$1:9000/trans_buy_f505_0 -------wget http://$1:9000/trans_add_f506_2_150 -------wget http://$1:9000/trans_buy_f506_1 -------wget http://$1:9000/trans_add_f507_3_200 -------wget http://$1:9000/trans_buy_f507_2 -------wget http://$1:9000/trans_add_f508_4_50 -------wget http://$1:9000/trans_buy_f508_3 -------wget http://$1:9000/trans_add_f509_5_100 -------wget http://$1:9000/trans_buy_f509_4 -------wget http://$1:9000/trans_add_f510_1_150 -------wget http://$1:9000/trans_buy_f510_0 -------wget http://$1:9000/trans_add_f511_2_200 -------wget http://$1:9000/trans_buy_f511_1 -------wget http://$1:9000/trans_add_f512_3_50 -------wget http://$1:9000/trans_buy_f512_2 -------wget http://$1:9000/trans_add_f513_4_100 -------wget http://$1:9000/trans_buy_f513_3 -------wget http://$1:9000/trans_add_f514_5_150 -------wget http://$1:9000/trans_buy_f514_4 -------wget http://$1:9000/trans_add_f515_1_200 -------wget http://$1:9000/trans_buy_f515_0 -------wget http://$1:9000/trans_add_f516_2_50 -------wget http://$1:9000/trans_buy_f516_1 -------wget http://$1:9000/trans_add_f517_3_100 -------wget http://$1:9000/trans_buy_f517_2 -------wget http://$1:9000/trans_add_f518_4_150 -------wget http://$1:9000/trans_buy_f518_3 -------wget http://$1:9000/trans_add_f519_5_200 -------wget http://$1:9000/trans_buy_f519_4 -------wget http://$1:9000/trans_add_f520_1_50 -------wget http://$1:9000/trans_buy_f520_0 -------wget http://$1:9000/trans_add_f521_2_100 -------wget http://$1:9000/trans_buy_f521_1 -------wget http://$1:9000/trans_add_f522_3_150 -------wget http://$1:9000/trans_buy_f522_2 -------wget http://$1:9000/trans_add_f523_4_200 -------wget http://$1:9000/trans_buy_f523_3 -------wget http://$1:9000/trans_add_f524_5_50 -------wget http://$1:9000/trans_buy_f524_4 -------wget http://$1:9000/trans_add_f525_1_100 -------wget http://$1:9000/trans_buy_f525_0 -------wget http://$1:9000/trans_add_f526_2_150 -------wget http://$1:9000/trans_buy_f526_1 -------wget http://$1:9000/trans_add_f527_3_200 -------wget http://$1:9000/trans_buy_f527_2 -------wget http://$1:9000/trans_add_f528_4_50 -------wget http://$1:9000/trans_buy_f528_3 -------wget http://$1:9000/trans_add_f529_5_100 -------wget http://$1:9000/trans_buy_f529_4 -------wget http://$1:9000/trans_add_f530_1_150 -------wget http://$1:9000/trans_buy_f530_0 -------wget http://$1:9000/trans_add_f531_2_200 -------wget http://$1:9000/trans_buy_f531_1 -------wget http://$1:9000/trans_add_f532_3_50 -------wget http://$1:9000/trans_buy_f532_2 -------wget http://$1:9000/trans_add_f533_4_100 -------wget http://$1:9000/trans_buy_f533_3 -------wget http://$1:9000/trans_add_f534_5_150 -------wget http://$1:9000/trans_buy_f534_4 -------wget http://$1:9000/trans_add_f535_1_200 -------wget http://$1:9000/trans_buy_f535_0 -------wget http://$1:9000/trans_add_f536_2_50 -------wget http://$1:9000/trans_buy_f536_1 -------wget http://$1:9000/trans_add_f537_3_100 -------wget http://$1:9000/trans_buy_f537_2 -------wget http://$1:9000/trans_add_f538_4_150 -------wget http://$1:9000/trans_buy_f538_3 -------wget http://$1:9000/trans_add_f539_5_200 -------wget http://$1:9000/trans_buy_f539_4 -------wget http://$1:9000/trans_add_f540_1_50 -------wget http://$1:9000/trans_buy_f540_0 -------wget http://$1:9000/trans_add_f541_2_100 -------wget http://$1:9000/trans_buy_f541_1 -------wget http://$1:9000/trans_add_f542_3_150 -------wget http://$1:9000/trans_buy_f542_2 -------wget http://$1:9000/trans_add_f543_4_200 -------wget http://$1:9000/trans_buy_f543_3 -------wget http://$1:9000/trans_add_f544_5_50 -------wget http://$1:9000/trans_buy_f544_4 -------wget http://$1:9000/trans_add_f545_1_100 -------wget http://$1:9000/trans_buy_f545_0 -------wget http://$1:9000/trans_add_f546_2_150 -------wget http://$1:9000/trans_buy_f546_1 -------wget http://$1:9000/trans_add_f547_3_200 -------wget http://$1:9000/trans_buy_f547_2 -------wget http://$1:9000/trans_add_f548_4_50 -------wget http://$1:9000/trans_buy_f548_3 -------wget http://$1:9000/trans_add_f549_5_100 -------wget http://$1:9000/trans_buy_f549_4 -------wget http://$1:9000/trans_add_f550_1_150 -------wget http://$1:9000/trans_buy_f550_0 -------wget http://$1:9000/trans_add_f551_2_200 -------wget http://$1:9000/trans_buy_f551_1 -------wget http://$1:9000/trans_add_f552_3_50 -------wget http://$1:9000/trans_buy_f552_2 -------wget http://$1:9000/trans_add_f553_4_100 -------wget http://$1:9000/trans_buy_f553_3 -------wget http://$1:9000/trans_add_f554_5_150 -------wget http://$1:9000/trans_buy_f554_4 -------wget http://$1:9000/trans_add_f555_1_200 -------wget http://$1:9000/trans_buy_f555_0 -------wget http://$1:9000/trans_add_f556_2_50 -------wget http://$1:9000/trans_buy_f556_1 -------wget http://$1:9000/trans_add_f557_3_100 -------wget http://$1:9000/trans_buy_f557_2 -------wget http://$1:9000/trans_add_f558_4_150 -------wget http://$1:9000/trans_buy_f558_3 -------wget http://$1:9000/trans_add_f559_5_200 -------wget http://$1:9000/trans_buy_f559_4 -------wget http://$1:9000/trans_add_f560_1_50 -------wget http://$1:9000/trans_buy_f560_0 -------wget http://$1:9000/trans_add_f561_2_100 -------wget http://$1:9000/trans_buy_f561_1 -------wget http://$1:9000/trans_add_f562_3_150 -------wget http://$1:9000/trans_buy_f562_2 -------wget http://$1:9000/trans_add_f563_4_200 -------wget http://$1:9000/trans_buy_f563_3 -------wget http://$1:9000/trans_add_f564_5_50 -------wget http://$1:9000/trans_buy_f564_4 -------wget http://$1:9000/trans_add_f565_1_100 -------wget http://$1:9000/trans_buy_f565_0 -------wget http://$1:9000/trans_add_f566_2_150 -------wget http://$1:9000/trans_buy_f566_1 -------wget http://$1:9000/trans_add_f567_3_200 -------wget http://$1:9000/trans_buy_f567_2 -------wget http://$1:9000/trans_add_f568_4_50 -------wget http://$1:9000/trans_buy_f568_3 -------wget http://$1:9000/trans_add_f569_5_100 -------wget http://$1:9000/trans_buy_f569_4 -------wget http://$1:9000/trans_add_f570_1_150 -------wget http://$1:9000/trans_buy_f570_0 -------wget http://$1:9000/trans_add_f571_2_200 -------wget http://$1:9000/trans_buy_f571_1 -------wget http://$1:9000/trans_add_f572_3_50 -------wget http://$1:9000/trans_buy_f572_2 -------wget http://$1:9000/trans_add_f573_4_100 -------wget http://$1:9000/trans_buy_f573_3 -------wget http://$1:9000/trans_add_f574_5_150 -------wget http://$1:9000/trans_buy_f574_4 -------wget http://$1:9000/trans_add_f575_1_200 -------wget http://$1:9000/trans_buy_f575_0 -------wget http://$1:9000/trans_add_f576_2_50 -------wget http://$1:9000/trans_buy_f576_1 -------wget http://$1:9000/trans_add_f577_3_100 -------wget http://$1:9000/trans_buy_f577_2 -------wget http://$1:9000/trans_add_f578_4_150 -------wget http://$1:9000/trans_buy_f578_3 -------wget http://$1:9000/trans_add_f579_5_200 -------wget http://$1:9000/trans_buy_f579_4 -------wget http://$1:9000/trans_add_f580_1_50 -------wget http://$1:9000/trans_buy_f580_0 -------wget http://$1:9000/trans_add_f581_2_100 -------wget http://$1:9000/trans_buy_f581_1 -------wget http://$1:9000/trans_add_f582_3_150 -------wget http://$1:9000/trans_buy_f582_2 -------wget http://$1:9000/trans_add_f583_4_200 -------wget http://$1:9000/trans_buy_f583_3 -------wget http://$1:9000/trans_add_f584_5_50 -------wget http://$1:9000/trans_buy_f584_4 -------wget http://$1:9000/trans_add_f585_1_100 -------wget http://$1:9000/trans_buy_f585_0 -------wget http://$1:9000/trans_add_f586_2_150 -------wget http://$1:9000/trans_buy_f586_1 -------wget http://$1:9000/trans_add_f587_3_200 -------wget http://$1:9000/trans_buy_f587_2 -------wget http://$1:9000/trans_add_f588_4_50 -------wget http://$1:9000/trans_buy_f588_3 -------wget http://$1:9000/trans_add_f589_5_100 -------wget http://$1:9000/trans_buy_f589_4 -------wget http://$1:9000/trans_add_f590_1_150 -------wget http://$1:9000/trans_buy_f590_0 -------wget http://$1:9000/trans_add_f591_2_200 -------wget http://$1:9000/trans_buy_f591_1 -------wget http://$1:9000/trans_add_f592_3_50 -------wget http://$1:9000/trans_buy_f592_2 -------wget http://$1:9000/trans_add_f593_4_100 -------wget http://$1:9000/trans_buy_f593_3 -------wget http://$1:9000/trans_add_f594_5_150 -------wget http://$1:9000/trans_buy_f594_4 -------wget http://$1:9000/trans_add_f595_1_200 -------wget http://$1:9000/trans_buy_f595_0 -------wget http://$1:9000/trans_add_f596_2_50 -------wget http://$1:9000/trans_buy_f596_1 -------wget http://$1:9000/trans_add_f597_3_100 -------wget http://$1:9000/trans_buy_f597_2 -------wget http://$1:9000/trans_add_f598_4_150 -------wget http://$1:9000/trans_buy_f598_3 -------wget http://$1:9000/trans_add_f599_5_200 -------wget http://$1:9000/trans_buy_f599_4 -------wget http://$1:9000/trans_add_f600_1_50 -------wget http://$1:9000/trans_buy_f600_0 -------wget http://$1:9000/trans_add_f601_2_100 -------wget http://$1:9000/trans_buy_f601_1 -------wget http://$1:9000/trans_add_f602_3_150 -------wget http://$1:9000/trans_buy_f602_2 -------wget http://$1:9000/trans_add_f603_4_200 -------wget http://$1:9000/trans_buy_f603_3 -------wget http://$1:9000/trans_add_f604_5_50 -------wget http://$1:9000/trans_buy_f604_4 -------wget http://$1:9000/trans_add_f605_1_100 -------wget http://$1:9000/trans_buy_f605_0 -------wget http://$1:9000/trans_add_f606_2_150 -------wget http://$1:9000/trans_buy_f606_1 -------wget http://$1:9000/trans_add_f607_3_200 -------wget http://$1:9000/trans_buy_f607_2 -------wget http://$1:9000/trans_add_f608_4_50 -------wget http://$1:9000/trans_buy_f608_3 -------wget http://$1:9000/trans_add_f609_5_100 -------wget http://$1:9000/trans_buy_f609_4 -------wget http://$1:9000/trans_add_f610_1_150 -------wget http://$1:9000/trans_buy_f610_0 -------wget http://$1:9000/trans_add_f611_2_200 -------wget http://$1:9000/trans_buy_f611_1 -------wget http://$1:9000/trans_add_f612_3_50 -------wget http://$1:9000/trans_buy_f612_2 -------wget http://$1:9000/trans_add_f613_4_100 -------wget http://$1:9000/trans_buy_f613_3 -------wget http://$1:9000/trans_add_f614_5_150 -------wget http://$1:9000/trans_buy_f614_4 -------wget http://$1:9000/trans_add_f615_1_200 -------wget http://$1:9000/trans_buy_f615_0 -------wget http://$1:9000/trans_add_f616_2_50 -------wget http://$1:9000/trans_buy_f616_1 -------wget http://$1:9000/trans_add_f617_3_100 -------wget http://$1:9000/trans_buy_f617_2 -------wget http://$1:9000/trans_add_f618_4_150 -------wget http://$1:9000/trans_buy_f618_3 -------wget http://$1:9000/trans_add_f619_5_200 -------wget http://$1:9000/trans_buy_f619_4 -------wget http://$1:9000/trans_add_f620_1_50 -------wget http://$1:9000/trans_buy_f620_0 -------wget http://$1:9000/trans_add_f621_2_100 -------wget http://$1:9000/trans_buy_f621_1 -------wget http://$1:9000/trans_add_f622_3_150 -------wget http://$1:9000/trans_buy_f622_2 -------wget http://$1:9000/trans_add_f623_4_200 -------wget http://$1:9000/trans_buy_f623_3 -------wget http://$1:9000/trans_add_f624_5_50 -------wget http://$1:9000/trans_buy_f624_4 -------wget http://$1:9000/trans_add_f625_1_100 -------wget http://$1:9000/trans_buy_f625_0 -------wget http://$1:9000/trans_add_f626_2_150 -------wget http://$1:9000/trans_buy_f626_1 -------wget http://$1:9000/trans_add_f627_3_200 -------wget http://$1:9000/trans_buy_f627_2 -------wget http://$1:9000/trans_add_f628_4_50 -------wget http://$1:9000/trans_buy_f628_3 -------wget http://$1:9000/trans_add_f629_5_100 -------wget http://$1:9000/trans_buy_f629_4 -------wget http://$1:9000/trans_add_f630_1_150 -------wget http://$1:9000/trans_buy_f630_0 -------wget http://$1:9000/trans_add_f631_2_200 -------wget http://$1:9000/trans_buy_f631_1 -------wget http://$1:9000/trans_add_f632_3_50 -------wget http://$1:9000/trans_buy_f632_2 -------wget http://$1:9000/trans_add_f633_4_100 -------wget http://$1:9000/trans_buy_f633_3 -------wget http://$1:9000/trans_add_f634_5_150 -------wget http://$1:9000/trans_buy_f634_4 -------wget http://$1:9000/trans_add_f635_1_200 -------wget http://$1:9000/trans_buy_f635_0 -------wget http://$1:9000/trans_add_f636_2_50 -------wget http://$1:9000/trans_buy_f636_1 -------wget http://$1:9000/trans_add_f637_3_100 -------wget http://$1:9000/trans_buy_f637_2 -------wget http://$1:9000/trans_add_f638_4_150 -------wget http://$1:9000/trans_buy_f638_3 -------wget http://$1:9000/trans_add_f639_5_200 -------wget http://$1:9000/trans_buy_f639_4 -------wget http://$1:9000/trans_add_f640_1_50 -------wget http://$1:9000/trans_buy_f640_0 -------wget http://$1:9000/trans_add_f641_2_100 -------wget http://$1:9000/trans_buy_f641_1 -------wget http://$1:9000/trans_add_f642_3_150 -------wget http://$1:9000/trans_buy_f642_2 -------wget http://$1:9000/trans_add_f643_4_200 -------wget http://$1:9000/trans_buy_f643_3 -------wget http://$1:9000/trans_add_f644_5_50 -------wget http://$1:9000/trans_buy_f644_4 -------wget http://$1:9000/trans_add_f645_1_100 -------wget http://$1:9000/trans_buy_f645_0 -------wget http://$1:9000/trans_add_f646_2_150 -------wget http://$1:9000/trans_buy_f646_1 -------wget http://$1:9000/trans_add_f647_3_200 -------wget http://$1:9000/trans_buy_f647_2 -------wget http://$1:9000/trans_add_f648_4_50 -------wget http://$1:9000/trans_buy_f648_3 -------wget http://$1:9000/trans_add_f649_5_100 -------wget http://$1:9000/trans_buy_f649_4 -------wget http://$1:9000/trans_add_f650_1_150 -------wget http://$1:9000/trans_buy_f650_0 -------wget http://$1:9000/trans_add_f651_2_200 -------wget http://$1:9000/trans_buy_f651_1 -------wget http://$1:9000/trans_add_f652_3_50 -------wget http://$1:9000/trans_buy_f652_2 -------wget http://$1:9000/trans_add_f653_4_100 -------wget http://$1:9000/trans_buy_f653_3 -------wget http://$1:9000/trans_add_f654_5_150 -------wget http://$1:9000/trans_buy_f654_4 -------wget http://$1:9000/trans_add_f655_1_200 -------wget http://$1:9000/trans_buy_f655_0 -------wget http://$1:9000/trans_add_f656_2_50 -------wget http://$1:9000/trans_buy_f656_1 -------wget http://$1:9000/trans_add_f657_3_100 -------wget http://$1:9000/trans_buy_f657_2 -------wget http://$1:9000/trans_add_f658_4_150 -------wget http://$1:9000/trans_buy_f658_3 -------wget http://$1:9000/trans_add_f659_5_200 -------wget http://$1:9000/trans_buy_f659_4 -------wget http://$1:9000/trans_add_f660_1_50 -------wget http://$1:9000/trans_buy_f660_0 -------wget http://$1:9000/trans_add_f661_2_100 -------wget http://$1:9000/trans_buy_f661_1 -------wget http://$1:9000/trans_add_f662_3_150 -------wget http://$1:9000/trans_buy_f662_2 -------wget http://$1:9000/trans_add_f663_4_200 -------wget http://$1:9000/trans_buy_f663_3 -------wget http://$1:9000/trans_add_f664_5_50 -------wget http://$1:9000/trans_buy_f664_4 -------wget http://$1:9000/trans_add_f665_1_100 -------wget http://$1:9000/trans_buy_f665_0 -------wget http://$1:9000/trans_add_f666_2_150 -------wget http://$1:9000/trans_buy_f666_1 -------wget http://$1:9000/trans_add_f667_3_200 -------wget http://$1:9000/trans_buy_f667_2 -------wget http://$1:9000/trans_add_f668_4_50 -------wget http://$1:9000/trans_buy_f668_3 -------wget http://$1:9000/trans_add_f669_5_100 -------wget http://$1:9000/trans_buy_f669_4 -------wget http://$1:9000/trans_add_f670_1_150 -------wget http://$1:9000/trans_buy_f670_0 -------wget http://$1:9000/trans_add_f671_2_200 -------wget http://$1:9000/trans_buy_f671_1 -------wget http://$1:9000/trans_add_f672_3_50 -------wget http://$1:9000/trans_buy_f672_2 -------wget http://$1:9000/trans_add_f673_4_100 -------wget http://$1:9000/trans_buy_f673_3 -------wget http://$1:9000/trans_add_f674_5_150 -------wget http://$1:9000/trans_buy_f674_4 -------wget http://$1:9000/trans_add_f675_1_200 -------wget http://$1:9000/trans_buy_f675_0 -------wget http://$1:9000/trans_add_f676_2_50 -------wget http://$1:9000/trans_buy_f676_1 -------wget http://$1:9000/trans_add_f677_3_100 -------wget http://$1:9000/trans_buy_f677_2 -------wget http://$1:9000/trans_add_f678_4_150 -------wget http://$1:9000/trans_buy_f678_3 -------wget http://$1:9000/trans_add_f679_5_200 -------wget http://$1:9000/trans_buy_f679_4 -------wget http://$1:9000/trans_add_f680_1_50 -------wget http://$1:9000/trans_buy_f680_0 -------wget http://$1:9000/trans_add_f681_2_100 -------wget http://$1:9000/trans_buy_f681_1 -------wget http://$1:9000/trans_add_f682_3_150 -------wget http://$1:9000/trans_buy_f682_2 -------wget http://$1:9000/trans_add_f683_4_200 -------wget http://$1:9000/trans_buy_f683_3 -------wget http://$1:9000/trans_add_f684_5_50 -------wget http://$1:9000/trans_buy_f684_4 -------wget http://$1:9000/trans_add_f685_1_100 -------wget http://$1:9000/trans_buy_f685_0 -------wget http://$1:9000/trans_add_f686_2_150 -------wget http://$1:9000/trans_buy_f686_1 -------wget http://$1:9000/trans_add_f687_3_200 -------wget http://$1:9000/trans_buy_f687_2 -------wget http://$1:9000/trans_add_f688_4_50 -------wget http://$1:9000/trans_buy_f688_3 -------wget http://$1:9000/trans_add_f689_5_100 -------wget http://$1:9000/trans_buy_f689_4 -------wget http://$1:9000/trans_add_f690_1_150 -------wget http://$1:9000/trans_buy_f690_0 -------wget http://$1:9000/trans_add_f691_2_200 -------wget http://$1:9000/trans_buy_f691_1 -------wget http://$1:9000/trans_add_f692_3_50 -------wget http://$1:9000/trans_buy_f692_2 -------wget http://$1:9000/trans_add_f693_4_100 -------wget http://$1:9000/trans_buy_f693_3 -------wget http://$1:9000/trans_add_f694_5_150 -------wget http://$1:9000/trans_buy_f694_4 -------wget http://$1:9000/trans_add_f695_1_200 -------wget http://$1:9000/trans_buy_f695_0 -------wget http://$1:9000/trans_add_f696_2_50 -------wget http://$1:9000/trans_buy_f696_1 -------wget http://$1:9000/trans_add_f697_3_100 -------wget http://$1:9000/trans_buy_f697_2 -------wget http://$1:9000/trans_add_f698_4_150 -------wget http://$1:9000/trans_buy_f698_3 -------wget http://$1:9000/trans_add_f699_5_200 -------wget http://$1:9000/trans_buy_f699_4 -------wget http://$1:9000/trans_add_f700_1_50 -------wget http://$1:9000/trans_buy_f700_0 -------wget http://$1:9000/trans_add_f701_2_100 -------wget http://$1:9000/trans_buy_f701_1 -------wget http://$1:9000/trans_add_f702_3_150 -------wget http://$1:9000/trans_buy_f702_2 -------wget http://$1:9000/trans_add_f703_4_200 -------wget http://$1:9000/trans_buy_f703_3 -------wget http://$1:9000/trans_add_f704_5_50 -------wget http://$1:9000/trans_buy_f704_4 -------wget http://$1:9000/trans_add_f705_1_100 -------wget http://$1:9000/trans_buy_f705_0 -------wget http://$1:9000/trans_add_f706_2_150 -------wget http://$1:9000/trans_buy_f706_1 -------wget http://$1:9000/trans_add_f707_3_200 -------wget http://$1:9000/trans_buy_f707_2 -------wget http://$1:9000/trans_add_f708_4_50 -------wget http://$1:9000/trans_buy_f708_3 -------wget http://$1:9000/trans_add_f709_5_100 -------wget http://$1:9000/trans_buy_f709_4 -------wget http://$1:9000/trans_add_f710_1_150 -------wget http://$1:9000/trans_buy_f710_0 -------wget http://$1:9000/trans_add_f711_2_200 -------wget http://$1:9000/trans_buy_f711_1 -------wget http://$1:9000/trans_add_f712_3_50 -------wget http://$1:9000/trans_buy_f712_2 -------wget http://$1:9000/trans_add_f713_4_100 -------wget http://$1:9000/trans_buy_f713_3 -------wget http://$1:9000/trans_add_f714_5_150 -------wget http://$1:9000/trans_buy_f714_4 -------wget http://$1:9000/trans_add_f715_1_200 -------wget http://$1:9000/trans_buy_f715_0 -------wget http://$1:9000/trans_add_f716_2_50 -------wget http://$1:9000/trans_buy_f716_1 -------wget http://$1:9000/trans_add_f717_3_100 -------wget http://$1:9000/trans_buy_f717_2 -------wget http://$1:9000/trans_add_f718_4_150 -------wget http://$1:9000/trans_buy_f718_3 -------wget http://$1:9000/trans_add_f719_5_200 -------wget http://$1:9000/trans_buy_f719_4 -------wget http://$1:9000/trans_add_f720_1_50 -------wget http://$1:9000/trans_buy_f720_0 -------wget http://$1:9000/trans_add_f721_2_100 -------wget http://$1:9000/trans_buy_f721_1 -------wget http://$1:9000/trans_add_f722_3_150 -------wget http://$1:9000/trans_buy_f722_2 -------wget http://$1:9000/trans_add_f723_4_200 -------wget http://$1:9000/trans_buy_f723_3 -------wget http://$1:9000/trans_add_f724_5_50 -------wget http://$1:9000/trans_buy_f724_4 -------wget http://$1:9000/trans_add_f725_1_100 -------wget http://$1:9000/trans_buy_f725_0 -------wget http://$1:9000/trans_add_f726_2_150 -------wget http://$1:9000/trans_buy_f726_1 -------wget http://$1:9000/trans_add_f727_3_200 -------wget http://$1:9000/trans_buy_f727_2 -------wget http://$1:9000/trans_add_f728_4_50 -------wget http://$1:9000/trans_buy_f728_3 -------wget http://$1:9000/trans_add_f729_5_100 -------wget http://$1:9000/trans_buy_f729_4 -------wget http://$1:9000/trans_add_f730_1_150 -------wget http://$1:9000/trans_buy_f730_0 -------wget http://$1:9000/trans_add_f731_2_200 -------wget http://$1:9000/trans_buy_f731_1 -------wget http://$1:9000/trans_add_f732_3_50 -------wget http://$1:9000/trans_buy_f732_2 -------wget http://$1:9000/trans_add_f733_4_100 -------wget http://$1:9000/trans_buy_f733_3 -------wget http://$1:9000/trans_add_f734_5_150 -------wget http://$1:9000/trans_buy_f734_4 -------wget http://$1:9000/trans_add_f735_1_200 -------wget http://$1:9000/trans_buy_f735_0 -------wget http://$1:9000/trans_add_f736_2_50 -------wget http://$1:9000/trans_buy_f736_1 -------wget http://$1:9000/trans_add_f737_3_100 -------wget http://$1:9000/trans_buy_f737_2 -------wget http://$1:9000/trans_add_f738_4_150 -------wget http://$1:9000/trans_buy_f738_3 -------wget http://$1:9000/trans_add_f739_5_200 -------wget http://$1:9000/trans_buy_f739_4 -------wget http://$1:9000/trans_add_f740_1_50 -------wget http://$1:9000/trans_buy_f740_0 -------wget http://$1:9000/trans_add_f741_2_100 -------wget http://$1:9000/trans_buy_f741_1 -------wget http://$1:9000/trans_add_f742_3_150 -------wget http://$1:9000/trans_buy_f742_2 -------wget http://$1:9000/trans_add_f743_4_200 -------wget http://$1:9000/trans_buy_f743_3 -------wget http://$1:9000/trans_add_f744_5_50 -------wget http://$1:9000/trans_buy_f744_4 -------wget http://$1:9000/trans_add_f745_1_100 -------wget http://$1:9000/trans_buy_f745_0 -------wget http://$1:9000/trans_add_f746_2_150 -------wget http://$1:9000/trans_buy_f746_1 -------wget http://$1:9000/trans_add_f747_3_200 -------wget http://$1:9000/trans_buy_f747_2 -------wget http://$1:9000/trans_add_f748_4_50 -------wget http://$1:9000/trans_buy_f748_3 -------wget http://$1:9000/trans_add_f749_5_100 -------wget http://$1:9000/trans_buy_f749_4 -------wget http://$1:9000/trans_add_f750_1_150 -------wget http://$1:9000/trans_buy_f750_0 -------wget http://$1:9000/trans_add_f751_2_200 -------wget http://$1:9000/trans_buy_f751_1 -------wget http://$1:9000/trans_add_f752_3_50 -------wget http://$1:9000/trans_buy_f752_2 -------wget http://$1:9000/trans_add_f753_4_100 -------wget http://$1:9000/trans_buy_f753_3 -------wget http://$1:9000/trans_add_f754_5_150 -------wget http://$1:9000/trans_buy_f754_4 -------wget http://$1:9000/trans_add_f755_1_200 -------wget http://$1:9000/trans_buy_f755_0 -------wget http://$1:9000/trans_add_f756_2_50 -------wget http://$1:9000/trans_buy_f756_1 -------wget http://$1:9000/trans_add_f757_3_100 -------wget http://$1:9000/trans_buy_f757_2 -------wget http://$1:9000/trans_add_f758_4_150 -------wget http://$1:9000/trans_buy_f758_3 -------wget http://$1:9000/trans_add_f759_5_200 -------wget http://$1:9000/trans_buy_f759_4 -------wget http://$1:9000/trans_add_f760_1_50 -------wget http://$1:9000/trans_buy_f760_0 -------wget http://$1:9000/trans_add_f761_2_100 -------wget http://$1:9000/trans_buy_f761_1 -------wget http://$1:9000/trans_add_f762_3_150 -------wget http://$1:9000/trans_buy_f762_2 -------wget http://$1:9000/trans_add_f763_4_200 -------wget http://$1:9000/trans_buy_f763_3 -------wget http://$1:9000/trans_add_f764_5_50 -------wget http://$1:9000/trans_buy_f764_4 -------wget http://$1:9000/trans_add_f765_1_100 -------wget http://$1:9000/trans_buy_f765_0 -------wget http://$1:9000/trans_add_f766_2_150 -------wget http://$1:9000/trans_buy_f766_1 -------wget http://$1:9000/trans_add_f767_3_200 -------wget http://$1:9000/trans_buy_f767_2 -------wget http://$1:9000/trans_add_f768_4_50 -------wget http://$1:9000/trans_buy_f768_3 -------wget http://$1:9000/trans_add_f769_5_100 -------wget http://$1:9000/trans_buy_f769_4 -------wget http://$1:9000/trans_add_f770_1_150 -------wget http://$1:9000/trans_buy_f770_0 -------wget http://$1:9000/trans_add_f771_2_200 -------wget http://$1:9000/trans_buy_f771_1 -------wget http://$1:9000/trans_add_f772_3_50 -------wget http://$1:9000/trans_buy_f772_2 -------wget http://$1:9000/trans_add_f773_4_100 -------wget http://$1:9000/trans_buy_f773_3 -------wget http://$1:9000/trans_add_f774_5_150 -------wget http://$1:9000/trans_buy_f774_4 -------wget http://$1:9000/trans_add_f775_1_200 -------wget http://$1:9000/trans_buy_f775_0 -------wget http://$1:9000/trans_add_f776_2_50 -------wget http://$1:9000/trans_buy_f776_1 -------wget http://$1:9000/trans_add_f777_3_100 -------wget http://$1:9000/trans_buy_f777_2 -------wget http://$1:9000/trans_add_f778_4_150 -------wget http://$1:9000/trans_buy_f778_3 -------wget http://$1:9000/trans_add_f779_5_200 -------wget http://$1:9000/trans_buy_f779_4 -------wget http://$1:9000/trans_add_f780_1_50 -------wget http://$1:9000/trans_buy_f780_0 -------wget http://$1:9000/trans_add_f781_2_100 -------wget http://$1:9000/trans_buy_f781_1 -------wget http://$1:9000/trans_add_f782_3_150 -------wget http://$1:9000/trans_buy_f782_2 -------wget http://$1:9000/trans_add_f783_4_200 -------wget http://$1:9000/trans_buy_f783_3 -------wget http://$1:9000/trans_add_f784_5_50 -------wget http://$1:9000/trans_buy_f784_4 -------wget http://$1:9000/trans_add_f785_1_100 -------wget http://$1:9000/trans_buy_f785_0 -------wget http://$1:9000/trans_add_f786_2_150 -------wget http://$1:9000/trans_buy_f786_1 -------wget http://$1:9000/trans_add_f787_3_200 -------wget http://$1:9000/trans_buy_f787_2 -------wget http://$1:9000/trans_add_f788_4_50 -------wget http://$1:9000/trans_buy_f788_3 -------wget http://$1:9000/trans_add_f789_5_100 -------wget http://$1:9000/trans_buy_f789_4 -------wget http://$1:9000/trans_add_f790_1_150 -------wget http://$1:9000/trans_buy_f790_0 -------wget http://$1:9000/trans_add_f791_2_200 -------wget http://$1:9000/trans_buy_f791_1 -------wget http://$1:9000/trans_add_f792_3_50 -------wget http://$1:9000/trans_buy_f792_2 -------wget http://$1:9000/trans_add_f793_4_100 -------wget http://$1:9000/trans_buy_f793_3 -------wget http://$1:9000/trans_add_f794_5_150 -------wget http://$1:9000/trans_buy_f794_4 -------wget http://$1:9000/trans_add_f795_1_200 -------wget http://$1:9000/trans_buy_f795_0 -------wget http://$1:9000/trans_add_f796_2_50 -------wget http://$1:9000/trans_buy_f796_1 -------wget http://$1:9000/trans_add_f797_3_100 -------wget http://$1:9000/trans_buy_f797_2 -------wget http://$1:9000/trans_add_f798_4_150 -------wget http://$1:9000/trans_buy_f798_3 -------wget http://$1:9000/trans_add_f799_5_200 -------wget http://$1:9000/trans_buy_f799_4 -------wget http://$1:9000/trans_add_f800_1_50 -------wget http://$1:9000/trans_buy_f800_0 -------wget http://$1:9000/trans_add_f801_2_100 -------wget http://$1:9000/trans_buy_f801_1 -------wget http://$1:9000/trans_add_f802_3_150 -------wget http://$1:9000/trans_buy_f802_2 -------wget http://$1:9000/trans_add_f803_4_200 -------wget http://$1:9000/trans_buy_f803_3 -------wget http://$1:9000/trans_add_f804_5_50 -------wget http://$1:9000/trans_buy_f804_4 -------wget http://$1:9000/trans_add_f805_1_100 -------wget http://$1:9000/trans_buy_f805_0 -------wget http://$1:9000/trans_add_f806_2_150 -------wget http://$1:9000/trans_buy_f806_1 -------wget http://$1:9000/trans_add_f807_3_200 -------wget http://$1:9000/trans_buy_f807_2 -------wget http://$1:9000/trans_add_f808_4_50 -------wget http://$1:9000/trans_buy_f808_3 -------wget http://$1:9000/trans_add_f809_5_100 -------wget http://$1:9000/trans_buy_f809_4 -------wget http://$1:9000/trans_add_f810_1_150 -------wget http://$1:9000/trans_buy_f810_0 -------wget http://$1:9000/trans_add_f811_2_200 -------wget http://$1:9000/trans_buy_f811_1 -------wget http://$1:9000/trans_add_f812_3_50 -------wget http://$1:9000/trans_buy_f812_2 -------wget http://$1:9000/trans_add_f813_4_100 -------wget http://$1:9000/trans_buy_f813_3 -------wget http://$1:9000/trans_add_f814_5_150 -------wget http://$1:9000/trans_buy_f814_4 -------wget http://$1:9000/trans_add_f815_1_200 -------wget http://$1:9000/trans_buy_f815_0 -------wget http://$1:9000/trans_add_f816_2_50 -------wget http://$1:9000/trans_buy_f816_1 -------wget http://$1:9000/trans_add_f817_3_100 -------wget http://$1:9000/trans_buy_f817_2 -------wget http://$1:9000/trans_add_f818_4_150 -------wget http://$1:9000/trans_buy_f818_3 -------wget http://$1:9000/trans_add_f819_5_200 -------wget http://$1:9000/trans_buy_f819_4 -------wget http://$1:9000/trans_add_f820_1_50 -------wget http://$1:9000/trans_buy_f820_0 -------wget http://$1:9000/trans_add_f821_2_100 -------wget http://$1:9000/trans_buy_f821_1 -------wget http://$1:9000/trans_add_f822_3_150 -------wget http://$1:9000/trans_buy_f822_2 -------wget http://$1:9000/trans_add_f823_4_200 -------wget http://$1:9000/trans_buy_f823_3 -------wget http://$1:9000/trans_add_f824_5_50 -------wget http://$1:9000/trans_buy_f824_4 -------wget http://$1:9000/trans_add_f825_1_100 -------wget http://$1:9000/trans_buy_f825_0 -------wget http://$1:9000/trans_add_f826_2_150 -------wget http://$1:9000/trans_buy_f826_1 -------wget http://$1:9000/trans_add_f827_3_200 -------wget http://$1:9000/trans_buy_f827_2 -------wget http://$1:9000/trans_add_f828_4_50 -------wget http://$1:9000/trans_buy_f828_3 -------wget http://$1:9000/trans_add_f829_5_100 -------wget http://$1:9000/trans_buy_f829_4 -------wget http://$1:9000/trans_add_f830_1_150 -------wget http://$1:9000/trans_buy_f830_0 -------wget http://$1:9000/trans_add_f831_2_200 -------wget http://$1:9000/trans_buy_f831_1 -------wget http://$1:9000/trans_add_f832_3_50 -------wget http://$1:9000/trans_buy_f832_2 -------wget http://$1:9000/trans_add_f833_4_100 -------wget http://$1:9000/trans_buy_f833_3 -------wget http://$1:9000/trans_add_f834_5_150 -------wget http://$1:9000/trans_buy_f834_4 -------wget http://$1:9000/trans_add_f835_1_200 -------wget http://$1:9000/trans_buy_f835_0 -------wget http://$1:9000/trans_add_f836_2_50 -------wget http://$1:9000/trans_buy_f836_1 -------wget http://$1:9000/trans_add_f837_3_100 -------wget http://$1:9000/trans_buy_f837_2 -------wget http://$1:9000/trans_add_f838_4_150 -------wget http://$1:9000/trans_buy_f838_3 -------wget http://$1:9000/trans_add_f839_5_200 -------wget http://$1:9000/trans_buy_f839_4 -------wget http://$1:9000/trans_add_f840_1_50 -------wget http://$1:9000/trans_buy_f840_0 -------wget http://$1:9000/trans_add_f841_2_100 -------wget http://$1:9000/trans_buy_f841_1 -------wget http://$1:9000/trans_add_f842_3_150 -------wget http://$1:9000/trans_buy_f842_2 -------wget http://$1:9000/trans_add_f843_4_200 -------wget http://$1:9000/trans_buy_f843_3 -------wget http://$1:9000/trans_add_f844_5_50 -------wget http://$1:9000/trans_buy_f844_4 -------wget http://$1:9000/trans_add_f845_1_100 -------wget http://$1:9000/trans_buy_f845_0 -------wget http://$1:9000/trans_add_f846_2_150 -------wget http://$1:9000/trans_buy_f846_1 -------wget http://$1:9000/trans_add_f847_3_200 -------wget http://$1:9000/trans_buy_f847_2 -------wget http://$1:9000/trans_add_f848_4_50 -------wget http://$1:9000/trans_buy_f848_3 -------wget http://$1:9000/trans_add_f849_5_100 -------wget http://$1:9000/trans_buy_f849_4 -------wget http://$1:9000/trans_add_f850_1_150 -------wget http://$1:9000/trans_buy_f850_0 -------wget http://$1:9000/trans_add_f851_2_200 -------wget http://$1:9000/trans_buy_f851_1 -------wget http://$1:9000/trans_add_f852_3_50 -------wget http://$1:9000/trans_buy_f852_2 -------wget http://$1:9000/trans_add_f853_4_100 -------wget http://$1:9000/trans_buy_f853_3 -------wget http://$1:9000/trans_add_f854_5_150 -------wget http://$1:9000/trans_buy_f854_4 -------wget http://$1:9000/trans_add_f855_1_200 -------wget http://$1:9000/trans_buy_f855_0 -------wget http://$1:9000/trans_add_f856_2_50 -------wget http://$1:9000/trans_buy_f856_1 -------wget http://$1:9000/trans_add_f857_3_100 -------wget http://$1:9000/trans_buy_f857_2 -------wget http://$1:9000/trans_add_f858_4_150 -------wget http://$1:9000/trans_buy_f858_3 -------wget http://$1:9000/trans_add_f859_5_200 -------wget http://$1:9000/trans_buy_f859_4 -------wget http://$1:9000/trans_add_f860_1_50 -------wget http://$1:9000/trans_buy_f860_0 -------wget http://$1:9000/trans_add_f861_2_100 -------wget http://$1:9000/trans_buy_f861_1 -------wget http://$1:9000/trans_add_f862_3_150 -------wget http://$1:9000/trans_buy_f862_2 -------wget http://$1:9000/trans_add_f863_4_200 -------wget http://$1:9000/trans_buy_f863_3 -------wget http://$1:9000/trans_add_f864_5_50 -------wget http://$1:9000/trans_buy_f864_4 -------wget http://$1:9000/trans_add_f865_1_100 -------wget http://$1:9000/trans_buy_f865_0 -------wget http://$1:9000/trans_add_f866_2_150 -------wget http://$1:9000/trans_buy_f866_1 -------wget http://$1:9000/trans_add_f867_3_200 -------wget http://$1:9000/trans_buy_f867_2 -------wget http://$1:9000/trans_add_f868_4_50 -------wget http://$1:9000/trans_buy_f868_3 -------wget http://$1:9000/trans_add_f869_5_100 -------wget http://$1:9000/trans_buy_f869_4 -------wget http://$1:9000/trans_add_f870_1_150 -------wget http://$1:9000/trans_buy_f870_0 -------wget http://$1:9000/trans_add_f871_2_200 -------wget http://$1:9000/trans_buy_f871_1 -------wget http://$1:9000/trans_add_f872_3_50 -------wget http://$1:9000/trans_buy_f872_2 -------wget http://$1:9000/trans_add_f873_4_100 -------wget http://$1:9000/trans_buy_f873_3 -------wget http://$1:9000/trans_add_f874_5_150 -------wget http://$1:9000/trans_buy_f874_4 -------wget http://$1:9000/trans_add_f875_1_200 -------wget http://$1:9000/trans_buy_f875_0 -------wget http://$1:9000/trans_add_f876_2_50 -------wget http://$1:9000/trans_buy_f876_1 -------wget http://$1:9000/trans_add_f877_3_100 -------wget http://$1:9000/trans_buy_f877_2 -------wget http://$1:9000/trans_add_f878_4_150 -------wget http://$1:9000/trans_buy_f878_3 -------wget http://$1:9000/trans_add_f879_5_200 -------wget http://$1:9000/trans_buy_f879_4 -------wget http://$1:9000/trans_add_f880_1_50 -------wget http://$1:9000/trans_buy_f880_0 -------wget http://$1:9000/trans_add_f881_2_100 -------wget http://$1:9000/trans_buy_f881_1 -------wget http://$1:9000/trans_add_f882_3_150 -------wget http://$1:9000/trans_buy_f882_2 -------wget http://$1:9000/trans_add_f883_4_200 -------wget http://$1:9000/trans_buy_f883_3 -------wget http://$1:9000/trans_add_f884_5_50 -------wget http://$1:9000/trans_buy_f884_4 -------wget http://$1:9000/trans_add_f885_1_100 -------wget http://$1:9000/trans_buy_f885_0 -------wget http://$1:9000/trans_add_f886_2_150 -------wget http://$1:9000/trans_buy_f886_1 -------wget http://$1:9000/trans_add_f887_3_200 -------wget http://$1:9000/trans_buy_f887_2 -------wget http://$1:9000/trans_add_f888_4_50 -------wget http://$1:9000/trans_buy_f888_3 -------wget http://$1:9000/trans_add_f889_5_100 -------wget http://$1:9000/trans_buy_f889_4 -------wget http://$1:9000/trans_add_f890_1_150 -------wget http://$1:9000/trans_buy_f890_0 -------wget http://$1:9000/trans_add_f891_2_200 -------wget http://$1:9000/trans_buy_f891_1 -------wget http://$1:9000/trans_add_f892_3_50 -------wget http://$1:9000/trans_buy_f892_2 -------wget http://$1:9000/trans_add_f893_4_100 -------wget http://$1:9000/trans_buy_f893_3 -------wget http://$1:9000/trans_add_f894_5_150 -------wget http://$1:9000/trans_buy_f894_4 -------wget http://$1:9000/trans_add_f895_1_200 -------wget http://$1:9000/trans_buy_f895_0 -------wget http://$1:9000/trans_add_f896_2_50 -------wget http://$1:9000/trans_buy_f896_1 -------wget http://$1:9000/trans_add_f897_3_100 -------wget http://$1:9000/trans_buy_f897_2 -------wget http://$1:9000/trans_add_f898_4_150 -------wget http://$1:9000/trans_buy_f898_3 -------wget http://$1:9000/trans_add_f899_5_200 -------wget http://$1:9000/trans_buy_f899_4 -------wget http://$1:9000/trans_add_f900_1_50 -------wget http://$1:9000/trans_buy_f900_0 -------wget http://$1:9000/trans_add_f901_2_100 -------wget http://$1:9000/trans_buy_f901_1 -------wget http://$1:9000/trans_add_f902_3_150 -------wget http://$1:9000/trans_buy_f902_2 -------wget http://$1:9000/trans_add_f903_4_200 -------wget http://$1:9000/trans_buy_f903_3 -------wget http://$1:9000/trans_add_f904_5_50 -------wget http://$1:9000/trans_buy_f904_4 -------wget http://$1:9000/trans_add_f905_1_100 -------wget http://$1:9000/trans_buy_f905_0 -------wget http://$1:9000/trans_add_f906_2_150 -------wget http://$1:9000/trans_buy_f906_1 -------wget http://$1:9000/trans_add_f907_3_200 -------wget http://$1:9000/trans_buy_f907_2 -------wget http://$1:9000/trans_add_f908_4_50 -------wget http://$1:9000/trans_buy_f908_3 -------wget http://$1:9000/trans_add_f909_5_100 -------wget http://$1:9000/trans_buy_f909_4 -------wget http://$1:9000/trans_add_f910_1_150 -------wget http://$1:9000/trans_buy_f910_0 -------wget http://$1:9000/trans_add_f911_2_200 -------wget http://$1:9000/trans_buy_f911_1 -------wget http://$1:9000/trans_add_f912_3_50 -------wget http://$1:9000/trans_buy_f912_2 -------wget http://$1:9000/trans_add_f913_4_100 -------wget http://$1:9000/trans_buy_f913_3 -------wget http://$1:9000/trans_add_f914_5_150 -------wget http://$1:9000/trans_buy_f914_4 -------wget http://$1:9000/trans_add_f915_1_200 -------wget http://$1:9000/trans_buy_f915_0 -------wget http://$1:9000/trans_add_f916_2_50 -------wget http://$1:9000/trans_buy_f916_1 -------wget http://$1:9000/trans_add_f917_3_100 -------wget http://$1:9000/trans_buy_f917_2 -------wget http://$1:9000/trans_add_f918_4_150 -------wget http://$1:9000/trans_buy_f918_3 -------wget http://$1:9000/trans_add_f919_5_200 -------wget http://$1:9000/trans_buy_f919_4 -------wget http://$1:9000/trans_add_f920_1_50 -------wget http://$1:9000/trans_buy_f920_0 -------wget http://$1:9000/trans_add_f921_2_100 -------wget http://$1:9000/trans_buy_f921_1 -------wget http://$1:9000/trans_add_f922_3_150 -------wget http://$1:9000/trans_buy_f922_2 -------wget http://$1:9000/trans_add_f923_4_200 -------wget http://$1:9000/trans_buy_f923_3 -------wget http://$1:9000/trans_add_f924_5_50 -------wget http://$1:9000/trans_buy_f924_4 -------wget http://$1:9000/trans_add_f925_1_100 -------wget http://$1:9000/trans_buy_f925_0 -------wget http://$1:9000/trans_add_f926_2_150 -------wget http://$1:9000/trans_buy_f926_1 -------wget http://$1:9000/trans_add_f927_3_200 -------wget http://$1:9000/trans_buy_f927_2 -------wget http://$1:9000/trans_add_f928_4_50 -------wget http://$1:9000/trans_buy_f928_3 -------wget http://$1:9000/trans_add_f929_5_100 -------wget http://$1:9000/trans_buy_f929_4 -------wget http://$1:9000/trans_add_f930_1_150 -------wget http://$1:9000/trans_buy_f930_0 -------wget http://$1:9000/trans_add_f931_2_200 -------wget http://$1:9000/trans_buy_f931_1 -------wget http://$1:9000/trans_add_f932_3_50 -------wget http://$1:9000/trans_buy_f932_2 -------wget http://$1:9000/trans_add_f933_4_100 -------wget http://$1:9000/trans_buy_f933_3 -------wget http://$1:9000/trans_add_f934_5_150 -------wget http://$1:9000/trans_buy_f934_4 -------wget http://$1:9000/trans_add_f935_1_200 -------wget http://$1:9000/trans_buy_f935_0 -------wget http://$1:9000/trans_add_f936_2_50 -------wget http://$1:9000/trans_buy_f936_1 -------wget http://$1:9000/trans_add_f937_3_100 -------wget http://$1:9000/trans_buy_f937_2 -------wget http://$1:9000/trans_add_f938_4_150 -------wget http://$1:9000/trans_buy_f938_3 -------wget http://$1:9000/trans_add_f939_5_200 -------wget http://$1:9000/trans_buy_f939_4 -------wget http://$1:9000/trans_add_f940_1_50 -------wget http://$1:9000/trans_buy_f940_0 -------wget http://$1:9000/trans_add_f941_2_100 -------wget http://$1:9000/trans_buy_f941_1 -------wget http://$1:9000/trans_add_f942_3_150 -------wget http://$1:9000/trans_buy_f942_2 -------wget http://$1:9000/trans_add_f943_4_200 -------wget http://$1:9000/trans_buy_f943_3 -------wget http://$1:9000/trans_add_f944_5_50 -------wget http://$1:9000/trans_buy_f944_4 -------wget http://$1:9000/trans_add_f945_1_100 -------wget http://$1:9000/trans_buy_f945_0 -------wget http://$1:9000/trans_add_f946_2_150 -------wget http://$1:9000/trans_buy_f946_1 -------wget http://$1:9000/trans_add_f947_3_200 -------wget http://$1:9000/trans_buy_f947_2 -------wget http://$1:9000/trans_add_f948_4_50 -------wget http://$1:9000/trans_buy_f948_3 -------wget http://$1:9000/trans_add_f949_5_100 -------wget http://$1:9000/trans_buy_f949_4 -------wget http://$1:9000/trans_add_f950_1_150 -------wget http://$1:9000/trans_buy_f950_0 -------wget http://$1:9000/trans_add_f951_2_200 -------wget http://$1:9000/trans_buy_f951_1 -------wget http://$1:9000/trans_add_f952_3_50 -------wget http://$1:9000/trans_buy_f952_2 -------wget http://$1:9000/trans_add_f953_4_100 -------wget http://$1:9000/trans_buy_f953_3 -------wget http://$1:9000/trans_add_f954_5_150 -------wget http://$1:9000/trans_buy_f954_4 -------wget http://$1:9000/trans_add_f955_1_200 -------wget http://$1:9000/trans_buy_f955_0 -------wget http://$1:9000/trans_add_f956_2_50 -------wget http://$1:9000/trans_buy_f956_1 -------wget http://$1:9000/trans_add_f957_3_100 -------wget http://$1:9000/trans_buy_f957_2 -------wget http://$1:9000/trans_add_f958_4_150 -------wget http://$1:9000/trans_buy_f958_3 -------wget http://$1:9000/trans_add_f959_5_200 -------wget http://$1:9000/trans_buy_f959_4 -------wget http://$1:9000/trans_add_f960_1_50 -------wget http://$1:9000/trans_buy_f960_0 -------wget http://$1:9000/trans_add_f961_2_100 -------wget http://$1:9000/trans_buy_f961_1 -------wget http://$1:9000/trans_add_f962_3_150 -------wget http://$1:9000/trans_buy_f962_2 -------wget http://$1:9000/trans_add_f963_4_200 -------wget http://$1:9000/trans_buy_f963_3 -------wget http://$1:9000/trans_add_f964_5_50 -------wget http://$1:9000/trans_buy_f964_4 -------wget http://$1:9000/trans_add_f965_1_100 -------wget http://$1:9000/trans_buy_f965_0 -------wget http://$1:9000/trans_add_f966_2_150 -------wget http://$1:9000/trans_buy_f966_1 -------wget http://$1:9000/trans_add_f967_3_200 -------wget http://$1:9000/trans_buy_f967_2 -------wget http://$1:9000/trans_add_f968_4_50 -------wget http://$1:9000/trans_buy_f968_3 -------wget http://$1:9000/trans_add_f969_5_100 -------wget http://$1:9000/trans_buy_f969_4 -------wget http://$1:9000/trans_add_f970_1_150 -------wget http://$1:9000/trans_buy_f970_0 -------wget http://$1:9000/trans_add_f971_2_200 -------wget http://$1:9000/trans_buy_f971_1 -------wget http://$1:9000/trans_add_f972_3_50 -------wget http://$1:9000/trans_buy_f972_2 -------wget http://$1:9000/trans_add_f973_4_100 -------wget http://$1:9000/trans_buy_f973_3 -------wget http://$1:9000/trans_add_f974_5_150 -------wget http://$1:9000/trans_buy_f974_4 -------wget http://$1:9000/trans_add_f975_1_200 -------wget http://$1:9000/trans_buy_f975_0 -------wget http://$1:9000/trans_add_f976_2_50 -------wget http://$1:9000/trans_buy_f976_1 -------wget http://$1:9000/trans_add_f977_3_100 -------wget http://$1:9000/trans_buy_f977_2 -------wget http://$1:9000/trans_add_f978_4_150 -------wget http://$1:9000/trans_buy_f978_3 -------wget http://$1:9000/trans_add_f979_5_200 -------wget http://$1:9000/trans_buy_f979_4 -------wget http://$1:9000/trans_add_f980_1_50 -------wget http://$1:9000/trans_buy_f980_0 -------wget http://$1:9000/trans_add_f981_2_100 -------wget http://$1:9000/trans_buy_f981_1 -------wget http://$1:9000/trans_add_f982_3_150 -------wget http://$1:9000/trans_buy_f982_2 -------wget http://$1:9000/trans_add_f983_4_200 -------wget http://$1:9000/trans_buy_f983_3 -------wget http://$1:9000/trans_add_f984_5_50 -------wget http://$1:9000/trans_buy_f984_4 -------wget http://$1:9000/trans_add_f985_1_100 -------wget http://$1:9000/trans_buy_f985_0 -------wget http://$1:9000/trans_add_f986_2_150 -------wget http://$1:9000/trans_buy_f986_1 -------wget http://$1:9000/trans_add_f987_3_200 -------wget http://$1:9000/trans_buy_f987_2 -------wget http://$1:9000/trans_add_f988_4_50 -------wget http://$1:9000/trans_buy_f988_3 -------wget http://$1:9000/trans_add_f989_5_100 -------wget http://$1:9000/trans_buy_f989_4 -------wget http://$1:9000/trans_add_f990_1_150 -------wget http://$1:9000/trans_buy_f990_0 -------wget http://$1:9000/trans_add_f991_2_200 -------wget http://$1:9000/trans_buy_f991_1 -------wget http://$1:9000/trans_add_f992_3_50 -------wget http://$1:9000/trans_buy_f992_2 -------wget http://$1:9000/trans_add_f993_4_100 -------wget http://$1:9000/trans_buy_f993_3 -------wget http://$1:9000/trans_add_f994_5_150 -------wget http://$1:9000/trans_buy_f994_4 -------wget http://$1:9000/trans_add_f995_1_200 -------wget http://$1:9000/trans_buy_f995_0 -------wget http://$1:9000/trans_add_f996_2_50 -------wget http://$1:9000/trans_buy_f996_1 -------wget http://$1:9000/trans_add_f997_3_100 -------wget http://$1:9000/trans_buy_f997_2 -------wget http://$1:9000/trans_add_f998_4_150 -------wget http://$1:9000/trans_buy_f998_3 -------wget http://$1:9000/trans_add_f999_5_200 -------wget http://$1:9000/trans_buy_f999_4 -------wget http://$1:9000/trans_add_f1000_1_50 -------wget http://$1:9000/trans_buy_f1000_0 -------wget http://$1:9000/trans_add_f1001_2_100 -------wget http://$1:9000/trans_buy_f1001_1 -------wget http://$1:9000/trans_add_f1002_3_150 -------wget http://$1:9000/trans_buy_f1002_2 -------wget http://$1:9000/trans_add_f1003_4_200 -------wget http://$1:9000/trans_buy_f1003_3 -------wget http://$1:9000/trans_add_f1004_5_50 -------wget http://$1:9000/trans_buy_f1004_4 -------wget http://$1:9000/trans_add_f1005_1_100 -------wget http://$1:9000/trans_buy_f1005_0 -------wget http://$1:9000/trans_add_f1006_2_150 -------wget http://$1:9000/trans_buy_f1006_1 -------wget http://$1:9000/trans_add_f1007_3_200 -------wget http://$1:9000/trans_buy_f1007_2 -------wget http://$1:9000/trans_add_f1008_4_50 -------wget http://$1:9000/trans_buy_f1008_3 -------wget http://$1:9000/trans_add_f1009_5_100 -------wget http://$1:9000/trans_buy_f1009_4 -------wget http://$1:9000/trans_add_f1010_1_150 -------wget http://$1:9000/trans_buy_f1010_0 -------wget http://$1:9000/trans_add_f1011_2_200 -------wget http://$1:9000/trans_buy_f1011_1 -------wget http://$1:9000/trans_add_f1012_3_50 -------wget http://$1:9000/trans_buy_f1012_2 -------wget http://$1:9000/trans_add_f1013_4_100 -------wget http://$1:9000/trans_buy_f1013_3 -------wget http://$1:9000/trans_add_f1014_5_150 -------wget http://$1:9000/trans_buy_f1014_4 -------wget http://$1:9000/trans_add_f1015_1_200 -------wget http://$1:9000/trans_buy_f1015_0 -------wget http://$1:9000/trans_add_f1016_2_50 -------wget http://$1:9000/trans_buy_f1016_1 -------wget http://$1:9000/trans_add_f1017_3_100 -------wget http://$1:9000/trans_buy_f1017_2 -------wget http://$1:9000/trans_add_f1018_4_150 -------wget http://$1:9000/trans_buy_f1018_3 -------wget http://$1:9000/trans_add_f1019_5_200 -------wget http://$1:9000/trans_buy_f1019_4 -------wget http://$1:9000/trans_add_f1020_1_50 -------wget http://$1:9000/trans_buy_f1020_0 -------wget http://$1:9000/trans_add_f1021_2_100 -------wget http://$1:9000/trans_buy_f1021_1 -------wget http://$1:9000/trans_add_f1022_3_150 -------wget http://$1:9000/trans_buy_f1022_2 -------wget http://$1:9000/trans_add_f1023_4_200 -------wget http://$1:9000/trans_buy_f1023_3 -------wget http://$1:9000/trans_add_f1024_5_50 -------wget http://$1:9000/trans_buy_f1024_4 -------wget http://$1:9000/trans_add_f1025_1_100 -------wget http://$1:9000/trans_buy_f1025_0 -------wget http://$1:9000/trans_add_f1026_2_150 -------wget http://$1:9000/trans_buy_f1026_1 -------wget http://$1:9000/trans_add_f1027_3_200 -------wget http://$1:9000/trans_buy_f1027_2 -------wget http://$1:9000/trans_add_f1028_4_50 -------wget http://$1:9000/trans_buy_f1028_3 -------wget http://$1:9000/trans_add_f1029_5_100 -------wget http://$1:9000/trans_buy_f1029_4 -------wget http://$1:9000/trans_add_f1030_1_150 -------wget http://$1:9000/trans_buy_f1030_0 -------wget http://$1:9000/trans_add_f1031_2_200 -------wget http://$1:9000/trans_buy_f1031_1 -------wget http://$1:9000/trans_add_f1032_3_50 -------wget http://$1:9000/trans_buy_f1032_2 -------wget http://$1:9000/trans_add_f1033_4_100 -------wget http://$1:9000/trans_buy_f1033_3 -------wget http://$1:9000/trans_add_f1034_5_150 -------wget http://$1:9000/trans_buy_f1034_4 -------wget http://$1:9000/trans_add_f1035_1_200 -------wget http://$1:9000/trans_buy_f1035_0 -------wget http://$1:9000/trans_add_f1036_2_50 -------wget http://$1:9000/trans_buy_f1036_1 -------wget http://$1:9000/trans_add_f1037_3_100 -------wget http://$1:9000/trans_buy_f1037_2 -------wget http://$1:9000/trans_add_f1038_4_150 -------wget http://$1:9000/trans_buy_f1038_3 -------wget http://$1:9000/trans_add_f1039_5_200 -------wget http://$1:9000/trans_buy_f1039_4 -------wget http://$1:9000/trans_add_f1040_1_50 -------wget http://$1:9000/trans_buy_f1040_0 -------wget http://$1:9000/trans_add_f1041_2_100 -------wget http://$1:9000/trans_buy_f1041_1 -------wget http://$1:9000/trans_add_f1042_3_150 -------wget http://$1:9000/trans_buy_f1042_2 -------wget http://$1:9000/trans_add_f1043_4_200 -------wget http://$1:9000/trans_buy_f1043_3 -------wget http://$1:9000/trans_add_f1044_5_50 -------wget http://$1:9000/trans_buy_f1044_4 -------wget http://$1:9000/trans_add_f1045_1_100 -------wget http://$1:9000/trans_buy_f1045_0 -------wget http://$1:9000/trans_add_f1046_2_150 -------wget http://$1:9000/trans_buy_f1046_1 -------wget http://$1:9000/trans_add_f1047_3_200 -------wget http://$1:9000/trans_buy_f1047_2 -------wget http://$1:9000/trans_add_f1048_4_50 -------wget http://$1:9000/trans_buy_f1048_3 -------wget http://$1:9000/trans_add_f1049_5_100 -------wget http://$1:9000/trans_buy_f1049_4 -------wget http://$1:9000/trans_add_f1050_1_150 -------wget http://$1:9000/trans_buy_f1050_0 -------wget http://$1:9000/trans_add_f1051_2_200 -------wget http://$1:9000/trans_buy_f1051_1 -------wget http://$1:9000/trans_add_f1052_3_50 -------wget http://$1:9000/trans_buy_f1052_2 -------wget http://$1:9000/trans_add_f1053_4_100 -------wget http://$1:9000/trans_buy_f1053_3 -------wget http://$1:9000/trans_add_f1054_5_150 -------wget http://$1:9000/trans_buy_f1054_4 -------wget http://$1:9000/trans_add_f1055_1_200 -------wget http://$1:9000/trans_buy_f1055_0 -------wget http://$1:9000/trans_add_f1056_2_50 -------wget http://$1:9000/trans_buy_f1056_1 -------wget http://$1:9000/trans_add_f1057_3_100 -------wget http://$1:9000/trans_buy_f1057_2 -------wget http://$1:9000/trans_add_f1058_4_150 -------wget http://$1:9000/trans_buy_f1058_3 -------wget http://$1:9000/trans_add_f1059_5_200 -------wget http://$1:9000/trans_buy_f1059_4 -------wget http://$1:9000/trans_add_f1060_1_50 -------wget http://$1:9000/trans_buy_f1060_0 -------wget http://$1:9000/trans_add_f1061_2_100 -------wget http://$1:9000/trans_buy_f1061_1 -------wget http://$1:9000/trans_add_f1062_3_150 -------wget http://$1:9000/trans_buy_f1062_2 -------wget http://$1:9000/trans_add_f1063_4_200 -------wget http://$1:9000/trans_buy_f1063_3 -------wget http://$1:9000/trans_add_f1064_5_50 -------wget http://$1:9000/trans_buy_f1064_4 -------wget http://$1:9000/trans_add_f1065_1_100 -------wget http://$1:9000/trans_buy_f1065_0 -------wget http://$1:9000/trans_add_f1066_2_150 -------wget http://$1:9000/trans_buy_f1066_1 -------wget http://$1:9000/trans_add_f1067_3_200 -------wget http://$1:9000/trans_buy_f1067_2 -------wget http://$1:9000/trans_add_f1068_4_50 -------wget http://$1:9000/trans_buy_f1068_3 -------wget http://$1:9000/trans_add_f1069_5_100 -------wget http://$1:9000/trans_buy_f1069_4 -------wget http://$1:9000/trans_add_f1070_1_150 -------wget http://$1:9000/trans_buy_f1070_0 -------wget http://$1:9000/trans_add_f1071_2_200 -------wget http://$1:9000/trans_buy_f1071_1 -------wget http://$1:9000/trans_add_f1072_3_50 -------wget http://$1:9000/trans_buy_f1072_2 -------wget http://$1:9000/trans_add_f1073_4_100 -------wget http://$1:9000/trans_buy_f1073_3 -------wget http://$1:9000/trans_add_f1074_5_150 -------wget http://$1:9000/trans_buy_f1074_4 -------wget http://$1:9000/trans_add_f1075_1_200 -------wget http://$1:9000/trans_buy_f1075_0 -------wget http://$1:9000/trans_add_f1076_2_50 -------wget http://$1:9000/trans_buy_f1076_1 -------wget http://$1:9000/trans_add_f1077_3_100 -------wget http://$1:9000/trans_buy_f1077_2 -------wget http://$1:9000/trans_add_f1078_4_150 -------wget http://$1:9000/trans_buy_f1078_3 -------wget http://$1:9000/trans_add_f1079_5_200 -------wget http://$1:9000/trans_buy_f1079_4 -------wget http://$1:9000/trans_add_f1080_1_50 -------wget http://$1:9000/trans_buy_f1080_0 -------wget http://$1:9000/trans_add_f1081_2_100 -------wget http://$1:9000/trans_buy_f1081_1 -------wget http://$1:9000/trans_add_f1082_3_150 -------wget http://$1:9000/trans_buy_f1082_2 -------wget http://$1:9000/trans_add_f1083_4_200 -------wget http://$1:9000/trans_buy_f1083_3 -------wget http://$1:9000/trans_add_f1084_5_50 -------wget http://$1:9000/trans_buy_f1084_4 -------wget http://$1:9000/trans_add_f1085_1_100 -------wget http://$1:9000/trans_buy_f1085_0 -------wget http://$1:9000/trans_add_f1086_2_150 -------wget http://$1:9000/trans_buy_f1086_1 -------wget http://$1:9000/trans_add_f1087_3_200 -------wget http://$1:9000/trans_buy_f1087_2 -------wget http://$1:9000/trans_add_f1088_4_50 -------wget http://$1:9000/trans_buy_f1088_3 -------wget http://$1:9000/trans_add_f1089_5_100 -------wget http://$1:9000/trans_buy_f1089_4 -------wget http://$1:9000/trans_add_f1090_1_150 -------wget http://$1:9000/trans_buy_f1090_0 -------wget http://$1:9000/trans_add_f1091_2_200 -------wget http://$1:9000/trans_buy_f1091_1 -------wget http://$1:9000/trans_add_f1092_3_50 -------wget http://$1:9000/trans_buy_f1092_2 -------wget http://$1:9000/trans_add_f1093_4_100 -------wget http://$1:9000/trans_buy_f1093_3 -------wget http://$1:9000/trans_add_f1094_5_150 -------wget http://$1:9000/trans_buy_f1094_4 -------wget http://$1:9000/trans_add_f1095_1_200 -------wget http://$1:9000/trans_buy_f1095_0 -------wget http://$1:9000/trans_add_f1096_2_50 -------wget http://$1:9000/trans_buy_f1096_1 -------wget http://$1:9000/trans_add_f1097_3_100 -------wget http://$1:9000/trans_buy_f1097_2 -------wget http://$1:9000/trans_add_f1098_4_150 -------wget http://$1:9000/trans_buy_f1098_3 -------wget http://$1:9000/trans_add_f1099_5_200 -------wget http://$1:9000/trans_buy_f1099_4 -------wget http://$1:9000/trans_add_f1100_1_50 -------wget http://$1:9000/trans_buy_f1100_0 -------wget http://$1:9000/trans_add_f1101_2_100 -------wget http://$1:9000/trans_buy_f1101_1 -------wget http://$1:9000/trans_add_f1102_3_150 -------wget http://$1:9000/trans_buy_f1102_2 -------wget http://$1:9000/trans_add_f1103_4_200 -------wget http://$1:9000/trans_buy_f1103_3 -------wget http://$1:9000/trans_add_f1104_5_50 -------wget http://$1:9000/trans_buy_f1104_4 -------wget http://$1:9000/trans_add_f1105_1_100 -------wget http://$1:9000/trans_buy_f1105_0 -------wget http://$1:9000/trans_add_f1106_2_150 -------wget http://$1:9000/trans_buy_f1106_1 -------wget http://$1:9000/trans_add_f1107_3_200 -------wget http://$1:9000/trans_buy_f1107_2 -------wget http://$1:9000/trans_add_f1108_4_50 -------wget http://$1:9000/trans_buy_f1108_3 -------wget http://$1:9000/trans_add_f1109_5_100 -------wget http://$1:9000/trans_buy_f1109_4 -------wget http://$1:9000/trans_add_f1110_1_150 -------wget http://$1:9000/trans_buy_f1110_0 -------wget http://$1:9000/trans_add_f1111_2_200 -------wget http://$1:9000/trans_buy_f1111_1 -------wget http://$1:9000/trans_add_f1112_3_50 -------wget http://$1:9000/trans_buy_f1112_2 -------wget http://$1:9000/trans_add_f1113_4_100 -------wget http://$1:9000/trans_buy_f1113_3 -------wget http://$1:9000/trans_add_f1114_5_150 -------wget http://$1:9000/trans_buy_f1114_4 -------wget http://$1:9000/trans_add_f1115_1_200 -------wget http://$1:9000/trans_buy_f1115_0 -------wget http://$1:9000/trans_add_f1116_2_50 -------wget http://$1:9000/trans_buy_f1116_1 -------wget http://$1:9000/trans_add_f1117_3_100 -------wget http://$1:9000/trans_buy_f1117_2 -------wget http://$1:9000/trans_add_f1118_4_150 -------wget http://$1:9000/trans_buy_f1118_3 -------wget http://$1:9000/trans_add_f1119_5_200 -------wget http://$1:9000/trans_buy_f1119_4 -------wget http://$1:9000/trans_add_f1120_1_50 -------wget http://$1:9000/trans_buy_f1120_0 -------wget http://$1:9000/trans_add_f1121_2_100 -------wget http://$1:9000/trans_buy_f1121_1 -------wget http://$1:9000/trans_add_f1122_3_150 -------wget http://$1:9000/trans_buy_f1122_2 -------wget http://$1:9000/trans_add_f1123_4_200 -------wget http://$1:9000/trans_buy_f1123_3 -------wget http://$1:9000/trans_add_f1124_5_50 -------wget http://$1:9000/trans_buy_f1124_4 -------wget http://$1:9000/trans_add_f1125_1_100 -------wget http://$1:9000/trans_buy_f1125_0 -------wget http://$1:9000/trans_add_f1126_2_150 -------wget http://$1:9000/trans_buy_f1126_1 -------wget http://$1:9000/trans_add_f1127_3_200 -------wget http://$1:9000/trans_buy_f1127_2 -------wget http://$1:9000/trans_add_f1128_4_50 -------wget http://$1:9000/trans_buy_f1128_3 -------wget http://$1:9000/trans_add_f1129_5_100 -------wget http://$1:9000/trans_buy_f1129_4 -------wget http://$1:9000/trans_add_f1130_1_150 -------wget http://$1:9000/trans_buy_f1130_0 -------wget http://$1:9000/trans_add_f1131_2_200 -------wget http://$1:9000/trans_buy_f1131_1 -------wget http://$1:9000/trans_add_f1132_3_50 -------wget http://$1:9000/trans_buy_f1132_2 -------wget http://$1:9000/trans_add_f1133_4_100 -------wget http://$1:9000/trans_buy_f1133_3 -------wget http://$1:9000/trans_add_f1134_5_150 -------wget http://$1:9000/trans_buy_f1134_4 -------wget http://$1:9000/trans_add_f1135_1_200 -------wget http://$1:9000/trans_buy_f1135_0 -------wget http://$1:9000/trans_add_f1136_2_50 -------wget http://$1:9000/trans_buy_f1136_1 -------wget http://$1:9000/trans_add_f1137_3_100 -------wget http://$1:9000/trans_buy_f1137_2 -------wget http://$1:9000/trans_add_f1138_4_150 -------wget http://$1:9000/trans_buy_f1138_3 -------wget http://$1:9000/trans_add_f1139_5_200 -------wget http://$1:9000/trans_buy_f1139_4 -------wget http://$1:9000/trans_add_f1140_1_50 -------wget http://$1:9000/trans_buy_f1140_0 -------wget http://$1:9000/trans_add_f1141_2_100 -------wget http://$1:9000/trans_buy_f1141_1 -------wget http://$1:9000/trans_add_f1142_3_150 -------wget http://$1:9000/trans_buy_f1142_2 -------wget http://$1:9000/trans_add_f1143_4_200 -------wget http://$1:9000/trans_buy_f1143_3 -------wget http://$1:9000/trans_add_f1144_5_50 -------wget http://$1:9000/trans_buy_f1144_4 -------wget http://$1:9000/trans_add_f1145_1_100 -------wget http://$1:9000/trans_buy_f1145_0 -------wget http://$1:9000/trans_add_f1146_2_150 -------wget http://$1:9000/trans_buy_f1146_1 -------wget http://$1:9000/trans_add_f1147_3_200 -------wget http://$1:9000/trans_buy_f1147_2 -------wget http://$1:9000/trans_add_f1148_4_50 -------wget http://$1:9000/trans_buy_f1148_3 -------wget http://$1:9000/trans_add_f1149_5_100 -------wget http://$1:9000/trans_buy_f1149_4 -------wget http://$1:9000/trans_add_f1150_1_150 -------wget http://$1:9000/trans_buy_f1150_0 -------wget http://$1:9000/trans_add_f1151_2_200 -------wget http://$1:9000/trans_buy_f1151_1 -------wget http://$1:9000/trans_add_f1152_3_50 -------wget http://$1:9000/trans_buy_f1152_2 -------wget http://$1:9000/trans_add_f1153_4_100 -------wget http://$1:9000/trans_buy_f1153_3 -------wget http://$1:9000/trans_add_f1154_5_150 -------wget http://$1:9000/trans_buy_f1154_4 -------wget http://$1:9000/trans_add_f1155_1_200 -------wget http://$1:9000/trans_buy_f1155_0 -------wget http://$1:9000/trans_add_f1156_2_50 -------wget http://$1:9000/trans_buy_f1156_1 -------wget http://$1:9000/trans_add_f1157_3_100 -------wget http://$1:9000/trans_buy_f1157_2 -------wget http://$1:9000/trans_add_f1158_4_150 -------wget http://$1:9000/trans_buy_f1158_3 -------wget http://$1:9000/trans_add_f1159_5_200 -------wget http://$1:9000/trans_buy_f1159_4 -------wget http://$1:9000/trans_add_f1160_1_50 -------wget http://$1:9000/trans_buy_f1160_0 -------wget http://$1:9000/trans_add_f1161_2_100 -------wget http://$1:9000/trans_buy_f1161_1 -------wget http://$1:9000/trans_add_f1162_3_150 -------wget http://$1:9000/trans_buy_f1162_2 -------wget http://$1:9000/trans_add_f1163_4_200 -------wget http://$1:9000/trans_buy_f1163_3 -------wget http://$1:9000/trans_add_f1164_5_50 -------wget http://$1:9000/trans_buy_f1164_4 -------wget http://$1:9000/trans_add_f1165_1_100 -------wget http://$1:9000/trans_buy_f1165_0 -------wget http://$1:9000/trans_add_f1166_2_150 -------wget http://$1:9000/trans_buy_f1166_1 -------wget http://$1:9000/trans_add_f1167_3_200 -------wget http://$1:9000/trans_buy_f1167_2 -------wget http://$1:9000/trans_add_f1168_4_50 -------wget http://$1:9000/trans_buy_f1168_3 -------wget http://$1:9000/trans_add_f1169_5_100 -------wget http://$1:9000/trans_buy_f1169_4 -------wget http://$1:9000/trans_add_f1170_1_150 -------wget http://$1:9000/trans_buy_f1170_0 -------wget http://$1:9000/trans_add_f1171_2_200 -------wget http://$1:9000/trans_buy_f1171_1 -------wget http://$1:9000/trans_add_f1172_3_50 -------wget http://$1:9000/trans_buy_f1172_2 -------wget http://$1:9000/trans_add_f1173_4_100 -------wget http://$1:9000/trans_buy_f1173_3 -------wget http://$1:9000/trans_add_f1174_5_150 -------wget http://$1:9000/trans_buy_f1174_4 -------wget http://$1:9000/trans_add_f1175_1_200 -------wget http://$1:9000/trans_buy_f1175_0 -------wget http://$1:9000/trans_add_f1176_2_50 -------wget http://$1:9000/trans_buy_f1176_1 -------wget http://$1:9000/trans_add_f1177_3_100 -------wget http://$1:9000/trans_buy_f1177_2 -------wget http://$1:9000/trans_add_f1178_4_150 -------wget http://$1:9000/trans_buy_f1178_3 -------wget http://$1:9000/trans_add_f1179_5_200 -------wget http://$1:9000/trans_buy_f1179_4 -------wget http://$1:9000/trans_add_f1180_1_50 -------wget http://$1:9000/trans_buy_f1180_0 -------wget http://$1:9000/trans_add_f1181_2_100 -------wget http://$1:9000/trans_buy_f1181_1 -------wget http://$1:9000/trans_add_f1182_3_150 -------wget http://$1:9000/trans_buy_f1182_2 -------wget http://$1:9000/trans_add_f1183_4_200 -------wget http://$1:9000/trans_buy_f1183_3 -------wget http://$1:9000/trans_add_f1184_5_50 -------wget http://$1:9000/trans_buy_f1184_4 -------wget http://$1:9000/trans_add_f1185_1_100 -------wget http://$1:9000/trans_buy_f1185_0 -------wget http://$1:9000/trans_add_f1186_2_150 -------wget http://$1:9000/trans_buy_f1186_1 -------wget http://$1:9000/trans_add_f1187_3_200 -------wget http://$1:9000/trans_buy_f1187_2 -------wget http://$1:9000/trans_add_f1188_4_50 -------wget http://$1:9000/trans_buy_f1188_3 -------wget http://$1:9000/trans_add_f1189_5_100 -------wget http://$1:9000/trans_buy_f1189_4 -------wget http://$1:9000/trans_add_f1190_1_150 -------wget http://$1:9000/trans_buy_f1190_0 -------wget http://$1:9000/trans_add_f1191_2_200 -------wget http://$1:9000/trans_buy_f1191_1 -------wget http://$1:9000/trans_add_f1192_3_50 -------wget http://$1:9000/trans_buy_f1192_2 -------wget http://$1:9000/trans_add_f1193_4_100 -------wget http://$1:9000/trans_buy_f1193_3 -------wget http://$1:9000/trans_add_f1194_5_150 -------wget http://$1:9000/trans_buy_f1194_4 -------wget http://$1:9000/trans_add_f1195_1_200 -------wget http://$1:9000/trans_buy_f1195_0 -------wget http://$1:9000/trans_add_f1196_2_50 -------wget http://$1:9000/trans_buy_f1196_1 -------wget http://$1:9000/trans_add_f1197_3_100 -------wget http://$1:9000/trans_buy_f1197_2 -------wget http://$1:9000/trans_add_f1198_4_150 -------wget http://$1:9000/trans_buy_f1198_3 -------wget http://$1:9000/trans_add_f1199_5_200 -------wget http://$1:9000/trans_buy_f1199_4 -------wget http://$1:9000/trans_add_f1200_1_50 -------wget http://$1:9000/trans_buy_f1200_0 -------wget http://$1:9000/trans_add_f1201_2_100 -------wget http://$1:9000/trans_buy_f1201_1 -------wget http://$1:9000/trans_add_f1202_3_150 -------wget http://$1:9000/trans_buy_f1202_2 -------wget http://$1:9000/trans_add_f1203_4_200 -------wget http://$1:9000/trans_buy_f1203_3 -------wget http://$1:9000/trans_add_f1204_5_50 -------wget http://$1:9000/trans_buy_f1204_4 -------wget http://$1:9000/trans_add_f1205_1_100 -------wget http://$1:9000/trans_buy_f1205_0 -------wget http://$1:9000/trans_add_f1206_2_150 -------wget http://$1:9000/trans_buy_f1206_1 -------wget http://$1:9000/trans_add_f1207_3_200 -------wget http://$1:9000/trans_buy_f1207_2 -------wget http://$1:9000/trans_add_f1208_4_50 -------wget http://$1:9000/trans_buy_f1208_3 -------wget http://$1:9000/trans_add_f1209_5_100 -------wget http://$1:9000/trans_buy_f1209_4 -------wget http://$1:9000/trans_add_f1210_1_150 -------wget http://$1:9000/trans_buy_f1210_0 -------wget http://$1:9000/trans_add_f1211_2_200 -------wget http://$1:9000/trans_buy_f1211_1 -------wget http://$1:9000/trans_add_f1212_3_50 -------wget http://$1:9000/trans_buy_f1212_2 -------wget http://$1:9000/trans_add_f1213_4_100 -------wget http://$1:9000/trans_buy_f1213_3 -------wget http://$1:9000/trans_add_f1214_5_150 -------wget http://$1:9000/trans_buy_f1214_4 -------wget http://$1:9000/trans_add_f1215_1_200 -------wget http://$1:9000/trans_buy_f1215_0 -------wget http://$1:9000/trans_add_f1216_2_50 -------wget http://$1:9000/trans_buy_f1216_1 -------wget http://$1:9000/trans_add_f1217_3_100 -------wget http://$1:9000/trans_buy_f1217_2 -------wget http://$1:9000/trans_add_f1218_4_150 -------wget http://$1:9000/trans_buy_f1218_3 -------wget http://$1:9000/trans_add_f1219_5_200 -------wget http://$1:9000/trans_buy_f1219_4 -------wget http://$1:9000/trans_add_f1220_1_50 -------wget http://$1:9000/trans_buy_f1220_0 -------wget http://$1:9000/trans_add_f1221_2_100 -------wget http://$1:9000/trans_buy_f1221_1 -------wget http://$1:9000/trans_add_f1222_3_150 -------wget http://$1:9000/trans_buy_f1222_2 -------wget http://$1:9000/trans_add_f1223_4_200 -------wget http://$1:9000/trans_buy_f1223_3 -------wget http://$1:9000/trans_add_f1224_5_50 -------wget http://$1:9000/trans_buy_f1224_4 -------wget http://$1:9000/trans_add_f1225_1_100 -------wget http://$1:9000/trans_buy_f1225_0 -------wget http://$1:9000/trans_add_f1226_2_150 -------wget http://$1:9000/trans_buy_f1226_1 -------wget http://$1:9000/trans_add_f1227_3_200 -------wget http://$1:9000/trans_buy_f1227_2 -------wget http://$1:9000/trans_add_f1228_4_50 -------wget http://$1:9000/trans_buy_f1228_3 -------wget http://$1:9000/trans_add_f1229_5_100 -------wget http://$1:9000/trans_buy_f1229_4 -------wget http://$1:9000/trans_add_f1230_1_150 -------wget http://$1:9000/trans_buy_f1230_0 -------wget http://$1:9000/trans_add_f1231_2_200 -------wget http://$1:9000/trans_buy_f1231_1 -------wget http://$1:9000/trans_add_f1232_3_50 -------wget http://$1:9000/trans_buy_f1232_2 -------wget http://$1:9000/trans_add_f1233_4_100 -------wget http://$1:9000/trans_buy_f1233_3 -------wget http://$1:9000/trans_add_f1234_5_150 -------wget http://$1:9000/trans_buy_f1234_4 -------wget http://$1:9000/trans_add_f1235_1_200 -------wget http://$1:9000/trans_buy_f1235_0 -------wget http://$1:9000/trans_add_f1236_2_50 -------wget http://$1:9000/trans_buy_f1236_1 -------wget http://$1:9000/trans_add_f1237_3_100 -------wget http://$1:9000/trans_buy_f1237_2 -------wget http://$1:9000/trans_add_f1238_4_150 -------wget http://$1:9000/trans_buy_f1238_3 -------wget http://$1:9000/trans_add_f1239_5_200 -------wget http://$1:9000/trans_buy_f1239_4 -------wget http://$1:9000/trans_add_f1240_1_50 -------wget http://$1:9000/trans_buy_f1240_0 -------wget http://$1:9000/trans_add_f1241_2_100 -------wget http://$1:9000/trans_buy_f1241_1 -------wget http://$1:9000/trans_add_f1242_3_150 -------wget http://$1:9000/trans_buy_f1242_2 -------wget http://$1:9000/trans_add_f1243_4_200 -------wget http://$1:9000/trans_buy_f1243_3 -------wget http://$1:9000/trans_add_f1244_5_50 -------wget http://$1:9000/trans_buy_f1244_4 -------wget http://$1:9000/trans_add_f1245_1_100 -------wget http://$1:9000/trans_buy_f1245_0 -------wget http://$1:9000/trans_add_f1246_2_150 -------wget http://$1:9000/trans_buy_f1246_1 -------wget http://$1:9000/trans_add_f1247_3_200 -------wget http://$1:9000/trans_buy_f1247_2 -------wget http://$1:9000/trans_add_f1248_4_50 -------wget http://$1:9000/trans_buy_f1248_3 -------wget http://$1:9000/trans_add_f1249_5_100 -------wget http://$1:9000/trans_buy_f1249_4 -------wget http://$1:9000/trans_add_f1250_1_150 -------wget http://$1:9000/trans_buy_f1250_0 -------wget http://$1:9000/trans_add_f1251_2_200 -------wget http://$1:9000/trans_buy_f1251_1 -------wget http://$1:9000/trans_add_f1252_3_50 -------wget http://$1:9000/trans_buy_f1252_2 -------wget http://$1:9000/trans_add_f1253_4_100 -------wget http://$1:9000/trans_buy_f1253_3 -------wget http://$1:9000/trans_add_f1254_5_150 -------wget http://$1:9000/trans_buy_f1254_4 -------wget http://$1:9000/trans_add_f1255_1_200 -------wget http://$1:9000/trans_buy_f1255_0 -------wget http://$1:9000/trans_add_f1256_2_50 -------wget http://$1:9000/trans_buy_f1256_1 -------wget http://$1:9000/trans_add_f1257_3_100 -------wget http://$1:9000/trans_buy_f1257_2 -------wget http://$1:9000/trans_add_f1258_4_150 -------wget http://$1:9000/trans_buy_f1258_3 -------wget http://$1:9000/trans_add_f1259_5_200 -------wget http://$1:9000/trans_buy_f1259_4 -------wget http://$1:9000/trans_add_f1260_1_50 -------wget http://$1:9000/trans_buy_f1260_0 -------wget http://$1:9000/trans_add_f1261_2_100 -------wget http://$1:9000/trans_buy_f1261_1 -------wget http://$1:9000/trans_add_f1262_3_150 -------wget http://$1:9000/trans_buy_f1262_2 -------wget http://$1:9000/trans_add_f1263_4_200 -------wget http://$1:9000/trans_buy_f1263_3 -------wget http://$1:9000/trans_add_f1264_5_50 -------wget http://$1:9000/trans_buy_f1264_4 -------wget http://$1:9000/trans_add_f1265_1_100 -------wget http://$1:9000/trans_buy_f1265_0 -------wget http://$1:9000/trans_add_f1266_2_150 -------wget http://$1:9000/trans_buy_f1266_1 -------wget http://$1:9000/trans_add_f1267_3_200 -------wget http://$1:9000/trans_buy_f1267_2 -------wget http://$1:9000/trans_add_f1268_4_50 -------wget http://$1:9000/trans_buy_f1268_3 -------wget http://$1:9000/trans_add_f1269_5_100 -------wget http://$1:9000/trans_buy_f1269_4 -------wget http://$1:9000/trans_add_f1270_1_150 -------wget http://$1:9000/trans_buy_f1270_0 -------wget http://$1:9000/trans_add_f1271_2_200 -------wget http://$1:9000/trans_buy_f1271_1 -------wget http://$1:9000/trans_add_f1272_3_50 -------wget http://$1:9000/trans_buy_f1272_2 -------wget http://$1:9000/trans_add_f1273_4_100 -------wget http://$1:9000/trans_buy_f1273_3 -------wget http://$1:9000/trans_add_f1274_5_150 -------wget http://$1:9000/trans_buy_f1274_4 -------wget http://$1:9000/trans_add_f1275_1_200 -------wget http://$1:9000/trans_buy_f1275_0 -------wget http://$1:9000/trans_add_f1276_2_50 -------wget http://$1:9000/trans_buy_f1276_1 -------wget http://$1:9000/trans_add_f1277_3_100 -------wget http://$1:9000/trans_buy_f1277_2 -------wget http://$1:9000/trans_add_f1278_4_150 -------wget http://$1:9000/trans_buy_f1278_3 -------wget http://$1:9000/trans_add_f1279_5_200 -------wget http://$1:9000/trans_buy_f1279_4 -------wget http://$1:9000/trans_add_f1280_1_50 -------wget http://$1:9000/trans_buy_f1280_0 -------wget http://$1:9000/trans_add_f1281_2_100 -------wget http://$1:9000/trans_buy_f1281_1 -------wget http://$1:9000/trans_add_f1282_3_150 -------wget http://$1:9000/trans_buy_f1282_2 -------wget http://$1:9000/trans_add_f1283_4_200 -------wget http://$1:9000/trans_buy_f1283_3 -------wget http://$1:9000/trans_add_f1284_5_50 -------wget http://$1:9000/trans_buy_f1284_4 -------wget http://$1:9000/trans_add_f1285_1_100 -------wget http://$1:9000/trans_buy_f1285_0 -------wget http://$1:9000/trans_add_f1286_2_150 -------wget http://$1:9000/trans_buy_f1286_1 -------wget http://$1:9000/trans_add_f1287_3_200 -------wget http://$1:9000/trans_buy_f1287_2 -------wget http://$1:9000/trans_add_f1288_4_50 -------wget http://$1:9000/trans_buy_f1288_3 -------wget http://$1:9000/trans_add_f1289_5_100 -------wget http://$1:9000/trans_buy_f1289_4 -------wget http://$1:9000/trans_add_f1290_1_150 -------wget http://$1:9000/trans_buy_f1290_0 -------wget http://$1:9000/trans_add_f1291_2_200 -------wget http://$1:9000/trans_buy_f1291_1 -------wget http://$1:9000/trans_add_f1292_3_50 -------wget http://$1:9000/trans_buy_f1292_2 -------wget http://$1:9000/trans_add_f1293_4_100 -------wget http://$1:9000/trans_buy_f1293_3 -------wget http://$1:9000/trans_add_f1294_5_150 -------wget http://$1:9000/trans_buy_f1294_4 -------wget http://$1:9000/trans_add_f1295_1_200 -------wget http://$1:9000/trans_buy_f1295_0 -------wget http://$1:9000/trans_add_f1296_2_50 -------wget http://$1:9000/trans_buy_f1296_1 -------wget http://$1:9000/trans_add_f1297_3_100 -------wget http://$1:9000/trans_buy_f1297_2 -------wget http://$1:9000/trans_add_f1298_4_150 -------wget http://$1:9000/trans_buy_f1298_3 -------wget http://$1:9000/trans_add_f1299_5_200 -------wget http://$1:9000/trans_buy_f1299_4 -------wget http://$1:9000/trans_add_f1300_1_50 -------wget http://$1:9000/trans_buy_f1300_0 -------wget http://$1:9000/trans_add_f1301_2_100 -------wget http://$1:9000/trans_buy_f1301_1 -------wget http://$1:9000/trans_add_f1302_3_150 -------wget http://$1:9000/trans_buy_f1302_2 -------wget http://$1:9000/trans_add_f1303_4_200 -------wget http://$1:9000/trans_buy_f1303_3 -------wget http://$1:9000/trans_add_f1304_5_50 -------wget http://$1:9000/trans_buy_f1304_4 -------wget http://$1:9000/trans_add_f1305_1_100 -------wget http://$1:9000/trans_buy_f1305_0 -------wget http://$1:9000/trans_add_f1306_2_150 -------wget http://$1:9000/trans_buy_f1306_1 -------wget http://$1:9000/trans_add_f1307_3_200 -------wget http://$1:9000/trans_buy_f1307_2 -------wget http://$1:9000/trans_add_f1308_4_50 -------wget http://$1:9000/trans_buy_f1308_3 -------wget http://$1:9000/trans_add_f1309_5_100 -------wget http://$1:9000/trans_buy_f1309_4 -------wget http://$1:9000/trans_add_f1310_1_150 -------wget http://$1:9000/trans_buy_f1310_0 -------wget http://$1:9000/trans_add_f1311_2_200 -------wget http://$1:9000/trans_buy_f1311_1 -------wget http://$1:9000/trans_add_f1312_3_50 -------wget http://$1:9000/trans_buy_f1312_2 -------wget http://$1:9000/trans_add_f1313_4_100 -------wget http://$1:9000/trans_buy_f1313_3 -------wget http://$1:9000/trans_add_f1314_5_150 -------wget http://$1:9000/trans_buy_f1314_4 -------wget http://$1:9000/trans_add_f1315_1_200 -------wget http://$1:9000/trans_buy_f1315_0 -------wget http://$1:9000/trans_add_f1316_2_50 -------wget http://$1:9000/trans_buy_f1316_1 -------wget http://$1:9000/trans_add_f1317_3_100 -------wget http://$1:9000/trans_buy_f1317_2 -------wget http://$1:9000/trans_add_f1318_4_150 -------wget http://$1:9000/trans_buy_f1318_3 -------wget http://$1:9000/trans_add_f1319_5_200 -------wget http://$1:9000/trans_buy_f1319_4 -------wget http://$1:9000/trans_add_f1320_1_50 -------wget http://$1:9000/trans_buy_f1320_0 -------wget http://$1:9000/trans_add_f1321_2_100 -------wget http://$1:9000/trans_buy_f1321_1 -------wget http://$1:9000/trans_add_f1322_3_150 -------wget http://$1:9000/trans_buy_f1322_2 -------wget http://$1:9000/trans_add_f1323_4_200 -------wget http://$1:9000/trans_buy_f1323_3 -------wget http://$1:9000/trans_add_f1324_5_50 -------wget http://$1:9000/trans_buy_f1324_4 -------wget http://$1:9000/trans_add_f1325_1_100 -------wget http://$1:9000/trans_buy_f1325_0 -------wget http://$1:9000/trans_add_f1326_2_150 -------wget http://$1:9000/trans_buy_f1326_1 -------wget http://$1:9000/trans_add_f1327_3_200 -------wget http://$1:9000/trans_buy_f1327_2 -------wget http://$1:9000/trans_add_f1328_4_50 -------wget http://$1:9000/trans_buy_f1328_3 -------wget http://$1:9000/trans_add_f1329_5_100 -------wget http://$1:9000/trans_buy_f1329_4 -------wget http://$1:9000/trans_add_f1330_1_150 -------wget http://$1:9000/trans_buy_f1330_0 -------wget http://$1:9000/trans_add_f1331_2_200 -------wget http://$1:9000/trans_buy_f1331_1 -------wget http://$1:9000/trans_add_f1332_3_50 -------wget http://$1:9000/trans_buy_f1332_2 -------wget http://$1:9000/trans_add_f1333_4_100 -------wget http://$1:9000/trans_buy_f1333_3 -------wget http://$1:9000/trans_add_f1334_5_150 -------wget http://$1:9000/trans_buy_f1334_4 -------wget http://$1:9000/trans_add_f1335_1_200 -------wget http://$1:9000/trans_buy_f1335_0 -------wget http://$1:9000/trans_add_f1336_2_50 -------wget http://$1:9000/trans_buy_f1336_1 -------wget http://$1:9000/trans_add_f1337_3_100 -------wget http://$1:9000/trans_buy_f1337_2 -------wget http://$1:9000/trans_add_f1338_4_150 -------wget http://$1:9000/trans_buy_f1338_3 -------wget http://$1:9000/trans_add_f1339_5_200 -------wget http://$1:9000/trans_buy_f1339_4 -------wget http://$1:9000/trans_add_f1340_1_50 -------wget http://$1:9000/trans_buy_f1340_0 -------wget http://$1:9000/trans_add_f1341_2_100 -------wget http://$1:9000/trans_buy_f1341_1 -------wget http://$1:9000/trans_add_f1342_3_150 -------wget http://$1:9000/trans_buy_f1342_2 -------wget http://$1:9000/trans_add_f1343_4_200 -------wget http://$1:9000/trans_buy_f1343_3 -------wget http://$1:9000/trans_add_f1344_5_50 -------wget http://$1:9000/trans_buy_f1344_4 -------wget http://$1:9000/trans_add_f1345_1_100 -------wget http://$1:9000/trans_buy_f1345_0 -------wget http://$1:9000/trans_add_f1346_2_150 -------wget http://$1:9000/trans_buy_f1346_1 -------wget http://$1:9000/trans_add_f1347_3_200 -------wget http://$1:9000/trans_buy_f1347_2 -------wget http://$1:9000/trans_add_f1348_4_50 -------wget http://$1:9000/trans_buy_f1348_3 -------wget http://$1:9000/trans_add_f1349_5_100 -------wget http://$1:9000/trans_buy_f1349_4 -------wget http://$1:9000/trans_add_f1350_1_150 -------wget http://$1:9000/trans_buy_f1350_0 -------wget http://$1:9000/trans_add_f1351_2_200 -------wget http://$1:9000/trans_buy_f1351_1 -------wget http://$1:9000/trans_add_f1352_3_50 -------wget http://$1:9000/trans_buy_f1352_2 -------wget http://$1:9000/trans_add_f1353_4_100 -------wget http://$1:9000/trans_buy_f1353_3 -------wget http://$1:9000/trans_add_f1354_5_150 -------wget http://$1:9000/trans_buy_f1354_4 -------wget http://$1:9000/trans_add_f1355_1_200 -------wget http://$1:9000/trans_buy_f1355_0 -------wget http://$1:9000/trans_add_f1356_2_50 -------wget http://$1:9000/trans_buy_f1356_1 -------wget http://$1:9000/trans_add_f1357_3_100 -------wget http://$1:9000/trans_buy_f1357_2 -------wget http://$1:9000/trans_add_f1358_4_150 -------wget http://$1:9000/trans_buy_f1358_3 -------wget http://$1:9000/trans_add_f1359_5_200 -------wget http://$1:9000/trans_buy_f1359_4 -------wget http://$1:9000/trans_add_f1360_1_50 -------wget http://$1:9000/trans_buy_f1360_0 -------wget http://$1:9000/trans_add_f1361_2_100 -------wget http://$1:9000/trans_buy_f1361_1 -------wget http://$1:9000/trans_add_f1362_3_150 -------wget http://$1:9000/trans_buy_f1362_2 -------wget http://$1:9000/trans_add_f1363_4_200 -------wget http://$1:9000/trans_buy_f1363_3 -------wget http://$1:9000/trans_add_f1364_5_50 -------wget http://$1:9000/trans_buy_f1364_4 -------wget http://$1:9000/trans_add_f1365_1_100 -------wget http://$1:9000/trans_buy_f1365_0 -------wget http://$1:9000/trans_add_f1366_2_150 -------wget http://$1:9000/trans_buy_f1366_1 -------wget http://$1:9000/trans_add_f1367_3_200 -------wget http://$1:9000/trans_buy_f1367_2 -------wget http://$1:9000/trans_add_f1368_4_50 -------wget http://$1:9000/trans_buy_f1368_3 -------wget http://$1:9000/trans_add_f1369_5_100 -------wget http://$1:9000/trans_buy_f1369_4 -------wget http://$1:9000/trans_add_f1370_1_150 -------wget http://$1:9000/trans_buy_f1370_0 -------wget http://$1:9000/trans_add_f1371_2_200 -------wget http://$1:9000/trans_buy_f1371_1 -------wget http://$1:9000/trans_add_f1372_3_50 -------wget http://$1:9000/trans_buy_f1372_2 -------wget http://$1:9000/trans_add_f1373_4_100 -------wget http://$1:9000/trans_buy_f1373_3 -------wget http://$1:9000/trans_add_f1374_5_150 -------wget http://$1:9000/trans_buy_f1374_4 -------wget http://$1:9000/trans_add_f1375_1_200 -------wget http://$1:9000/trans_buy_f1375_0 -------wget http://$1:9000/trans_add_f1376_2_50 -------wget http://$1:9000/trans_buy_f1376_1 -------wget http://$1:9000/trans_add_f1377_3_100 -------wget http://$1:9000/trans_buy_f1377_2 -------wget http://$1:9000/trans_add_f1378_4_150 -------wget http://$1:9000/trans_buy_f1378_3 -------wget http://$1:9000/trans_add_f1379_5_200 -------wget http://$1:9000/trans_buy_f1379_4 -------wget http://$1:9000/trans_add_f1380_1_50 -------wget http://$1:9000/trans_buy_f1380_0 -------wget http://$1:9000/trans_add_f1381_2_100 -------wget http://$1:9000/trans_buy_f1381_1 -------wget http://$1:9000/trans_add_f1382_3_150 -------wget http://$1:9000/trans_buy_f1382_2 -------wget http://$1:9000/trans_add_f1383_4_200 -------wget http://$1:9000/trans_buy_f1383_3 -------wget http://$1:9000/trans_add_f1384_5_50 -------wget http://$1:9000/trans_buy_f1384_4 -------wget http://$1:9000/trans_add_f1385_1_100 -------wget http://$1:9000/trans_buy_f1385_0 -------wget http://$1:9000/trans_add_f1386_2_150 -------wget http://$1:9000/trans_buy_f1386_1 -------wget http://$1:9000/trans_add_f1387_3_200 -------wget http://$1:9000/trans_buy_f1387_2 -------wget http://$1:9000/trans_add_f1388_4_50 -------wget http://$1:9000/trans_buy_f1388_3 -------wget http://$1:9000/trans_add_f1389_5_100 -------wget http://$1:9000/trans_buy_f1389_4 -------wget http://$1:9000/trans_add_f1390_1_150 -------wget http://$1:9000/trans_buy_f1390_0 -------wget http://$1:9000/trans_add_f1391_2_200 -------wget http://$1:9000/trans_buy_f1391_1 -------wget http://$1:9000/trans_add_f1392_3_50 -------wget http://$1:9000/trans_buy_f1392_2 -------wget http://$1:9000/trans_add_f1393_4_100 -------wget http://$1:9000/trans_buy_f1393_3 -------wget http://$1:9000/trans_add_f1394_5_150 -------wget http://$1:9000/trans_buy_f1394_4 -------wget http://$1:9000/trans_add_f1395_1_200 -------wget http://$1:9000/trans_buy_f1395_0 -------wget http://$1:9000/trans_add_f1396_2_50 -------wget http://$1:9000/trans_buy_f1396_1 -------wget http://$1:9000/trans_add_f1397_3_100 -------wget http://$1:9000/trans_buy_f1397_2 -------wget http://$1:9000/trans_add_f1398_4_150 -------wget http://$1:9000/trans_buy_f1398_3 -------wget http://$1:9000/trans_add_f1399_5_200 -------wget http://$1:9000/trans_buy_f1399_4 -------wget http://$1:9000/trans_add_f1400_1_50 -------wget http://$1:9000/trans_buy_f1400_0 -------wget http://$1:9000/trans_add_f1401_2_100 -------wget http://$1:9000/trans_buy_f1401_1 -------wget http://$1:9000/trans_add_f1402_3_150 -------wget http://$1:9000/trans_buy_f1402_2 -------wget http://$1:9000/trans_add_f1403_4_200 -------wget http://$1:9000/trans_buy_f1403_3 -------wget http://$1:9000/trans_add_f1404_5_50 -------wget http://$1:9000/trans_buy_f1404_4 -------wget http://$1:9000/trans_add_f1405_1_100 -------wget http://$1:9000/trans_buy_f1405_0 -------wget http://$1:9000/trans_add_f1406_2_150 -------wget http://$1:9000/trans_buy_f1406_1 -------wget http://$1:9000/trans_add_f1407_3_200 -------wget http://$1:9000/trans_buy_f1407_2 -------wget http://$1:9000/trans_add_f1408_4_50 -------wget http://$1:9000/trans_buy_f1408_3 -------wget http://$1:9000/trans_add_f1409_5_100 -------wget http://$1:9000/trans_buy_f1409_4 -------wget http://$1:9000/trans_add_f1410_1_150 -------wget http://$1:9000/trans_buy_f1410_0 -------wget http://$1:9000/trans_add_f1411_2_200 -------wget http://$1:9000/trans_buy_f1411_1 -------wget http://$1:9000/trans_add_f1412_3_50 -------wget http://$1:9000/trans_buy_f1412_2 -------wget http://$1:9000/trans_add_f1413_4_100 -------wget http://$1:9000/trans_buy_f1413_3 -------wget http://$1:9000/trans_add_f1414_5_150 -------wget http://$1:9000/trans_buy_f1414_4 -------wget http://$1:9000/trans_add_f1415_1_200 -------wget http://$1:9000/trans_buy_f1415_0 -------wget http://$1:9000/trans_add_f1416_2_50 -------wget http://$1:9000/trans_buy_f1416_1 -------wget http://$1:9000/trans_add_f1417_3_100 -------wget http://$1:9000/trans_buy_f1417_2 -------wget http://$1:9000/trans_add_f1418_4_150 -------wget http://$1:9000/trans_buy_f1418_3 -------wget http://$1:9000/trans_add_f1419_5_200 -------wget http://$1:9000/trans_buy_f1419_4 -------wget http://$1:9000/trans_add_f1420_1_50 -------wget http://$1:9000/trans_buy_f1420_0 -------wget http://$1:9000/trans_add_f1421_2_100 -------wget http://$1:9000/trans_buy_f1421_1 -------wget http://$1:9000/trans_add_f1422_3_150 -------wget http://$1:9000/trans_buy_f1422_2 -------wget http://$1:9000/trans_add_f1423_4_200 -------wget http://$1:9000/trans_buy_f1423_3 -------wget http://$1:9000/trans_add_f1424_5_50 -------wget http://$1:9000/trans_buy_f1424_4 -------wget http://$1:9000/trans_add_f1425_1_100 -------wget http://$1:9000/trans_buy_f1425_0 -------wget http://$1:9000/trans_add_f1426_2_150 -------wget http://$1:9000/trans_buy_f1426_1 -------wget http://$1:9000/trans_add_f1427_3_200 -------wget http://$1:9000/trans_buy_f1427_2 -------wget http://$1:9000/trans_add_f1428_4_50 -------wget http://$1:9000/trans_buy_f1428_3 -------wget http://$1:9000/trans_add_f1429_5_100 -------wget http://$1:9000/trans_buy_f1429_4 -------wget http://$1:9000/trans_add_f1430_1_150 -------wget http://$1:9000/trans_buy_f1430_0 -------wget http://$1:9000/trans_add_f1431_2_200 -------wget http://$1:9000/trans_buy_f1431_1 -------wget http://$1:9000/trans_add_f1432_3_50 -------wget http://$1:9000/trans_buy_f1432_2 -------wget http://$1:9000/trans_add_f1433_4_100 -------wget http://$1:9000/trans_buy_f1433_3 -------wget http://$1:9000/trans_add_f1434_5_150 -------wget http://$1:9000/trans_buy_f1434_4 -------wget http://$1:9000/trans_add_f1435_1_200 -------wget http://$1:9000/trans_buy_f1435_0 -------wget http://$1:9000/trans_add_f1436_2_50 -------wget http://$1:9000/trans_buy_f1436_1 -------wget http://$1:9000/trans_add_f1437_3_100 -------wget http://$1:9000/trans_buy_f1437_2 -------wget http://$1:9000/trans_add_f1438_4_150 -------wget http://$1:9000/trans_buy_f1438_3 -------wget http://$1:9000/trans_add_f1439_5_200 -------wget http://$1:9000/trans_buy_f1439_4 -------wget http://$1:9000/trans_add_f1440_1_50 -------wget http://$1:9000/trans_buy_f1440_0 -------wget http://$1:9000/trans_add_f1441_2_100 -------wget http://$1:9000/trans_buy_f1441_1 -------wget http://$1:9000/trans_add_f1442_3_150 -------wget http://$1:9000/trans_buy_f1442_2 -------wget http://$1:9000/trans_add_f1443_4_200 -------wget http://$1:9000/trans_buy_f1443_3 -------wget http://$1:9000/trans_add_f1444_5_50 -------wget http://$1:9000/trans_buy_f1444_4 -------wget http://$1:9000/trans_add_f1445_1_100 -------wget http://$1:9000/trans_buy_f1445_0 -------wget http://$1:9000/trans_add_f1446_2_150 -------wget http://$1:9000/trans_buy_f1446_1 -------wget http://$1:9000/trans_add_f1447_3_200 -------wget http://$1:9000/trans_buy_f1447_2 -------wget http://$1:9000/trans_add_f1448_4_50 -------wget http://$1:9000/trans_buy_f1448_3 -------wget http://$1:9000/trans_add_f1449_5_100 -------wget http://$1:9000/trans_buy_f1449_4 -------wget http://$1:9000/trans_add_f1450_1_150 -------wget http://$1:9000/trans_buy_f1450_0 -------wget http://$1:9000/trans_add_f1451_2_200 -------wget http://$1:9000/trans_buy_f1451_1 -------wget http://$1:9000/trans_add_f1452_3_50 -------wget http://$1:9000/trans_buy_f1452_2 -------wget http://$1:9000/trans_add_f1453_4_100 -------wget http://$1:9000/trans_buy_f1453_3 -------wget http://$1:9000/trans_add_f1454_5_150 -------wget http://$1:9000/trans_buy_f1454_4 -------wget http://$1:9000/trans_add_f1455_1_200 -------wget http://$1:9000/trans_buy_f1455_0 -------wget http://$1:9000/trans_add_f1456_2_50 -------wget http://$1:9000/trans_buy_f1456_1 -------wget http://$1:9000/trans_add_f1457_3_100 -------wget http://$1:9000/trans_buy_f1457_2 -------wget http://$1:9000/trans_add_f1458_4_150 -------wget http://$1:9000/trans_buy_f1458_3 -------wget http://$1:9000/trans_add_f1459_5_200 -------wget http://$1:9000/trans_buy_f1459_4 -------wget http://$1:9000/trans_add_f1460_1_50 -------wget http://$1:9000/trans_buy_f1460_0 -------wget http://$1:9000/trans_add_f1461_2_100 -------wget http://$1:9000/trans_buy_f1461_1 -------wget http://$1:9000/trans_add_f1462_3_150 -------wget http://$1:9000/trans_buy_f1462_2 -------wget http://$1:9000/trans_add_f1463_4_200 -------wget http://$1:9000/trans_buy_f1463_3 -------wget http://$1:9000/trans_add_f1464_5_50 -------wget http://$1:9000/trans_buy_f1464_4 -------wget http://$1:9000/trans_add_f1465_1_100 -------wget http://$1:9000/trans_buy_f1465_0 -------wget http://$1:9000/trans_add_f1466_2_150 -------wget http://$1:9000/trans_buy_f1466_1 -------wget http://$1:9000/trans_add_f1467_3_200 -------wget http://$1:9000/trans_buy_f1467_2 -------wget http://$1:9000/trans_add_f1468_4_50 -------wget http://$1:9000/trans_buy_f1468_3 -------wget http://$1:9000/trans_add_f1469_5_100 -------wget http://$1:9000/trans_buy_f1469_4 -------wget http://$1:9000/trans_add_f1470_1_150 -------wget http://$1:9000/trans_buy_f1470_0 -------wget http://$1:9000/trans_add_f1471_2_200 -------wget http://$1:9000/trans_buy_f1471_1 -------wget http://$1:9000/trans_add_f1472_3_50 -------wget http://$1:9000/trans_buy_f1472_2 -------wget http://$1:9000/trans_add_f1473_4_100 -------wget http://$1:9000/trans_buy_f1473_3 -------wget http://$1:9000/trans_add_f1474_5_150 -------wget http://$1:9000/trans_buy_f1474_4 -------wget http://$1:9000/trans_add_f1475_1_200 -------wget http://$1:9000/trans_buy_f1475_0 -------wget http://$1:9000/trans_add_f1476_2_50 -------wget http://$1:9000/trans_buy_f1476_1 -------wget http://$1:9000/trans_add_f1477_3_100 -------wget http://$1:9000/trans_buy_f1477_2 -------wget http://$1:9000/trans_add_f1478_4_150 -------wget http://$1:9000/trans_buy_f1478_3 -------wget http://$1:9000/trans_add_f1479_5_200 -------wget http://$1:9000/trans_buy_f1479_4 -------wget http://$1:9000/trans_add_f1480_1_50 -------wget http://$1:9000/trans_buy_f1480_0 -------wget http://$1:9000/trans_add_f1481_2_100 -------wget http://$1:9000/trans_buy_f1481_1 -------wget http://$1:9000/trans_add_f1482_3_150 -------wget http://$1:9000/trans_buy_f1482_2 -------wget http://$1:9000/trans_add_f1483_4_200 -------wget http://$1:9000/trans_buy_f1483_3 -------wget http://$1:9000/trans_add_f1484_5_50 -------wget http://$1:9000/trans_buy_f1484_4 -------wget http://$1:9000/trans_add_f1485_1_100 -------wget http://$1:9000/trans_buy_f1485_0 -------wget http://$1:9000/trans_add_f1486_2_150 -------wget http://$1:9000/trans_buy_f1486_1 -------wget http://$1:9000/trans_add_f1487_3_200 -------wget http://$1:9000/trans_buy_f1487_2 -------wget http://$1:9000/trans_add_f1488_4_50 -------wget http://$1:9000/trans_buy_f1488_3 -------wget http://$1:9000/trans_add_f1489_5_100 -------wget http://$1:9000/trans_buy_f1489_4 -------wget http://$1:9000/trans_add_f1490_1_150 -------wget http://$1:9000/trans_buy_f1490_0 -------wget http://$1:9000/trans_add_f1491_2_200 -------wget http://$1:9000/trans_buy_f1491_1 -------wget http://$1:9000/trans_add_f1492_3_50 -------wget http://$1:9000/trans_buy_f1492_2 -------wget http://$1:9000/trans_add_f1493_4_100 -------wget http://$1:9000/trans_buy_f1493_3 -------wget http://$1:9000/trans_add_f1494_5_150 -------wget http://$1:9000/trans_buy_f1494_4 -------wget http://$1:9000/trans_add_f1495_1_200 -------wget http://$1:9000/trans_buy_f1495_0 -------wget http://$1:9000/trans_add_f1496_2_50 -------wget http://$1:9000/trans_buy_f1496_1 -------wget http://$1:9000/trans_add_f1497_3_100 -------wget http://$1:9000/trans_buy_f1497_2 -------wget http://$1:9000/trans_add_f1498_4_150 -------wget http://$1:9000/trans_buy_f1498_3 -------wget http://$1:9000/trans_add_f1499_5_200 -------wget http://$1:9000/trans_buy_f1499_4 -------wget http://$1:9000/trans_add_f1500_1_50 -------wget http://$1:9000/trans_buy_f1500_0 -------wget http://$1:9000/trans_add_f1501_2_100 -------wget http://$1:9000/trans_buy_f1501_1 -------wget http://$1:9000/trans_add_f1502_3_150 -------wget http://$1:9000/trans_buy_f1502_2 -------wget http://$1:9000/trans_add_f1503_4_200 -------wget http://$1:9000/trans_buy_f1503_3 -------wget http://$1:9000/trans_add_f1504_5_50 -------wget http://$1:9000/trans_buy_f1504_4 -------wget http://$1:9000/trans_add_f1505_1_100 -------wget http://$1:9000/trans_buy_f1505_0 -------wget http://$1:9000/trans_add_f1506_2_150 -------wget http://$1:9000/trans_buy_f1506_1 -------wget http://$1:9000/trans_add_f1507_3_200 -------wget http://$1:9000/trans_buy_f1507_2 -------wget http://$1:9000/trans_add_f1508_4_50 -------wget http://$1:9000/trans_buy_f1508_3 -------wget http://$1:9000/trans_add_f1509_5_100 -------wget http://$1:9000/trans_buy_f1509_4 -------wget http://$1:9000/trans_add_f1510_1_150 -------wget http://$1:9000/trans_buy_f1510_0 -------wget http://$1:9000/trans_add_f1511_2_200 -------wget http://$1:9000/trans_buy_f1511_1 -------wget http://$1:9000/trans_add_f1512_3_50 -------wget http://$1:9000/trans_buy_f1512_2 -------wget http://$1:9000/trans_add_f1513_4_100 -------wget http://$1:9000/trans_buy_f1513_3 -------wget http://$1:9000/trans_add_f1514_5_150 -------wget http://$1:9000/trans_buy_f1514_4 -------wget http://$1:9000/trans_add_f1515_1_200 -------wget http://$1:9000/trans_buy_f1515_0 -------wget http://$1:9000/trans_add_f1516_2_50 -------wget http://$1:9000/trans_buy_f1516_1 -------wget http://$1:9000/trans_add_f1517_3_100 -------wget http://$1:9000/trans_buy_f1517_2 -------wget http://$1:9000/trans_add_f1518_4_150 -------wget http://$1:9000/trans_buy_f1518_3 -------wget http://$1:9000/trans_add_f1519_5_200 -------wget http://$1:9000/trans_buy_f1519_4 -------wget http://$1:9000/trans_add_f1520_1_50 -------wget http://$1:9000/trans_buy_f1520_0 -------wget http://$1:9000/trans_add_f1521_2_100 -------wget http://$1:9000/trans_buy_f1521_1 -------wget http://$1:9000/trans_add_f1522_3_150 -------wget http://$1:9000/trans_buy_f1522_2 -------wget http://$1:9000/trans_add_f1523_4_200 -------wget http://$1:9000/trans_buy_f1523_3 -------wget http://$1:9000/trans_add_f1524_5_50 -------wget http://$1:9000/trans_buy_f1524_4 -------wget http://$1:9000/trans_add_f1525_1_100 -------wget http://$1:9000/trans_buy_f1525_0 -------wget http://$1:9000/trans_add_f1526_2_150 -------wget http://$1:9000/trans_buy_f1526_1 -------wget http://$1:9000/trans_add_f1527_3_200 -------wget http://$1:9000/trans_buy_f1527_2 -------wget http://$1:9000/trans_add_f1528_4_50 -------wget http://$1:9000/trans_buy_f1528_3 -------wget http://$1:9000/trans_add_f1529_5_100 -------wget http://$1:9000/trans_buy_f1529_4 -------wget http://$1:9000/trans_add_f1530_1_150 -------wget http://$1:9000/trans_buy_f1530_0 -------wget http://$1:9000/trans_add_f1531_2_200 -------wget http://$1:9000/trans_buy_f1531_1 -------wget http://$1:9000/trans_add_f1532_3_50 -------wget http://$1:9000/trans_buy_f1532_2 -------wget http://$1:9000/trans_add_f1533_4_100 -------wget http://$1:9000/trans_buy_f1533_3 -------wget http://$1:9000/trans_add_f1534_5_150 -------wget http://$1:9000/trans_buy_f1534_4 -------wget http://$1:9000/trans_add_f1535_1_200 -------wget http://$1:9000/trans_buy_f1535_0 -------wget http://$1:9000/trans_add_f1536_2_50 -------wget http://$1:9000/trans_buy_f1536_1 -------wget http://$1:9000/trans_add_f1537_3_100 -------wget http://$1:9000/trans_buy_f1537_2 -------wget http://$1:9000/trans_add_f1538_4_150 -------wget http://$1:9000/trans_buy_f1538_3 -------wget http://$1:9000/trans_add_f1539_5_200 -------wget http://$1:9000/trans_buy_f1539_4 -------wget http://$1:9000/trans_add_f1540_1_50 -------wget http://$1:9000/trans_buy_f1540_0 -------wget http://$1:9000/trans_add_f1541_2_100 -------wget http://$1:9000/trans_buy_f1541_1 -------wget http://$1:9000/trans_add_f1542_3_150 -------wget http://$1:9000/trans_buy_f1542_2 -------wget http://$1:9000/trans_add_f1543_4_200 -------wget http://$1:9000/trans_buy_f1543_3 -------wget http://$1:9000/trans_add_f1544_5_50 -------wget http://$1:9000/trans_buy_f1544_4 -------wget http://$1:9000/trans_add_f1545_1_100 -------wget http://$1:9000/trans_buy_f1545_0 -------wget http://$1:9000/trans_add_f1546_2_150 -------wget http://$1:9000/trans_buy_f1546_1 -------wget http://$1:9000/trans_add_f1547_3_200 -------wget http://$1:9000/trans_buy_f1547_2 -------wget http://$1:9000/trans_add_f1548_4_50 -------wget http://$1:9000/trans_buy_f1548_3 -------wget http://$1:9000/trans_add_f1549_5_100 -------wget http://$1:9000/trans_buy_f1549_4 -------wget http://$1:9000/trans_add_f1550_1_150 -------wget http://$1:9000/trans_buy_f1550_0 -------wget http://$1:9000/trans_add_f1551_2_200 -------wget http://$1:9000/trans_buy_f1551_1 -------wget http://$1:9000/trans_add_f1552_3_50 -------wget http://$1:9000/trans_buy_f1552_2 -------wget http://$1:9000/trans_add_f1553_4_100 -------wget http://$1:9000/trans_buy_f1553_3 -------wget http://$1:9000/trans_add_f1554_5_150 -------wget http://$1:9000/trans_buy_f1554_4 -------wget http://$1:9000/trans_add_f1555_1_200 -------wget http://$1:9000/trans_buy_f1555_0 -------wget http://$1:9000/trans_add_f1556_2_50 -------wget http://$1:9000/trans_buy_f1556_1 -------wget http://$1:9000/trans_add_f1557_3_100 -------wget http://$1:9000/trans_buy_f1557_2 -------wget http://$1:9000/trans_add_f1558_4_150 -------wget http://$1:9000/trans_buy_f1558_3 -------wget http://$1:9000/trans_add_f1559_5_200 -------wget http://$1:9000/trans_buy_f1559_4 -------wget http://$1:9000/trans_add_f1560_1_50 -------wget http://$1:9000/trans_buy_f1560_0 -------wget http://$1:9000/trans_add_f1561_2_100 -------wget http://$1:9000/trans_buy_f1561_1 -------wget http://$1:9000/trans_add_f1562_3_150 -------wget http://$1:9000/trans_buy_f1562_2 -------wget http://$1:9000/trans_add_f1563_4_200 -------wget http://$1:9000/trans_buy_f1563_3 -------wget http://$1:9000/trans_add_f1564_5_50 -------wget http://$1:9000/trans_buy_f1564_4 -------wget http://$1:9000/trans_add_f1565_1_100 -------wget http://$1:9000/trans_buy_f1565_0 -------wget http://$1:9000/trans_add_f1566_2_150 -------wget http://$1:9000/trans_buy_f1566_1 -------wget http://$1:9000/trans_add_f1567_3_200 -------wget http://$1:9000/trans_buy_f1567_2 -------wget http://$1:9000/trans_add_f1568_4_50 -------wget http://$1:9000/trans_buy_f1568_3 -------wget http://$1:9000/trans_add_f1569_5_100 -------wget http://$1:9000/trans_buy_f1569_4 -------wget http://$1:9000/trans_add_f1570_1_150 -------wget http://$1:9000/trans_buy_f1570_0 -------wget http://$1:9000/trans_add_f1571_2_200 -------wget http://$1:9000/trans_buy_f1571_1 -------wget http://$1:9000/trans_add_f1572_3_50 -------wget http://$1:9000/trans_buy_f1572_2 -------wget http://$1:9000/trans_add_f1573_4_100 -------wget http://$1:9000/trans_buy_f1573_3 -------wget http://$1:9000/trans_add_f1574_5_150 -------wget http://$1:9000/trans_buy_f1574_4 -------wget http://$1:9000/trans_add_f1575_1_200 -------wget http://$1:9000/trans_buy_f1575_0 -------wget http://$1:9000/trans_add_f1576_2_50 -------wget http://$1:9000/trans_buy_f1576_1 -------wget http://$1:9000/trans_add_f1577_3_100 -------wget http://$1:9000/trans_buy_f1577_2 -------wget http://$1:9000/trans_add_f1578_4_150 -------wget http://$1:9000/trans_buy_f1578_3 -------wget http://$1:9000/trans_add_f1579_5_200 -------wget http://$1:9000/trans_buy_f1579_4 -------wget http://$1:9000/trans_add_f1580_1_50 -------wget http://$1:9000/trans_buy_f1580_0 -------wget http://$1:9000/trans_add_f1581_2_100 -------wget http://$1:9000/trans_buy_f1581_1 -------wget http://$1:9000/trans_add_f1582_3_150 -------wget http://$1:9000/trans_buy_f1582_2 -------wget http://$1:9000/trans_add_f1583_4_200 -------wget http://$1:9000/trans_buy_f1583_3 -------wget http://$1:9000/trans_add_f1584_5_50 -------wget http://$1:9000/trans_buy_f1584_4 -------wget http://$1:9000/trans_add_f1585_1_100 -------wget http://$1:9000/trans_buy_f1585_0 -------wget http://$1:9000/trans_add_f1586_2_150 -------wget http://$1:9000/trans_buy_f1586_1 -------wget http://$1:9000/trans_add_f1587_3_200 -------wget http://$1:9000/trans_buy_f1587_2 -------wget http://$1:9000/trans_add_f1588_4_50 -------wget http://$1:9000/trans_buy_f1588_3 -------wget http://$1:9000/trans_add_f1589_5_100 -------wget http://$1:9000/trans_buy_f1589_4 -------wget http://$1:9000/trans_add_f1590_1_150 -------wget http://$1:9000/trans_buy_f1590_0 -------wget http://$1:9000/trans_add_f1591_2_200 -------wget http://$1:9000/trans_buy_f1591_1 -------wget http://$1:9000/trans_add_f1592_3_50 -------wget http://$1:9000/trans_buy_f1592_2 -------wget http://$1:9000/trans_add_f1593_4_100 -------wget http://$1:9000/trans_buy_f1593_3 -------wget http://$1:9000/trans_add_f1594_5_150 -------wget http://$1:9000/trans_buy_f1594_4 -------wget http://$1:9000/trans_add_f1595_1_200 -------wget http://$1:9000/trans_buy_f1595_0 -------wget http://$1:9000/trans_add_f1596_2_50 -------wget http://$1:9000/trans_buy_f1596_1 -------wget http://$1:9000/trans_add_f1597_3_100 -------wget http://$1:9000/trans_buy_f1597_2 -------wget http://$1:9000/trans_add_f1598_4_150 -------wget http://$1:9000/trans_buy_f1598_3 -------wget http://$1:9000/trans_add_f1599_5_200 -------wget http://$1:9000/trans_buy_f1599_4 -------wget http://$1:9000/trans_add_f1600_1_50 -------wget http://$1:9000/trans_buy_f1600_0 -------wget http://$1:9000/trans_add_f1601_2_100 -------wget http://$1:9000/trans_buy_f1601_1 -------wget http://$1:9000/trans_add_f1602_3_150 -------wget http://$1:9000/trans_buy_f1602_2 -------wget http://$1:9000/trans_add_f1603_4_200 -------wget http://$1:9000/trans_buy_f1603_3 -------wget http://$1:9000/trans_add_f1604_5_50 -------wget http://$1:9000/trans_buy_f1604_4 -------wget http://$1:9000/trans_add_f1605_1_100 -------wget http://$1:9000/trans_buy_f1605_0 -------wget http://$1:9000/trans_add_f1606_2_150 -------wget http://$1:9000/trans_buy_f1606_1 -------wget http://$1:9000/trans_add_f1607_3_200 -------wget http://$1:9000/trans_buy_f1607_2 -------wget http://$1:9000/trans_add_f1608_4_50 -------wget http://$1:9000/trans_buy_f1608_3 -------wget http://$1:9000/trans_add_f1609_5_100 -------wget http://$1:9000/trans_buy_f1609_4 -------wget http://$1:9000/trans_add_f1610_1_150 -------wget http://$1:9000/trans_buy_f1610_0 -------wget http://$1:9000/trans_add_f1611_2_200 -------wget http://$1:9000/trans_buy_f1611_1 -------wget http://$1:9000/trans_add_f1612_3_50 -------wget http://$1:9000/trans_buy_f1612_2 -------wget http://$1:9000/trans_add_f1613_4_100 -------wget http://$1:9000/trans_buy_f1613_3 -------wget http://$1:9000/trans_add_f1614_5_150 -------wget http://$1:9000/trans_buy_f1614_4 -------wget http://$1:9000/trans_add_f1615_1_200 -------wget http://$1:9000/trans_buy_f1615_0 -------wget http://$1:9000/trans_add_f1616_2_50 -------wget http://$1:9000/trans_buy_f1616_1 -------wget http://$1:9000/trans_add_f1617_3_100 -------wget http://$1:9000/trans_buy_f1617_2 -------wget http://$1:9000/trans_add_f1618_4_150 -------wget http://$1:9000/trans_buy_f1618_3 -------wget http://$1:9000/trans_add_f1619_5_200 -------wget http://$1:9000/trans_buy_f1619_4 -------wget http://$1:9000/trans_add_f1620_1_50 -------wget http://$1:9000/trans_buy_f1620_0 -------wget http://$1:9000/trans_add_f1621_2_100 -------wget http://$1:9000/trans_buy_f1621_1 -------wget http://$1:9000/trans_add_f1622_3_150 -------wget http://$1:9000/trans_buy_f1622_2 -------wget http://$1:9000/trans_add_f1623_4_200 -------wget http://$1:9000/trans_buy_f1623_3 -------wget http://$1:9000/trans_add_f1624_5_50 -------wget http://$1:9000/trans_buy_f1624_4 -------wget http://$1:9000/trans_add_f1625_1_100 -------wget http://$1:9000/trans_buy_f1625_0 -------wget http://$1:9000/trans_add_f1626_2_150 -------wget http://$1:9000/trans_buy_f1626_1 -------wget http://$1:9000/trans_add_f1627_3_200 -------wget http://$1:9000/trans_buy_f1627_2 -------wget http://$1:9000/trans_add_f1628_4_50 -------wget http://$1:9000/trans_buy_f1628_3 -------wget http://$1:9000/trans_add_f1629_5_100 -------wget http://$1:9000/trans_buy_f1629_4 -------wget http://$1:9000/trans_add_f1630_1_150 -------wget http://$1:9000/trans_buy_f1630_0 -------wget http://$1:9000/trans_add_f1631_2_200 -------wget http://$1:9000/trans_buy_f1631_1 -------wget http://$1:9000/trans_add_f1632_3_50 -------wget http://$1:9000/trans_buy_f1632_2 -------wget http://$1:9000/trans_add_f1633_4_100 -------wget http://$1:9000/trans_buy_f1633_3 -------wget http://$1:9000/trans_add_f1634_5_150 -------wget http://$1:9000/trans_buy_f1634_4 -------wget http://$1:9000/trans_add_f1635_1_200 -------wget http://$1:9000/trans_buy_f1635_0 -------wget http://$1:9000/trans_add_f1636_2_50 -------wget http://$1:9000/trans_buy_f1636_1 -------wget http://$1:9000/trans_add_f1637_3_100 -------wget http://$1:9000/trans_buy_f1637_2 -------wget http://$1:9000/trans_add_f1638_4_150 -------wget http://$1:9000/trans_buy_f1638_3 -------wget http://$1:9000/trans_add_f1639_5_200 -------wget http://$1:9000/trans_buy_f1639_4 -------wget http://$1:9000/trans_add_f1640_1_50 -------wget http://$1:9000/trans_buy_f1640_0 -------wget http://$1:9000/trans_add_f1641_2_100 -------wget http://$1:9000/trans_buy_f1641_1 -------wget http://$1:9000/trans_add_f1642_3_150 -------wget http://$1:9000/trans_buy_f1642_2 -------wget http://$1:9000/trans_add_f1643_4_200 -------wget http://$1:9000/trans_buy_f1643_3 -------wget http://$1:9000/trans_add_f1644_5_50 -------wget http://$1:9000/trans_buy_f1644_4 -------wget http://$1:9000/trans_add_f1645_1_100 -------wget http://$1:9000/trans_buy_f1645_0 -------wget http://$1:9000/trans_add_f1646_2_150 -------wget http://$1:9000/trans_buy_f1646_1 -------wget http://$1:9000/trans_add_f1647_3_200 -------wget http://$1:9000/trans_buy_f1647_2 -------wget http://$1:9000/trans_add_f1648_4_50 -------wget http://$1:9000/trans_buy_f1648_3 -------wget http://$1:9000/trans_add_f1649_5_100 -------wget http://$1:9000/trans_buy_f1649_4 -------wget http://$1:9000/trans_add_f1650_1_150 -------wget http://$1:9000/trans_buy_f1650_0 -------wget http://$1:9000/trans_add_f1651_2_200 -------wget http://$1:9000/trans_buy_f1651_1 -------wget http://$1:9000/trans_add_f1652_3_50 -------wget http://$1:9000/trans_buy_f1652_2 -------wget http://$1:9000/trans_add_f1653_4_100 -------wget http://$1:9000/trans_buy_f1653_3 -------wget http://$1:9000/trans_add_f1654_5_150 -------wget http://$1:9000/trans_buy_f1654_4 -------wget http://$1:9000/trans_add_f1655_1_200 -------wget http://$1:9000/trans_buy_f1655_0 -------wget http://$1:9000/trans_add_f1656_2_50 -------wget http://$1:9000/trans_buy_f1656_1 -------wget http://$1:9000/trans_add_f1657_3_100 -------wget http://$1:9000/trans_buy_f1657_2 -------wget http://$1:9000/trans_add_f1658_4_150 -------wget http://$1:9000/trans_buy_f1658_3 -------wget http://$1:9000/trans_add_f1659_5_200 -------wget http://$1:9000/trans_buy_f1659_4 -------wget http://$1:9000/trans_add_f1660_1_50 -------wget http://$1:9000/trans_buy_f1660_0 -------wget http://$1:9000/trans_add_f1661_2_100 -------wget http://$1:9000/trans_buy_f1661_1 -------wget http://$1:9000/trans_add_f1662_3_150 -------wget http://$1:9000/trans_buy_f1662_2 -------wget http://$1:9000/trans_add_f1663_4_200 -------wget http://$1:9000/trans_buy_f1663_3 -------wget http://$1:9000/trans_add_f1664_5_50 -------wget http://$1:9000/trans_buy_f1664_4 -------wget http://$1:9000/trans_add_f1665_1_100 -------wget http://$1:9000/trans_buy_f1665_0 -------wget http://$1:9000/trans_add_f1666_2_150 -------wget http://$1:9000/trans_buy_f1666_1 -------wget http://$1:9000/trans_add_f1667_3_200 -------wget http://$1:9000/trans_buy_f1667_2 -------wget http://$1:9000/trans_add_f1668_4_50 -------wget http://$1:9000/trans_buy_f1668_3 -------wget http://$1:9000/trans_add_f1669_5_100 -------wget http://$1:9000/trans_buy_f1669_4 -------wget http://$1:9000/trans_add_f1670_1_150 -------wget http://$1:9000/trans_buy_f1670_0 -------wget http://$1:9000/trans_add_f1671_2_200 -------wget http://$1:9000/trans_buy_f1671_1 -------wget http://$1:9000/trans_add_f1672_3_50 -------wget http://$1:9000/trans_buy_f1672_2 -------wget http://$1:9000/trans_add_f1673_4_100 -------wget http://$1:9000/trans_buy_f1673_3 -------wget http://$1:9000/trans_add_f1674_5_150 -------wget http://$1:9000/trans_buy_f1674_4 -------wget http://$1:9000/trans_add_f1675_1_200 -------wget http://$1:9000/trans_buy_f1675_0 -------wget http://$1:9000/trans_add_f1676_2_50 -------wget http://$1:9000/trans_buy_f1676_1 -------wget http://$1:9000/trans_add_f1677_3_100 -------wget http://$1:9000/trans_buy_f1677_2 -------wget http://$1:9000/trans_add_f1678_4_150 -------wget http://$1:9000/trans_buy_f1678_3 -------wget http://$1:9000/trans_add_f1679_5_200 -------wget http://$1:9000/trans_buy_f1679_4 -------wget http://$1:9000/trans_add_f1680_1_50 -------wget http://$1:9000/trans_buy_f1680_0 -------wget http://$1:9000/trans_add_f1681_2_100 -------wget http://$1:9000/trans_buy_f1681_1 -------wget http://$1:9000/trans_add_f1682_3_150 -------wget http://$1:9000/trans_buy_f1682_2 -------wget http://$1:9000/trans_add_f1683_4_200 -------wget http://$1:9000/trans_buy_f1683_3 -------wget http://$1:9000/trans_add_f1684_5_50 -------wget http://$1:9000/trans_buy_f1684_4 -------wget http://$1:9000/trans_add_f1685_1_100 -------wget http://$1:9000/trans_buy_f1685_0 -------wget http://$1:9000/trans_add_f1686_2_150 -------wget http://$1:9000/trans_buy_f1686_1 -------wget http://$1:9000/trans_add_f1687_3_200 -------wget http://$1:9000/trans_buy_f1687_2 -------wget http://$1:9000/trans_add_f1688_4_50 -------wget http://$1:9000/trans_buy_f1688_3 -------wget http://$1:9000/trans_add_f1689_5_100 -------wget http://$1:9000/trans_buy_f1689_4 -------wget http://$1:9000/trans_add_f1690_1_150 -------wget http://$1:9000/trans_buy_f1690_0 -------wget http://$1:9000/trans_add_f1691_2_200 -------wget http://$1:9000/trans_buy_f1691_1 -------wget http://$1:9000/trans_add_f1692_3_50 -------wget http://$1:9000/trans_buy_f1692_2 -------wget http://$1:9000/trans_add_f1693_4_100 -------wget http://$1:9000/trans_buy_f1693_3 -------wget http://$1:9000/trans_add_f1694_5_150 -------wget http://$1:9000/trans_buy_f1694_4 -------wget http://$1:9000/trans_add_f1695_1_200 -------wget http://$1:9000/trans_buy_f1695_0 -------wget http://$1:9000/trans_add_f1696_2_50 -------wget http://$1:9000/trans_buy_f1696_1 -------wget http://$1:9000/trans_add_f1697_3_100 -------wget http://$1:9000/trans_buy_f1697_2 -------wget http://$1:9000/trans_add_f1698_4_150 -------wget http://$1:9000/trans_buy_f1698_3 -------wget http://$1:9000/trans_add_f1699_5_200 -------wget http://$1:9000/trans_buy_f1699_4 -------wget http://$1:9000/trans_add_f1700_1_50 -------wget http://$1:9000/trans_buy_f1700_0 -------wget http://$1:9000/trans_add_f1701_2_100 -------wget http://$1:9000/trans_buy_f1701_1 -------wget http://$1:9000/trans_add_f1702_3_150 -------wget http://$1:9000/trans_buy_f1702_2 -------wget http://$1:9000/trans_add_f1703_4_200 -------wget http://$1:9000/trans_buy_f1703_3 -------wget http://$1:9000/trans_add_f1704_5_50 -------wget http://$1:9000/trans_buy_f1704_4 -------wget http://$1:9000/trans_add_f1705_1_100 -------wget http://$1:9000/trans_buy_f1705_0 -------wget http://$1:9000/trans_add_f1706_2_150 -------wget http://$1:9000/trans_buy_f1706_1 -------wget http://$1:9000/trans_add_f1707_3_200 -------wget http://$1:9000/trans_buy_f1707_2 -------wget http://$1:9000/trans_add_f1708_4_50 -------wget http://$1:9000/trans_buy_f1708_3 -------wget http://$1:9000/trans_add_f1709_5_100 -------wget http://$1:9000/trans_buy_f1709_4 -------wget http://$1:9000/trans_add_f1710_1_150 -------wget http://$1:9000/trans_buy_f1710_0 -------wget http://$1:9000/trans_add_f1711_2_200 -------wget http://$1:9000/trans_buy_f1711_1 -------wget http://$1:9000/trans_add_f1712_3_50 -------wget http://$1:9000/trans_buy_f1712_2 -------wget http://$1:9000/trans_add_f1713_4_100 -------wget http://$1:9000/trans_buy_f1713_3 -------wget http://$1:9000/trans_add_f1714_5_150 -------wget http://$1:9000/trans_buy_f1714_4 -------wget http://$1:9000/trans_add_f1715_1_200 -------wget http://$1:9000/trans_buy_f1715_0 -------wget http://$1:9000/trans_add_f1716_2_50 -------wget http://$1:9000/trans_buy_f1716_1 -------wget http://$1:9000/trans_add_f1717_3_100 -------wget http://$1:9000/trans_buy_f1717_2 -------wget http://$1:9000/trans_add_f1718_4_150 -------wget http://$1:9000/trans_buy_f1718_3 -------wget http://$1:9000/trans_add_f1719_5_200 -------wget http://$1:9000/trans_buy_f1719_4 -------wget http://$1:9000/trans_add_f1720_1_50 -------wget http://$1:9000/trans_buy_f1720_0 -------wget http://$1:9000/trans_add_f1721_2_100 -------wget http://$1:9000/trans_buy_f1721_1 -------wget http://$1:9000/trans_add_f1722_3_150 -------wget http://$1:9000/trans_buy_f1722_2 -------wget http://$1:9000/trans_add_f1723_4_200 -------wget http://$1:9000/trans_buy_f1723_3 -------wget http://$1:9000/trans_add_f1724_5_50 -------wget http://$1:9000/trans_buy_f1724_4 -------wget http://$1:9000/trans_add_f1725_1_100 -------wget http://$1:9000/trans_buy_f1725_0 -------wget http://$1:9000/trans_add_f1726_2_150 -------wget http://$1:9000/trans_buy_f1726_1 -------wget http://$1:9000/trans_add_f1727_3_200 -------wget http://$1:9000/trans_buy_f1727_2 -------wget http://$1:9000/trans_add_f1728_4_50 -------wget http://$1:9000/trans_buy_f1728_3 -------wget http://$1:9000/trans_add_f1729_5_100 -------wget http://$1:9000/trans_buy_f1729_4 -------wget http://$1:9000/trans_add_f1730_1_150 -------wget http://$1:9000/trans_buy_f1730_0 -------wget http://$1:9000/trans_add_f1731_2_200 -------wget http://$1:9000/trans_buy_f1731_1 -------wget http://$1:9000/trans_add_f1732_3_50 -------wget http://$1:9000/trans_buy_f1732_2 -------wget http://$1:9000/trans_add_f1733_4_100 -------wget http://$1:9000/trans_buy_f1733_3 -------wget http://$1:9000/trans_add_f1734_5_150 -------wget http://$1:9000/trans_buy_f1734_4 -------wget http://$1:9000/trans_add_f1735_1_200 -------wget http://$1:9000/trans_buy_f1735_0 -------wget http://$1:9000/trans_add_f1736_2_50 -------wget http://$1:9000/trans_buy_f1736_1 -------wget http://$1:9000/trans_add_f1737_3_100 -------wget http://$1:9000/trans_buy_f1737_2 -------wget http://$1:9000/trans_add_f1738_4_150 -------wget http://$1:9000/trans_buy_f1738_3 -------wget http://$1:9000/trans_add_f1739_5_200 -------wget http://$1:9000/trans_buy_f1739_4 -------wget http://$1:9000/trans_add_f1740_1_50 -------wget http://$1:9000/trans_buy_f1740_0 -------wget http://$1:9000/trans_add_f1741_2_100 -------wget http://$1:9000/trans_buy_f1741_1 -------wget http://$1:9000/trans_add_f1742_3_150 -------wget http://$1:9000/trans_buy_f1742_2 -------wget http://$1:9000/trans_add_f1743_4_200 -------wget http://$1:9000/trans_buy_f1743_3 -------wget http://$1:9000/trans_add_f1744_5_50 -------wget http://$1:9000/trans_buy_f1744_4 -------wget http://$1:9000/trans_add_f1745_1_100 -------wget http://$1:9000/trans_buy_f1745_0 -------wget http://$1:9000/trans_add_f1746_2_150 -------wget http://$1:9000/trans_buy_f1746_1 -------wget http://$1:9000/trans_add_f1747_3_200 -------wget http://$1:9000/trans_buy_f1747_2 -------wget http://$1:9000/trans_add_f1748_4_50 -------wget http://$1:9000/trans_buy_f1748_3 -------wget http://$1:9000/trans_add_f1749_5_100 -------wget http://$1:9000/trans_buy_f1749_4 -------wget http://$1:9000/trans_add_f1750_1_150 -------wget http://$1:9000/trans_buy_f1750_0 -------wget http://$1:9000/trans_add_f1751_2_200 -------wget http://$1:9000/trans_buy_f1751_1 -------wget http://$1:9000/trans_add_f1752_3_50 -------wget http://$1:9000/trans_buy_f1752_2 -------wget http://$1:9000/trans_add_f1753_4_100 -------wget http://$1:9000/trans_buy_f1753_3 -------wget http://$1:9000/trans_add_f1754_5_150 -------wget http://$1:9000/trans_buy_f1754_4 -------wget http://$1:9000/trans_add_f1755_1_200 -------wget http://$1:9000/trans_buy_f1755_0 -------wget http://$1:9000/trans_add_f1756_2_50 -------wget http://$1:9000/trans_buy_f1756_1 -------wget http://$1:9000/trans_add_f1757_3_100 -------wget http://$1:9000/trans_buy_f1757_2 -------wget http://$1:9000/trans_add_f1758_4_150 -------wget http://$1:9000/trans_buy_f1758_3 -------wget http://$1:9000/trans_add_f1759_5_200 -------wget http://$1:9000/trans_buy_f1759_4 -------wget http://$1:9000/trans_add_f1760_1_50 -------wget http://$1:9000/trans_buy_f1760_0 -------wget http://$1:9000/trans_add_f1761_2_100 -------wget http://$1:9000/trans_buy_f1761_1 -------wget http://$1:9000/trans_add_f1762_3_150 -------wget http://$1:9000/trans_buy_f1762_2 -------wget http://$1:9000/trans_add_f1763_4_200 -------wget http://$1:9000/trans_buy_f1763_3 -------wget http://$1:9000/trans_add_f1764_5_50 -------wget http://$1:9000/trans_buy_f1764_4 -------wget http://$1:9000/trans_add_f1765_1_100 -------wget http://$1:9000/trans_buy_f1765_0 -------wget http://$1:9000/trans_add_f1766_2_150 -------wget http://$1:9000/trans_buy_f1766_1 -------wget http://$1:9000/trans_add_f1767_3_200 -------wget http://$1:9000/trans_buy_f1767_2 -------wget http://$1:9000/trans_add_f1768_4_50 -------wget http://$1:9000/trans_buy_f1768_3 -------wget http://$1:9000/trans_add_f1769_5_100 -------wget http://$1:9000/trans_buy_f1769_4 -------wget http://$1:9000/trans_add_f1770_1_150 -------wget http://$1:9000/trans_buy_f1770_0 -------wget http://$1:9000/trans_add_f1771_2_200 -------wget http://$1:9000/trans_buy_f1771_1 -------wget http://$1:9000/trans_add_f1772_3_50 -------wget http://$1:9000/trans_buy_f1772_2 -------wget http://$1:9000/trans_add_f1773_4_100 -------wget http://$1:9000/trans_buy_f1773_3 -------wget http://$1:9000/trans_add_f1774_5_150 -------wget http://$1:9000/trans_buy_f1774_4 -------wget http://$1:9000/trans_add_f1775_1_200 -------wget http://$1:9000/trans_buy_f1775_0 -------wget http://$1:9000/trans_add_f1776_2_50 -------wget http://$1:9000/trans_buy_f1776_1 -------wget http://$1:9000/trans_add_f1777_3_100 -------wget http://$1:9000/trans_buy_f1777_2 -------wget http://$1:9000/trans_add_f1778_4_150 -------wget http://$1:9000/trans_buy_f1778_3 -------wget http://$1:9000/trans_add_f1779_5_200 -------wget http://$1:9000/trans_buy_f1779_4 -------wget http://$1:9000/trans_add_f1780_1_50 -------wget http://$1:9000/trans_buy_f1780_0 -------wget http://$1:9000/trans_add_f1781_2_100 -------wget http://$1:9000/trans_buy_f1781_1 -------wget http://$1:9000/trans_add_f1782_3_150 -------wget http://$1:9000/trans_buy_f1782_2 -------wget http://$1:9000/trans_add_f1783_4_200 -------wget http://$1:9000/trans_buy_f1783_3 -------wget http://$1:9000/trans_add_f1784_5_50 -------wget http://$1:9000/trans_buy_f1784_4 -------wget http://$1:9000/trans_add_f1785_1_100 -------wget http://$1:9000/trans_buy_f1785_0 -------wget http://$1:9000/trans_add_f1786_2_150 -------wget http://$1:9000/trans_buy_f1786_1 -------wget http://$1:9000/trans_add_f1787_3_200 -------wget http://$1:9000/trans_buy_f1787_2 -------wget http://$1:9000/trans_add_f1788_4_50 -------wget http://$1:9000/trans_buy_f1788_3 -------wget http://$1:9000/trans_add_f1789_5_100 -------wget http://$1:9000/trans_buy_f1789_4 -------wget http://$1:9000/trans_add_f1790_1_150 -------wget http://$1:9000/trans_buy_f1790_0 -------wget http://$1:9000/trans_add_f1791_2_200 -------wget http://$1:9000/trans_buy_f1791_1 -------wget http://$1:9000/trans_add_f1792_3_50 -------wget http://$1:9000/trans_buy_f1792_2 -------wget http://$1:9000/trans_add_f1793_4_100 -------wget http://$1:9000/trans_buy_f1793_3 -------wget http://$1:9000/trans_add_f1794_5_150 -------wget http://$1:9000/trans_buy_f1794_4 -------wget http://$1:9000/trans_add_f1795_1_200 -------wget http://$1:9000/trans_buy_f1795_0 -------wget http://$1:9000/trans_add_f1796_2_50 -------wget http://$1:9000/trans_buy_f1796_1 -------wget http://$1:9000/trans_add_f1797_3_100 -------wget http://$1:9000/trans_buy_f1797_2 -------wget http://$1:9000/trans_add_f1798_4_150 -------wget http://$1:9000/trans_buy_f1798_3 -------wget http://$1:9000/trans_add_f1799_5_200 -------wget http://$1:9000/trans_buy_f1799_4 -------wget http://$1:9000/trans_add_f1800_1_50 -------wget http://$1:9000/trans_buy_f1800_0 -------wget http://$1:9000/trans_add_f1801_2_100 -------wget http://$1:9000/trans_buy_f1801_1 -------wget http://$1:9000/trans_add_f1802_3_150 -------wget http://$1:9000/trans_buy_f1802_2 -------wget http://$1:9000/trans_add_f1803_4_200 -------wget http://$1:9000/trans_buy_f1803_3 -------wget http://$1:9000/trans_add_f1804_5_50 -------wget http://$1:9000/trans_buy_f1804_4 -------wget http://$1:9000/trans_add_f1805_1_100 -------wget http://$1:9000/trans_buy_f1805_0 -------wget http://$1:9000/trans_add_f1806_2_150 -------wget http://$1:9000/trans_buy_f1806_1 -------wget http://$1:9000/trans_add_f1807_3_200 -------wget http://$1:9000/trans_buy_f1807_2 -------wget http://$1:9000/trans_add_f1808_4_50 -------wget http://$1:9000/trans_buy_f1808_3 -------wget http://$1:9000/trans_add_f1809_5_100 -------wget http://$1:9000/trans_buy_f1809_4 -------wget http://$1:9000/trans_add_f1810_1_150 -------wget http://$1:9000/trans_buy_f1810_0 -------wget http://$1:9000/trans_add_f1811_2_200 -------wget http://$1:9000/trans_buy_f1811_1 -------wget http://$1:9000/trans_add_f1812_3_50 -------wget http://$1:9000/trans_buy_f1812_2 -------wget http://$1:9000/trans_add_f1813_4_100 -------wget http://$1:9000/trans_buy_f1813_3 -------wget http://$1:9000/trans_add_f1814_5_150 -------wget http://$1:9000/trans_buy_f1814_4 -------wget http://$1:9000/trans_add_f1815_1_200 -------wget http://$1:9000/trans_buy_f1815_0 -------wget http://$1:9000/trans_add_f1816_2_50 -------wget http://$1:9000/trans_buy_f1816_1 -------wget http://$1:9000/trans_add_f1817_3_100 -------wget http://$1:9000/trans_buy_f1817_2 -------wget http://$1:9000/trans_add_f1818_4_150 -------wget http://$1:9000/trans_buy_f1818_3 -------wget http://$1:9000/trans_add_f1819_5_200 -------wget http://$1:9000/trans_buy_f1819_4 -------wget http://$1:9000/trans_add_f1820_1_50 -------wget http://$1:9000/trans_buy_f1820_0 -------wget http://$1:9000/trans_add_f1821_2_100 -------wget http://$1:9000/trans_buy_f1821_1 -------wget http://$1:9000/trans_add_f1822_3_150 -------wget http://$1:9000/trans_buy_f1822_2 -------wget http://$1:9000/trans_add_f1823_4_200 -------wget http://$1:9000/trans_buy_f1823_3 -------wget http://$1:9000/trans_add_f1824_5_50 -------wget http://$1:9000/trans_buy_f1824_4 -------wget http://$1:9000/trans_add_f1825_1_100 -------wget http://$1:9000/trans_buy_f1825_0 -------wget http://$1:9000/trans_add_f1826_2_150 -------wget http://$1:9000/trans_buy_f1826_1 -------wget http://$1:9000/trans_add_f1827_3_200 -------wget http://$1:9000/trans_buy_f1827_2 -------wget http://$1:9000/trans_add_f1828_4_50 -------wget http://$1:9000/trans_buy_f1828_3 -------wget http://$1:9000/trans_add_f1829_5_100 -------wget http://$1:9000/trans_buy_f1829_4 -------wget http://$1:9000/trans_add_f1830_1_150 -------wget http://$1:9000/trans_buy_f1830_0 -------wget http://$1:9000/trans_add_f1831_2_200 -------wget http://$1:9000/trans_buy_f1831_1 -------wget http://$1:9000/trans_add_f1832_3_50 -------wget http://$1:9000/trans_buy_f1832_2 -------wget http://$1:9000/trans_add_f1833_4_100 -------wget http://$1:9000/trans_buy_f1833_3 -------wget http://$1:9000/trans_add_f1834_5_150 -------wget http://$1:9000/trans_buy_f1834_4 -------wget http://$1:9000/trans_add_f1835_1_200 -------wget http://$1:9000/trans_buy_f1835_0 -------wget http://$1:9000/trans_add_f1836_2_50 -------wget http://$1:9000/trans_buy_f1836_1 -------wget http://$1:9000/trans_add_f1837_3_100 -------wget http://$1:9000/trans_buy_f1837_2 -------wget http://$1:9000/trans_add_f1838_4_150 -------wget http://$1:9000/trans_buy_f1838_3 -------wget http://$1:9000/trans_add_f1839_5_200 -------wget http://$1:9000/trans_buy_f1839_4 -------wget http://$1:9000/trans_add_f1840_1_50 -------wget http://$1:9000/trans_buy_f1840_0 -------wget http://$1:9000/trans_add_f1841_2_100 -------wget http://$1:9000/trans_buy_f1841_1 -------wget http://$1:9000/trans_add_f1842_3_150 -------wget http://$1:9000/trans_buy_f1842_2 -------wget http://$1:9000/trans_add_f1843_4_200 -------wget http://$1:9000/trans_buy_f1843_3 -------wget http://$1:9000/trans_add_f1844_5_50 -------wget http://$1:9000/trans_buy_f1844_4 -------wget http://$1:9000/trans_add_f1845_1_100 -------wget http://$1:9000/trans_buy_f1845_0 -------wget http://$1:9000/trans_add_f1846_2_150 -------wget http://$1:9000/trans_buy_f1846_1 -------wget http://$1:9000/trans_add_f1847_3_200 -------wget http://$1:9000/trans_buy_f1847_2 -------wget http://$1:9000/trans_add_f1848_4_50 -------wget http://$1:9000/trans_buy_f1848_3 -------wget http://$1:9000/trans_add_f1849_5_100 -------wget http://$1:9000/trans_buy_f1849_4 -------wget http://$1:9000/trans_add_f1850_1_150 -------wget http://$1:9000/trans_buy_f1850_0 -------wget http://$1:9000/trans_add_f1851_2_200 -------wget http://$1:9000/trans_buy_f1851_1 -------wget http://$1:9000/trans_add_f1852_3_50 -------wget http://$1:9000/trans_buy_f1852_2 -------wget http://$1:9000/trans_add_f1853_4_100 -------wget http://$1:9000/trans_buy_f1853_3 -------wget http://$1:9000/trans_add_f1854_5_150 -------wget http://$1:9000/trans_buy_f1854_4 -------wget http://$1:9000/trans_add_f1855_1_200 -------wget http://$1:9000/trans_buy_f1855_0 -------wget http://$1:9000/trans_add_f1856_2_50 -------wget http://$1:9000/trans_buy_f1856_1 -------wget http://$1:9000/trans_add_f1857_3_100 -------wget http://$1:9000/trans_buy_f1857_2 -------wget http://$1:9000/trans_add_f1858_4_150 -------wget http://$1:9000/trans_buy_f1858_3 -------wget http://$1:9000/trans_add_f1859_5_200 -------wget http://$1:9000/trans_buy_f1859_4 -------wget http://$1:9000/trans_add_f1860_1_50 -------wget http://$1:9000/trans_buy_f1860_0 -------wget http://$1:9000/trans_add_f1861_2_100 -------wget http://$1:9000/trans_buy_f1861_1 -------wget http://$1:9000/trans_add_f1862_3_150 -------wget http://$1:9000/trans_buy_f1862_2 -------wget http://$1:9000/trans_add_f1863_4_200 -------wget http://$1:9000/trans_buy_f1863_3 -------wget http://$1:9000/trans_add_f1864_5_50 -------wget http://$1:9000/trans_buy_f1864_4 -------wget http://$1:9000/trans_add_f1865_1_100 -------wget http://$1:9000/trans_buy_f1865_0 -------wget http://$1:9000/trans_add_f1866_2_150 -------wget http://$1:9000/trans_buy_f1866_1 -------wget http://$1:9000/trans_add_f1867_3_200 -------wget http://$1:9000/trans_buy_f1867_2 -------wget http://$1:9000/trans_add_f1868_4_50 -------wget http://$1:9000/trans_buy_f1868_3 -------wget http://$1:9000/trans_add_f1869_5_100 -------wget http://$1:9000/trans_buy_f1869_4 -------wget http://$1:9000/trans_add_f1870_1_150 -------wget http://$1:9000/trans_buy_f1870_0 -------wget http://$1:9000/trans_add_f1871_2_200 -------wget http://$1:9000/trans_buy_f1871_1 -------wget http://$1:9000/trans_add_f1872_3_50 -------wget http://$1:9000/trans_buy_f1872_2 -------wget http://$1:9000/trans_add_f1873_4_100 -------wget http://$1:9000/trans_buy_f1873_3 -------wget http://$1:9000/trans_add_f1874_5_150 -------wget http://$1:9000/trans_buy_f1874_4 -------wget http://$1:9000/trans_add_f1875_1_200 -------wget http://$1:9000/trans_buy_f1875_0 -------wget http://$1:9000/trans_add_f1876_2_50 -------wget http://$1:9000/trans_buy_f1876_1 -------wget http://$1:9000/trans_add_f1877_3_100 -------wget http://$1:9000/trans_buy_f1877_2 -------wget http://$1:9000/trans_add_f1878_4_150 -------wget http://$1:9000/trans_buy_f1878_3 -------wget http://$1:9000/trans_add_f1879_5_200 -------wget http://$1:9000/trans_buy_f1879_4 -------wget http://$1:9000/trans_add_f1880_1_50 -------wget http://$1:9000/trans_buy_f1880_0 -------wget http://$1:9000/trans_add_f1881_2_100 -------wget http://$1:9000/trans_buy_f1881_1 -------wget http://$1:9000/trans_add_f1882_3_150 -------wget http://$1:9000/trans_buy_f1882_2 -------wget http://$1:9000/trans_add_f1883_4_200 -------wget http://$1:9000/trans_buy_f1883_3 -------wget http://$1:9000/trans_add_f1884_5_50 -------wget http://$1:9000/trans_buy_f1884_4 -------wget http://$1:9000/trans_add_f1885_1_100 -------wget http://$1:9000/trans_buy_f1885_0 -------wget http://$1:9000/trans_add_f1886_2_150 -------wget http://$1:9000/trans_buy_f1886_1 -------wget http://$1:9000/trans_add_f1887_3_200 -------wget http://$1:9000/trans_buy_f1887_2 -------wget http://$1:9000/trans_add_f1888_4_50 -------wget http://$1:9000/trans_buy_f1888_3 -------wget http://$1:9000/trans_add_f1889_5_100 -------wget http://$1:9000/trans_buy_f1889_4 -------wget http://$1:9000/trans_add_f1890_1_150 -------wget http://$1:9000/trans_buy_f1890_0 -------wget http://$1:9000/trans_add_f1891_2_200 -------wget http://$1:9000/trans_buy_f1891_1 -------wget http://$1:9000/trans_add_f1892_3_50 -------wget http://$1:9000/trans_buy_f1892_2 -------wget http://$1:9000/trans_add_f1893_4_100 -------wget http://$1:9000/trans_buy_f1893_3 -------wget http://$1:9000/trans_add_f1894_5_150 -------wget http://$1:9000/trans_buy_f1894_4 -------wget http://$1:9000/trans_add_f1895_1_200 -------wget http://$1:9000/trans_buy_f1895_0 -------wget http://$1:9000/trans_add_f1896_2_50 -------wget http://$1:9000/trans_buy_f1896_1 -------wget http://$1:9000/trans_add_f1897_3_100 -------wget http://$1:9000/trans_buy_f1897_2 -------wget http://$1:9000/trans_add_f1898_4_150 -------wget http://$1:9000/trans_buy_f1898_3 -------wget http://$1:9000/trans_add_f1899_5_200 -------wget http://$1:9000/trans_buy_f1899_4 -------wget http://$1:9000/trans_add_f1900_1_50 -------wget http://$1:9000/trans_buy_f1900_0 -------wget http://$1:9000/trans_add_f1901_2_100 -------wget http://$1:9000/trans_buy_f1901_1 -------wget http://$1:9000/trans_add_f1902_3_150 -------wget http://$1:9000/trans_buy_f1902_2 -------wget http://$1:9000/trans_add_f1903_4_200 -------wget http://$1:9000/trans_buy_f1903_3 -------wget http://$1:9000/trans_add_f1904_5_50 -------wget http://$1:9000/trans_buy_f1904_4 -------wget http://$1:9000/trans_add_f1905_1_100 -------wget http://$1:9000/trans_buy_f1905_0 -------wget http://$1:9000/trans_add_f1906_2_150 -------wget http://$1:9000/trans_buy_f1906_1 -------wget http://$1:9000/trans_add_f1907_3_200 -------wget http://$1:9000/trans_buy_f1907_2 -------wget http://$1:9000/trans_add_f1908_4_50 -------wget http://$1:9000/trans_buy_f1908_3 -------wget http://$1:9000/trans_add_f1909_5_100 -------wget http://$1:9000/trans_buy_f1909_4 -------wget http://$1:9000/trans_add_f1910_1_150 -------wget http://$1:9000/trans_buy_f1910_0 -------wget http://$1:9000/trans_add_f1911_2_200 -------wget http://$1:9000/trans_buy_f1911_1 -------wget http://$1:9000/trans_add_f1912_3_50 -------wget http://$1:9000/trans_buy_f1912_2 -------wget http://$1:9000/trans_add_f1913_4_100 -------wget http://$1:9000/trans_buy_f1913_3 -------wget http://$1:9000/trans_add_f1914_5_150 -------wget http://$1:9000/trans_buy_f1914_4 -------wget http://$1:9000/trans_add_f1915_1_200 -------wget http://$1:9000/trans_buy_f1915_0 -------wget http://$1:9000/trans_add_f1916_2_50 -------wget http://$1:9000/trans_buy_f1916_1 -------wget http://$1:9000/trans_add_f1917_3_100 -------wget http://$1:9000/trans_buy_f1917_2 -------wget http://$1:9000/trans_add_f1918_4_150 -------wget http://$1:9000/trans_buy_f1918_3 -------wget http://$1:9000/trans_add_f1919_5_200 -------wget http://$1:9000/trans_buy_f1919_4 -------wget http://$1:9000/trans_add_f1920_1_50 -------wget http://$1:9000/trans_buy_f1920_0 -------wget http://$1:9000/trans_add_f1921_2_100 -------wget http://$1:9000/trans_buy_f1921_1 -------wget http://$1:9000/trans_add_f1922_3_150 -------wget http://$1:9000/trans_buy_f1922_2 -------wget http://$1:9000/trans_add_f1923_4_200 -------wget http://$1:9000/trans_buy_f1923_3 -------wget http://$1:9000/trans_add_f1924_5_50 -------wget http://$1:9000/trans_buy_f1924_4 -------wget http://$1:9000/trans_add_f1925_1_100 -------wget http://$1:9000/trans_buy_f1925_0 -------wget http://$1:9000/trans_add_f1926_2_150 -------wget http://$1:9000/trans_buy_f1926_1 -------wget http://$1:9000/trans_add_f1927_3_200 -------wget http://$1:9000/trans_buy_f1927_2 -------wget http://$1:9000/trans_add_f1928_4_50 -------wget http://$1:9000/trans_buy_f1928_3 -------wget http://$1:9000/trans_add_f1929_5_100 -------wget http://$1:9000/trans_buy_f1929_4 -------wget http://$1:9000/trans_add_f1930_1_150 -------wget http://$1:9000/trans_buy_f1930_0 -------wget http://$1:9000/trans_add_f1931_2_200 -------wget http://$1:9000/trans_buy_f1931_1 -------wget http://$1:9000/trans_add_f1932_3_50 -------wget http://$1:9000/trans_buy_f1932_2 -------wget http://$1:9000/trans_add_f1933_4_100 -------wget http://$1:9000/trans_buy_f1933_3 -------wget http://$1:9000/trans_add_f1934_5_150 -------wget http://$1:9000/trans_buy_f1934_4 -------wget http://$1:9000/trans_add_f1935_1_200 -------wget http://$1:9000/trans_buy_f1935_0 -------wget http://$1:9000/trans_add_f1936_2_50 -------wget http://$1:9000/trans_buy_f1936_1 -------wget http://$1:9000/trans_add_f1937_3_100 -------wget http://$1:9000/trans_buy_f1937_2 -------wget http://$1:9000/trans_add_f1938_4_150 -------wget http://$1:9000/trans_buy_f1938_3 -------wget http://$1:9000/trans_add_f1939_5_200 -------wget http://$1:9000/trans_buy_f1939_4 -------wget http://$1:9000/trans_add_f1940_1_50 -------wget http://$1:9000/trans_buy_f1940_0 -------wget http://$1:9000/trans_add_f1941_2_100 -------wget http://$1:9000/trans_buy_f1941_1 -------wget http://$1:9000/trans_add_f1942_3_150 -------wget http://$1:9000/trans_buy_f1942_2 -------wget http://$1:9000/trans_add_f1943_4_200 -------wget http://$1:9000/trans_buy_f1943_3 -------wget http://$1:9000/trans_add_f1944_5_50 -------wget http://$1:9000/trans_buy_f1944_4 -------wget http://$1:9000/trans_add_f1945_1_100 -------wget http://$1:9000/trans_buy_f1945_0 -------wget http://$1:9000/trans_add_f1946_2_150 -------wget http://$1:9000/trans_buy_f1946_1 -------wget http://$1:9000/trans_add_f1947_3_200 -------wget http://$1:9000/trans_buy_f1947_2 -------wget http://$1:9000/trans_add_f1948_4_50 -------wget http://$1:9000/trans_buy_f1948_3 -------wget http://$1:9000/trans_add_f1949_5_100 -------wget http://$1:9000/trans_buy_f1949_4 -------wget http://$1:9000/trans_add_f1950_1_150 -------wget http://$1:9000/trans_buy_f1950_0 -------wget http://$1:9000/trans_add_f1951_2_200 -------wget http://$1:9000/trans_buy_f1951_1 -------wget http://$1:9000/trans_add_f1952_3_50 -------wget http://$1:9000/trans_buy_f1952_2 -------wget http://$1:9000/trans_add_f1953_4_100 -------wget http://$1:9000/trans_buy_f1953_3 -------wget http://$1:9000/trans_add_f1954_5_150 -------wget http://$1:9000/trans_buy_f1954_4 -------wget http://$1:9000/trans_add_f1955_1_200 -------wget http://$1:9000/trans_buy_f1955_0 -------wget http://$1:9000/trans_add_f1956_2_50 -------wget http://$1:9000/trans_buy_f1956_1 -------wget http://$1:9000/trans_add_f1957_3_100 -------wget http://$1:9000/trans_buy_f1957_2 -------wget http://$1:9000/trans_add_f1958_4_150 -------wget http://$1:9000/trans_buy_f1958_3 -------wget http://$1:9000/trans_add_f1959_5_200 -------wget http://$1:9000/trans_buy_f1959_4 -------wget http://$1:9000/trans_add_f1960_1_50 -------wget http://$1:9000/trans_buy_f1960_0 -------wget http://$1:9000/trans_add_f1961_2_100 -------wget http://$1:9000/trans_buy_f1961_1 -------wget http://$1:9000/trans_add_f1962_3_150 -------wget http://$1:9000/trans_buy_f1962_2 -------wget http://$1:9000/trans_add_f1963_4_200 -------wget http://$1:9000/trans_buy_f1963_3 -------wget http://$1:9000/trans_add_f1964_5_50 -------wget http://$1:9000/trans_buy_f1964_4 -------wget http://$1:9000/trans_add_f1965_1_100 -------wget http://$1:9000/trans_buy_f1965_0 -------wget http://$1:9000/trans_add_f1966_2_150 -------wget http://$1:9000/trans_buy_f1966_1 -------wget http://$1:9000/trans_add_f1967_3_200 -------wget http://$1:9000/trans_buy_f1967_2 -------wget http://$1:9000/trans_add_f1968_4_50 -------wget http://$1:9000/trans_buy_f1968_3 -------wget http://$1:9000/trans_add_f1969_5_100 -------wget http://$1:9000/trans_buy_f1969_4 -------wget http://$1:9000/trans_add_f1970_1_150 -------wget http://$1:9000/trans_buy_f1970_0 -------wget http://$1:9000/trans_add_f1971_2_200 -------wget http://$1:9000/trans_buy_f1971_1 -------wget http://$1:9000/trans_add_f1972_3_50 -------wget http://$1:9000/trans_buy_f1972_2 -------wget http://$1:9000/trans_add_f1973_4_100 -------wget http://$1:9000/trans_buy_f1973_3 -------wget http://$1:9000/trans_add_f1974_5_150 -------wget http://$1:9000/trans_buy_f1974_4 -------wget http://$1:9000/trans_add_f1975_1_200 -------wget http://$1:9000/trans_buy_f1975_0 -------wget http://$1:9000/trans_add_f1976_2_50 -------wget http://$1:9000/trans_buy_f1976_1 -------wget http://$1:9000/trans_add_f1977_3_100 -------wget http://$1:9000/trans_buy_f1977_2 -------wget http://$1:9000/trans_add_f1978_4_150 -------wget http://$1:9000/trans_buy_f1978_3 -------wget http://$1:9000/trans_add_f1979_5_200 -------wget http://$1:9000/trans_buy_f1979_4 -------wget http://$1:9000/trans_add_f1980_1_50 -------wget http://$1:9000/trans_buy_f1980_0 -------wget http://$1:9000/trans_add_f1981_2_100 -------wget http://$1:9000/trans_buy_f1981_1 -------wget http://$1:9000/trans_add_f1982_3_150 -------wget http://$1:9000/trans_buy_f1982_2 -------wget http://$1:9000/trans_add_f1983_4_200 -------wget http://$1:9000/trans_buy_f1983_3 -------wget http://$1:9000/trans_add_f1984_5_50 -------wget http://$1:9000/trans_buy_f1984_4 -------wget http://$1:9000/trans_add_f1985_1_100 -------wget http://$1:9000/trans_buy_f1985_0 -------wget http://$1:9000/trans_add_f1986_2_150 -------wget http://$1:9000/trans_buy_f1986_1 -------wget http://$1:9000/trans_add_f1987_3_200 -------wget http://$1:9000/trans_buy_f1987_2 -------wget http://$1:9000/trans_add_f1988_4_50 -------wget http://$1:9000/trans_buy_f1988_3 -------wget http://$1:9000/trans_add_f1989_5_100 -------wget http://$1:9000/trans_buy_f1989_4 -------wget http://$1:9000/trans_add_f1990_1_150 -------wget http://$1:9000/trans_buy_f1990_0 -------wget http://$1:9000/trans_add_f1991_2_200 -------wget http://$1:9000/trans_buy_f1991_1 -------wget http://$1:9000/trans_add_f1992_3_50 -------wget http://$1:9000/trans_buy_f1992_2 -------wget http://$1:9000/trans_add_f1993_4_100 -------wget http://$1:9000/trans_buy_f1993_3 -------wget http://$1:9000/trans_add_f1994_5_150 -------wget http://$1:9000/trans_buy_f1994_4 -------wget http://$1:9000/trans_add_f1995_1_200 -------wget http://$1:9000/trans_buy_f1995_0 -------wget http://$1:9000/trans_add_f1996_2_50 -------wget http://$1:9000/trans_buy_f1996_1 -------wget http://$1:9000/trans_add_f1997_3_100 -------wget http://$1:9000/trans_buy_f1997_2 -------wget http://$1:9000/trans_add_f1998_4_150 -------wget http://$1:9000/trans_buy_f1998_3 -------wget http://$1:9000/trans_add_f1999_5_200 -------wget http://$1:9000/trans_buy_f1999_4 -------wget http://$1:9000/trans_add_f2000_1_50 -------wget http://$1:9000/trans_buy_f2000_0 -------wget http://$1:9000/trans_add_f2001_2_100 -------wget http://$1:9000/trans_buy_f2001_1 -------wget http://$1:9000/trans_add_f2002_3_150 -------wget http://$1:9000/trans_buy_f2002_2 -------wget http://$1:9000/trans_add_f2003_4_200 -------wget http://$1:9000/trans_buy_f2003_3 -------wget http://$1:9000/trans_add_f2004_5_50 -------wget http://$1:9000/trans_buy_f2004_4 -------wget http://$1:9000/trans_add_f2005_1_100 -------wget http://$1:9000/trans_buy_f2005_0 -------wget http://$1:9000/trans_add_f2006_2_150 -------wget http://$1:9000/trans_buy_f2006_1 -------wget http://$1:9000/trans_add_f2007_3_200 -------wget http://$1:9000/trans_buy_f2007_2 -------wget http://$1:9000/trans_add_f2008_4_50 -------wget http://$1:9000/trans_buy_f2008_3 -------wget http://$1:9000/trans_add_f2009_5_100 -------wget http://$1:9000/trans_buy_f2009_4 -------wget http://$1:9000/trans_add_f2010_1_150 -------wget http://$1:9000/trans_buy_f2010_0 -------wget http://$1:9000/trans_add_f2011_2_200 -------wget http://$1:9000/trans_buy_f2011_1 -------wget http://$1:9000/trans_add_f2012_3_50 -------wget http://$1:9000/trans_buy_f2012_2 -------wget http://$1:9000/trans_add_f2013_4_100 -------wget http://$1:9000/trans_buy_f2013_3 -------wget http://$1:9000/trans_add_f2014_5_150 -------wget http://$1:9000/trans_buy_f2014_4 -------wget http://$1:9000/trans_add_f2015_1_200 -------wget http://$1:9000/trans_buy_f2015_0 -------wget http://$1:9000/trans_add_f2016_2_50 -------wget http://$1:9000/trans_buy_f2016_1 -------wget http://$1:9000/trans_add_f2017_3_100 -------wget http://$1:9000/trans_buy_f2017_2 -------wget http://$1:9000/trans_add_f2018_4_150 -------wget http://$1:9000/trans_buy_f2018_3 -------wget http://$1:9000/trans_add_f2019_5_200 -------wget http://$1:9000/trans_buy_f2019_4 -------wget http://$1:9000/trans_add_f2020_1_50 -------wget http://$1:9000/trans_buy_f2020_0 -------wget http://$1:9000/trans_add_f2021_2_100 -------wget http://$1:9000/trans_buy_f2021_1 -------wget http://$1:9000/trans_add_f2022_3_150 -------wget http://$1:9000/trans_buy_f2022_2 -------wget http://$1:9000/trans_add_f2023_4_200 -------wget http://$1:9000/trans_buy_f2023_3 -------wget http://$1:9000/trans_add_f2024_5_50 -------wget http://$1:9000/trans_buy_f2024_4 -------wget http://$1:9000/trans_add_f2025_1_100 -------wget http://$1:9000/trans_buy_f2025_0 -------wget http://$1:9000/trans_add_f2026_2_150 -------wget http://$1:9000/trans_buy_f2026_1 -------wget http://$1:9000/trans_add_f2027_3_200 -------wget http://$1:9000/trans_buy_f2027_2 -------wget http://$1:9000/trans_add_f2028_4_50 -------wget http://$1:9000/trans_buy_f2028_3 -------wget http://$1:9000/trans_add_f2029_5_100 -------wget http://$1:9000/trans_buy_f2029_4 -------wget http://$1:9000/trans_add_f2030_1_150 -------wget http://$1:9000/trans_buy_f2030_0 -------wget http://$1:9000/trans_add_f2031_2_200 -------wget http://$1:9000/trans_buy_f2031_1 -------wget http://$1:9000/trans_add_f2032_3_50 -------wget http://$1:9000/trans_buy_f2032_2 -------wget http://$1:9000/trans_add_f2033_4_100 -------wget http://$1:9000/trans_buy_f2033_3 -------wget http://$1:9000/trans_add_f2034_5_150 -------wget http://$1:9000/trans_buy_f2034_4 -------wget http://$1:9000/trans_add_f2035_1_200 -------wget http://$1:9000/trans_buy_f2035_0 -------wget http://$1:9000/trans_add_f2036_2_50 -------wget http://$1:9000/trans_buy_f2036_1 -------wget http://$1:9000/trans_add_f2037_3_100 -------wget http://$1:9000/trans_buy_f2037_2 -------wget http://$1:9000/trans_add_f2038_4_150 -------wget http://$1:9000/trans_buy_f2038_3 -------wget http://$1:9000/trans_add_f2039_5_200 -------wget http://$1:9000/trans_buy_f2039_4 -------wget http://$1:9000/trans_add_f2040_1_50 -------wget http://$1:9000/trans_buy_f2040_0 -------wget http://$1:9000/trans_add_f2041_2_100 -------wget http://$1:9000/trans_buy_f2041_1 -------wget http://$1:9000/trans_add_f2042_3_150 -------wget http://$1:9000/trans_buy_f2042_2 -------wget http://$1:9000/trans_add_f2043_4_200 -------wget http://$1:9000/trans_buy_f2043_3 -------wget http://$1:9000/trans_add_f2044_5_50 -------wget http://$1:9000/trans_buy_f2044_4 -------wget http://$1:9000/trans_add_f2045_1_100 -------wget http://$1:9000/trans_buy_f2045_0 -------wget http://$1:9000/trans_add_f2046_2_150 -------wget http://$1:9000/trans_buy_f2046_1 -------wget http://$1:9000/trans_add_f2047_3_200 -------wget http://$1:9000/trans_buy_f2047_2 -------wget http://$1:9000/trans_add_f2048_4_50 -------wget http://$1:9000/trans_buy_f2048_3 -------wget http://$1:9000/trans_add_f2049_5_100 -------wget http://$1:9000/trans_buy_f2049_4 -------wget http://$1:9000/trans_add_f2050_1_150 -------wget http://$1:9000/trans_buy_f2050_0 -------wget http://$1:9000/trans_add_f2051_2_200 -------wget http://$1:9000/trans_buy_f2051_1 -------wget http://$1:9000/trans_add_f2052_3_50 -------wget http://$1:9000/trans_buy_f2052_2 -------wget http://$1:9000/trans_add_f2053_4_100 -------wget http://$1:9000/trans_buy_f2053_3 -------wget http://$1:9000/trans_add_f2054_5_150 -------wget http://$1:9000/trans_buy_f2054_4 -------wget http://$1:9000/trans_add_f2055_1_200 -------wget http://$1:9000/trans_buy_f2055_0 -------wget http://$1:9000/trans_add_f2056_2_50 -------wget http://$1:9000/trans_buy_f2056_1 -------wget http://$1:9000/trans_add_f2057_3_100 -------wget http://$1:9000/trans_buy_f2057_2 -------wget http://$1:9000/trans_add_f2058_4_150 -------wget http://$1:9000/trans_buy_f2058_3 -------wget http://$1:9000/trans_add_f2059_5_200 -------wget http://$1:9000/trans_buy_f2059_4 -------wget http://$1:9000/trans_add_f2060_1_50 -------wget http://$1:9000/trans_buy_f2060_0 -------wget http://$1:9000/trans_add_f2061_2_100 -------wget http://$1:9000/trans_buy_f2061_1 -------wget http://$1:9000/trans_add_f2062_3_150 -------wget http://$1:9000/trans_buy_f2062_2 -------wget http://$1:9000/trans_add_f2063_4_200 -------wget http://$1:9000/trans_buy_f2063_3 -------wget http://$1:9000/trans_add_f2064_5_50 -------wget http://$1:9000/trans_buy_f2064_4 -------wget http://$1:9000/trans_add_f2065_1_100 -------wget http://$1:9000/trans_buy_f2065_0 -------wget http://$1:9000/trans_add_f2066_2_150 -------wget http://$1:9000/trans_buy_f2066_1 -------wget http://$1:9000/trans_add_f2067_3_200 -------wget http://$1:9000/trans_buy_f2067_2 -------wget http://$1:9000/trans_add_f2068_4_50 -------wget http://$1:9000/trans_buy_f2068_3 -------wget http://$1:9000/trans_add_f2069_5_100 -------wget http://$1:9000/trans_buy_f2069_4 -------wget http://$1:9000/trans_add_f2070_1_150 -------wget http://$1:9000/trans_buy_f2070_0 -------wget http://$1:9000/trans_add_f2071_2_200 -------wget http://$1:9000/trans_buy_f2071_1 -------wget http://$1:9000/trans_add_f2072_3_50 -------wget http://$1:9000/trans_buy_f2072_2 -------wget http://$1:9000/trans_add_f2073_4_100 -------wget http://$1:9000/trans_buy_f2073_3 -------wget http://$1:9000/trans_add_f2074_5_150 -------wget http://$1:9000/trans_buy_f2074_4 -------wget http://$1:9000/trans_add_f2075_1_200 -------wget http://$1:9000/trans_buy_f2075_0 -------wget http://$1:9000/trans_add_f2076_2_50 -------wget http://$1:9000/trans_buy_f2076_1 -------wget http://$1:9000/trans_add_f2077_3_100 -------wget http://$1:9000/trans_buy_f2077_2 -------wget http://$1:9000/trans_add_f2078_4_150 -------wget http://$1:9000/trans_buy_f2078_3 -------wget http://$1:9000/trans_add_f2079_5_200 -------wget http://$1:9000/trans_buy_f2079_4 -------wget http://$1:9000/trans_add_f2080_1_50 -------wget http://$1:9000/trans_buy_f2080_0 -------wget http://$1:9000/trans_add_f2081_2_100 -------wget http://$1:9000/trans_buy_f2081_1 -------wget http://$1:9000/trans_add_f2082_3_150 -------wget http://$1:9000/trans_buy_f2082_2 -------wget http://$1:9000/trans_add_f2083_4_200 -------wget http://$1:9000/trans_buy_f2083_3 -------wget http://$1:9000/trans_add_f2084_5_50 -------wget http://$1:9000/trans_buy_f2084_4 -------wget http://$1:9000/trans_add_f2085_1_100 -------wget http://$1:9000/trans_buy_f2085_0 -------wget http://$1:9000/trans_add_f2086_2_150 -------wget http://$1:9000/trans_buy_f2086_1 -------wget http://$1:9000/trans_add_f2087_3_200 -------wget http://$1:9000/trans_buy_f2087_2 -------wget http://$1:9000/trans_add_f2088_4_50 -------wget http://$1:9000/trans_buy_f2088_3 -------wget http://$1:9000/trans_add_f2089_5_100 -------wget http://$1:9000/trans_buy_f2089_4 -------wget http://$1:9000/trans_add_f2090_1_150 -------wget http://$1:9000/trans_buy_f2090_0 -------wget http://$1:9000/trans_add_f2091_2_200 -------wget http://$1:9000/trans_buy_f2091_1 -------wget http://$1:9000/trans_add_f2092_3_50 -------wget http://$1:9000/trans_buy_f2092_2 -------wget http://$1:9000/trans_add_f2093_4_100 -------wget http://$1:9000/trans_buy_f2093_3 -------wget http://$1:9000/trans_add_f2094_5_150 -------wget http://$1:9000/trans_buy_f2094_4 -------wget http://$1:9000/trans_add_f2095_1_200 -------wget http://$1:9000/trans_buy_f2095_0 -------wget http://$1:9000/trans_add_f2096_2_50 -------wget http://$1:9000/trans_buy_f2096_1 -------wget http://$1:9000/trans_add_f2097_3_100 -------wget http://$1:9000/trans_buy_f2097_2 -------wget http://$1:9000/trans_add_f2098_4_150 -------wget http://$1:9000/trans_buy_f2098_3 -------wget http://$1:9000/trans_add_f2099_5_200 -------wget http://$1:9000/trans_buy_f2099_4 -------wget http://$1:9000/trans_add_f2100_1_50 -------wget http://$1:9000/trans_buy_f2100_0 -------wget http://$1:9000/trans_add_f2101_2_100 -------wget http://$1:9000/trans_buy_f2101_1 -------wget http://$1:9000/trans_add_f2102_3_150 -------wget http://$1:9000/trans_buy_f2102_2 -------wget http://$1:9000/trans_add_f2103_4_200 -------wget http://$1:9000/trans_buy_f2103_3 -------wget http://$1:9000/trans_add_f2104_5_50 -------wget http://$1:9000/trans_buy_f2104_4 -------wget http://$1:9000/trans_add_f2105_1_100 -------wget http://$1:9000/trans_buy_f2105_0 -------wget http://$1:9000/trans_add_f2106_2_150 -------wget http://$1:9000/trans_buy_f2106_1 -------wget http://$1:9000/trans_add_f2107_3_200 -------wget http://$1:9000/trans_buy_f2107_2 -------wget http://$1:9000/trans_add_f2108_4_50 -------wget http://$1:9000/trans_buy_f2108_3 -------wget http://$1:9000/trans_add_f2109_5_100 -------wget http://$1:9000/trans_buy_f2109_4 -------wget http://$1:9000/trans_add_f2110_1_150 -------wget http://$1:9000/trans_buy_f2110_0 -------wget http://$1:9000/trans_add_f2111_2_200 -------wget http://$1:9000/trans_buy_f2111_1 -------wget http://$1:9000/trans_add_f2112_3_50 -------wget http://$1:9000/trans_buy_f2112_2 -------wget http://$1:9000/trans_add_f2113_4_100 -------wget http://$1:9000/trans_buy_f2113_3 -------wget http://$1:9000/trans_add_f2114_5_150 -------wget http://$1:9000/trans_buy_f2114_4 -------wget http://$1:9000/trans_add_f2115_1_200 -------wget http://$1:9000/trans_buy_f2115_0 -------wget http://$1:9000/trans_add_f2116_2_50 -------wget http://$1:9000/trans_buy_f2116_1 -------wget http://$1:9000/trans_add_f2117_3_100 -------wget http://$1:9000/trans_buy_f2117_2 -------wget http://$1:9000/trans_add_f2118_4_150 -------wget http://$1:9000/trans_buy_f2118_3 -------wget http://$1:9000/trans_add_f2119_5_200 -------wget http://$1:9000/trans_buy_f2119_4 -------wget http://$1:9000/trans_add_f2120_1_50 -------wget http://$1:9000/trans_buy_f2120_0 -------wget http://$1:9000/trans_add_f2121_2_100 -------wget http://$1:9000/trans_buy_f2121_1 -------wget http://$1:9000/trans_add_f2122_3_150 -------wget http://$1:9000/trans_buy_f2122_2 -------wget http://$1:9000/trans_add_f2123_4_200 -------wget http://$1:9000/trans_buy_f2123_3 -------wget http://$1:9000/trans_add_f2124_5_50 -------wget http://$1:9000/trans_buy_f2124_4 -------wget http://$1:9000/trans_add_f2125_1_100 -------wget http://$1:9000/trans_buy_f2125_0 -------wget http://$1:9000/trans_add_f2126_2_150 -------wget http://$1:9000/trans_buy_f2126_1 -------wget http://$1:9000/trans_add_f2127_3_200 -------wget http://$1:9000/trans_buy_f2127_2 -------wget http://$1:9000/trans_add_f2128_4_50 -------wget http://$1:9000/trans_buy_f2128_3 -------wget http://$1:9000/trans_add_f2129_5_100 -------wget http://$1:9000/trans_buy_f2129_4 -------wget http://$1:9000/trans_add_f2130_1_150 -------wget http://$1:9000/trans_buy_f2130_0 -------wget http://$1:9000/trans_add_f2131_2_200 -------wget http://$1:9000/trans_buy_f2131_1 -------wget http://$1:9000/trans_add_f2132_3_50 -------wget http://$1:9000/trans_buy_f2132_2 -------wget http://$1:9000/trans_add_f2133_4_100 -------wget http://$1:9000/trans_buy_f2133_3 -------wget http://$1:9000/trans_add_f2134_5_150 -------wget http://$1:9000/trans_buy_f2134_4 -------wget http://$1:9000/trans_add_f2135_1_200 -------wget http://$1:9000/trans_buy_f2135_0 -------wget http://$1:9000/trans_add_f2136_2_50 -------wget http://$1:9000/trans_buy_f2136_1 -------wget http://$1:9000/trans_add_f2137_3_100 -------wget http://$1:9000/trans_buy_f2137_2 -------wget http://$1:9000/trans_add_f2138_4_150 -------wget http://$1:9000/trans_buy_f2138_3 -------wget http://$1:9000/trans_add_f2139_5_200 -------wget http://$1:9000/trans_buy_f2139_4 -------wget http://$1:9000/trans_add_f2140_1_50 -------wget http://$1:9000/trans_buy_f2140_0 -------wget http://$1:9000/trans_add_f2141_2_100 -------wget http://$1:9000/trans_buy_f2141_1 -------wget http://$1:9000/trans_add_f2142_3_150 -------wget http://$1:9000/trans_buy_f2142_2 -------wget http://$1:9000/trans_add_f2143_4_200 -------wget http://$1:9000/trans_buy_f2143_3 -------wget http://$1:9000/trans_add_f2144_5_50 -------wget http://$1:9000/trans_buy_f2144_4 -------wget http://$1:9000/trans_add_f2145_1_100 -------wget http://$1:9000/trans_buy_f2145_0 -------wget http://$1:9000/trans_add_f2146_2_150 -------wget http://$1:9000/trans_buy_f2146_1 -------wget http://$1:9000/trans_add_f2147_3_200 -------wget http://$1:9000/trans_buy_f2147_2 -------wget http://$1:9000/trans_add_f2148_4_50 -------wget http://$1:9000/trans_buy_f2148_3 -------wget http://$1:9000/trans_add_f2149_5_100 -------wget http://$1:9000/trans_buy_f2149_4 -------wget http://$1:9000/trans_add_f2150_1_150 -------wget http://$1:9000/trans_buy_f2150_0 -------wget http://$1:9000/trans_add_f2151_2_200 -------wget http://$1:9000/trans_buy_f2151_1 -------wget http://$1:9000/trans_add_f2152_3_50 -------wget http://$1:9000/trans_buy_f2152_2 -------wget http://$1:9000/trans_add_f2153_4_100 -------wget http://$1:9000/trans_buy_f2153_3 -------wget http://$1:9000/trans_add_f2154_5_150 -------wget http://$1:9000/trans_buy_f2154_4 -------wget http://$1:9000/trans_add_f2155_1_200 -------wget http://$1:9000/trans_buy_f2155_0 -------wget http://$1:9000/trans_add_f2156_2_50 -------wget http://$1:9000/trans_buy_f2156_1 -------wget http://$1:9000/trans_add_f2157_3_100 -------wget http://$1:9000/trans_buy_f2157_2 -------wget http://$1:9000/trans_add_f2158_4_150 -------wget http://$1:9000/trans_buy_f2158_3 -------wget http://$1:9000/trans_add_f2159_5_200 -------wget http://$1:9000/trans_buy_f2159_4 -------wget http://$1:9000/trans_add_f2160_1_50 -------wget http://$1:9000/trans_buy_f2160_0 -------wget http://$1:9000/trans_add_f2161_2_100 -------wget http://$1:9000/trans_buy_f2161_1 -------wget http://$1:9000/trans_add_f2162_3_150 -------wget http://$1:9000/trans_buy_f2162_2 -------wget http://$1:9000/trans_add_f2163_4_200 -------wget http://$1:9000/trans_buy_f2163_3 -------wget http://$1:9000/trans_add_f2164_5_50 -------wget http://$1:9000/trans_buy_f2164_4 -------wget http://$1:9000/trans_add_f2165_1_100 -------wget http://$1:9000/trans_buy_f2165_0 -------wget http://$1:9000/trans_add_f2166_2_150 -------wget http://$1:9000/trans_buy_f2166_1 -------wget http://$1:9000/trans_add_f2167_3_200 -------wget http://$1:9000/trans_buy_f2167_2 -------wget http://$1:9000/trans_add_f2168_4_50 -------wget http://$1:9000/trans_buy_f2168_3 -------wget http://$1:9000/trans_add_f2169_5_100 -------wget http://$1:9000/trans_buy_f2169_4 -------wget http://$1:9000/trans_add_f2170_1_150 -------wget http://$1:9000/trans_buy_f2170_0 -------wget http://$1:9000/trans_add_f2171_2_200 -------wget http://$1:9000/trans_buy_f2171_1 -------wget http://$1:9000/trans_add_f2172_3_50 -------wget http://$1:9000/trans_buy_f2172_2 -------wget http://$1:9000/trans_add_f2173_4_100 -------wget http://$1:9000/trans_buy_f2173_3 -------wget http://$1:9000/trans_add_f2174_5_150 -------wget http://$1:9000/trans_buy_f2174_4 -------wget http://$1:9000/trans_add_f2175_1_200 -------wget http://$1:9000/trans_buy_f2175_0 -------wget http://$1:9000/trans_add_f2176_2_50 -------wget http://$1:9000/trans_buy_f2176_1 -------wget http://$1:9000/trans_add_f2177_3_100 -------wget http://$1:9000/trans_buy_f2177_2 -------wget http://$1:9000/trans_add_f2178_4_150 -------wget http://$1:9000/trans_buy_f2178_3 -------wget http://$1:9000/trans_add_f2179_5_200 -------wget http://$1:9000/trans_buy_f2179_4 -------wget http://$1:9000/trans_add_f2180_1_50 -------wget http://$1:9000/trans_buy_f2180_0 -------wget http://$1:9000/trans_add_f2181_2_100 -------wget http://$1:9000/trans_buy_f2181_1 -------wget http://$1:9000/trans_add_f2182_3_150 -------wget http://$1:9000/trans_buy_f2182_2 -------wget http://$1:9000/trans_add_f2183_4_200 -------wget http://$1:9000/trans_buy_f2183_3 -------wget http://$1:9000/trans_add_f2184_5_50 -------wget http://$1:9000/trans_buy_f2184_4 -------wget http://$1:9000/trans_add_f2185_1_100 -------wget http://$1:9000/trans_buy_f2185_0 -------wget http://$1:9000/trans_add_f2186_2_150 -------wget http://$1:9000/trans_buy_f2186_1 -------wget http://$1:9000/trans_add_f2187_3_200 -------wget http://$1:9000/trans_buy_f2187_2 -------wget http://$1:9000/trans_add_f2188_4_50 -------wget http://$1:9000/trans_buy_f2188_3 -------wget http://$1:9000/trans_add_f2189_5_100 -------wget http://$1:9000/trans_buy_f2189_4 -------wget http://$1:9000/trans_add_f2190_1_150 -------wget http://$1:9000/trans_buy_f2190_0 -------wget http://$1:9000/trans_add_f2191_2_200 -------wget http://$1:9000/trans_buy_f2191_1 -------wget http://$1:9000/trans_add_f2192_3_50 -------wget http://$1:9000/trans_buy_f2192_2 -------wget http://$1:9000/trans_add_f2193_4_100 -------wget http://$1:9000/trans_buy_f2193_3 -------wget http://$1:9000/trans_add_f2194_5_150 -------wget http://$1:9000/trans_buy_f2194_4 -------wget http://$1:9000/trans_add_f2195_1_200 -------wget http://$1:9000/trans_buy_f2195_0 -------wget http://$1:9000/trans_add_f2196_2_50 -------wget http://$1:9000/trans_buy_f2196_1 -------wget http://$1:9000/trans_add_f2197_3_100 -------wget http://$1:9000/trans_buy_f2197_2 -------wget http://$1:9000/trans_add_f2198_4_150 -------wget http://$1:9000/trans_buy_f2198_3 -------wget http://$1:9000/trans_add_f2199_5_200 -------wget http://$1:9000/trans_buy_f2199_4 -------wget http://$1:9000/trans_inventory diff --cc Robust/src/Benchmarks/WebServer/Workload/workloaderror index b1c3d407,b1c3d407,b1c3d407,b1c3d407,b1c3d407,b1c3d407,b1c3d407..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/workloaderror +++ /dev/null @@@@@@@@ -1,101 -1,101 -1,101 -1,101 -1,101 -1,101 -1,101 +1,0 @@@@@@@@ -------#!/bin/bash -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preperfume_39_50 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 -------wget http://$1:9000/trans_buy_predvd_15_19 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_preroses_15_4 -------wget http://$1:9000/trans_add_predvd_78_19 -------wget http://$1:9000/trans_buy_preperfume_9_50 diff --cc Robust/src/Benchmarks/WebServer/Workload/workloadfile1000 index 29dce06e,29dce06e,29dce06e,29dce06e,29dce06e,29dce06e,29dce06e..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadfile1000 +++ /dev/null @@@@@@@@ -1,1000 -1,1000 -1,1000 -1,1000 -1,1000 -1,1000 -1,1000 +1,0 @@@@@@@@ -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 diff --cc Robust/src/Benchmarks/WebServer/Workload/workloadmix1000 index d6d1746f,d6d1746f,d6d1746f,d6d1746f,d6d1746f,d6d1746f,d6d1746f..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadmix1000 +++ /dev/null @@@@@@@@ -1,1000 -1,1000 -1,1000 -1,1000 -1,1000 -1,1000 -1,1000 +1,0 @@@@@@@@ -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.3 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/index.html -------wget http://$1:9000/index1.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/index1.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index3.html -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/index1.html -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index2.html -------wget http://$1:9000/index.html.1 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index3.html -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index2.html -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/index.html.2 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory diff --cc Robust/src/Benchmarks/WebServer/Workload/workloadtrans index b81da8f1,b81da8f1,b81da8f1,b81da8f1,b81da8f1,b81da8f1,b81da8f1..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadtrans +++ /dev/null @@@@@@@@ -1,101 -1,101 -1,101 -1,101 -1,101 -1,101 -1,101 +1,0 @@@@@@@@ -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory diff --cc Robust/src/Benchmarks/WebServer/Workload/workloadtrans1000 index dc509b5f,dc509b5f,dc509b5f,dc509b5f,dc509b5f,dc509b5f,dc509b5f..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadtrans1000 +++ /dev/null @@@@@@@@ -1,980 -1,980 -1,980 -1,980 -1,980 -1,980 -1,980 +1,0 @@@@@@@@ -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_book_2 -------wget http://$1:9000/trans_buy_soap_2 -------wget http://$1:9000/trans_buy_pen_22 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_1 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_20_3 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_bread_10000_4 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_add_car_20_15000 -------wget http://$1:9000/trans_add_book_100_50 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_buy_soap_2000_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_15_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_car_1_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_15_10000 -------wget http://$1:9000/trans_add_car_1_10000 -------wget http://$1:9000/trans_add_car_1_10000 -------wget http://$1:9000/trans_add_car_1_10000 -------wget http://$1:9000/trans_add_car_1_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_buy_soap_2000_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_5_5 -------wget http://$1:9000/trans_add_pen_0_5 -------wget http://$1:9000/trans_add_pen_300_5 -------wget http://$1:9000/trans_add_pen_45_5 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_add_soap_42_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_155_7 -------wget http://$1:9000/trans_buy_soap_200_7 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_add_bread_10_4 -------wget http://$1:9000/trans_add_bread_1340_4 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_bread_220 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_buy_soap_8 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_add_book_10_50 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_add_soap_2_7 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_add_car_2_10000 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_car_2_10000 -------wget http://$1:9000/trans_add_pen_50_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_add_coke_100_5 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_add_soap_20_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_soap_888 -------wget http://$1:9000/trans_add_soap_72_7 -------wget http://$1:9000/trans_inventory -------wget http://$1:9000/trans_buy_pen_11 diff --cc Robust/src/Benchmarks/WebServer/compileserver index 8070674f,8070674f,8070674f,8070674f,8070674f,8070674f,8070674f..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/compileserver +++ /dev/null @@@@@@@@ -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 +1,0 @@@@@@@@ -------#!/bin/bash -------./buildscripttaskerror trans WebServerSocket.java WebServerExample.java Logger.java ItemInfo.java Inventory.java diff --cc Robust/src/Benchmarks/WebServer/htmlfiles/index1.html index e46085cf,e46085cf,e46085cf,e46085cf,e46085cf,e46085cf,e46085cf..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/htmlfiles/index1.html +++ /dev/null @@@@@@@@ -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 +1,0 @@@@@@@@ -------Google ------- -------
Google

-------
Web    Images    VideoNew!    News    Maps    more » -------
 
  Advanced Search
  Preferences
  Language Tools


Advertising Programs - Business Solutions - About Google

©2006 Google

diff --cc Robust/src/Benchmarks/WebServer/htmlfiles/index2.html index b545ec08,b545ec08,b545ec08,b545ec08,b545ec08,b545ec08,b545ec08..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServer/htmlfiles/index2.html +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ ------- ------- ------- Test HTML Document ------- ------- -------

Testing html file for display on web browser.

------- ------- diff --cc Robust/src/Benchmarks/WebServer/htmlfiles/request.log index 2e982db4,2e982db4,2e982db4,2e982db4,2e982db4,2e982db4,2e982db4..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Benchmarks/WebServer/htmlfiles/request.log +++ /dev/null @@@@@@@@ -1,16 -1,16 -1,16 -1,16 -1,16 -1,16 -1,16 +1,0 @@@@@@@@ ------- -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html -------New Request received: favicon.ico -------New Request received: index2.html diff --cc Robust/src/Benchmarks/WebServerJ/Inventory.java index 570ac6b8,570ac6b8,570ac6b8,570ac6b8,570ac6b8,570ac6b8,570ac6b8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJ/Inventory.java +++ /dev/null @@@@@@@@ -1,94 -1,94 -1,94 -1,94 -1,94 -1,94 -1,94 +1,0 @@@@@@@@ -------import java.util.*; -------import java.net.*; -------import java.io.*; ------- -------public class Inventory { ------- // Transaction variables ------- int numitems; ------- HashMap map; ------- int balance; ------- ------- // Constructor ------- public Inventory(){ ------- map = new HashMap(); ------- balance=100000; ------- } ------- ------- public Inventory(int howmany) { ------- numitems = howmany;// howmany keeps track of the number of items ------- // in the inventory ------- map = new HashMap(); ------- } ------- ------- // Add item to a list of inventory ------- public synchronized void additem(String name, int quantity, int price){ ------- ItemInfo newitem = new ItemInfo(quantity, price); ------- balance-=quantity*price; ------- ------- // Get the item from hash ------- if (map.containsKey(name) == false) { ------- map.put(name, newitem); ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- i.quantity += quantity; ------- i.price = price; ------- map.put(name, i); ------- } ------- } ------- ------- // Buy item from a given list of inventory ------- public synchronized int buyitem(String name, int quantity){ ------- if (map.containsKey(name) == false) { ------- // System.printString("Error - Item does not exist"); ------- return -1; ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- if (i.quantity == 0) { ------- // System.printString("Error - Item unavailable"); ------- return -1; ------- } ------- if ((i.quantity-quantity) < 0 ) { ------- // System.printString("Error - Available qty is less: Cannot Buy\n"); ------- return -1; ------- } else { ------- i.quantity -= quantity; ------- map.put(name, i); ------- balance+=quantity*i.price; ------- return i.price; ------- } ------- } ------- } ------- ------- //Display the inventory list ------- public synchronized void inventory(Socket s){ ------- try { ------- OutputStream sockout=s.getOutputStream(); ------- Iterator i = map.keySet().iterator();// Gets key from the hashmap= name of item ------- Iterator j = map.values().iterator();//Gets the value from hashmap ------- int totalvalue=balance; ------- while (i.hasNext() == true) { ------- StringBuffer sb = new StringBuffer(""); ------- Object o = i.next(); ------- String name = o.toString(); ------- ItemInfo oo = (ItemInfo) j.next(); ------- sb.append(name); ------- sb.append(" "); ------- Integer q = new Integer(oo.quantity); ------- sb.append(q.toString()); ------- sb.append(" "); ------- Integer p = new Integer(oo.price); ------- sb.append(p.toString()); ------- sb.append("\n"); ------- totalvalue+=oo.quantity*oo.price; ------- sockout.write(sb.toString().getBytes()); ------- } ------- StringBuffer sb=new StringBuffer(""); ------- sb.append("Total value: "); ------- sb.append((new Integer(totalvalue)).toString()); ------- sb.append("\n"); ------- sockout.write(sb.toString().getBytes()); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJ/ItemInfo.java index 18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJ/ItemInfo.java +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ -------class ItemInfo { ------- int quantity; ------- int price; ------- ItemInfo(int x, int y) { ------- quantity = x; ------- price = y; ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJ/Logger.java index 558c65f9,558c65f9,558c65f9,558c65f9,558c65f9,558c65f9,558c65f9..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJ/Logger.java +++ /dev/null @@@@@@@@ -1,46 -1,46 -1,46 -1,46 -1,46 -1,46 -1,46 +1,0 @@@@@@@@ -------import java.io.*; ------- -------public class Logger { ------- //Logger flag ------- FileOutputStream fos; ------- ------- ------- //Constructor ------- public Logger(){ ------- try { ------- fos=new FileOutputStream("request.log");//Open request.log file ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } ------- ------- //Logs filename as per client requests ------- public void logrequest(String filename){ ------- try { ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.write(filename.getBytes()); ------- fos.flush(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } ------- ------- public void logrequest(){ ------- try { ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.flush(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } ------- ------- public void closerequest() { ------- try { ------- fos.close(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJ/WebServerExample.java index c485b18e,c485b18e,c485b18e,c485b18e,c485b18e,c485b18e,c485b18e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJ/WebServerExample.java +++ /dev/null @@@@@@@@ -1,31 -1,31 -1,31 -1,31 -1,31 -1,31 -1,31 +1,0 @@@@@@@@ -------import java.net.*; ------- -------public class WebServerExample { ------- ------- public static void main(String arg[]) { ------- // Create New ServerSocket ------- // System.printString("W> Starting\n"); ------- ServerSocket ss=null; ------- try { ------- ss= new ServerSocket(9000); ------- } catch (Exception e){} ------- // System.printString("W> Creating ServerSocket\n"); ------- Logger log = new Logger(); ------- Inventory inventorylist = new Inventory(); ------- acceptConnection(ss, log, inventorylist); ------- } ------- ------- //Listen for a request and accept request ------- public static void acceptConnection(ServerSocket ss, Logger log, Inventory inventorylist) { ------- // System.printString("W> Waiting for connection...\n"); ------- while(true) { ------- Socket s=null; ------- try { ------- s=ss.accept(); ------- } catch (Exception e) {} ------- WebServerThread web = new WebServerThread(s, log, inventorylist); ------- web.start(); ------- // System.printString("W> Connected... \n"); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJ/WebServerThread.java index 329af8e2,329af8e2,329af8e2,329af8e2,329af8e2,329af8e2,329af8e2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJ/WebServerThread.java +++ /dev/null @@@@@@@@ -1,275 -1,275 -1,275 -1,275 -1,275 -1,275 -1,275 +1,0 @@@@@@@@ -------import java.io.*; -------import java.net.*; ------- -------public class WebServerThread extends Thread { ------- //Filename requested by the client ------- String filename; ------- String[] parsed; ------- String prefix; ------- Logger log; ------- Inventory inventorylist; ------- Socket sock; ------- InputStream sockin; ------- OutputStream sockout; ------- ------- //Constructor ------- public WebServerThread(Socket s, Logger log, Inventory inventory){ ------- parsed = new String[4]; ------- this.log=log; ------- this.sock=s; ------- try { ------- sockin=s.getInputStream(); ------- sockout=s.getOutputStream(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- this.inventorylist=inventory; ------- } ------- ------- public void run() { ------- // Process the incoming http request ------- while (!clientrequest()) { ------- } ------- if(checktrans()==false) { ------- // Not special transaction , do normal filesending ------- SendFile(); ------- LogRequest(); ------- } else { ------- // Invoke special inventory transaction ------- Transaction(); ------- LogRequest(); ------- } ------- } ------- ------- //Do the WriteIO on server socket and send the requested file to Client ------- public void SendFile() { ------- sendfile(); ------- try { ------- sock.close(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } ------- ------- // Log the Client request ------- public void LogRequest() { ------- log.logrequest(filename); ------- } ------- ------- //Transaction on Inventory ------- public void Transaction() { ------- // Parse ------- int op = parseTransaction(); ------- // Check for the kind of operation ------- if (op == 0 ) { /* Add */ ------- // System.printString("DEBUG > Calling add transaction\n"); ------- Integer qty = new Integer(parsed[2]); ------- Integer price = new Integer(parsed[3]); ------- inventorylist.additem(parsed[1], qty.intValue(), price.intValue()); ------- httpresponse(); ------- StringBuffer s = new StringBuffer("Added Item "); ------- s.append(parsed[1]); ------- s.append(" Quantity "); ------- s.append(parsed[2]); ------- s.append(" Price "); ------- s.append(parsed[3]); ------- s.append("\n"); ------- String towrite = new String(s); ------- try { ------- sockout.write(towrite.getBytes()); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } else if (op == 1) { /* Buy */ ------- // System.printString("DEBUG > Calling buy transaction\n"); ------- Integer qty = new Integer(parsed[2]); ------- int ret = inventorylist.buyitem(parsed[1], qty.intValue()); ------- if (ret >= 0) { ------- httpresponse(); ------- StringBuffer s = new StringBuffer("Bought item "); ------- s.append(parsed[1]); ------- s.append(" Quantity "); ------- s.append(parsed[2]); ------- s.append(" Cost "); ------- Integer cost = new Integer(ret*qty.intValue()); ------- String c = cost.toString(); ------- s.append(c); ------- String towrite = new String(s); ------- try { ------- sockout.write(towrite.getBytes()); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } else { ------- httpresponse(); ------- String s = new String("Error encountered"); ------- try { ------- sockout.write(s.getBytes()); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } ------- } else if (op == 2) { /* Inventory */ ------- // System.printString("DEBUG > Calling inventory transaction\n"); ------- httpresponse(); ------- inventorylist.inventory(sock); ------- } else { /* Error */ ------- // System.printString("T > Error - Unknown transaction\n"); ------- } ------- //Invoke close operations ------- try { ------- sock.close(); ------- } catch (Exception e) {e.printStackTrace();} ------- } ------- ------- ------- //Send the http header for web browser display ------- public void httpresponse(){ ------- StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); ------- header.append("Content-type: text/html\n"); ------- header.append("\n\n"); ------- String temp_str = new String(header); ------- try { ------- sockout.write(temp_str.getBytes()); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- return; ------- ------- } ------- ------- // Send the html file , read from file one byte at a time ------- public void sendfile() { ------- StringBuffer req_file = new StringBuffer("./htmlfiles/"); ------- req_file.append(filename); ------- String filepath = new String(req_file); ------- FileInputStream def_file = null; ------- try { ------- def_file=new FileInputStream(filepath); ------- } catch (FileNotFoundException e) { ------- } ------- // int status = def_file.getfd();//Checks if the file is present in ------- //current directory ------- httpresponse(); ------- if (def_file == null){ ------- StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if ------- // file not found ------- response.append(filename); ------- String buffer = new String(response); ------- try { ------- sockout.write(buffer.getBytes()); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- try { ------- def_file.close(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- return; ------- } ------- byte buf[] = new byte[16]; ------- int ret; ------- ------- try { ------- while ((ret = def_file.read(buf)) > 0) {// Read from file and write ------- // one byte at a time into the socket ------- byte tosend[] = new byte[ret]; ------- for (int i = 0; i < ret; i++) { ------- tosend[i] = buf[i]; ------- } ------- sockout.write(tosend); ------- //String str = new String(tosend); ------- } ------- def_file.close(); ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- } ------- ------- //Read the client request and extract the filename from it ------- public boolean clientrequest(){ ------- byte b1[] = new byte[1024]; ------- int numbytes=0; ------- try { ------- numbytes=sockin.read(b1);//Read client request from web server socket ------- } catch (Exception e) { ------- e.printStackTrace(); ------- } ------- String curr=(new String(b1)).substring(0, numbytes); ------- if (prefix!=null) { ------- StringBuffer sb=new StringBuffer(prefix); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- prefix=curr; ------- if(prefix.indexOf("\r\n\r\n")>=0) { ------- ------- int index = prefix.indexOf('/');//Parse the GET client request to find filename ------- int end = prefix.indexOf('H'); ------- filename = prefix.substring((index+1), (end-1)); ------- // System.printString("\n"); ------- return true; ------- } ------- return false; ------- } ------- ------- // Parse for the prefix in the client request ------- // This is helpful to find if the prefix is a special transaction ------- public boolean checktrans(){ ------- if (filename.startsWith("trans") == true) { ------- return true; ------- } else { ------- return false; ------- } ------- } ------- ------- //Parse for the substrings in the filename and use it to obtain the ------- //kind of operation, name of item, quantity of item, price of item ------- //e.g. trans_add_car_2_10000 is the filename ------- //store in the parsed[] string , add,car,2,1000 ------- public int parseTransaction(){ ------- int start = filename.indexOf('_'); ------- String s = filename.substring(start+1); ------- ------- if (s.startsWith("add")==true){ ------- // System.printString("DEBUG > ADD\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = new String(s.substring(0,i1)); ------- ------- int i2 = s.indexOf('_',i1+1); ------- parsed[1] = new String(s.substring(i1+1,i2)); ------- ------- int i3 = s.indexOf('_',i2+1); ------- parsed[2] = new String(s.substring(i2+1,i3)); ------- ------- String s3 = s.substring(i3+1); ------- parsed[3] = s3; ------- ------- return 0; ------- ------- } ------- if (s.startsWith("buy")==true){ ------- // System.printString("DEBUG > BUY\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = s.substring(0,i1); ------- ------- int i2 = s.indexOf('_', i1+1); ------- parsed[1] = s.substring(i1+1,i2); ------- ------- String s2 = s.substring(i2+1); ------- parsed[2] = s2; ------- ------- parsed[3] = ""; ------- ------- return 1; ------- } ------- if (s.startsWith("inventory")==true){ ------- // System.printString("DEBUG > INVENTORY\n"); ------- return 2; ------- ------- } ------- // Error transaction ------- return -1; ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJava/Inventory.java index 4c839535,4c839535,4c839535,4c839535,4c839535,4c839535,4c839535..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJava/Inventory.java +++ /dev/null @@@@@@@@ -1,87 -1,87 -1,87 -1,87 -1,87 -1,87 -1,87 +1,0 @@@@@@@@ -------public class Inventory { ------- // Transaction variables ------- int numitems; ------- HashMap map; ------- int balance; ------- ------- // Constructor ------- public Inventory(){ ------- map = new HashMap(); ------- balance=100000; ------- } ------- ------- public Inventory(int howmany) { ------- numitems = howmany;// howmany keeps track of the number of items ------- // in the inventory ------- map = new HashMap(); ------- } ------- ------- // Add item to a list of inventory ------- public synchronized int additem(String name, int quantity, int price){ ------- ItemInfo newitem = new ItemInfo(quantity, price); ------- balance-=quantity*price; ------- ------- // Get the item from hash ------- if (map.containsKey(name) == false) { ------- map.put(name, newitem); ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- i.quantity += quantity; ------- i.price = price; ------- map.put(name, i); ------- } ------- return 0; ------- } ------- ------- // Buy item from a given list of inventory ------- public synchronized int buyitem(String name, int quantity){ ------- if (map.containsKey(name) == false) { ------- // System.printString("Error - Item does not exist"); ------- return -1; ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- if (i.quantity == 0) { ------- // System.printString("Error - Item unavailable"); ------- return -1; ------- } ------- if ((i.quantity-quantity) < 0 ) { ------- // System.printString("Error - Available qty is less: Cannot Buy\n"); ------- return -1; ------- } else { ------- i.quantity -= quantity; ------- map.put(name, i); ------- balance+=quantity*i.price; ------- return i.price; ------- } ------- } ------- return 0; ------- } ------- ------- //Display the inventory list ------- public synchronized void inventory(Socket s){ ------- HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item ------- HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap ------- int totalvalue=balance; ------- while (i.hasNext() == true) { ------- StringBuffer sb = new StringBuffer(""); ------- Object o = i.next(); ------- String name = o.toString(); ------- ItemInfo oo = (ItemInfo) j.next(); ------- sb.append(name); ------- sb.append(" "); ------- Integer q = new Integer(oo.quantity); ------- sb.append(q.toString()); ------- sb.append(" "); ------- Integer p = new Integer(oo.price); ------- sb.append(p.toString()); ------- sb.append("\n"); ------- totalvalue+=oo.quantity*oo.price; ------- s.write(sb.toString().getBytes()); ------- } ------- StringBuffer sb=new StringBuffer(""); ------- sb.append("Total value: "); ------- sb.append((new Integer(totalvalue)).toString()); ------- sb.append("\n"); ------- s.write(sb.toString().getBytes()); ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJava/ItemInfo.java index 18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJava/ItemInfo.java +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ -------class ItemInfo { ------- int quantity; ------- int price; ------- ItemInfo(int x, int y) { ------- quantity = x; ------- price = y; ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJava/Logger.java index 9e7d3aba,9e7d3aba,9e7d3aba,9e7d3aba,9e7d3aba,9e7d3aba,9e7d3aba..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJava/Logger.java +++ /dev/null @@@@@@@@ -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 +1,0 @@@@@@@@ -------public class Logger { ------- FileOutputStream fos; ------- ------- ------- //Constructor ------- public Logger(){ ------- fos=new FileOutputStream("request.log");//Open request.log file ------- } ------- ------- //Logs filename as per client requests ------- public synchronized void logrequest(String filename){ ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.write(filename.getBytes()); ------- fos.flush(); ------- } ------- ------- public synchronized void logrequest(){ ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.flush(); ------- } ------- ------- public void closerequest() { ------- fos.close(); ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJava/WebServerExampleJava.java index 0bb291fc,0bb291fc,0bb291fc,0bb291fc,0bb291fc,0bb291fc,0bb291fc..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJava/WebServerExampleJava.java +++ /dev/null @@@@@@@@ -1,23 -1,23 -1,23 -1,23 -1,23 -1,23 -1,23 +1,0 @@@@@@@@ -------public class WebServerExample { ------- ------- public static int main(String arg[]) { ------- // Create New ServerSocket ------- // System.printString("W> Starting\n"); ------- ServerSocket ss = new ServerSocket(9000); ------- // System.printString("W> Creating ServerSocket\n"); ------- Logger log = new Logger(); ------- Inventory inventorylist = new Inventory(); ------- acceptConnection(ss, log, inventorylist); ------- } ------- ------- //Listen for a request and accept request ------- public static void acceptConnection(ServerSocket ss, Logger log, Inventory inventorylist) { ------- // System.printString("W> Waiting for connection...\n"); ------- while(true) { ------- Socket s=ss.accept(); ------- WebServerThread web = new WebServerThread(s, log, inventorylist); ------- web.start(); ------- // System.printString("W> Connected... \n"); ------- } ------- } -------} diff --cc Robust/src/Benchmarks/WebServerJava/WebServerThread.java index 53782b5a,53782b5a,53782b5a,53782b5a,53782b5a,53782b5a,53782b5a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerJava/WebServerThread.java +++ /dev/null @@@@@@@@ -1,227 -1,227 -1,227 -1,227 -1,227 -1,227 -1,227 +1,0 @@@@@@@@ -------public class WebServerThread extends Thread { ------- //Filename requested by the client ------- String filename; ------- String[] parsed; ------- String prefix; ------- Logger log; ------- Inventory inventorylist; ------- Socket sock; ------- ------- //Constructor ------- public WebServerThread(Socket s, Logger log, Inventory inventory){ ------- parsed = new String[4]; ------- this.log=log; ------- this.sock=s; ------- this.inventorylist=inventory; ------- } ------- ------- public void run() { ------- // Process the incoming http request ------- while (!clientrequest()) { ------- } ------- if(checktrans()==false) { ------- // Not special transaction , do normal filesending ------- SendFile(); ------- LogRequest(); ------- } else { ------- // Invoke special inventory transaction ------- Transaction(); ------- LogRequest(); ------- } ------- } ------- ------- //Do the WriteIO on server socket and send the requested file to Client ------- public void SendFile() { ------- sendfile(); ------- sock.close(); ------- } ------- ------- // Log the Client request ------- public void LogRequest() { ------- log.logrequest(filename); ------- } ------- ------- //Transaction on Inventory ------- public void Transaction() { ------- // Parse ------- int op = parseTransaction(); ------- // Check for the kind of operation ------- if (op == 0 ) { /* Add */ ------- // System.printString("DEBUG > Calling add transaction\n"); ------- Integer qty = new Integer(parsed[2]); ------- Integer price = new Integer(parsed[3]); ------- int ret = inventorylist.additem(parsed[1], qty.intValue(), price.intValue()); ------- if (ret == 0) { ------- httpresponse(); ------- StringBuffer s = new StringBuffer("Added Item "); ------- s.append(parsed[1]); ------- s.append(" Quantity "); ------- s.append(parsed[2]); ------- s.append(" Price "); ------- s.append(parsed[3]); ------- s.append("\n"); ------- String towrite = new String(s); ------- sock.write(towrite.getBytes()); ------- } else { ------- httpresponse(); ------- String s = new String("Error encountered"); ------- sock.write(s.getBytes()); ------- } ------- } else if (op == 1) { /* Buy */ ------- // System.printString("DEBUG > Calling buy transaction\n"); ------- Integer qty = new Integer(parsed[2]); ------- int ret = inventorylist.buyitem(parsed[1], qty.intValue()); ------- if (ret >= 0) { ------- httpresponse(); ------- StringBuffer s = new StringBuffer("Bought item "); ------- s.append(parsed[1]); ------- s.append(" Quantity "); ------- s.append(parsed[2]); ------- s.append(" Cost "); ------- Integer cost = new Integer(ret*qty.intValue()); ------- String c = cost.toString(); ------- s.append(c); ------- String towrite = new String(s); ------- sock.write(towrite.getBytes()); ------- } else { ------- httpresponse(); ------- String s = new String("Error encountered"); ------- sock.write(s.getBytes()); ------- } ------- } else if (op == 2) { /* Inventory */ ------- // System.printString("DEBUG > Calling inventory transaction\n"); ------- httpresponse(); ------- inventorylist.inventory(sock); ------- } else { /* Error */ ------- // System.printString("T > Error - Unknown transaction\n"); ------- } ------- //Invoke close operations ------- sock.close(); ------- } ------- ------- ------- //Send the http header for web browser display ------- public void httpresponse(){ ------- StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); ------- header.append("Content-type: text/html\n"); ------- header.append("\n\n"); ------- String temp_str = new String(header); ------- sock.write(temp_str.getBytes()); ------- return; ------- ------- } ------- ------- // Send the html file , read from file one byte at a time ------- public void sendfile() { ------- StringBuffer req_file = new StringBuffer("./htmlfiles/"); ------- req_file.append(filename); ------- String filepath = new String(req_file); ------- FileInputStream def_file = new FileInputStream(filepath); ------- int status = def_file.getfd();//Checks if the file is present in ------- //current directory ------- httpresponse(); ------- if (status == -1){ ------- StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if ------- // file not found ------- response.append(filename); ------- String buffer = new String(response); ------- sock.write(buffer.getBytes()); ------- def_file.close(); ------- return; ------- } ------- byte buf[] = new byte[16]; ------- int ret; ------- ------- while ((ret = def_file.read(buf)) > 0) {// Read from file and write ------- // one byte at a time into the socket ------- byte tosend[] = new byte[ret]; ------- for (int i = 0; i < ret; i++) { ------- tosend[i] = buf[i]; ------- } ------- sock.write(tosend); ------- //String str = new String(tosend); ------- } ------- def_file.close(); ------- } ------- ------- //Read the client request and extract the filename from it ------- public boolean clientrequest(){ ------- byte b1[] = new byte[1024]; ------- int numbytes=sock.read(b1);//Read client request from web server socket ------- String curr=(new String(b1)).subString(0, numbytes); ------- if (prefix!=null) { ------- StringBuffer sb=new StringBuffer(prefix); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- prefix=curr; ------- if(prefix.indexOf("\r\n\r\n")>=0) { ------- ------- int index = prefix.indexOf('/');//Parse the GET client request to find filename ------- int end = prefix.indexOf('H'); ------- filename = prefix.subString((index+1), (end-1)); ------- // System.printString("\n"); ------- return true; ------- } ------- return false; ------- } ------- ------- // Parse for the prefix in the client request ------- // This is helpful to find if the prefix is a special transaction ------- public boolean checktrans(){ ------- if (filename.startsWith("trans") == true) { ------- return true; ------- } else { ------- return false; ------- } ------- } ------- ------- //Parse for the substrings in the filename and use it to obtain the ------- //kind of operation, name of item, quantity of item, price of item ------- //e.g. trans_add_car_2_10000 is the filename ------- //store in the parsed[] string , add,car,2,1000 ------- public int parseTransaction(){ ------- int start = filename.indexOf('_'); ------- String s = filename.subString(start+1); ------- ------- if (s.startsWith("add")==true){ ------- // System.printString("DEBUG > ADD\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = new String(s.subString(0,i1)); ------- ------- int i2 = s.indexOf('_',i1+1); ------- parsed[1] = new String(s.subString(i1+1,i2)); ------- ------- int i3 = s.indexOf('_',i2+1); ------- parsed[2] = new String(s.subString(i2+1,i3)); ------- ------- String s3 = s.subString(i3+1); ------- parsed[3] = s3; ------- ------- return 0; ------- ------- } ------- if (s.startsWith("buy")==true){ ------- // System.printString("DEBUG > BUY\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = s.subString(0,i1); ------- ------- int i2 = s.indexOf('_', i1+1); ------- parsed[1] = s.subString(i1+1,i2); ------- ------- String s2 = s.subString(i2+1); ------- parsed[2] = s2; ------- ------- parsed[3] = ""; ------- ------- return 1; ------- } ------- if (s.startsWith("inventory")==true){ ------- // System.printString("DEBUG > INVENTORY\n"); ------- return 2; ------- ------- } ------- // Error transaction ------- return -1; ------- } -------} diff --cc Robust/src/Benchmarks/WebServerTag/Inventory.java index 74756956,74756956,74756956,74756956,74756956,74756956,74756956..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerTag/Inventory.java +++ /dev/null @@@@@@@@ -1,91 -1,91 -1,91 -1,91 -1,91 -1,91 -1,91 +1,0 @@@@@@@@ -------public class Inventory { ------- // Inventory flags ------- flag TransInitialize; ------- ------- // Transaction variables ------- int numitems; ------- HashMap map; ------- int balance; ------- ------- // Constructor ------- public Inventory(){ ------- map = new HashMap(); ------- balance=100000; ------- } ------- ------- public Inventory(int howmany) { ------- numitems = howmany;// howmany keeps track of the number of items ------- // in the inventory ------- map = new HashMap(); ------- } ------- ------- // Add item to a list of inventory ------- public int additem(String name, int quantity, int price){ ------- ItemInfo newitem = new ItemInfo(quantity, price); ------- balance-=quantity*price; ------- ------- // Get the item from hash ------- if (map.containsKey(name) == false) { ------- map.put(name, newitem); ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- i.quantity += quantity; ------- i.price = price; ------- map.put(name, i); ------- } ------- return 0; ------- } ------- ------- // Buy item from a given list of inventory ------- public int buyitem(String name, int quantity){ ------- if (map.containsKey(name) == false) { ------- // System.printString("Error - Item does not exist"); ------- return -1; ------- } else { ------- ItemInfo i = (ItemInfo) map.get(name); ------- if (i.quantity == 0) { ------- // System.printString("Error - Item unavailable"); ------- return -1; ------- } ------- if ((i.quantity-quantity) < 0 ) { ------- // System.printString("Error - Available qty is less: Cannot Buy\n"); ------- return -1; ------- } else { ------- i.quantity -= quantity; ------- map.put(name, i); ------- balance+=quantity*i.price; ------- return i.price; ------- } ------- } ------- return 0; ------- } ------- ------- //Display the inventory list ------- //Display the inventory list ------- public synchronized void inventory(Socket s){ ------- HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item ------- HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap ------- int totalvalue=balance; ------- while (i.hasNext() == true) { ------- StringBuffer sb = new StringBuffer(""); ------- Object o = i.next(); ------- String name = o.toString(); ------- ItemInfo oo = (ItemInfo) j.next(); ------- sb.append(name); ------- sb.append(" "); ------- Integer q = new Integer(oo.quantity); ------- sb.append(q.toString()); ------- sb.append(" "); ------- Integer p = new Integer(oo.price); ------- sb.append(p.toString()); ------- sb.append("\n"); ------- totalvalue+=oo.quantity*oo.price; ------- s.write(sb.toString().getBytes()); ------- } ------- StringBuffer sb=new StringBuffer(""); ------- sb.append("Total value: "); ------- sb.append((new Integer(totalvalue)).toString()); ------- sb.append("\n"); ------- s.write(sb.toString().getBytes()); ------- } -------} diff --cc Robust/src/Benchmarks/WebServerTag/ItemInfo.java index 18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59,18a61a59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerTag/ItemInfo.java +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ -------class ItemInfo { ------- int quantity; ------- int price; ------- ItemInfo(int x, int y) { ------- quantity = x; ------- price = y; ------- } -------} diff --cc Robust/src/Benchmarks/WebServerTag/Logger.java index a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa,a23cc4fa..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerTag/Logger.java +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------public class Logger { ------- //Logger flag ------- flag Initialize; ------- FileOutputStream fos; ------- ------- ------- //Constructor ------- public Logger(){ ------- fos=new FileOutputStream("request.log");//Open request.log file ------- } ------- ------- //Logs filename as per client requests ------- public void logrequest(String filename){ ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.write(filename.getBytes()); ------- fos.flush(); ------- } ------- ------- public void logrequest(){ ------- String request = new String("\nNew Request received: "); ------- fos.write(request.getBytes()); ------- fos.flush(); ------- } ------- ------- public void closerequest() { ------- fos.close(); ------- } -------} diff --cc Robust/src/Benchmarks/WebServerTag/WebServerExample.java index be86e36a,be86e36a,be86e36a,be86e36a,be86e36a,be86e36a,be86e36a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerTag/WebServerExample.java +++ /dev/null @@@@@@@@ -1,110 -1,110 -1,110 -1,110 -1,110 -1,110 -1,110 +1,0 @@@@@@@@ -------/* Startup object is generated with the initialstate flag set by the ------- * system to start the computation up */ ------- -------// Create New ServerSocket -------task Startup(StartupObject s {initialstate}) { -------// System.printString("W> Starting\n"); ------- ServerSocket ss = new ServerSocket(9000); -------// System.printString("W> Creating ServerSocket\n"); ------- Logger log = new Logger() {Initialize}; ------- Inventory inventorylist = new Inventory(){TransInitialize}; ------- taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -------} ------- -------//Listen for a request and accept request -------task AcceptConnection(ServerSocket ss{SocketPending}) { ------- // System.printString("W> Waiting for connection...\n"); ------- tag t=new tag(link); ------- WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}{t}; ------- ss.accept(t); -------// System.printString("W> Connected... \n"); -------} ------- -------// Process the incoming http request -------task ProcessRequest(WebServerSocket web{WebInitialize}{link l}, Socket s{IOPending}{link l}) { ------- if (web.clientrequest(s)) { ------- if(web.checktrans()==false) ------- // Not special transaction , do normal filesending ------- taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true ------- else ------- // Invoke special inventory transaction ------- taskexit(web {TransPending, LogPending,!WebInitialize}); ------- } -------} ------- -------//Do the WriteIO on server socket and send the requested file to Client -------task SendFile(WebServerSocket web{WritePending}{link l}, Socket s{}{link l}) { -------// System.printString("W> Inside SendFile ... \n"); ------- web.sendfile(s); ------- s.close(); ------- taskexit(web {!WritePending}); -------} ------- -------// Log the Client request -------task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { -------//Task fired when both -------// LogPending and Initialize flags are true -------// System.printString("L > Inside logrequest\n"); ------- log.logrequest(web.filename); ------- taskexit(web {!LogPending}); -------} ------- -------//Transaction on Inventory -------task Transaction(WebServerSocket web{TransPending}{link l}, Inventory inventorylist{TransInitialize},Socket s{}{link l}){ //Task for WebServerTransactions -------// System.printString("T > Inside Transaction\n"); ------- // Parse ------- int op = web.parseTransaction(); ------- // Check for the kind of operation ------- if (op == 0 ) { /* Add */ -------// System.printString("DEBUG > Calling add transaction\n"); ------- Integer qty = new Integer(web.parsed[2]); ------- Integer price = new Integer(web.parsed[3]); ------- int ret = inventorylist.additem(web.parsed[1], qty.intValue(), price.intValue()); ------- if (ret == 0) { ------- web.httpresponse(s); ------- StringBuffer st = new StringBuffer("Added Item "); ------- st.append(web.parsed[1]); ------- st.append(" Quantity "); ------- st.append(web.parsed[2]); ------- st.append(" Price "); ------- st.append(web.parsed[3]); ------- st.append("\n"); ------- String towrite = new String(st); ------- s.write(towrite.getBytes()); ------- } else { ------- web.httpresponse(s); ------- String st = new String("Error encountered"); ------- s.write(st.getBytes()); ------- } ------- } else if (op == 1) { /* Buy */ -------// System.printString("DEBUG > Calling buy transaction\n"); ------- Integer qty = new Integer(web.parsed[2]); ------- int ret = inventorylist.buyitem(web.parsed[1], qty.intValue()); ------- if (ret >= 0) { ------- web.httpresponse(s); ------- StringBuffer st = new StringBuffer("Bought item "); ------- st.append(web.parsed[1]); ------- st.append(" Quantity "); ------- st.append(web.parsed[2]); ------- st.append(" Cost "); ------- Integer cost = new Integer(ret*qty.intValue()); ------- String c = cost.toString(); ------- st.append(c); ------- String towrite = new String(st); ------- s.write(towrite.getBytes()); ------- } else { ------- web.httpresponse(s); ------- String st = new String("Error encountered"); ------- s.write(st.getBytes()); ------- } ------- } else if (op == 2) { /* Inventory */ -------// System.printString("DEBUG > Calling inventory transaction\n"); ------- web.httpresponse(s); ------- inventorylist.inventory(s); ------- } else { /* Error */ -------// System.printString("T > Error - Unknown transaction\n"); ------- } ------- //Invoke close operations ------- s.close(); ------- taskexit(web {!TransPending}); -------} diff --cc Robust/src/Benchmarks/WebServerTag/WebServerSocket.java index 00d24052,00d24052,00d24052,00d24052,00d24052,00d24052,00d24052..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Benchmarks/WebServerTag/WebServerSocket.java +++ /dev/null @@@@@@@@ -1,141 -1,141 -1,141 -1,141 -1,141 -1,141 -1,141 +1,0 @@@@@@@@ -------public class WebServerSocket { ------- // Websocket flag ------- flag LogPending; ------- flag WritePending; ------- flag TransPending; ------- flag WebInitialize; ------- ------- //Filename requested by the client ------- String filename; ------- String[] parsed; ------- String prefix; ------- ------- //Constructor ------- public WebServerSocket(){ ------- parsed = new String[4]; ------- } ------- ------- //Send the http header for web browser display ------- public void httpresponse(Socket s){ ------- StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); ------- header.append("Content-type: text/html\n"); ------- header.append("\n\n"); ------- String temp_str = new String(header); ------- s.write(temp_str.getBytes()); ------- return; ------- ------- } ------- ------- // Send the html file , read from file one byte at a time ------- public void sendfile(Socket s) { ------- StringBuffer req_file = new StringBuffer("./htmlfiles/"); ------- req_file.append(filename); ------- String filepath = new String(req_file); ------- FileInputStream def_file = new FileInputStream(filepath); ------- int status = def_file.getfd();//Checks if the file is present in ------- //current directory ------- httpresponse(s); ------- if (status == -1){ ------- StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if ------- // file not found ------- response.append(filename); ------- String buffer = new String(response); ------- s.write(buffer.getBytes()); ------- def_file.close(); ------- return; ------- } ------- byte buf[] = new byte[16]; ------- int ret; ------- ------- while ((ret = def_file.read(buf)) > 0) {// Read from file and write ------- // one byte at a time into the socket ------- byte tosend[] = new byte[ret]; ------- for (int i = 0; i < ret; i++) { ------- tosend[i] = buf[i]; ------- } ------- s.write(tosend); ------- //String str = new String(tosend); ------- } ------- def_file.close(); ------- } ------- ------- //Read the client request and extract the filename from it ------- public boolean clientrequest(Socket s){ ------- byte b1[] = new byte[1024]; ------- int numbytes=s.read(b1);//Read client request from web server socket ------- String curr=(new String(b1)).subString(0, numbytes); ------- if (prefix!=null) { ------- StringBuffer sb=new StringBuffer(prefix); ------- sb.append(curr); ------- curr=sb.toString(); ------- } ------- prefix=curr; ------- if(prefix.indexOf("\r\n\r\n")>=0) { ------- ------- int index = prefix.indexOf('/');//Parse the GET client request to find filename ------- int end = prefix.indexOf('H'); ------- filename = prefix.subString((index+1), (end-1)); ------- return true; ------- } ------- return false; ------- } ------- ------- // Parse for the prefix in the client request ------- // This is helpful to find if the prefix is a special transaction ------- public boolean checktrans(){ ------- if (filename.startsWith("trans") == true) { ------- return true; ------- } else { ------- return false; ------- } ------- } ------- ------- //Parse for the substrings in the filename and use it to obtain the ------- //kind of operation, name of item, quantity of item, price of item ------- //e.g. trans_add_car_2_10000 is the filename ------- //store in the parsed[] string , add,car,2,1000 ------- public int parseTransaction(){ ------- int start = filename.indexOf('_'); ------- String s = filename.subString(start+1); ------- ------- if (s.startsWith("add")==true){ ------- // System.printString("DEBUG > ADD\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = new String(s.subString(0,i1)); ------- ------- int i2 = s.indexOf('_',i1+1); ------- parsed[1] = new String(s.subString(i1+1,i2)); ------- ------- int i3 = s.indexOf('_',i2+1); ------- parsed[2] = new String(s.subString(i2+1,i3)); ------- ------- String s3 = s.subString(i3+1); ------- parsed[3] = s3; ------- ------- return 0; ------- ------- } ------- if (s.startsWith("buy")==true){ ------- // System.printString("DEBUG > BUY\n"); ------- int i1 = s.indexOf('_'); ------- parsed[0] = s.subString(0,i1); ------- ------- int i2 = s.indexOf('_', i1+1); ------- parsed[1] = s.subString(i1+1,i2); ------- ------- String s2 = s.subString(i2+1); ------- parsed[2] = s2; ------- ------- parsed[3] = ""; ------- ------- return 1; ------- } ------- if (s.startsWith("inventory")==true){ ------- // System.printString("DEBUG > INVENTORY\n"); ------- return 2; ------- ------- } ------- // Error transaction ------- return -1; ------- } -------} diff --cc Robust/src/ClassLibrary/File.java index af9ce815,af9ce815,af9ce815,af9ce815,87c3c5e1,87c3c5e1,87c3c5e1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/File.java +++ /dev/null @@@@@@@@ -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------public class File { ---- String path; --- String path; ------- ---- public File(String path) { ---- this.path=path; ---- } --- public File(String path) { --- this.path=path; --- } ------- ---- String getPath() { ---- return path; ---- } --- String getPath() { --- return path; --- } ------- ---- long length() { ---- return nativeLength(path.getBytes()); ---- } --- long length() { --- return nativeLength(path.getBytes()); --- } ------- ---- private static native long nativeLength(byte[] pathname); --- private static native long nativeLength(byte[] pathname); -------} diff --cc Robust/src/ClassLibrary/FileInputStream.java index 3a62d054,11bb6e44,11bb6e44,11bb6e44,dbc58d4c,dbc58d4c,dbc58d4c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/FileInputStream.java +++ /dev/null @@@@@@@@ -1,34 -1,34 -1,34 -1,34 -1,34 -1,34 -1,34 +1,0 @@@@@@@@ - public class FileInputStream { ------public class FileInputStream extends InputStream { ---- private int fd; --- private int fd; ------- ---- public FileInputStream(String pathname) { ---- fd=nativeOpen(pathname.getBytes()); ---- } --- public FileInputStream(String pathname) { --- fd=nativeOpen(pathname.getBytes()); --- } ------- ---- public FileInputStream(File path) { ---- fd=nativeOpen(path.getPath().getBytes()); ---- } ---- public int getfd() { ---- return fd; ---- } --- public FileInputStream(File path) { --- fd=nativeOpen(path.getPath().getBytes()); --- } --- public int getfd() { --- return fd; --- } ------- ---- private static native int nativeOpen(byte[] filename); ---- private static native int nativeRead(int fd, byte[] array, int numBytes); ---- private static native void nativeClose(int fd); ---- ---- public int read() { ---- byte b[]=new byte[1]; ---- int retval=read(b); ---- if (retval==-1) ---- return -1; ---- return b[0]; ---- } --- private static native int nativeOpen(byte[] filename); --- private static native int nativeRead(int fd, byte[] array, int numBytes); --- private static native void nativeClose(int fd); ------- ---- public int read(byte[] b) { ---- return nativeRead(fd, b, b.length); ---- } --- public int read() { --- byte b[]=new byte[1]; --- int retval=read(b); --- if (retval==-1) --- return -1; --- return b[0]; --- } ------- ---- public void close() { ---- nativeClose(fd); ---- } --- public int read(byte[] b) { --- return nativeRead(fd, b, b.length); --- } --- --- public void close() { --- nativeClose(fd); --- } -------} diff --cc Robust/src/ClassLibrary/FileOutputStream.java index 031634ff,22babeaa,22babeaa,22babeaa,297cd482,297cd482,297cd482..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/FileOutputStream.java +++ /dev/null @@@@@@@@ -1,43 -1,57 -1,57 -1,57 -1,57 -1,57 -1,57 +1,0 @@@@@@@@ - public class FileOutputStream { ------public class FileOutputStream extends OutputStream { ---- private int fd; --- private int fd; ------- ---- public FileOutputStream(String pathname) { ---- fd=nativeOpen(pathname.getBytes()); --- } --- public FileOutputStream(String pathname) { --- fd=nativeOpen(pathname.getBytes()); --- } ------ --- public FileOutputStream(String pathname, boolean append) { --- if(append) --- fd=nativeAppend(pathname.getBytes()); --- else --- fd=nativeOpen(pathname.getBytes()); ---- } --- public FileOutputStream(String pathname, boolean append) { --- if(append) --- fd=nativeAppend(pathname.getBytes()); --- else --- fd=nativeOpen(pathname.getBytes()); --- } ------- ---- public FileOutputStream(String pathname, int mode) { ---- if(mode==0) ---- fd=nativeAppend(pathname.getBytes()); ---- if(mode==1) ---- fd=nativeOpen(pathname.getBytes()); ---- } --- public FileOutputStream(String pathname, int mode) { --- if(mode==0) --- fd=nativeAppend(pathname.getBytes()); --- if(mode==1) --- fd=nativeOpen(pathname.getBytes()); --- } - --- --- public FileOutputStream(File path) { --- fd=nativeOpen(path.getPath().getBytes()); --- } - --- --- ---- public FileOutputStream(File path) { ---- fd=nativeOpen(path.getPath().getBytes()); --- } --- public FileOutputStreamOpen(String pathname) { --- fd = nativeOpen(pathname.getBytes()); --- } ------ --- public FileOutputStreamOpen(String pathname) { --- fd = nativeOpen(pathname.getBytes()); ---- } --- private static native int nativeOpen(byte[] filename); --- private static native int nativeAppend(byte[] filename); --- private static native void nativeWrite(int fd, byte[] array, int off, int len); --- private static native void nativeClose(int fd); --- private static native void nativeFlush(int fd); ------- ---- private static native int nativeOpen(byte[] filename); ---- private static native int nativeAppend(byte[] filename); - private static native void nativeWrite(int fd, byte[] array); --- private static native void nativeWrite(int fd, byte[] array, int off, int len); ---- private static native void nativeClose(int fd); ---- private static native void nativeFlush(int fd); ---- ---- public void write(int ch) { ---- byte b[]=new byte[1]; ---- b[0]=(byte)ch; ---- write(b); ---- } --- public void write(int ch) { --- byte b[]=new byte[1]; --- b[0]=(byte)ch; --- write(b); --- } ------- ---- public void write(byte[] b) { - nativeWrite(fd, b); --- nativeWrite(fd, b, 0, b.length); --- } --- public void write(byte[] b) { --- nativeWrite(fd, b, 0, b.length); --- } ------ --- public void write(byte[] b, int index, int len) { --- nativeWrite(fd, b, index, len); ---- } --- public void write(byte[] b, int index, int len) { --- nativeWrite(fd, b, index, len); --- } ------- ---- public void flush() { ---- nativeFlush(fd); ---- } --- public void flush() { --- nativeFlush(fd); --- } ------- ---- public void close() { ---- nativeClose(fd); ---- } --- public void close() { --- nativeClose(fd); --- } -------} diff --cc Robust/src/ClassLibrary/HashEntry.java index 904d16f4,904d16f4,904d16f4,904d16f4,d53d6e89,d53d6e89,d53d6e89..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/HashEntry.java +++ /dev/null @@@@@@@@ -1,6 -1,6 -1,6 -1,6 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------class HashEntry { ---- public HashEntry() {} ---- Object key; ---- Object value; ---- HashEntry next; --- public HashEntry() { --- } --- Object key; --- Object value; --- HashEntry next; -------} diff --cc Robust/src/ClassLibrary/HashMap.java index db3d5694,db3d5694,db3d5694,db3d5694,78040e77,78040e77,db028844..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/HashMap.java +++ /dev/null @@@@@@@@ -1,132 -1,132 -1,132 -1,132 -1,132 -1,132 -1,132 +1,0 @@@@@@@@ -------public class HashMap { ---- HashEntry[] table; ---- float loadFactor; ---- int numItems; --- HashEntry[] table; --- float loadFactor; --- int numItems; ------- ---- public HashMap() { ---- init(16, 0.75f); ---- } --- public HashMap() { --- init(16, 0.75f); --- } ------- ---- public HashMap(int initialCapacity) { ---- init(initialCapacity, 0.75f); ---- } ---- ---- public HashMap(int initialCapacity, float loadFactor) { ---- init(initialCapacity, loadFactor); ---- } ---- ---- private void init(int initialCapacity, float loadFactor) { ---- table=new HashEntry[initialCapacity]; ---- this.loadFactor=loadFactor; ---- this.numItems=0; ---- } --- public HashMap(int initialCapacity) { --- init(initialCapacity, 0.75f); --- } ------- ---- private int hash(Object o) { ---- if (o==null) ---- return 0; ---- int value=o.hashCode()%table.length; ---- if (value<0) ---- return -value; ---- return value; ---- } --- public HashMap(int initialCapacity, float loadFactor) { --- init(initialCapacity, loadFactor); --- } ------- ---- void resize() { ---- int newCapacity=2*table.length+1; ---- HashEntry[] oldtable=table; ---- this.table=new HashEntry[newCapacity]; --- private void init(int initialCapacity, float loadFactor) { --- table=new HashEntry[initialCapacity]; --- this.loadFactor=loadFactor; --- this.numItems=0; --- } ------- ---- for(int i=0;i(loadFactor*table.length)) { ---- //Resize the table ---- resize(); ---- } ---- int bin=hash(key); ---- HashEntry ptr=table[bin]; ---- while(ptr!=null) { ---- if (ptr.key.equals(key)) { ---- Object oldvalue=ptr.value; ---- ptr.value=value; ---- return oldvalue; ---- } ---- ptr=ptr.next; ---- } ---- HashEntry he=new HashEntry(); ---- he.value=value; ---- he.key=key; ---- he.next=table[bin]; ---- table[bin]=he; ---- return null; --- Object put(Object key, Object value) { --- numItems++; --- if (numItems>(loadFactor*table.length)) { --- //Resize the table --- resize(); --- } -- int bin=hash(key); - int bin=hash(key, table.length); --- HashEntry ptr=table[bin]; --- while(ptr!=null) { --- if (ptr.key.equals(key)) { --- Object oldvalue=ptr.value; --- ptr.value=value; --- return oldvalue; --- } --- ptr=ptr.next; ------- } --- HashEntry he=new HashEntry(); --- he.value=value; --- he.key=key; --- he.next=table[bin]; --- table[bin]=he; --- return null; --- } -------} diff --cc Robust/src/ClassLibrary/HashMapIterator.java index 70e1a405,70e1a405,70e1a405,70e1a405,48dc9137,48dc9137,48dc9137..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/HashMapIterator.java +++ /dev/null @@@@@@@@ -1,46 -1,46 -1,46 -1,46 -1,46 -1,46 -1,46 +1,0 @@@@@@@@ -------class HashMapIterator { ---- HashMap map; ---- int type; ---- int bin; ---- HashEntry he; --- HashMap map; --- int type; --- int bin; --- HashEntry he; ------- ---- public HashMapIterator(HashMap map, int type) { ---- this.map=map; ---- this.type=type; ---- this.bin=0; ---- this.he=null; ---- } --- public HashMapIterator(HashMap map, int type) { --- this.map=map; --- this.type=type; --- this.bin=0; --- this.he=null; --- } ------- ---- public boolean hasNext() { ---- if (he!=null&&he.next!=null) ---- return true; ---- int i=bin; ---- while((i0) --- h+="."; --- h+=(int)address[i]; --- } --- return h; --- public String toString() { --- String h=hostname+" "; --- for (int i=0; i0) --- h+="."; --- h+=(int)address[i]; ------ } --- return h; --- } -------} diff --cc Robust/src/ClassLibrary/Integer.java index 06c621e1,06c621e1,06c621e1,2358adb7,b287800f,b287800f,523acb2b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/Integer.java +++ /dev/null @@@@@@@@ -1,58 -1,58 -1,58 -1,60 -1,60 -1,60 -1,73 +1,0 @@@@@@@@ -------public class Integer { ---- private int value; --- private int value; ------- ---- public Integer(int value) { ---- this.value=value; ---- } --- public Integer(int value) { --- this.value=value; --- } ------- ---- public Integer(String str) { ---- value=Integer.parseInt(str, 10); ---- } --- public Integer(String str) { --- value=Integer.parseInt(str, 10); --- } ------- ---- public int intValue() { ---- return value; ---- } --- public int intValue() { --- return value; --- } ------- ---- public static int parseInt(String str) { ---- return Integer.parseInt(str, 10); ---- } --- public static int parseInt(String str) { --- return Integer.parseInt(str, 10); --- } ------- ---- public static int parseInt(String str, int radix) { ---- int value=0; ---- boolean isNeg=false; ---- int start=0; ---- byte[] chars=str.getBytes(); --- public static int parseInt(String str, int radix) { --- int value=0; --- boolean isNeg=false; --- int start=0; --- byte[] chars=str.getBytes(); ------- ---- while(chars[start]==' '||chars[start]=='\t') ---- start++; --- while(chars[start]==' '||chars[start]=='\t') --- start++; ------- ---- if (chars[start]=='-') { ---- isNeg=true; ---- start++; ---- } ---- boolean cont=true; ---- for(int i=start;cont&&i='0'&&b<='9') ---- val=b-'0'; ---- else if (b>='a'&&b<='z') ---- val=10+b-'a'; ---- else if (b>='A'&&b<='Z') ---- val=10+b-'A'; --- else cont=false; - else { - cont=false; - } ---- if (cont) { ---- if (val>=radix) ---- System.error(); ---- value=value*radix+val; ---- } ---- } ---- if (isNeg) ---- value=-value; ---- return value; --- if (chars[start]=='-') { --- isNeg=true; --- start++; ------- } ---- ---- public String toString() { ---- return String.valueOf(value); --- boolean cont=true; --- for(int i=start; cont&&i='0'&&b<='9') --- val=b-'0'; --- else if (b>='a'&&b<='z') --- val=10+b-'a'; --- else if (b>='A'&&b<='Z') --- val=10+b-'A'; --- else { --- cont=false; --- } --- if (cont) { --- if (val>=radix) --- System.error(); --- value=value*radix+val; --- } ------- } --- if (isNeg) --- value=-value; --- return value; --- } --- --- public String toString() { --- return String.valueOf(value); - } - - public int hashCode() { - return value; - } - - public boolean equals(Object o) { - if (o.getType()!=getType()) - return false; - Integer s=(Integer)o; - if (s.intValue()!=this.value) - return false; - return true; --- } -------} diff --cc Robust/src/ClassLibrary/Object.java index 92971f66,e968e17b,e968e17b,e968e17b,f2d05d25,f2d05d25,f2d05d25..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/Object.java +++ /dev/null @@@@@@@@ -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 -1,30 +1,0 @@@@@@@@ -------public class Object { ---- public native int nativehashCode(); ---- private int cachedCode;//first field has to be a primitive ---- private boolean cachedHash; --- public native int nativehashCode(); --- private int cachedCode; //first field has to be a primitive --- private boolean cachedHash; ------- ---- /* DO NOT USE ANY OF THESE - THEY ARE FOR IMPLEMENTING TAGS */ ---- private Object tags; --- /* DO NOT USE ANY OF THESE - THEY ARE FOR IMPLEMENTING TAGS */ --- private Object tags; ------- ---- public int hashCode() { ---- if (!cachedHash) { ---- cachedCode=nativehashCode(); ---- cachedHash=true; ---- } ---- return cachedCode; --- public int hashCode() { --- if (!cachedHash) { --- cachedCode=nativehashCode(); --- cachedHash=true; ------- } --- return cachedCode; --- } ------- ---- /* DON'T USE THIS METHOD UNLESS NECESSARY */ ---- /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ ---- public native int getType(); --- /* DON'T USE THIS METHOD UNLESS NECESSARY */ --- /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ --- public native int getType(); ------- ---- public String toString() { - return String.valueOf(this); --- return "Object"+hashCode(); ---- } --- public String toString() { --- return "Object"+hashCode(); --- } ------- ---- public boolean equals(Object o) { ---- if (o==this) ---- return true; ---- return false; ---- } --- public boolean equals(Object o) { --- if (o==this) --- return true; --- return false; --- } -------} diff --cc Robust/src/ClassLibrary/ObjectJava.java index 0ef8f296,59a62f4a,59a62f4a,59a62f4a,a9bf6f4d,a9bf6f4d,a9bf6f4d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/ObjectJava.java +++ /dev/null @@@@@@@@ -1,33 -1,33 -1,33 -1,33 -1,33 -1,33 -1,33 +1,0 @@@@@@@@ -------public class Object { ---- public int cachedCode; //first field has to be a primitive ---- public boolean cachedHash; --- public int cachedCode; //first field has to be a primitive --- public boolean cachedHash; ------- ---- public native int nativehashCode(); ---- private Object nextlockobject; ---- private Object prevlockobject; --- public native int nativehashCode(); --- private Object nextlockobject; --- private Object prevlockobject; ------- ---- public int hashCode() { ---- if (!cachedHash) { ---- cachedCode=nativehashCode(); ---- cachedHash=true; ---- } ---- return cachedCode; --- public int hashCode() { --- if (!cachedHash) { --- cachedCode=nativehashCode(); --- cachedHash=true; ------- } --- return cachedCode; --- } ------- ---- /* DON'T USE THIS METHOD UNLESS NECESSARY */ ---- /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ ---- public native int getType(); --- /* DON'T USE THIS METHOD UNLESS NECESSARY */ --- /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ --- public native int getType(); ------- ---- public native int MonitorEnter(); ---- public native int MonitorExit(); --- public native int MonitorEnter(); --- public native int MonitorExit(); ------- ---- public String toString() { - return String.valueOf(this); --- return "Object"+hashCode(); ---- } --- public String toString() { --- return "Object"+hashCode(); --- } ------- ---- public boolean equals(Object o) { ---- if (o==this) ---- return true; ---- return false; ---- } --- public boolean equals(Object o) { --- if (o==this) --- return true; --- return false; --- } -------} diff --cc Robust/src/ClassLibrary/ObjectJavaNT.java index ef808ae9,2d768eb6,2d768eb6,2d768eb6,4968cfa3,4968cfa3,4968cfa3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/ObjectJavaNT.java +++ /dev/null @@@@@@@@ -1,29 -1,28 -1,28 -1,28 -1,28 -1,28 -1,28 +1,0 @@@@@@@@ -------public class Object { ---- public int cachedCode; //first field has to be a primitive ---- public boolean cachedHash; --- public int cachedCode; //first field has to be a primitive --- public boolean cachedHash; ------- ---- public native int nativehashCode(); - public Object foo; --- public native int nativehashCode(); ------- ---- public int hashCode() { ---- if (!cachedHash) { ---- cachedCode=nativehashCode(); ---- cachedHash=true; ---- } ---- return cachedCode; --- public int hashCode() { --- if (!cachedHash) { --- cachedCode=nativehashCode(); --- cachedHash=true; ------- } --- return cachedCode; --- } ------- ---- /* DON'T USE THIS METHOD UNLESS NECESSARY */ ---- /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ ---- public native int getType(); --- /* DON'T USE THIS METHOD UNLESS NECESSARY */ --- /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ --- public native int getType(); ------- ---- public String toString() { - return String.valueOf(this); --- return "Object"+hashCode(); ---- } --- public String toString() { --- return "Object"+hashCode(); --- } ------- ---- public boolean equals(Object o) { ---- if (o==this) ---- return true; ---- return false; ---- } --- public boolean equals(Object o) { --- if (o==this) --- return true; --- return false; --- } -------} diff --cc Robust/src/ClassLibrary/ServerSocket.java index 465ad340,465ad340,465ad340,465ad340,723e886c,723e886c,723e886c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/ServerSocket.java +++ /dev/null @@@@@@@@ -1,37 -1,37 -1,37 -1,37 -1,38 -1,38 -1,38 +1,0 @@@@@@@@ -------public class ServerSocket { ---- /* Socket pending flag */ ---- external flag SocketPending; ---- /* File Descriptor */ ---- int fd; --- /* Socket pending flag */ --- external flag SocketPending; --- /* File Descriptor */ --- int fd; ------- ---- private native int createSocket(int port); --- private native int createSocket(int port); ------- ---- public ServerSocket(int port) { ---- this.fd=createSocket(port); ---- } ---- ---- public Socket accept() { ---- Socket s=new Socket(); ---- int newfd=nativeaccept(s); ---- s.setFD(newfd); ---- return s; ---- } --- public ServerSocket(int port) { --- this.fd=createSocket(port); --- } ------- ---- public Socket accept(tag td) { ---- Socket s=new Socket(){}{td}; ---- int newfd=nativeaccept(s); ---- s.setFD(newfd); ---- return s; ---- } --- public Socket accept() { --- Socket s=new Socket(); --- int newfd=nativeaccept(s); --- s.setFD(newfd); --- return s; --- } ------- ---- /* Lets caller pass in their own Socket object. */ ---- public void accept(Socket s) { ---- int newfd=nativeaccept(s); ---- s.setFD(newfd); ---- } --- public Socket accept(tag td) { --- Socket s=new Socket() { --- } {td}; --- int newfd=nativeaccept(s); --- s.setFD(newfd); --- return s; --- } ------- ---- private native int nativeaccept(Socket s); ---- ---- public void close(); --- /* Lets caller pass in their own Socket object. */ --- public void accept(Socket s) { --- int newfd=nativeaccept(s); --- s.setFD(newfd); --- } --- --- private native int nativeaccept(Socket s); --- --- public void close(); ------- -------} diff --cc Robust/src/ClassLibrary/ServerSocketJava.java index 30e9638a,30e9638a,30e9638a,30e9638a,1cf07f29,1cf07f29,1cf07f29..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/ServerSocketJava.java +++ /dev/null @@@@@@@@ -1,28 -1,28 -1,28 -1,28 -1,28 -1,28 -1,28 +1,0 @@@@@@@@ -------public class ServerSocket { ---- /* File Descriptor */ ---- int fd; --- /* File Descriptor */ --- int fd; ------- ---- private native int createSocket(int port); --- private native int createSocket(int port); ------- ---- public ServerSocket(int port) { ---- this.fd=createSocket(port); ---- } ---- ---- public Socket accept() { ---- Socket s=new Socket(); ---- int newfd=nativeaccept(s); ---- s.setFD(newfd); ---- return s; ---- } --- public ServerSocket(int port) { --- this.fd=createSocket(port); --- } ------- ---- /* Lets caller pass in their own Socket object. */ ---- public void accept(Socket s) { ---- int newfd=nativeaccept(s); ---- s.setFD(newfd); ---- } --- public Socket accept() { --- Socket s=new Socket(); --- int newfd=nativeaccept(s); --- s.setFD(newfd); --- return s; --- } ------- ---- private native int nativeaccept(Socket s); ---- ---- public void close(); --- /* Lets caller pass in their own Socket object. */ --- public void accept(Socket s) { --- int newfd=nativeaccept(s); --- s.setFD(newfd); --- } --- --- private native int nativeaccept(Socket s); --- --- public void close(); ------- -------} diff --cc Robust/src/ClassLibrary/Socket.java index 72b76f64,452e395e,452e395e,452e395e,506c3272,506c3272,506c3272..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/Socket.java +++ /dev/null @@@@@@@@ -1,43 -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 +1,0 @@@@@@@@ -------public class Socket { ---- /* Data pending flag */ ---- external flag IOPending; ---- /* File Descriptor */ ---- int fd; --- private SocketInputStream sin; --- private SocketOutputStream sout; ---- ---- public Socket() { --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); --- } --- /* Data pending flag */ --- external flag IOPending; --- /* File Descriptor */ --- int fd; --- private SocketInputStream sin; --- private SocketOutputStream sout; ------ --- public InputStream getInputStream() { --- return sin; --- } --- public Socket() { --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); --- } ------ --- public OutputStream getOutputStream() { --- return sout; ---- } --- public InputStream getInputStream() { --- return sin; --- } ------- ---- public Socket(String host, int port) { ---- InetAddress address=InetAddress.getByName(host); ---- fd=nativeBind(address.getAddress(), port); ---- nativeConnect(fd, address.getAddress(), port); ---- } ---- ---- public Socket(InetAddress address, int port) { --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- } --- public OutputStream getOutputStream() { --- return sout; --- } ------ --- public void connect(String host, int port) { --- InetAddress address=InetAddress.getByName(host); --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- } --- public Socket(String host, int port) { --- InetAddress address=InetAddress.getByName(host); --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- } ------ --- public void connect(InetAddress address, int port) { ---- fd=nativeBind(address.getAddress(), port); ---- nativeConnect(fd, address.getAddress(), port); ---- } --- public Socket(InetAddress address, int port) { --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- } ------- ---- public static native int nativeBind(byte[] address, int port); --- public void connect(String host, int port) { --- InetAddress address=InetAddress.getByName(host); --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- } ------- ---- public native int nativeConnect(int fd, byte[] address, int port); ---- ---- int setFD(int filed) { ---- fd=filed; ---- } --- public void connect(InetAddress address, int port) { --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- } ------- ---- public int read(byte[] b) { ---- return nativeRead(b); ---- } ---- public void write(byte[] b) { - nativeWrite(b); --- nativeWrite(b, 0, b.length); --- } --- public static native int nativeBind(byte[] address, int port); ------ --- public void write(byte[] b, int offset, int len) { --- nativeWrite(b, offset, len); ---- } --- public native int nativeConnect(int fd, byte[] address, int port); ------- --- private native void nativeBindFD(int fd); ---- private native int nativeRead(byte[] b); - private native void nativeWrite(byte[] b); --- private native void nativeWrite(byte[] b, int offset, int len); ---- private native void nativeClose(); --- int setFD(int filed) { --- fd=filed; --- } ------- ---- public void close() { ---- nativeClose(); ---- } --- public int read(byte[] b) { --- return nativeRead(b); --- } --- public void write(byte[] b) { --- nativeWrite(b, 0, b.length); --- } --- --- public void write(byte[] b, int offset, int len) { --- nativeWrite(b, offset, len); --- } --- --- private native void nativeBindFD(int fd); --- private native int nativeRead(byte[] b); --- private native void nativeWrite(byte[] b, int offset, int len); --- private native void nativeClose(); --- --- public void close() { --- nativeClose(); --- } -------} diff --cc Robust/src/ClassLibrary/SocketJava.java index 55624e1b,c2b85418,c2b85418,c2b85418,297fe3d0,297fe3d0,297fe3d0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/SocketJava.java +++ /dev/null @@@@@@@@ -1,41 -1,61 -1,61 -1,61 -1,61 -1,61 -1,61 +1,0 @@@@@@@@ -------public class Socket { ---- /* File Descriptor */ ---- int fd; - --- SocketInputStream sin; --- SocketOutputStream sout; --- /* File Descriptor */ --- int fd; --- SocketInputStream sin; --- SocketOutputStream sout; ------ ---- public Socket() { --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); --- } --- public Socket() { --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); --- } ------ --- public InputStream getInputStream() { --- return sin; --- } --- public InputStream getInputStream() { --- return sin; --- } ------ --- public OutputStream getOutputStream() { --- return sout; ---- } --- public OutputStream getOutputStream() { --- return sout; --- } ------- ---- public Socket(String host, int port) { ---- InetAddress address=InetAddress.getByName(host); ---- fd=nativeBind(address.getAddress(), port); ---- nativeConnect(fd, address.getAddress(), port); --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); ---- } ---- ---- public Socket(InetAddress address, int port) { ---- fd=nativeBind(address.getAddress(), port); ---- nativeConnect(fd, address.getAddress(), port); --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); ---- } --- public Socket(String host, int port) { --- InetAddress address=InetAddress.getByName(host); --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); --- } ------- ---- public static native int nativeBind(byte[] address, int port); --- public Socket(InetAddress address, int port) { --- fd=nativeBind(address.getAddress(), port); --- nativeConnect(fd, address.getAddress(), port); --- sin=new SocketInputStream(this); --- sout=new SocketOutputStream(this); --- } ------- ---- public static native int nativeConnect(int fd, byte[] address, int port); ---- ---- int setFD(int filed) { ---- fd=filed; ---- } --- public static native int nativeBind(byte[] address, int port); ------- ---- public int read(byte[] b) { ---- return nativeRead(b); ---- } ---- public void write(byte[] b) { - nativeWrite(b); --- nativeWrite(b, 0, b.length); --- } --- public static native int nativeConnect(int fd, byte[] address, int port); ------ --- public void write(byte[] b, int offset, int len) { --- nativeWrite(b, offset, len); ---- } --- int setFD(int filed) { --- fd=filed; --- } ------- ---- private native int nativeRead(byte[] b); - private native void nativeWrite(byte[] b); --- private native void nativeWrite(byte[] b, int offset, int len); ---- private native void nativeClose(); --- public int read(byte[] b) { --- return nativeRead(b); --- } --- public void write(byte[] b) { --- nativeWrite(b, 0, b.length); --- } ------- ---- public void close() { ---- nativeClose(); ---- } --- public void write(byte[] b, int offset, int len) { --- nativeWrite(b, offset, len); --- } --- --- private native int nativeRead(byte[] b); --- private native void nativeWrite(byte[] b, int offset, int len); --- private native void nativeClose(); --- --- public void close() { --- nativeClose(); --- } -------} diff --cc Robust/src/ClassLibrary/StartupObject.java index 14c762a9,14c762a9,14c762a9,14c762a9,541c26f5,541c26f5,541c26f5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/StartupObject.java +++ /dev/null @@@@@@@@ -1,5 -1,5 -1,5 -1,5 -1,5 -1,5 -1,5 +1,0 @@@@@@@@ -------public class StartupObject { ---- flag initialstate; --- flag initialstate; ------- ---- String [] parameters; --- String [] parameters; -------} diff --cc Robust/src/ClassLibrary/String.java index 689d3cf9,435f14d4,435f14d4,f1ec9d53,6ae7fcfa,6ae7fcfa,5bdaf0fb..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/String.java +++ /dev/null @@@@@@@@ -1,201 -1,336 -1,336 -1,343 -1,343 -1,343 -1,347 +1,0 @@@@@@@@ -------public class String { ---- char value[]; ---- int count; ---- int offset; ---- private int cachedHashcode; --- char value[]; --- int count; --- int offset; --- private int cachedHashcode; ------- ---- private String() { ---- } --- private String() { --- } ------- ---- public String(char str[]) { ---- char charstr[]=new char[str.length]; ---- for(int i=0;i(str.length-offset)) --- length=str.length-offset; --- char charstr[]=new char[length]; --- for(int i=0;i(str.length-offset)) --- length=str.length-offset; --- char charstr[]=new char[length]; --- for(int i=0; ithis.count||endIndex>this.count||beginIndex>endIndex) { ---- // FIXME --- System.printString("Index error: "+beginIndex+" "+endIndex+" "+count+"\n"+this); ---- } ---- str.value=this.value; ---- str.count=endIndex-beginIndex; ---- str.offset=this.offset+beginIndex; ---- return str; --- public String substring(int beginIndex, int endIndex) { --- String str=new String(); --- if (beginIndex>this.count||endIndex>this.count||beginIndex>endIndex) { --- // FIXME --- System.printString("Index error: "+beginIndex+" "+endIndex+" "+count+"\n"+this); ------- } --- str.value=this.value; --- str.count=endIndex-beginIndex; --- str.offset=this.offset+beginIndex; --- return str; --- } ------- ---- public String subString(int beginIndex) { ---- return this.subString(beginIndex, this.count); ---- } --- public String subString(int beginIndex) { --- return this.subString(beginIndex, this.count); --- } ------- ---- public int lastindexOf(int ch) { ---- return this.lastindexOf(ch, count - 1); --- } --- public int lastindexOf(int ch) { --- return this.lastindexOf(ch, count - 1); --- } ------ --- public static String concat2(String s1, String s2) { --- if (s1==null) --- return "null".concat(s2); --- else --- return s1.concat(s2); --- } --- public static String concat2(String s1, String s2) { --- if (s1==null) --- return "null".concat(s2); --- else --- return s1.concat(s2); --- } ------ --- public String concat(String str) { --- String newstr=new String(); --- newstr.count=this.count+str.count; --- char charstr[]=new char[newstr.count]; --- newstr.value=charstr; --- newstr.offset=0; --- for(int i=0;i0;i--) ---- if (this.charAt(i)==ch) ---- return i; ---- return -1; --- for(int i=0; i0; i--) --- if (this.charAt(i)==ch) --- return i; --- return -1; --- } ------ --- public String toUpperCase() { --- char[] buffer=new char[count]; --- for(int i=0;i='a'&&x<='z') { --- x=(char) ((x-'a')+'A'); --- } ---- buffer[i]=x; ---- } ---- return new String(buffer); --- public String replace(char oldch, char newch) { --- char[] buffer=new char[count]; --- for(int i=0; i='a'&&x<='z') { --- x=(char) ((x-'a')+'A'); --- } --- buffer[i]=x; ------- } --- return new String(buffer); --- } ------- ---- public int indexOf(int ch, int fromIndex) { ---- for(int i=fromIndex;ifromIndex) --- k=fromIndex; --- for(;k>=0;k--) { --- if (regionMatches(k, str, 0, str.count)) --- return k; --- } ---- return -1; ---- } --- public int indexOf(String str, int fromIndex) { --- if (fromIndex<0) --- fromIndex=0; --- for(int i=fromIndex; i<=(count-str.count); i++) --- if (regionMatches(i, str, 0, str.count)) --- return i; --- return -1; --- } ------- --- public int lastIndexOf(String str) { --- return lastIndexOf(str, count-str.count); --- } --- ---- public boolean startsWith(String str) { ---- return regionMatches(0, str, 0, str.count); --- public int lastIndexOf(String str, int fromIndex) { --- int k=count-str.count; --- if (k>fromIndex) --- k=fromIndex; --- for(; k>=0; k--) { --- if (regionMatches(k, str, 0, str.count)) --- return k; ------ } --- return -1; --- } ------ --- public boolean startsWith(String str, int toffset) { --- return regionMatches(toffset, str, 0, str.count); ---- } --- public int lastIndexOf(String str) { --- return lastIndexOf(str, count-str.count); --- } ------- ---- public boolean regionMatches(int toffset, String other, int ooffset, int len) { ---- if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count) ---- return false; ---- for(int i=0;icount || (ooffset+len)>other.count) --- return false; --- for(int i=0; i='a'&&l<='z') --- l=(char)((l-'a')+'A'); --- if (r>='a'&&r<='z') --- r=(char)((r-'a')+'A'); --- if (l!=r) ---- return false; ---- } ---- return true; --- public boolean equalsIgnoreCase(String s) { --- if (s.count!=count) --- return false; --- for(int i=0; i='a'&&l<='z') --- l=(char)((l-'a')+'A'); --- if (r>='a'&&r<='z') --- r=(char)((r-'a')+'A'); --- if (l!=r) --- return false; ------- } --- return true; --- } -------} diff --cc Robust/src/ClassLibrary/StringBuffer.java index 84e771e8,f51c7248,f51c7248,f51c7248,0aa1a2d9,0aa1a2d9,0aa1a2d9..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/ClassLibrary/StringBuffer.java +++ /dev/null @@@@@@@@ -1,69 -1,75 -1,75 -1,75 -1,75 -1,75 -1,75 +1,0 @@@@@@@@ -------public class StringBuffer { ---- char value[]; ---- int count; ---- // private static final int DEFAULTSIZE=16; --- char value[]; --- int count; --- // private static final int DEFAULTSIZE=16; ------- ---- public StringBuffer(String str) { ---- value=new char[str.count+16];//16 is DEFAULTSIZE ---- count=str.count; ---- for(int i=0;ivalue.length) { ---- // Need to allocate ---- char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE ---- for(int i=0;ivalue.length) { --- // Need to allocate --- char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE --- for(int i=0; ivalue.length) { ---- // Need to allocate ---- char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE ---- for(int i=0;ivalue.length) { --- // Need to allocate --- char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE --- for(int i=0; i="; --- else if (operation==RSHIFTEQ) --- return ">>="; ---- else if (operation==ANDEQ) ---- return "&="; ---- else if (operation==XOREQ) ---- return "^="; ---- else if (operation==OREQ) ---- return "|="; ---- else if (operation==POSTINC) ---- return "postinc"; ---- else if (operation==POSTDEC) ---- return "postdec"; ---- else throw new Error(); --- case DIVEQ: --- return new Operation(Operation.DIV); --- --- case MODEQ: --- return new Operation(Operation.MOD); --- --- case PLUSEQ: --- return new Operation(Operation.ADD); --- --- case MINUSEQ: --- return new Operation(Operation.SUB); --- --- case LSHIFTEQ: --- return new Operation(Operation.LEFTSHIFT); --- --- case RSHIFTEQ: --- return new Operation(Operation.RIGHTSHIFT); --- --- case URSHIFTEQ: --- return new Operation(Operation.URIGHTSHIFT); --- --- case ANDEQ: --- return new Operation(Operation.BIT_AND); --- --- case XOREQ: --- return new Operation(Operation.BIT_XOR); --- --- case OREQ: --- return new Operation(Operation.BIT_OR); --- --- case POSTINC: --- return new Operation(Operation.POSTINC); --- --- case POSTDEC: --- return new Operation(Operation.POSTDEC); ------- } --- throw new Error(); --- } --- --- public static int parseOp(String st) { --- if (st.equals("eq")) --- return EQ; --- else if (st.equals("multeq")) --- return MULTEQ; --- else if (st.equals("diveq")) --- return DIVEQ; --- else if (st.equals("modeq")) --- return MODEQ; --- else if (st.equals("pluseq")) --- return PLUSEQ; --- else if (st.equals("minuseq")) --- return MINUSEQ; --- else if (st.equals("lshifteq")) --- return LSHIFTEQ; --- else if (st.equals("urshifteq")) --- return URSHIFTEQ; --- else if (st.equals("rshifteq")) --- return RSHIFTEQ; --- else if (st.equals("andeq")) --- return ANDEQ; --- else if (st.equals("xoreq")) --- return XOREQ; --- else if (st.equals("oreq")) --- return OREQ; --- else if (st.equals("postinc")) --- return POSTINC; --- else if (st.equals("postdec")) --- return POSTDEC; --- else throw new Error(); --- } --- --- public String toString() { --- if (operation==EQ) --- return "="; --- else if (operation==MULTEQ) --- return "*="; --- else if (operation==DIVEQ) --- return "/="; --- else if (operation==MODEQ) --- return "%="; --- else if (operation==PLUSEQ) --- return "+="; --- else if (operation==MINUSEQ) --- return "-="; --- else if (operation==LSHIFTEQ) --- return "<="; --- else if (operation==RSHIFTEQ) --- return ">="; --- else if (operation==RSHIFTEQ) --- return ">>="; --- else if (operation==ANDEQ) --- return "&="; --- else if (operation==XOREQ) --- return "^="; --- else if (operation==OREQ) --- return "|="; --- else if (operation==POSTINC) --- return "postinc"; --- else if (operation==POSTDEC) --- return "postdec"; --- else throw new Error(); --- } ------- ------- -------} diff --cc Robust/src/IR/ClassDescriptor.java index b1e05b13,a86ea6af,a86ea6af,a86ea6af,e38a12f6,e38a12f6,e38a12f6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/ClassDescriptor.java +++ /dev/null @@@@@@@@ -1,142 -1,142 -1,142 -1,142 -1,142 -1,142 -1,142 +1,0 @@@@@@@@ -------package IR; -------import java.util.*; -------import IR.Tree.*; ------- -------public class ClassDescriptor extends Descriptor { ---- private static int UIDCount=0; ---- private final int classid; ---- String superclass; ---- ClassDescriptor superdesc; ---- boolean hasFlags=false; ---- String packagename; ---- ---- Modifiers modifiers; --- private static int UIDCount=0; --- private final int classid; --- String superclass; --- ClassDescriptor superdesc; --- boolean hasFlags=false; --- String packagename; ------- ---- SymbolTable fields; ---- SymbolTable flags; ---- SymbolTable methods; --- Modifiers modifiers; ------- ---- public ClassDescriptor(String classname) { ---- this("", classname); ---- } --- SymbolTable fields; --- SymbolTable flags; --- SymbolTable methods; ------- ---- public ClassDescriptor(String packagename, String classname) { ---- super(classname); ---- superclass=null; ---- flags=new SymbolTable(); ---- fields=new SymbolTable(); ---- methods=new SymbolTable(); ---- classid=UIDCount++; ---- this.packagename=packagename; ---- } --- public ClassDescriptor(String classname) { --- this("", classname); --- } ------- ---- public int getId() { ---- return classid; ---- } ---- ---- public Iterator getMethods() { ---- return methods.getDescriptorsIterator(); ---- } --- public ClassDescriptor(String packagename, String classname) { --- super(classname); --- superclass=null; --- flags=new SymbolTable(); --- fields=new SymbolTable(); --- methods=new SymbolTable(); --- classid=UIDCount++; --- this.packagename=packagename; --- } ------- ---- public Iterator getFields() { ---- return fields.getDescriptorsIterator(); ---- } --- public int getId() { --- return classid; --- } ------- ---- public Iterator getFlags() { ---- return flags.getDescriptorsIterator(); ---- } ---- ---- public SymbolTable getFieldTable() { ---- return fields; ---- } --- public Iterator getMethods() { --- return methods.getDescriptorsIterator(); --- } ------- ---- public SymbolTable getFlagTable() { ---- return flags; ---- } --- public Iterator getFields() { --- return fields.getDescriptorsIterator(); --- } ------- ---- public SymbolTable getMethodTable() { ---- return methods; ---- } --- public Iterator getFlags() { --- return flags.getDescriptorsIterator(); --- } ------- ---- public String getSafeDescriptor() { ---- return "L"+safename.replace('.','/'); ---- } --- public SymbolTable getFieldTable() { --- return fields; --- } ------- ---- public String printTree(State state) { ---- int indent; ---- String st=modifiers.toString()+"class "+getSymbol(); ---- if (superclass!=null) ---- st+="extends "+superclass.toString(); ---- st+=" {\n"; ---- indent=TreeNode.INDENT; ---- boolean printcr=false; --- public SymbolTable getFlagTable() { --- return flags; --- } ------- ---- for(Iterator it=getFlags();it.hasNext();) { ---- FlagDescriptor fd=(FlagDescriptor)it.next(); ---- st+=TreeNode.printSpace(indent)+fd.toString()+"\n"; ---- printcr=true; ---- } ---- if (printcr) ---- st+="\n"; --- public SymbolTable getMethodTable() { --- return methods; --- } ------- ---- printcr=false; --- public String getSafeDescriptor() { --- return "L"+safename.replace('.','/'); --- } ------- ---- for(Iterator it=getFields();it.hasNext();) { ---- FieldDescriptor fd=(FieldDescriptor)it.next(); ---- st+=TreeNode.printSpace(indent)+fd.toString()+"\n"; ---- printcr=true; ---- } ---- if (printcr) ---- st+="\n"; --- public String printTree(State state) { --- int indent; --- String st=modifiers.toString()+"class "+getSymbol(); --- if (superclass!=null) --- st+="extends "+superclass.toString(); --- st+=" {\n"; --- indent=TreeNode.INDENT; --- boolean printcr=false; ------- ---- for(Iterator it=getMethods();it.hasNext();) { ---- MethodDescriptor md=(MethodDescriptor)it.next(); ---- st+=TreeNode.printSpace(indent)+md.toString()+" "; ---- BlockNode bn=state.getMethodBody(md); ---- st+=bn.printNode(indent)+"\n\n"; ---- } ---- st+="}\n"; ---- return st; --- for(Iterator it=getFlags(); it.hasNext();) { --- FlagDescriptor fd=(FlagDescriptor)it.next(); --- st+=TreeNode.printSpace(indent)+fd.toString()+"\n"; --- printcr=true; ------- } --- if (printcr) --- st+="\n"; ------- ---- public void addFlag(FlagDescriptor fd) { ---- if (flags.contains(fd.getSymbol())) ---- throw new Error(fd.getSymbol()+" already defined"); ---- hasFlags=true; ---- flags.add(fd); ---- } --- printcr=false; ------- ---- public boolean hasFlags() { - return hasFlags; --- return hasFlags||getSuperDesc()!=null&&getSuperDesc().hasFlags(); --- for(Iterator it=getFields(); it.hasNext();) { --- FieldDescriptor fd=(FieldDescriptor)it.next(); --- st+=TreeNode.printSpace(indent)+fd.toString()+"\n"; --- printcr=true; ------- } --- if (printcr) --- st+="\n"; ------- ---- public void addField(FieldDescriptor fd) { ---- if (fields.contains(fd.getSymbol())) ---- throw new Error(fd.getSymbol()+" already defined"); ---- fields.add(fd); --- for(Iterator it=getMethods(); it.hasNext();) { --- MethodDescriptor md=(MethodDescriptor)it.next(); --- st+=TreeNode.printSpace(indent)+md.toString()+" "; --- BlockNode bn=state.getMethodBody(md); --- st+=bn.printNode(indent)+"\n\n"; ------- } --- st+="}\n"; --- return st; --- } ------- ---- public void addMethod(MethodDescriptor md) { ---- methods.add(md); ---- } ---- ---- public void setModifiers(Modifiers modifiers) { ---- this.modifiers=modifiers; ---- } --- public void addFlag(FlagDescriptor fd) { --- if (flags.contains(fd.getSymbol())) --- throw new Error(fd.getSymbol()+" already defined"); --- hasFlags=true; --- flags.add(fd); --- } ------- ---- public void setSuper(String superclass) { ---- this.superclass=superclass; ---- } --- public boolean hasFlags() { --- return hasFlags||getSuperDesc()!=null&&getSuperDesc().hasFlags(); --- } ------- ---- public ClassDescriptor getSuperDesc() { ---- return superdesc; ---- } --- public void addField(FieldDescriptor fd) { --- if (fields.contains(fd.getSymbol())) --- throw new Error(fd.getSymbol()+" already defined"); --- fields.add(fd); --- } ------- ---- public void setSuper(ClassDescriptor scd) { ---- this.superdesc=scd; ---- } --- public void addMethod(MethodDescriptor md) { --- methods.add(md); --- } ------- ---- public String getSuper() { ---- return superclass; ---- } --- public void setModifiers(Modifiers modifiers) { --- this.modifiers=modifiers; --- } --- --- public void setSuper(String superclass) { --- this.superclass=superclass; --- } --- --- public ClassDescriptor getSuperDesc() { --- return superdesc; --- } --- --- public void setSuper(ClassDescriptor scd) { --- this.superdesc=scd; --- } --- --- public String getSuper() { --- return superclass; --- } -------} diff --cc Robust/src/IR/Descriptor.java index edafd624,edafd624,edafd624,87d09137,4d4d67b7,4d4d67b7,4d4d67b7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Descriptor.java +++ /dev/null @@@@@@@@ -1,42 -1,42 -1,42 -1,46 -1,46 -1,46 -1,46 +1,0 @@@@@@@@ -------package IR; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- * represents a symbol in the language (var name, function name, etc). ------- */ ------- -------public abstract class Descriptor { ------- ---- protected String name; ---- protected String safename; ---- static int count=0; ---- int uniqueid; ---- ---- public Descriptor(String name) { ---- this.name = name; ---- this.safename = "___" + name + "___"; ---- this.uniqueid=count++; ---- } --- protected String name; --- protected String safename; --- static int count=0; --- int uniqueid; ------- ---- protected Descriptor(String name, String safename) { ---- this.name = name; ---- this.safename = safename; ---- this.uniqueid=count++; ---- } ---- ---- public String toString() { ---- return name; ---- } ---- ---- public String getSymbol() { ---- return name; ---- } --- public Descriptor(String name) { --- this.name = name; --- this.safename = "___" + name + "___"; --- this.uniqueid=count++; --- } ------- ---- public String getSafeSymbol() { ---- return safename; ---- } ---- public int getNum() { ---- return uniqueid; - } - - public String getCoreSafeSymbol(int num) { - return safename + "core" + num + "___"; ---- } --- protected Descriptor(String name, String safename) { --- this.name = name; --- this.safename = safename; --- this.uniqueid=count++; --- } --- --- public String toString() { --- return name; --- } --- --- public String getSymbol() { --- return name; --- } --- --- public String getSafeSymbol() { --- return safename; --- } --- public int getNum() { --- return uniqueid; --- } --- --- public String getCoreSafeSymbol(int num) { --- return safename + "core" + num + "___"; --- } -------} diff --cc Robust/src/IR/FieldDescriptor.java index a74e6917,a74e6917,a74e6917,fb67c8fe,edfb8959,edfb8959,edfb8959..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/FieldDescriptor.java +++ /dev/null @@@@@@@@ -1,46 -1,46 -1,46 -1,50 -1,50 -1,50 -1,50 +1,0 @@@@@@@@ -------package IR; -------import IR.Tree.Modifiers; -------import IR.Tree.ExpressionNode; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- * represents a symbol in the language (var name, function name, etc). ------- */ ------- -------public class FieldDescriptor extends Descriptor { ------- ---- public static FieldDescriptor arrayLength=new FieldDescriptor(new Modifiers(Modifiers.PUBLIC|Modifiers.FINAL), new TypeDescriptor(TypeDescriptor.INT), "length", null, false); --- public static FieldDescriptor arrayLength=new FieldDescriptor(new Modifiers(Modifiers.PUBLIC|Modifiers.FINAL), new TypeDescriptor(TypeDescriptor.INT), "length", null, false); ------- ---- protected Modifiers modifier; ---- protected TypeDescriptor td; ---- protected String identifier; ---- protected ExpressionNode en; ---- private boolean isglobal; --- protected Modifiers modifier; --- protected TypeDescriptor td; --- protected String identifier; --- protected ExpressionNode en; --- private boolean isglobal; ------- ---- public FieldDescriptor(Modifiers m, TypeDescriptor t, String identifier, ExpressionNode e, boolean isglobal) { ---- super(identifier); ---- this.modifier=m; ---- this.td=t; ---- this.en=e; ---- this.safename = "___" + name + "___"; ---- this.uniqueid=count++; ---- this.isglobal=isglobal; ---- if (en!=null) throw new Error("Field initializers not implemented"); ---- } --- public FieldDescriptor(Modifiers m, TypeDescriptor t, String identifier, ExpressionNode e, boolean isglobal) { --- super(identifier); --- this.modifier=m; --- this.td=t; --- this.en=e; --- this.safename = "___" + name + "___"; --- this.uniqueid=count++; --- this.isglobal=isglobal; --- if (en!=null) throw new Error("Field initializers not implemented"); --- } ------- ---- public boolean isGlobal() { ---- return isglobal; ---- } --- public boolean isGlobal() { --- return isglobal; --- } ------- ---- public TypeDescriptor getType() { ---- return td; ---- } --- public TypeDescriptor getType() { --- return td; --- } ------- ---- public String toString() { ---- if (en==null) ---- return modifier.toString()+td.toString()+" "+getSymbol()+";"; ---- else ---- return modifier.toString()+td.toString()+" "+getSymbol()+"="+en.printNode(0)+";"; - } --- public String toString() { --- if (en==null) --- return modifier.toString()+td.toString()+" "+getSymbol()+";"; --- else --- return modifier.toString()+td.toString()+" "+getSymbol()+"="+en.printNode(0)+";"; --- } ---- - public String toStringBrief() { - return td.toString()+" "+getSymbol(); ---- } --- public String toStringBrief() { --- return td.toString()+" "+getSymbol(); --- } -------} diff --cc Robust/src/IR/FlagDescriptor.java index f358fb62,e18393fd,e18393fd,4df76913,a390b617,a390b617,a390b617..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/FlagDescriptor.java +++ /dev/null @@@@@@@@ -1,27 -1,29 -1,29 -1,28 -1,28 -1,28 -1,28 +1,0 @@@@@@@@ -------package IR; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- * represents a symbol in the language (var name, function name, etc). ------- */ ------- -------public class FlagDescriptor extends Descriptor { -- public static final String InitialFlag="initialstate"; -- - public final static String InitialFlag="initialstate"; --- public final static String InitialFlag="initialstate"; ------- ---- public FlagDescriptor(String identifier) { ---- super(identifier); ---- } --- public FlagDescriptor(String identifier) { --- super(identifier); --- } ------- ---- private boolean isExternal=false; ---- public void makeExternal() { ---- isExternal=true; ---- } --- private boolean isExternal=false; --- public void makeExternal() { --- isExternal=true; --- } ------- ---- public boolean getExternal() { ---- return isExternal; ---- } --- public boolean getExternal() { --- return isExternal; --- } ------- ---- public String toString() { ---- return "Flag "+getSymbol(); ---- } --- public String toString() { --- return "Flag "+getSymbol(); --- } -------} diff --cc Robust/src/IR/Flat/BuildFlat.java index be735ffa,5bc766fd,5bc766fd,a460cc98,66b37355,66b37355,52f92b5c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ /dev/null @@@@@@@@ -1,954 -1,1004 -1,1004 -1,1014 -1,1022 -1,1022 -1,1023 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.*; -------import IR.Tree.*; -------import java.util.*; ------- -------public class BuildFlat { ---- State state; ---- Hashtable temptovar; ---- MethodDescriptor currmd; ---- TypeUtil typeutil; --- State state; --- Hashtable temptovar; --- MethodDescriptor currmd; --- TypeUtil typeutil; ------- ---- public BuildFlat(State st, TypeUtil typeutil) { ---- state=st; ---- temptovar=new Hashtable(); ---- this.typeutil=typeutil; --- public BuildFlat(State st, TypeUtil typeutil) { --- state=st; --- temptovar=new Hashtable(); --- this.typeutil=typeutil; --- } --- --- public Hashtable getMap() { --- return temptovar; --- } --- --- public void buildFlat() { --- Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); --- while(it.hasNext()) { --- ClassDescriptor cn=(ClassDescriptor)it.next(); --- flattenClass(cn); ------- } ------- ---- public Hashtable getMap() { ---- return temptovar; --- Iterator task_it=state.getTaskSymbolTable().getDescriptorsIterator(); --- while(task_it.hasNext()) { --- TaskDescriptor td=(TaskDescriptor)task_it.next(); --- flattenTask(td); ------- } --- } ------- ---- public void buildFlat() { ---- Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); ---- while(it.hasNext()) { ---- ClassDescriptor cn=(ClassDescriptor)it.next(); ---- flattenClass(cn); ---- } ---- ---- Iterator task_it=state.getTaskSymbolTable().getDescriptorsIterator(); ---- while(task_it.hasNext()) { ---- TaskDescriptor td=(TaskDescriptor)task_it.next(); ---- flattenTask(td); ---- } --- private void flattenTask(TaskDescriptor td) { --- BlockNode bn=state.getMethodBody(td); --- NodePair np=flattenBlockNode(bn); --- FlatNode fn=np.getBegin(); --- if (np.getEnd().kind()!=FKind.FlatReturnNode) { --- FlatReturnNode rnflat=new FlatReturnNode(null); --- np.getEnd().addNext(rnflat); ------- } ---- ---- private void flattenTask(TaskDescriptor td) { ---- BlockNode bn=state.getMethodBody(td); ---- NodePair np=flattenBlockNode(bn); ---- FlatNode fn=np.getBegin(); ---- if (np.getEnd().kind()!=FKind.FlatReturnNode) { ---- FlatReturnNode rnflat=new FlatReturnNode(null); ---- np.getEnd().addNext(rnflat); ---- } ------- ---- FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.PRE); ---- ffan.addNext(fn); --- FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.PRE); --- ffan.addNext(fn); ------- ---- FlatMethod fm=new FlatMethod(td); ---- fm.addNext(ffan); --- FlatMethod fm=new FlatMethod(td); --- fm.addNext(ffan); ------- ---- Hashtable visitedset=new Hashtable(); --- Hashtable visitedset=new Hashtable(); ------- ---- for(int i=0;i1) { ---- NodePair np=generateNewArrayLoop(temps, td.dereference(), out_temp, 0, con.isGlobal()); ---- fn.addNext(np.getBegin()); ---- return new NodePair(first,np.getEnd()); ---- } else ---- return new NodePair(first, fn); ---- } ---- } --- private NodePair flattenBlockExpressionNode(BlockExpressionNode en) { --- TempDescriptor tmp=TempDescriptor.tempFactory("neverused",en.getExpression().getType()); --- return flattenExpressionNode(en.getExpression(),tmp); --- } ------- ---- private NodePair generateNewArrayLoop(TempDescriptor[] temparray, TypeDescriptor td, TempDescriptor tmp, int i, boolean isglobal) { ---- TempDescriptor index=TempDescriptor.tempFactory("index",new TypeDescriptor(TypeDescriptor.INT)); ---- TempDescriptor tmpone=TempDescriptor.tempFactory("index",new TypeDescriptor(TypeDescriptor.INT)); ---- FlatNop fnop=new FlatNop();//last node --- private NodePair flattenCastNode(CastNode cn,TempDescriptor out_temp) { --- TempDescriptor tmp=TempDescriptor.tempFactory("tocast",cn.getExpression().getType()); --- NodePair np=flattenExpressionNode(cn.getExpression(), tmp); --- FlatCastNode fcn=new FlatCastNode(cn.getType(), tmp, out_temp); --- np.getEnd().addNext(fcn); --- return new NodePair(np.getBegin(),fcn); --- } ------- ---- //index=0 ---- FlatLiteralNode fln=new FlatLiteralNode(index.getType(),new Integer(0),index); ---- //tmpone=1 ---- FlatLiteralNode fln2=new FlatLiteralNode(tmpone.getType(),new Integer(1),tmpone); --- private NodePair flattenLiteralNode(LiteralNode ln,TempDescriptor out_temp) { --- FlatLiteralNode fln=new FlatLiteralNode(ln.getType(), ln.getValue(), out_temp); --- return new NodePair(fln,fln); --- } ------- ---- TempDescriptor tmpbool=TempDescriptor.tempFactory("comp",new TypeDescriptor(TypeDescriptor.BOOLEAN)); --- private NodePair flattenCreateObjectNode(CreateObjectNode con,TempDescriptor out_temp) { --- TypeDescriptor td=con.getType(); --- if (!td.isArray()) { --- FlatNew fn=new FlatNew(td, out_temp, con.isGlobal()); --- TempDescriptor[] temps=new TempDescriptor[con.numArgs()]; --- FlatNode last=fn; --- // Build arguments --- for(int i=0; i1) { --- NodePair np=generateNewArrayLoop(temps, td.dereference(), out_temp, 0, con.isGlobal()); --- fn.addNext(np.getBegin()); --- return new NodePair(first,np.getEnd()); --- } else --- return new NodePair(first, fn); ------- } --- } ------- ---- private NodePair flattenMethodInvokeNode(MethodInvokeNode min,TempDescriptor out_temp) { ---- TempDescriptor[] temps=new TempDescriptor[min.numArgs()]; ---- FlatNode first=null; ---- FlatNode last=null; ---- TempDescriptor thisarg=null; --- private NodePair generateNewArrayLoop(TempDescriptor[] temparray, TypeDescriptor td, TempDescriptor tmp, int i, boolean isglobal) { --- TempDescriptor index=TempDescriptor.tempFactory("index",new TypeDescriptor(TypeDescriptor.INT)); --- TempDescriptor tmpone=TempDescriptor.tempFactory("index",new TypeDescriptor(TypeDescriptor.INT)); --- FlatNop fnop=new FlatNop(); //last node ------- ---- if (min.getExpression()!=null) { ---- thisarg=TempDescriptor.tempFactory("thisarg",min.getExpression().getType()); ---- NodePair np=flattenExpressionNode(min.getExpression(),thisarg); ---- first=np.getBegin(); ---- last=np.getEnd(); ---- } ---- ---- //Build arguments ---- for(int i=0;i tempflagpairs; --- Hashtable temptagpairs; --- Hashtable tempflagpairs; --- Hashtable temptagpairs; ------- ---- int taskexit; ---- public static final int NEWOBJECT=0; ---- public static final int PRE=1; ---- public static final int TASKEXIT=2; - - Hashtable> cd2initfs; - Hashtable> cd2fs4new; - Hashtable> fs2fs; --- int taskexit; --- public static final int NEWOBJECT=0; --- public static final int PRE=1; --- public static final int TASKEXIT=2; ------- --- Hashtable> cd2initfs; --- Hashtable> cd2fs4new; --- Hashtable> fs2fs; ------- ---- public FlatFlagActionNode(int taskexit) { - tempflagpairs=new Hashtable(); - temptagpairs=new Hashtable(); --- tempflagpairs=new Hashtable(); --- temptagpairs=new Hashtable(); ---- this.taskexit=taskexit; - - this.cd2initfs = null; - this.cd2fs4new = null; - this.fs2fs = null; ---- } - int m_taskexitindex; ------- ---- public int getTaskType() { ---- return taskexit; - } - - public Vector getInitFStates(ClassDescriptor cd) { - if(this.cd2initfs == null) { - this.cd2initfs = new Hashtable>(); - } - if(this.cd2initfs.get(cd) == null) { - this.cd2initfs.put(cd, new Vector()); - } - return this.cd2initfs.get(cd); - } - - public Vector getTargetFStates4NewObj(ClassDescriptor cd) { - if(this.cd2fs4new == null) { - this.cd2fs4new = new Hashtable>(); - } - if(this.cd2fs4new.get(cd) == null) { - this.cd2fs4new.put(cd, new Vector()); - } - return this.cd2fs4new.get(cd); --- public FlatFlagActionNode(int taskexit) { --- tempflagpairs=new Hashtable(); --- temptagpairs=new Hashtable(); --- this.taskexit=taskexit; --- --- this.cd2initfs = null; --- this.cd2fs4new = null; --- this.fs2fs = null; - this.m_taskexitindex = 0; - } - - public int getTaskExitIndex() { - return m_taskexitindex; - } - - public void setTaskExitIndex(int taskexitindex) { - this.m_taskexitindex = taskexitindex; --- } --- --- public int getTaskType() { --- return taskexit; --- } --- --- public Vector getInitFStates(ClassDescriptor cd) { --- if(this.cd2initfs == null) { --- this.cd2initfs = new Hashtable>(); ---- } - - public Vector getTargetFStates(FlagState fs) { - if(this.fs2fs == null) { - this.fs2fs = new Hashtable>(); - } - if(this.fs2fs.get(fs) == null) { - this.fs2fs.put(fs, new Vector()); - } - return this.fs2fs.get(fs); --- if(this.cd2initfs.get(cd) == null) { --- this.cd2initfs.put(cd, new Vector()); ------- } --- return this.cd2initfs.get(cd); --- } ------- ---- public void addFlagAction(TempDescriptor td, FlagDescriptor fd, boolean status) { ---- TempFlagPair tfp=new TempFlagPair(td,fd); ---- if (tempflagpairs.containsKey(tfp)) { ---- throw new Error("Temp/Flag combination used twice: "+tfp); ---- } ---- tempflagpairs.put(tfp, new Boolean(status)); --- public Vector getTargetFStates4NewObj(ClassDescriptor cd) { --- if(this.cd2fs4new == null) { --- this.cd2fs4new = new Hashtable>(); ------- } ---- ---- public void addTagAction(TempDescriptor td, TagDescriptor tagd, TempDescriptor tagt, boolean status) { ---- TempTagPair ttp=new TempTagPair(td,tagd, tagt); ---- if (temptagpairs.containsKey(ttp)) { ---- throw new Error("Temp/Tag combination used twice: "+ttp); ---- } ---- temptagpairs.put(ttp, new Boolean(status)); --- if(this.cd2fs4new.get(cd) == null) { --- this.cd2fs4new.put(cd, new Vector()); ------- } --- return this.cd2fs4new.get(cd); --- } ------- ---- public int kind() { ---- return FKind.FlatFlagActionNode; --- public Vector getTargetFStates(FlagState fs) { --- if(this.fs2fs == null) { --- this.fs2fs = new Hashtable>(); ------- } ---- ---- /** This method returns an iterator over the Temp/Flag pairs. */ ---- - public Iterator getTempFlagPairs() { --- public Iterator getTempFlagPairs() { ---- return tempflagpairs.keySet().iterator(); --- if(this.fs2fs.get(fs) == null) { --- this.fs2fs.put(fs, new Vector()); ------- } --- return this.fs2fs.get(fs); --- } ------- - public Iterator getTempTagPairs() { --- public Iterator getTempTagPairs() { ---- return temptagpairs.keySet().iterator(); --- public void addFlagAction(TempDescriptor td, FlagDescriptor fd, boolean status) { --- TempFlagPair tfp=new TempFlagPair(td,fd); --- if (tempflagpairs.containsKey(tfp)) { --- throw new Error("Temp/Flag combination used twice: "+tfp); ------- } --- tempflagpairs.put(tfp, new Boolean(status)); --- } ------- ---- public boolean getFlagChange(TempFlagPair tfp) { ---- return ((Boolean)tempflagpairs.get(tfp)).booleanValue(); --- public void addTagAction(TempDescriptor td, TagDescriptor tagd, TempDescriptor tagt, boolean status) { --- TempTagPair ttp=new TempTagPair(td,tagd, tagt); --- if (temptagpairs.containsKey(ttp)) { --- throw new Error("Temp/Tag combination used twice: "+ttp); ------- } --- temptagpairs.put(ttp, new Boolean(status)); --- } ------- ---- public boolean getTagChange(TempTagPair ttp) { ---- return ((Boolean)temptagpairs.get(ttp)).booleanValue(); ---- } --- public int kind() { --- return FKind.FlatFlagActionNode; --- } ------- ---- public TempDescriptor [] readsTemps() { ---- if (tempflagpairs.size()==0) ---- return new TempDescriptor [0]; ---- else { ---- HashSet temps=new HashSet(); ---- for(Iterator it=tempflagpairs.keySet().iterator();it.hasNext();) { ---- TempFlagPair tfp=(TempFlagPair)it.next(); ---- temps.add(tfp.getTemp()); ---- } ---- for(Iterator it=temptagpairs.keySet().iterator();it.hasNext();) { ---- TempTagPair ttp=(TempTagPair)it.next(); ---- temps.add(ttp.getTemp()); ---- temps.add(ttp.getTagTemp()); ---- } ---- return (TempDescriptor[]) temps.toArray(new TempDescriptor [temps.size()]); ---- } ---- } --- /** This method returns an iterator over the Temp/Flag pairs. */ ------- ---- public int getFFANType() ---- { ---- throw new Error("Use getTaskType() instead and remove this method"); --- public Iterator getTempFlagPairs() { --- return tempflagpairs.keySet().iterator(); --- } --- --- public Iterator getTempTagPairs() { --- return temptagpairs.keySet().iterator(); --- } --- --- public boolean getFlagChange(TempFlagPair tfp) { --- return ((Boolean)tempflagpairs.get(tfp)).booleanValue(); --- } --- --- public boolean getTagChange(TempTagPair ttp) { --- return ((Boolean)temptagpairs.get(ttp)).booleanValue(); --- } --- --- public TempDescriptor [] readsTemps() { --- if (tempflagpairs.size()==0) --- return new TempDescriptor [0]; --- else { --- HashSet temps=new HashSet(); --- for(Iterator it=tempflagpairs.keySet().iterator(); it.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it.next(); --- temps.add(tfp.getTemp()); --- } --- for(Iterator it=temptagpairs.keySet().iterator(); it.hasNext();) { --- TempTagPair ttp=(TempTagPair)it.next(); --- temps.add(ttp.getTemp()); --- temps.add(ttp.getTagTemp()); --- } --- return (TempDescriptor[])temps.toArray(new TempDescriptor [temps.size()]); ------- } --- } ------- ---- public String toString() { --- String st="FlatFlagActionNode"; - String st="FlatFlagActionNode_"; ---- for(Iterator it=tempflagpairs.keySet().iterator();it.hasNext();) { ---- TempFlagPair tfp=(TempFlagPair)it.next(); ---- st+=getFlagChange(tfp)?"":"!"; ---- st+=tfp.getTemp()+" "+tfp.getFlag()+","; ---- } ---- for(Iterator it=temptagpairs.keySet().iterator();it.hasNext();) { ---- TempTagPair ttp=(TempTagPair)it.next(); ---- st+=getTagChange(ttp)?"":"!"; ---- st+=ttp.getTemp()+" "+ttp.getTag()+"("+ttp.getTagTemp()+"),"; ---- } --- public int getFFANType() { --- throw new Error("Use getTaskType() instead and remove this method"); --- } ------- ---- return st; --- public String toString() { --- String st="FlatFlagActionNode_"; --- for(Iterator it=tempflagpairs.keySet().iterator(); it.hasNext();) { --- TempFlagPair tfp=(TempFlagPair)it.next(); --- st+=getFlagChange(tfp) ? "" : "!"; --- st+=tfp.getTemp()+" "+tfp.getFlag()+","; --- } --- for(Iterator it=temptagpairs.keySet().iterator(); it.hasNext();) { --- TempTagPair ttp=(TempTagPair)it.next(); --- st+=getTagChange(ttp) ? "" : "!"; --- st+=ttp.getTemp()+" "+ttp.getTag()+"("+ttp.getTagTemp()+"),"; ------- } --- --- return st; --- } -------} diff --cc Robust/src/IR/Flat/FlatGlobalConvNode.java index ea61e84c,ea61e84c,ea61e84c,0d189446,d3b5d107,92c6b51b,92c6b51b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatGlobalConvNode.java +++ /dev/null @@@@@@@@ -1,46 -1,46 -1,46 -1,48 -1,48 -1,60 -1,60 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.TypeDescriptor; -------import Analysis.Locality.LocalityBinding; ------- -------public class FlatGlobalConvNode extends FlatNode { ---- TempDescriptor src; ---- LocalityBinding lb; ---- boolean makePtr; --- TempDescriptor src; --- LocalityBinding lb; --- boolean makePtr; -- boolean convert=true; ------- ---- public FlatGlobalConvNode(TempDescriptor src, LocalityBinding lb, boolean makePtr) { ---- this.src=src; ---- this.lb=lb; ---- this.makePtr=makePtr; ---- } --- public FlatGlobalConvNode(TempDescriptor src, LocalityBinding lb, boolean makePtr) { --- this.src=src; --- this.lb=lb; --- this.makePtr=makePtr; --- } ------- ---- public String toString() { - String str = "FlatGlobalConvNode_"+src.toString(); ---- if (makePtr) --- return src.toString()+"=(PTR)"+src.toString()+" "+lb; - str += "=(PTR)"; ---- else --- return src.toString()+"=(OID)"+src.toString()+" "+lb; - str += "=(OID)"; - return str+src.toString()+" "+lb; ---- } -- public FlatGlobalConvNode(TempDescriptor src, LocalityBinding lb, boolean makePtr, boolean doactualconvert) { -- this.src=src; -- this.lb=lb; -- this.makePtr=makePtr; -- this.convert=doactualconvert; -- } -- -- boolean doConvert() { -- return convert; -- } -- --- public String toString() { --- String str = "FlatGlobalConvNode_"+src.toString(); --- if (makePtr) --- str += "=(PTR)"; --- else --- str += "=(OID)"; --- return str+src.toString()+" "+lb; --- } ------- ---- public int kind() { ---- return FKind.FlatGlobalConvNode; ---- } --- public int kind() { --- return FKind.FlatGlobalConvNode; --- } ------- ---- public LocalityBinding getLocality() { ---- return lb; ---- } --- public LocalityBinding getLocality() { --- return lb; --- } ------- ---- public boolean getMakePtr() { ---- return makePtr; ---- } --- public boolean getMakePtr() { --- return makePtr; --- } ------- ---- public TempDescriptor getSrc() { ---- return src; ---- } --- public TempDescriptor getSrc() { --- return src; --- } ------- ---- public TempDescriptor [] writesTemps() { ---- return new TempDescriptor[] {src}; ---- } --- public TempDescriptor [] writesTemps() { --- return new TempDescriptor[] {src}; --- } ------- ---- public TempDescriptor [] readsTemps() { ---- return new TempDescriptor[] {src}; ---- } --- public TempDescriptor [] readsTemps() { --- return new TempDescriptor[] {src}; --- } -------} diff --cc Robust/src/IR/Flat/FlatLiteralNode.java index 93b814b4,93b814b4,93b814b4,58514317,99c1087d,99c1087d,99c1087d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatLiteralNode.java +++ /dev/null @@@@@@@@ -1,55 -1,55 -1,55 -1,57 -1,57 -1,57 -1,57 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.TypeDescriptor; ------- -------public class FlatLiteralNode extends FlatNode { ---- Object value; ---- TypeDescriptor type; ---- TempDescriptor dst; --- Object value; --- TypeDescriptor type; --- TempDescriptor dst; ------- ---- public FlatLiteralNode(TypeDescriptor type, Object o, TempDescriptor dst) { ---- this.type=type; ---- value=o; ---- this.dst=dst; ---- } --- public FlatLiteralNode(TypeDescriptor type, Object o, TempDescriptor dst) { --- this.type=type; --- value=o; --- this.dst=dst; --- } ------- ---- public TypeDescriptor getType() { ---- return type; ---- } --- public TypeDescriptor getType() { --- return type; --- } ------- ---- public TempDescriptor getDst() { ---- return dst; ---- } --- public TempDescriptor getDst() { --- return dst; --- } ------- ---- public Object getValue() { ---- return value; ---- } --- public Object getValue() { --- return value; --- } ------- ---- public String toString() { - String str = "FlatLiteralNode_"+dst; ---- if (value==null) --- return dst+"=null"; - str += "=null"; ---- else --- return dst+"="+escapeString(value.toString()); - str += "="+escapeString(value.toString()); - return str; ---- } ---- protected static String escapeString(String st) { ---- String new_st=""; ---- for(int i=0;i getNodeSet() { ---- HashSet tovisit=new HashSet(); ---- HashSet visited=new HashSet(); ---- tovisit.add(this); ---- while(!tovisit.isEmpty()) { ---- FlatNode fn=tovisit.iterator().next(); ---- tovisit.remove(fn); ---- visited.add(fn); ---- for(int i=0;i getNodeSet() { --- HashSet tovisit=new HashSet(); --- HashSet visited=new HashSet(); --- tovisit.add(this); --- while(!tovisit.isEmpty()) { --- FlatNode fn=tovisit.iterator().next(); --- tovisit.remove(fn); --- visited.add(fn); --- for(int i=0; i0) { ---- //1) Edge >1 of node ---- nodetolabel.put(nn,new Integer(labelindex++)); ---- } ---- if (!visited.contains(nn)&&!tovisit.contains(nn)) { ---- tovisit.add(nn); ---- } else { ---- //2) Join point ---- nodetolabel.put(nn,new Integer(labelindex++)); ---- } ---- } --- for(int i=0; i0) { --- //1) Edge >1 of node --- nodetolabel.put(nn,new Integer(labelindex++)); ------- } ---- ---- //Do the actual printing ---- tovisit=new HashSet(); ---- visited=new HashSet(); ---- tovisit.add(this); ---- while(current_node!=null||!tovisit.isEmpty()) { ---- if (current_node==null) { ---- current_node=(FlatNode)tovisit.iterator().next(); ---- tovisit.remove(current_node); ---- } ---- visited.add(current_node); ---- if (nodetolabel.containsKey(current_node)) ---- st+="L"+nodetolabel.get(current_node)+":\n"; ---- if (current_node.numNext()==0) { - st+=" "+current_node.toString()+"\n"; --- if (map==null) --- st+=" "+current_node.toString()+"\n"; --- else --- st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n"; ---- current_node=null; ---- } else if(current_node.numNext()==1) { - st+=" "+current_node.toString()+"\n"; --- if (map==null) --- st+=" "+current_node.toString()+"\n"; --- else --- st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n"; ---- FlatNode nextnode=current_node.getNext(0); ---- if (visited.contains(nextnode)) { ---- st+="goto L"+nodetolabel.get(nextnode)+"\n"; ---- current_node=null; ---- } else ---- current_node=nextnode; ---- } else if (current_node.numNext()==2) { ---- /* Branch */ ---- st+=" "+((FlatCondBranch)current_node).toString("L"+nodetolabel.get(current_node.getNext(1)))+"\n"; ---- if (!visited.contains(current_node.getNext(1))) ---- tovisit.add(current_node.getNext(1)); ---- if (visited.contains(current_node.getNext(0))) { ---- st+="goto L"+nodetolabel.get(current_node.getNext(0))+"\n"; ---- current_node=null; ---- } else ---- current_node=current_node.getNext(0); ---- } else throw new Error(); --- if (!visited.contains(nn)&&!tovisit.contains(nn)) { --- tovisit.add(nn); --- } else { --- //2) Join point --- nodetolabel.put(nn,new Integer(labelindex++)); ------- } ---- return st+"}\n"; --- } ------- } ---- ---- public TempDescriptor [] writesTemps() { ---- return (TempDescriptor[]) parameterTemps.toArray(new TempDescriptor[ parameterTemps.size()]); --- --- //Do the actual printing --- tovisit=new HashSet(); --- visited=new HashSet(); --- tovisit.add(this); --- while(current_node!=null||!tovisit.isEmpty()) { --- if (current_node==null) { --- current_node=(FlatNode)tovisit.iterator().next(); --- tovisit.remove(current_node); --- } --- visited.add(current_node); --- if (nodetolabel.containsKey(current_node)) --- st+="L"+nodetolabel.get(current_node)+":\n"; --- if (current_node.numNext()==0) { --- if (map==null) --- st+=" "+current_node.toString()+"\n"; --- else --- st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n"; --- current_node=null; --- } else if(current_node.numNext()==1) { --- if (map==null) --- st+=" "+current_node.toString()+"\n"; --- else --- st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n"; --- FlatNode nextnode=current_node.getNext(0); --- if (visited.contains(nextnode)) { --- st+="goto L"+nodetolabel.get(nextnode)+"\n"; --- current_node=null; --- } else --- current_node=nextnode; --- } else if (current_node.numNext()==2) { --- /* Branch */ --- st+=" "+((FlatCondBranch)current_node).toString("L"+nodetolabel.get(current_node.getNext(1)))+"\n"; --- if (!visited.contains(current_node.getNext(1))) --- tovisit.add(current_node.getNext(1)); --- if (visited.contains(current_node.getNext(0))) { --- st+="goto L"+nodetolabel.get(current_node.getNext(0))+"\n"; --- current_node=null; --- } else --- current_node=current_node.getNext(0); --- } else throw new Error(); ------- } --- return st+"}\n"; --- } --- --- public TempDescriptor [] writesTemps() { --- return (TempDescriptor[])parameterTemps.toArray(new TempDescriptor[ parameterTemps.size()]); --- } -------} diff --cc Robust/src/IR/Flat/FlatNew.java index f728e2ef,f728e2ef,f728e2ef,48737ecb,eec4beb4,eec4beb4,eec4beb4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatNew.java +++ /dev/null @@@@@@@@ -1,61 -1,61 -1,61 -1,61 -1,61 -1,61 -1,61 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.TypeDescriptor; ------- -------public class FlatNew extends FlatNode { ---- TempDescriptor dst; ---- TypeDescriptor type; ---- TempDescriptor size; ---- boolean isglobal; ---- ---- public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) { ---- this.type=type; ---- this.dst=dst; ---- this.size=null; ---- this.isglobal=isglobal; ---- } --- TempDescriptor dst; --- TypeDescriptor type; --- TempDescriptor size; --- boolean isglobal; ------- ---- public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) { ---- this.type=type; ---- this.dst=dst; ---- this.size=size; ---- this.isglobal=isglobal; ---- } --- public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) { --- this.type=type; --- this.dst=dst; --- this.size=null; --- this.isglobal=isglobal; --- } ------- ---- public boolean isGlobal() { ---- return isglobal; ---- } --- public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) { --- this.type=type; --- this.dst=dst; --- this.size=size; --- this.isglobal=isglobal; --- } ------- ---- public String toString() { --- if (size==null) --- return dst.toString()+"= NEW "+type.toString(); --- else --- return dst.toString()+"= NEW "+type.toString()+"["+size.toString()+"]"; - String str = "FlatNew_"+dst.toString()+"= NEW "+type.toString(); - if (size!=null) - str += "["+size.toString()+"]"; - return str; ---- } --- public boolean isGlobal() { --- return isglobal; --- } ------- ---- public int kind() { ---- return FKind.FlatNew; ---- } --- public String toString() { --- String str = "FlatNew_"+dst.toString()+"= NEW "+type.toString(); --- if (size!=null) --- str += "["+size.toString()+"]"; --- return str; --- } ------- ---- public TempDescriptor [] writesTemps() { ---- return new TempDescriptor[] {dst}; ---- } --- public int kind() { --- return FKind.FlatNew; --- } ------- ---- public TempDescriptor [] readsTemps() { ---- if (size!=null) ---- return new TempDescriptor[] {size}; ---- else ---- return new TempDescriptor[0]; ---- } --- public TempDescriptor [] writesTemps() { --- return new TempDescriptor[] {dst}; --- } ------- ---- public TempDescriptor getDst() { ---- return dst; ---- } --- public TempDescriptor [] readsTemps() { --- if (size!=null) --- return new TempDescriptor[] {size}; --- else --- return new TempDescriptor[0]; --- } ------- ---- public TempDescriptor getSize() { ---- return size; ---- } --- public TempDescriptor getDst() { --- return dst; --- } ------- ---- public TypeDescriptor getType() { ---- return type; ---- } --- public TempDescriptor getSize() { --- return size; --- } --- --- public TypeDescriptor getType() { --- return type; --- } -------} diff --cc Robust/src/IR/Flat/FlatNode.java index b1780b10,714b894b,714b894b,714b894b,57dcb736,57dcb736,57dcb736..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatNode.java +++ /dev/null @@@@@@@@ -1,56 -1,57 -1,57 -1,57 -1,57 -1,57 -1,57 +1,0 @@@@@@@@ -------package IR.Flat; -------import java.util.Vector; ------- -------public class FlatNode { ---- protected Vector next; ---- protected Vector prev; --- protected Vector next; --- protected Vector prev; ------- ---- public FlatNode() { ---- next=new Vector(); ---- prev=new Vector(); ---- } --- public FlatNode() { --- next=new Vector(); --- prev=new Vector(); --- } ------- ---- public String toString() { ---- throw new Error(this.getClass().getName() + "does not implement toString!"); ---- } ---- public int numNext() { ---- return next.size(); ---- } ---- public FlatNode getNext(int i) { ---- return (FlatNode) next.get(i); ---- } --- public String toString() { --- throw new Error(this.getClass().getName() + "does not implement toString!"); --- } --- public int numNext() { --- return next.size(); --- } --- public FlatNode getNext(int i) { --- return (FlatNode) next.get(i); --- } ------- ---- public int numPrev() { ---- return prev.size(); ---- } ---- public FlatNode getPrev(int i) { ---- return (FlatNode) prev.get(i); ---- } ---- ---- public void addNext(FlatNode n) { ---- next.add(n); ---- n.addPrev(this); ---- } --- public int numPrev() { --- return prev.size(); --- } --- public FlatNode getPrev(int i) { --- return (FlatNode) prev.get(i); --- } ------- ---- /** This function modifies the graph */ ---- public void setNext(int i, FlatNode n) { ---- FlatNode old=getNext(i); ---- next.set(i, n); ---- old.prev.remove(this); --- n.addPrev(this); ---- } --- public void addNext(FlatNode n) { --- next.add(n); --- n.addPrev(this); --- } ------- ---- protected void addPrev(FlatNode p) { ---- prev.add(p); ---- } ---- public int kind() { ---- throw new Error(); ---- } --- /** This function modifies the graph */ --- public void setNext(int i, FlatNode n) { --- FlatNode old=getNext(i); --- next.set(i, n); --- old.prev.remove(this); --- n.addPrev(this); --- } ------- ---- public TempDescriptor [] readsTemps() { ---- return new TempDescriptor[0]; ---- } --- protected void addPrev(FlatNode p) { --- prev.add(p); --- } --- public int kind() { --- throw new Error(); --- } ------- ---- public TempDescriptor [] writesTemps() { ---- return new TempDescriptor[0]; ---- } --- public TempDescriptor [] readsTemps() { --- return new TempDescriptor[0]; --- } --- --- public TempDescriptor [] writesTemps() { --- return new TempDescriptor[0]; --- } -------} diff --cc Robust/src/IR/Flat/FlatNop.java index 36079fbf,36079fbf,36079fbf,36079fbf,fdcab4ed,fdcab4ed,fdcab4ed..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatNop.java +++ /dev/null @@@@@@@@ -1,15 -1,15 -1,15 -1,15 -1,15 -1,15 -1,15 +1,0 @@@@@@@@ -------package IR.Flat; -------import java.util.Vector; ------- -------public class FlatNop extends FlatNode { ---- public FlatNop() { ---- } --- public FlatNop() { --- } ------- ---- public String toString() { ---- return "nop"; ---- } --- public String toString() { --- return "nop"; --- } ------- ---- public int kind() { ---- return FKind.FlatNop; ---- } --- public int kind() { --- return FKind.FlatNop; --- } -------} diff --cc Robust/src/IR/Flat/FlatOpNode.java index 4c8bcbaa,4c8bcbaa,4c8bcbaa,5cd20068,ade59315,ade59315,ade59315..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatOpNode.java +++ /dev/null @@@@@@@@ -1,57 -1,57 -1,57 -1,59 -1,59 -1,59 -1,59 +1,0 @@@@@@@@ -------package IR.Flat; -------import java.util.Vector; -------import IR.*; ------- -------public class FlatOpNode extends FlatNode { ---- TempDescriptor dest; ---- TempDescriptor left; ---- TempDescriptor right; ---- Operation op; --- TempDescriptor dest; --- TempDescriptor left; --- TempDescriptor right; --- Operation op; ------- ---- public FlatOpNode(TempDescriptor dest, TempDescriptor left, TempDescriptor right, Operation op) { ---- this.dest=dest; ---- this.left=left; ---- this.right=right; ---- this.op=op; ---- } ---- ---- public TempDescriptor getDest() { ---- return dest; ---- } --- public FlatOpNode(TempDescriptor dest, TempDescriptor left, TempDescriptor right, Operation op) { --- this.dest=dest; --- this.left=left; --- this.right=right; --- this.op=op; --- } ------- ---- public TempDescriptor getLeft() { ---- return left; ---- } --- public TempDescriptor getDest() { --- return dest; --- } ------- ---- public TempDescriptor getRight() { ---- return right; ---- } ---- ---- public Operation getOp() { ---- return op; ---- } --- public TempDescriptor getLeft() { --- return left; --- } ------- ---- public String toString() { - String str = "FlatOpNode_"+dest.toString(); ---- if (right!=null) --- return dest.toString()+"="+left.toString()+op.toString()+right.toString(); - str += "="+left.toString()+op.toString()+right.toString(); ---- else if (op.getOp()==Operation.ASSIGN) --- return dest.toString()+" = "+left.toString(); - str += " = "+left.toString(); ---- else --- return dest.toString()+" "+op.toString() +" "+left.toString(); - str += " "+op.toString() +" "+left.toString(); - return str; ---- } --- public TempDescriptor getRight() { --- return right; --- } ------- ---- public int kind() { ---- return FKind.FlatOpNode; ---- } --- public Operation getOp() { --- return op; --- } ------- ---- public TempDescriptor [] readsTemps() { ---- if (right!=null) ---- return new TempDescriptor [] {left,right}; ---- else ---- return new TempDescriptor [] {left}; ---- } --- public String toString() { --- String str = "FlatOpNode_"+dest.toString(); --- if (right!=null) --- str += "="+left.toString()+op.toString()+right.toString(); --- else if (op.getOp()==Operation.ASSIGN) --- str += " = "+left.toString(); --- else --- str += " "+op.toString() +" "+left.toString(); --- return str; --- } ------- ---- public TempDescriptor [] writesTemps() { ---- return new TempDescriptor [] {dest}; ---- } --- public int kind() { --- return FKind.FlatOpNode; --- } --- --- public TempDescriptor [] readsTemps() { --- if (right!=null) --- return new TempDescriptor [] {left,right}; --- else --- return new TempDescriptor [] {left}; --- } --- --- public TempDescriptor [] writesTemps() { --- return new TempDescriptor [] {dest}; --- } -------} diff --cc Robust/src/IR/Flat/FlatReturnNode.java index ec323f04,ec323f04,ec323f04,fb2d3b97,f90fd751,f90fd751,f90fd751..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatReturnNode.java +++ /dev/null @@@@@@@@ -1,28 -1,28 -1,28 -1,28 -1,28 -1,28 -1,28 +1,0 @@@@@@@@ -------package IR.Flat; ------- -------public class FlatReturnNode extends FlatNode { ---- TempDescriptor tempdesc; --- TempDescriptor tempdesc; ------- ---- public FlatReturnNode(TempDescriptor td) { ---- this.tempdesc=td; ---- } --- public FlatReturnNode(TempDescriptor td) { --- this.tempdesc=td; --- } ------- ---- public String toString() { --- return "return "+tempdesc; - return "FlatReturnNode_return "+tempdesc; ---- } --- public String toString() { --- return "FlatReturnNode_return "+tempdesc; --- } ------- ---- public int kind() { ---- return FKind.FlatReturnNode; ---- } --- public int kind() { --- return FKind.FlatReturnNode; --- } ------- ---- public TempDescriptor [] readsTemps() { ---- if (tempdesc==null) ---- return new TempDescriptor [0]; ---- else ---- return new TempDescriptor [] {tempdesc}; ---- } --- public TempDescriptor [] readsTemps() { --- if (tempdesc==null) --- return new TempDescriptor [0]; --- else --- return new TempDescriptor [] {tempdesc}; --- } ------- ---- public TempDescriptor getReturnTemp() { ---- return tempdesc; ---- } --- public TempDescriptor getReturnTemp() { --- return tempdesc; --- } -------} diff --cc Robust/src/IR/Flat/FlatSetElementNode.java index c231e079,c231e079,c231e079,d7e748e8,6dd4a624,6dd4a624,6dd4a624..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatSetElementNode.java +++ /dev/null @@@@@@@@ -1,42 -1,42 -1,42 -1,42 -1,42 -1,42 -1,42 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.FieldDescriptor; ------- -------public class FlatSetElementNode extends FlatNode { ---- TempDescriptor src; ---- TempDescriptor dst; ---- TempDescriptor index; ---- ---- public FlatSetElementNode(TempDescriptor dst, TempDescriptor index, TempDescriptor src) { ---- this.index=index; ---- this.src=src; ---- this.dst=dst; ---- } --- TempDescriptor src; --- TempDescriptor dst; --- TempDescriptor index; ------- ---- public boolean needsBoundsCheck() { ---- return true; ---- } --- public FlatSetElementNode(TempDescriptor dst, TempDescriptor index, TempDescriptor src) { --- this.index=index; --- this.src=src; --- this.dst=dst; --- } ------- ---- public TempDescriptor getSrc() { ---- return src; ---- } --- public boolean needsBoundsCheck() { --- return true; --- } ------- ---- public TempDescriptor getIndex() { ---- return index; ---- } --- public TempDescriptor getSrc() { --- return src; --- } ------- ---- public TempDescriptor getDst() { ---- return dst; ---- } --- public TempDescriptor getIndex() { --- return index; --- } ------- ---- public String toString() { --- return dst.toString()+"["+index.toString()+"]="+src.toString(); - return "FlatSetElementNode_"+dst.toString()+"["+index.toString()+"]="+src.toString(); ---- } --- public TempDescriptor getDst() { --- return dst; --- } ------- ---- public int kind() { ---- return FKind.FlatSetElementNode; ---- } ---- ---- public TempDescriptor [] readsTemps() { ---- return new TempDescriptor [] {src,dst,index}; ---- } --- public String toString() { --- return "FlatSetElementNode_"+dst.toString()+"["+index.toString()+"]="+src.toString(); --- } --- --- public int kind() { --- return FKind.FlatSetElementNode; --- } --- --- public TempDescriptor [] readsTemps() { --- return new TempDescriptor [] {src,dst,index}; --- } -------} diff --cc Robust/src/IR/Flat/FlatSetFieldNode.java index b1742479,b1742479,b1742479,e34de29b,50e834ed,50e834ed,50e834ed..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatSetFieldNode.java +++ /dev/null @@@@@@@@ -1,38 -1,38 -1,38 -1,38 -1,38 -1,38 -1,38 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.FieldDescriptor; ------- -------public class FlatSetFieldNode extends FlatNode { ---- TempDescriptor src; ---- TempDescriptor dst; ---- FieldDescriptor field; ---- ---- public FlatSetFieldNode(TempDescriptor dst, FieldDescriptor field, TempDescriptor src) { ---- this.field=field; ---- this.src=src; ---- this.dst=dst; ---- } --- TempDescriptor src; --- TempDescriptor dst; --- FieldDescriptor field; ------- ---- public TempDescriptor getSrc() { ---- return src; ---- } --- public FlatSetFieldNode(TempDescriptor dst, FieldDescriptor field, TempDescriptor src) { --- this.field=field; --- this.src=src; --- this.dst=dst; --- } ------- ---- public TempDescriptor getDst() { ---- return dst; ---- } --- public TempDescriptor getSrc() { --- return src; --- } ------- ---- public FieldDescriptor getField() { ---- return field; ---- } --- public TempDescriptor getDst() { --- return dst; --- } ------- ---- public String toString() { --- return dst.toString()+"."+field.getSymbol()+"="+src.toString(); - return "FlatSetFieldNode_"+dst.toString()+"."+field.getSymbol()+"="+src.toString(); ---- } --- public FieldDescriptor getField() { --- return field; --- } ------- ---- public int kind() { ---- return FKind.FlatSetFieldNode; ---- } ---- ---- public TempDescriptor [] readsTemps() { ---- return new TempDescriptor [] {src,dst}; ---- } --- public String toString() { --- return "FlatSetFieldNode_"+dst.toString()+"."+field.getSymbol()+"="+src.toString(); --- } --- --- public int kind() { --- return FKind.FlatSetFieldNode; --- } --- --- public TempDescriptor [] readsTemps() { --- return new TempDescriptor [] {src,dst}; --- } -------} diff --cc Robust/src/IR/Flat/FlatTagDeclaration.java index 78ada705,78ada705,78ada705,0e48da4d,78cdcddc,78cdcddc,78cdcddc..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/FlatTagDeclaration.java +++ /dev/null @@@@@@@@ -1,36 -1,36 -1,36 -1,36 -1,36 -1,36 -1,36 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.TagDescriptor; ------- -------public class FlatTagDeclaration extends FlatNode { ---- TempDescriptor dst; ---- TagDescriptor type; ---- ---- public FlatTagDeclaration(TagDescriptor type, TempDescriptor dst) { ---- this.type=type; ---- this.dst=dst; ---- } --- TempDescriptor dst; --- TagDescriptor type; ------- ---- public String toString() { --- return dst.toString()+"= new Tag("+type.toString()+")"; - return "FlatTagDeclaration_"+dst.toString()+"= new Tag("+type.toString()+")"; ---- } --- public FlatTagDeclaration(TagDescriptor type, TempDescriptor dst) { --- this.type=type; --- this.dst=dst; --- } ------- ---- public int kind() { ---- return FKind.FlatTagDeclaration; ---- } --- public String toString() { --- return "FlatTagDeclaration_"+dst.toString()+"= new Tag("+type.toString()+")"; --- } ------- ---- public TempDescriptor [] writesTemps() { ---- return new TempDescriptor[] {dst}; ---- } --- public int kind() { --- return FKind.FlatTagDeclaration; --- } ------- ---- public TempDescriptor [] readsTemps() { ---- return new TempDescriptor[0]; ---- } --- public TempDescriptor [] writesTemps() { --- return new TempDescriptor[] {dst}; --- } ------- ---- public TempDescriptor getDst() { ---- return dst; ---- } --- public TempDescriptor [] readsTemps() { --- return new TempDescriptor[0]; --- } ------- ---- public TagDescriptor getType() { ---- return type; ---- } --- public TempDescriptor getDst() { --- return dst; --- } --- --- public TagDescriptor getType() { --- return type; --- } -------} diff --cc Robust/src/IR/Flat/NodePair.java index f9164ffa,f9164ffa,f9164ffa,f9164ffa,c3a826e0,c3a826e0,c3a826e0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/NodePair.java +++ /dev/null @@@@@@@@ -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------package IR.Flat; ------- -------public class NodePair { ---- FlatNode begin; ---- FlatNode end; --- FlatNode begin; --- FlatNode end; ------- ---- public NodePair(FlatNode begin, FlatNode end) { ---- this.begin=begin; ---- this.end=end; ---- } --- public NodePair(FlatNode begin, FlatNode end) { --- this.begin=begin; --- this.end=end; --- } ------- ---- public FlatNode getBegin() { ---- return begin; ---- } --- public FlatNode getBegin() { --- return begin; --- } ------- ---- public FlatNode getEnd() { ---- return end; ---- } --- public FlatNode getEnd() { --- return end; --- } -------} diff --cc Robust/src/IR/Flat/ParamsObject.java index 8133a4a9,8133a4a9,8133a4a9,8133a4a9,22c689c1,22c689c1,22c689c1..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/ParamsObject.java +++ /dev/null @@@@@@@@ -1,95 -1,95 -1,95 -1,95 -1,95 -1,95 -1,95 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.*; -------import java.util.*; ------- -------public class ParamsObject { ---- private Vector pointerparams; ---- private Vector primitiveparams; ---- private MethodDescriptor method; ---- private TaskDescriptor task; ---- private int tag; ---- private Hashtable paramtotemp; ---- private Hashtable temptostore; ---- private int count; --- private Vector pointerparams; --- private Vector primitiveparams; --- private MethodDescriptor method; --- private TaskDescriptor task; --- private int tag; --- private Hashtable paramtotemp; --- private Hashtable temptostore; --- private int count; ------- ---- public ParamsObject(MethodDescriptor md, int tag) { ---- pointerparams=new Vector(); ---- primitiveparams=new Vector(); ---- paramtotemp=new Hashtable(); ---- temptostore=new Hashtable(); ---- this.method=md; ---- this.tag=tag; ---- count=0; ---- } --- public ParamsObject(MethodDescriptor md, int tag) { --- pointerparams=new Vector(); --- primitiveparams=new Vector(); --- paramtotemp=new Hashtable(); --- temptostore=new Hashtable(); --- this.method=md; --- this.tag=tag; --- count=0; --- } ------- ---- public ParamsObject(TaskDescriptor task, int tag) { ---- pointerparams=new Vector(); ---- primitiveparams=new Vector(); ---- paramtotemp=new Hashtable(); ---- temptostore=new Hashtable(); ---- this.task=task; ---- this.tag=tag; ---- count=0; ---- } --- public ParamsObject(TaskDescriptor task, int tag) { --- pointerparams=new Vector(); --- primitiveparams=new Vector(); --- paramtotemp=new Hashtable(); --- temptostore=new Hashtable(); --- this.task=task; --- this.tag=tag; --- count=0; --- } ------- ---- public int getUID() { ---- return tag; ---- } --- public int getUID() { --- return tag; --- } ------- ---- public void addPtr(TempDescriptor t) { ---- Position p=new Position(true, pointerparams.size()); ---- pointerparams.add(t); ---- paramtotemp.put(new Integer(count++), t); ---- temptostore.put(t,p); ---- } --- public void addPtr(TempDescriptor t) { --- Position p=new Position(true, pointerparams.size()); --- pointerparams.add(t); --- paramtotemp.put(new Integer(count++), t); --- temptostore.put(t,p); --- } ------- ---- public boolean isParamPtr(TempDescriptor t) { ---- if (containsTemp(t)) { ---- ParamsObject.Position p=(ParamsObject.Position)temptostore.get(t); ---- return p.inStruct; ---- } ---- return false; --- public boolean isParamPtr(TempDescriptor t) { --- if (containsTemp(t)) { --- ParamsObject.Position p=(ParamsObject.Position)temptostore.get(t); --- return p.inStruct; ------- } --- return false; --- } ------- ---- public boolean isParamPrim(TempDescriptor t) { ---- if (containsTemp(t)) { ---- ParamsObject.Position p=(ParamsObject.Position)temptostore.get(t); ---- return !p.inStruct; ---- } ---- return false; --- public boolean isParamPrim(TempDescriptor t) { --- if (containsTemp(t)) { --- ParamsObject.Position p=(ParamsObject.Position)temptostore.get(t); --- return !p.inStruct; ------- } --- return false; --- } ------- ---- public boolean containsTemp(TempDescriptor t) { ---- return temptostore.containsKey(t); ---- } --- public boolean containsTemp(TempDescriptor t) { --- return temptostore.containsKey(t); --- } ------- ---- public void addPrim(TempDescriptor t) { ---- Position p=new Position(false, primitiveparams.size()); ---- primitiveparams.add(t); ---- paramtotemp.put(new Integer(count++), t); ---- temptostore.put(t,p); ---- } --- public void addPrim(TempDescriptor t) { --- Position p=new Position(false, primitiveparams.size()); --- primitiveparams.add(t); --- paramtotemp.put(new Integer(count++), t); --- temptostore.put(t,p); --- } ------- ---- int numPointers() { ---- return pointerparams.size(); ---- } --- int numPointers() { --- return pointerparams.size(); --- } ------- ---- TempDescriptor getPointer(int i) { ---- return (TempDescriptor) pointerparams.get(i); ---- } ---- int numPrimitives() { ---- return primitiveparams.size(); ---- } --- TempDescriptor getPointer(int i) { --- return (TempDescriptor) pointerparams.get(i); --- } --- int numPrimitives() { --- return primitiveparams.size(); --- } ------- ---- TempDescriptor getPrimitive(int i) { ---- return (TempDescriptor) primitiveparams.get(i); ---- } ---- static class Position { ---- boolean inStruct; ---- int position; ---- Position(boolean inStruct, int position) { ---- this.inStruct=inStruct; ---- this.position=position; ---- } --- TempDescriptor getPrimitive(int i) { --- return (TempDescriptor) primitiveparams.get(i); --- } --- static class Position { --- boolean inStruct; --- int position; --- Position(boolean inStruct, int position) { --- this.inStruct=inStruct; --- this.position=position; ------- } --- } -------} diff --cc Robust/src/IR/Flat/TempDescriptor.java index 9e3034c2,39bb16e0,39bb16e0,39bb16e0,d5eb728a,d5eb728a,d5eb728a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/TempDescriptor.java +++ /dev/null @@@@@@@@ -1,70 -1,82 -1,82 -1,82 -1,82 -1,82 -1,82 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.*; ------- -------public class TempDescriptor extends Descriptor { ---- static int currentid=0; ---- int id; ---- // String safename; ---- TypeDescriptor type; ---- TagDescriptor tag; --- static int currentid=0; --- int id; --- // String safename; --- TypeDescriptor type; --- TagDescriptor tag; ------- ---- public TempDescriptor(String name) { ---- super(name); ---- id=currentid++; ---- } --- public TempDescriptor(String name) { --- super(name); --- id=currentid++; --- } ------- ---- public TempDescriptor(String name, TypeDescriptor td) { ---- this(name); ---- type=td; --- } --- public TempDescriptor(String name, TypeDescriptor td) { --- this(name); --- type=td; --- } ------ --- public TempDescriptor(String name, ClassDescriptor cd) { --- this(name); --- type=new TypeDescriptor(cd); ---- } --- public TempDescriptor(String name, ClassDescriptor cd) { --- this(name); --- type=new TypeDescriptor(cd); --- } ------- ---- public TempDescriptor(String name, TypeDescriptor type, TagDescriptor td) { ---- this(name); ---- this.type=type; ---- tag=td; --- } --- public TempDescriptor(String name, TypeDescriptor type, TagDescriptor td) { --- this(name); --- this.type=type; --- tag=td; --- } ------ --- public TempDescriptor createNew() { --- if (tag==null) --- return new TempDescriptor(name+"_"+currentid, type); --- else --- return new TempDescriptor(name+"_"+currentid, type, tag); ---- } ---- ---- public static TempDescriptor tempFactory() { ---- return new TempDescriptor("temp_"+currentid); ---- } --- public TempDescriptor createNew() { --- if (tag==null) --- return new TempDescriptor(name+"_"+currentid, type); --- else --- return new TempDescriptor(name+"_"+currentid, type, tag); --- } ------- ---- public static TempDescriptor tempFactory(String name) { ---- return new TempDescriptor(name+currentid); ---- } --- public static TempDescriptor tempFactory() { --- return new TempDescriptor("temp_"+currentid); --- } ------- ---- public static TempDescriptor tempFactory(String name, TypeDescriptor td) { ---- return new TempDescriptor(name+currentid,td); ---- } --- public static TempDescriptor tempFactory(String name) { --- return new TempDescriptor(name+currentid); --- } ------- ---- public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) { ---- return new TempDescriptor(name+currentid,type,tag); ---- } --- public static TempDescriptor tempFactory(String name, TypeDescriptor td) { --- return new TempDescriptor(name+currentid,td); --- } ------- ---- public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) { ---- return new TempDescriptor(name,td); ---- } --- public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) { --- return new TempDescriptor(name+currentid,type,tag); --- } ------- ---- public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) { ---- return new TempDescriptor(name, tagtype, tag); ---- } --- public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) { --- return new TempDescriptor(name,td); --- } ------- ---- public String toString() { ---- return safename; ---- } --- public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) { --- return new TempDescriptor(name, tagtype, tag); --- } ------- ---- public void setType(TypeDescriptor td) { ---- type=td; ---- } --- public String toString() { --- return safename; --- } ------- ---- public TypeDescriptor getType() { ---- return type; ---- } --- public void setType(TypeDescriptor td) { --- type=td; --- } ------- ---- public TagDescriptor getTag() { ---- return tag; ---- } --- public TypeDescriptor getType() { --- return type; --- } ------- ---- public void setTag(TagDescriptor tag) { ---- this.tag=tag; ---- } --- public TagDescriptor getTag() { --- return tag; --- } --- --- public void setTag(TagDescriptor tag) { --- this.tag=tag; --- } -------} diff --cc Robust/src/IR/Flat/TempFlagPair.java index 21915d2c,21915d2c,21915d2c,21915d2c,90d9f7b9,90d9f7b9,90d9f7b9..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/TempFlagPair.java +++ /dev/null @@@@@@@@ -1,37 -1,37 -1,37 -1,37 -1,37 -1,37 -1,37 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.FlagDescriptor; ------- -------public class TempFlagPair { ---- FlagDescriptor fd; ---- TempDescriptor td; --- FlagDescriptor fd; --- TempDescriptor td; ------- ---- public TempFlagPair(TempDescriptor td, FlagDescriptor fd) { ---- this.fd=fd; ---- this.td=td; ---- } ---- public int hashCode() { ---- if (fd!=null) ---- return fd.hashCode()^td.hashCode(); ---- else ---- return td.hashCode(); ---- } --- public TempFlagPair(TempDescriptor td, FlagDescriptor fd) { --- this.fd=fd; --- this.td=td; --- } --- public int hashCode() { --- if (fd!=null) --- return fd.hashCode()^td.hashCode(); --- else --- return td.hashCode(); --- } ------- ---- public TempDescriptor getTemp() { ---- return td; ---- } --- public TempDescriptor getTemp() { --- return td; --- } ------- ---- public FlagDescriptor getFlag() { ---- return fd; ---- } --- public FlagDescriptor getFlag() { --- return fd; --- } ------- ---- public boolean equals(Object o) { ---- if (!(o instanceof TempFlagPair)) ---- return false; ---- TempFlagPair tfp=(TempFlagPair)o; ---- return (tfp.fd==fd)&&(tfp.td==td); ---- } --- public boolean equals(Object o) { --- if (!(o instanceof TempFlagPair)) --- return false; --- TempFlagPair tfp=(TempFlagPair)o; --- return (tfp.fd==fd)&&(tfp.td==td); --- } ------- ---- public String toString() { ---- return "<"+fd+","+td+">"; ---- } --- public String toString() { --- return "<"+fd+","+td+">"; --- } -------} diff --cc Robust/src/IR/Flat/TempObject.java index f4e95e48,f4e95e48,f4e95e48,f4e95e48,01589158,01589158,01589158..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/TempObject.java +++ /dev/null @@@@@@@@ -1,104 -1,104 -1,104 -1,104 -1,104 -1,104 -1,104 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.*; -------import java.util.*; ------- -------public class TempObject { ---- ParamsObject params; ---- private Vector pointerparams; ---- private Vector primitiveparams; ---- private MethodDescriptor method; ---- private TaskDescriptor task; ---- private int tag; ---- private Hashtable paramtotemp; ---- private Hashtable temptostore; ---- private int count; --- ParamsObject params; --- private Vector pointerparams; --- private Vector primitiveparams; --- private MethodDescriptor method; --- private TaskDescriptor task; --- private int tag; --- private Hashtable paramtotemp; --- private Hashtable temptostore; --- private int count; ------- ---- public TempObject(ParamsObject p, MethodDescriptor md, int tag) { ---- params=p; ---- pointerparams=new Vector(); ---- primitiveparams=new Vector(); ---- paramtotemp=new Hashtable(); ---- temptostore=new Hashtable(); ---- this.method=md; ---- this.tag=tag; ---- count=0; ---- } --- public TempObject(ParamsObject p, MethodDescriptor md, int tag) { --- params=p; --- pointerparams=new Vector(); --- primitiveparams=new Vector(); --- paramtotemp=new Hashtable(); --- temptostore=new Hashtable(); --- this.method=md; --- this.tag=tag; --- count=0; --- } ------- ---- public TempObject(ParamsObject p, TaskDescriptor task, int tag) { ---- params=p; ---- pointerparams=new Vector(); ---- primitiveparams=new Vector(); ---- paramtotemp=new Hashtable(); ---- temptostore=new Hashtable(); ---- this.task=task; ---- this.tag=tag; ---- count=0; ---- } --- public TempObject(ParamsObject p, TaskDescriptor task, int tag) { --- params=p; --- pointerparams=new Vector(); --- primitiveparams=new Vector(); --- paramtotemp=new Hashtable(); --- temptostore=new Hashtable(); --- this.task=task; --- this.tag=tag; --- count=0; --- } ------- ---- public void addPtr(TempDescriptor t) { ---- if (!params.containsTemp(t)&&!pointerparams.contains(t)) { ---- Position p=new Position(true, pointerparams.size()); ---- pointerparams.add(t); ---- paramtotemp.put(new Integer(count++), t); ---- temptostore.put(t,p); ---- } --- public void addPtr(TempDescriptor t) { --- if (!params.containsTemp(t)&&!pointerparams.contains(t)) { --- Position p=new Position(true, pointerparams.size()); --- pointerparams.add(t); --- paramtotemp.put(new Integer(count++), t); --- temptostore.put(t,p); ------- } --- } ------- ---- public void addPrim(TempDescriptor t) { ---- if (!params.containsTemp(t)&&!primitiveparams.contains(t)) { ---- Position p=new Position(false, primitiveparams.size()); ---- primitiveparams.add(t); ---- paramtotemp.put(new Integer(count++), t); ---- temptostore.put(t,p); ---- } --- public void addPrim(TempDescriptor t) { --- if (!params.containsTemp(t)&&!primitiveparams.contains(t)) { --- Position p=new Position(false, primitiveparams.size()); --- primitiveparams.add(t); --- paramtotemp.put(new Integer(count++), t); --- temptostore.put(t,p); ------- } --- } ------- ---- public boolean isLocalPtr(TempDescriptor t) { ---- if (!params.containsTemp(t)) { ---- Position p=(Position)temptostore.get(t); ---- return p.inStruct; ---- } ---- return false; --- public boolean isLocalPtr(TempDescriptor t) { --- if (!params.containsTemp(t)) { --- Position p=(Position)temptostore.get(t); --- return p.inStruct; ------- } --- return false; --- } ------- ---- public boolean isLocalPrim(TempDescriptor t) { ---- if (!params.containsTemp(t)) { ---- Position p=(Position)temptostore.get(t); ---- return !p.inStruct; ---- } ---- return false; --- public boolean isLocalPrim(TempDescriptor t) { --- if (!params.containsTemp(t)) { --- Position p=(Position)temptostore.get(t); --- return !p.inStruct; ------- } --- return false; --- } ------- ---- public boolean isParamPtr(TempDescriptor t) { ---- return params.isParamPtr(t); ---- } --- public boolean isParamPtr(TempDescriptor t) { --- return params.isParamPtr(t); --- } ------- ---- public boolean isParamPrim(TempDescriptor t) { ---- return params.isParamPrim(t); ---- } --- public boolean isParamPrim(TempDescriptor t) { --- return params.isParamPrim(t); --- } ------- ---- int numPointers() { ---- return pointerparams.size(); ---- } --- int numPointers() { --- return pointerparams.size(); --- } ------- ---- TempDescriptor getPointer(int i) { ---- return (TempDescriptor) pointerparams.get(i); ---- } --- TempDescriptor getPointer(int i) { --- return (TempDescriptor) pointerparams.get(i); --- } ------- ---- int numPrimitives() { ---- return primitiveparams.size(); ---- } --- int numPrimitives() { --- return primitiveparams.size(); --- } ------- ---- TempDescriptor getPrimitive(int i) { ---- return (TempDescriptor) primitiveparams.get(i); ---- } --- TempDescriptor getPrimitive(int i) { --- return (TempDescriptor) primitiveparams.get(i); --- } ------- ---- static class Position { ---- boolean inStruct; ---- int position; ---- Position(boolean inStruct, int position) { ---- this.inStruct=inStruct; ---- this.position=position; ---- } --- static class Position { --- boolean inStruct; --- int position; --- Position(boolean inStruct, int position) { --- this.inStruct=inStruct; --- this.position=position; ------- } --- } -------} diff --cc Robust/src/IR/Flat/TempTagPair.java index 2231a000,2231a000,2231a000,2231a000,e4d935d8,e4d935d8,e4d935d8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Flat/TempTagPair.java +++ /dev/null @@@@@@@@ -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 +1,0 @@@@@@@@ -------package IR.Flat; -------import IR.TagDescriptor; ------- -------public class TempTagPair { ---- TagDescriptor tagd; ---- TempDescriptor td; ---- TempDescriptor tagt; --- TagDescriptor tagd; --- TempDescriptor td; --- TempDescriptor tagt; ------- ---- public TempTagPair(TempDescriptor td, TagDescriptor tagd, TempDescriptor tagt) { ---- this.tagd=tagd; ---- this.tagt=tagt; ---- this.td=td; ---- } ---- public int hashCode() { ---- return td.hashCode()^tagt.hashCode(); ---- } ---- ---- public TempDescriptor getTemp() { ---- return td; ---- } --- public TempTagPair(TempDescriptor td, TagDescriptor tagd, TempDescriptor tagt) { --- this.tagd=tagd; --- this.tagt=tagt; --- this.td=td; --- } --- public int hashCode() { --- return td.hashCode()^tagt.hashCode(); --- } ------- ---- public TagDescriptor getTag() { ---- return tagd; ---- } --- public TempDescriptor getTemp() { --- return td; --- } ------- ---- public TempDescriptor getTagTemp() { ---- return tagt; ---- } --- public TagDescriptor getTag() { --- return tagd; --- } ------- ---- public boolean equals(Object o) { ---- if (!(o instanceof TempTagPair)) ---- return false; ---- TempTagPair ttp=(TempTagPair)o; ---- if (ttp.tagt==tagt&&ttp.td==td) { ---- if (ttp.tagd!=null) { ---- if (!ttp.tagd.equals(tagd)) ---- throw new Error(); ---- } else if (tagd!=null) ---- throw new Error(); ---- ---- return true; ---- } else return false; ---- } --- public TempDescriptor getTagTemp() { --- return tagt; --- } ------- ---- public String toString() { ---- return "<"+td+","+tagd+","+tagt+">"; ---- } --- public boolean equals(Object o) { --- if (!(o instanceof TempTagPair)) --- return false; --- TempTagPair ttp=(TempTagPair)o; --- if (ttp.tagt==tagt&&ttp.td==td) { --- if (ttp.tagd!=null) { --- if (!ttp.tagd.equals(tagd)) --- throw new Error(); --- } else if (tagd!=null) --- throw new Error(); --- --- return true; --- } else return false; --- } --- --- public String toString() { --- return "<"+td+","+tagd+","+tagt+">"; --- } -------} diff --cc Robust/src/IR/MethodDescriptor.java index 79056252,1f781f3f,1f781f3f,6091ea5a,27423619,27423619,27423619..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/MethodDescriptor.java +++ /dev/null @@@@@@@@ -1,178 -1,183 -1,183 -1,187 -1,187 -1,187 -1,187 +1,0 @@@@@@@@ -------package IR; -------import IR.Tree.Modifiers; -------import IR.Tree.ExpressionNode; -------import java.util.Vector; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- * represents a symbol in the language (var name, function name, etc). ------- */ ------- -------public class MethodDescriptor extends Descriptor { ------- ---- protected Modifiers modifier; ---- protected TypeDescriptor returntype; ---- protected String identifier; ---- protected Vector params; ---- protected SymbolTable paramtable; ---- protected ClassDescriptor cd; ---- protected VarDescriptor thisvd; ---- protected boolean isglobal; --- protected Modifiers modifier; --- protected TypeDescriptor returntype; --- protected String identifier; --- protected Vector params; --- protected SymbolTable paramtable; --- protected ClassDescriptor cd; --- protected VarDescriptor thisvd; --- protected boolean isglobal; ------- ---- public MethodDescriptor(Modifiers m, TypeDescriptor rt, String identifier) { ---- super(identifier); ---- this.modifier=m; ---- this.returntype=rt; ---- this.identifier=identifier; ---- this.safename = "___" + name + "___"; ---- this.uniqueid=count++; ---- params=new Vector(); ---- paramtable=new SymbolTable(); ---- thisvd=null; ---- } --- public MethodDescriptor(Modifiers m, TypeDescriptor rt, String identifier) { --- super(identifier); --- this.modifier=m; --- this.returntype=rt; --- this.identifier=identifier; --- this.safename = "___" + name + "___"; --- this.uniqueid=count++; --- params=new Vector(); --- paramtable=new SymbolTable(); --- thisvd=null; --- } ------- ---- public Modifiers getModifiers() { ---- return modifier; ---- } ---- ---- public boolean matches(MethodDescriptor md) { ---- /* Check the name */ ---- if (!identifier.equals(md.identifier)) ---- return false; ---- if (numParameters()!=md.numParameters()) ---- return false; ---- for(int i=0;i"; ---- else if (operation==LTE) ---- return "<="; ---- else if (operation==GTE) ---- return ">="; ---- else if (operation==LEFTSHIFT) ---- return "<<"; ---- else if (operation==RIGHTSHIFT) ---- return ">>"; -- else if (operation==RIGHTSHIFT) - else if (operation==URIGHTSHIFT) --- return ">>>"; ---- else if (operation==SUB) ---- return "-"; ---- else if (operation==ADD) ---- return "+"; ---- else if (operation==MULT) ---- return "*"; ---- else if (operation==DIV) ---- return "/"; ---- else if (operation==MOD) ---- return "%"; ---- else if (operation==UNARYPLUS) ---- return "unaryplus"; ---- else if (operation==UNARYMINUS) ---- return "unaryminus"; ---- else if (operation==POSTINC) ---- return "postinc"; ---- else if (operation==POSTDEC) ---- return "postdec"; ---- else if (operation==PREINC) ---- return "preinc"; ---- else if (operation==PREDEC) ---- return "predec"; ---- else if (operation==ASSIGN) ---- return "assign"; ---- else throw new Error(); ---- } --- public static int parseOp(String st) { --- if (st.equals("logical_or")) --- return LOGIC_OR; --- else if (st.equals("logical_and")) --- return LOGIC_AND; --- else if (st.equals("bitwise_or")) --- return BIT_OR; --- else if (st.equals("bitwise_xor")) --- return BIT_XOR; --- else if (st.equals("bitwise_and")) --- return BIT_AND; --- else if (st.equals("equal")) --- return EQUAL; --- else if (st.equals("not_equal")) --- return NOTEQUAL; --- else if (st.equals("comp_lt")) --- return LT; --- else if (st.equals("comp_gt")) --- return GT; --- else if (st.equals("comp_lte")) --- return LTE; --- else if (st.equals("comp_gte")) --- return GTE; --- else if (st.equals("leftshift")) --- return LEFTSHIFT; --- else if (st.equals("rightshift")) --- return RIGHTSHIFT; --- else if (st.equals("urightshift")) --- return URIGHTSHIFT; --- else if (st.equals("sub")) --- return SUB; --- else if (st.equals("add")) --- return ADD; --- else if (st.equals("mult")) --- return MULT; --- else if (st.equals("div")) --- return DIV; --- else if (st.equals("mod")) --- return MOD; --- else if (st.equals("unaryplus")) --- return UNARYPLUS; --- else if (st.equals("unaryminus")) --- return UNARYMINUS; --- else if (st.equals("postinc")) --- return POSTINC; --- else if (st.equals("postdec")) --- return POSTDEC; --- else if (st.equals("preinc")) --- return PREINC; --- else if (st.equals("predec")) --- return PREDEC; --- else if (st.equals("not")) --- return LOGIC_NOT; --- else if (st.equals("comp")) --- return COMP; --- else - throw new Error(); -- throw new Error(st); --- } --- --- public String toString() { --- if (operation==LOGIC_OR) --- return "||"; --- else if (operation==LOGIC_AND) --- return "&&"; --- else if (operation==LOGIC_NOT) --- return "not"; --- else if (operation==COMP) --- return "~"; --- else if (operation==BIT_OR) --- return "|"; --- else if (operation==BIT_XOR) --- return "^"; --- else if (operation==BIT_AND) --- return "&"; --- else if (operation==EQUAL) --- return "=="; --- else if (operation==NOTEQUAL) --- return "!="; --- else if (operation==LT) --- return "<"; --- else if (operation==GT) --- return ">"; --- else if (operation==LTE) --- return "<="; --- else if (operation==GTE) --- return ">="; --- else if (operation==LEFTSHIFT) --- return "<<"; --- else if (operation==RIGHTSHIFT) --- return ">>"; --- else if (operation==URIGHTSHIFT) --- return ">>>"; --- else if (operation==SUB) --- return "-"; --- else if (operation==ADD) --- return "+"; --- else if (operation==MULT) --- return "*"; --- else if (operation==DIV) --- return "/"; --- else if (operation==MOD) --- return "%"; --- else if (operation==UNARYPLUS) --- return "unaryplus"; --- else if (operation==UNARYMINUS) --- return "unaryminus"; --- else if (operation==POSTINC) --- return "postinc"; --- else if (operation==POSTDEC) --- return "postdec"; --- else if (operation==PREINC) --- return "preinc"; --- else if (operation==PREDEC) --- return "predec"; --- else if (operation==ASSIGN) --- return "assign"; - else throw new Error(); -- else if (operation==ISAVAILABLE) -- return "isavailable"; -- else throw new Error("op="+operation); --- } ------- ------- -------} diff --cc Robust/src/IR/State.java index 9df0cc32,f67a6e56,f67a6e56,07bbae6e,c700c7ff,aed4c2d5,89322492..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/State.java +++ /dev/null @@@@@@@@ -1,171 -1,181 -1,181 -1,188 -1,188 -1,192 -1,195 +1,0 @@@@@@@@ -------package IR; -------import IR.Tree.*; -------import IR.Flat.*; -------import IR.*; -------import java.util.*; ------import Analysis.TaskStateAnalysis.*; ------- -------public class State { ---- public State() { ---- this.classes=new SymbolTable(); ---- this.tasks=new SymbolTable(); ---- this.treemethodmap=new Hashtable(); ---- this.flatmethodmap=new Hashtable(); ---- this.parsetrees=new HashSet(); ---- this.arraytypes=new HashSet(); ---- this.arraytonumber=new Hashtable(); ---- this.tagmap=new Hashtable(); - this.analysisresult=new Hashtable(); - this.optionaltaskdescriptors=new Hashtable(); --- this.selfloops=new HashSet(); - this.excprefetch=new HashSet(); ---- } --- public State() { --- this.classes=new SymbolTable(); --- this.tasks=new SymbolTable(); --- this.treemethodmap=new Hashtable(); --- this.flatmethodmap=new Hashtable(); --- this.parsetrees=new HashSet(); --- this.arraytypes=new HashSet(); --- this.arraytonumber=new Hashtable(); --- this.tagmap=new Hashtable(); --- this.selfloops=new HashSet(); --- this.excprefetch=new HashSet(); --- } ------- ---- public void addParseNode(ParseNode parsetree) { ---- parsetrees.add(parsetree); ---- } --- public void addParseNode(ParseNode parsetree) { --- parsetrees.add(parsetree); --- } ------- - public void storeAnalysisResult(Hashtable result){ - analysisresult = result; --- public void storeAnalysisResult(Hashtable>> analysisresults) { --- this.analysisresults=analysisresults; ---- } - - public void storeOptionalTaskDescriptors(Hashtable optionaltaskdescriptors){ - this.optionaltaskdescriptors=optionaltaskdescriptors; --- public void storeAnalysisResult(Hashtable>> analysisresults) { --- this.analysisresults=analysisresults; --- } ------ --- public Hashtable>> getAnalysisResult() { --- return analysisresults; ---- } --- public Hashtable>> getAnalysisResult() { --- return analysisresults; --- } ------- - public Hashtable getAnalysisResult(){ - return analysisresult; ------ --- public void storeOptionalTaskDescriptors(Hashtable> optionaltaskdescriptors){ --- this.optionaltaskdescriptors=optionaltaskdescriptors; ---- } - - public Hashtable getOptionalTaskDescriptors(){ --- public void storeOptionalTaskDescriptors(Hashtable> optionaltaskdescriptors) { --- this.optionaltaskdescriptors=optionaltaskdescriptors; --- } ------ --- public Hashtable> getOptionalTaskDescriptors(){ ---- return optionaltaskdescriptors; ---- } --- public Hashtable> getOptionalTaskDescriptors() { --- return optionaltaskdescriptors; --- } ------- ---- /** Boolean flag which indicates whether compiler is compiling a task-based ---- * program. */ ---- public boolean WEBINTERFACE=false; ---- public boolean TASK=false; ---- public boolean DSM=false; --- public boolean PREFETCH=false; ---- public boolean TASKSTATE=false; --- public boolean TAGSTATE=false; --- public boolean FLATIRGRAPH=false; --- public boolean FLATIRGRAPHTASKS=false; --- public boolean FLATIRGRAPHUSERMETHODS=false; --- public boolean FLATIRGRAPHLIBMETHODS=false; - public boolean MULTICORE=false; --- public boolean OWNERSHIP=false; ---- public boolean OPTIONAL=false; - public boolean RAW=false; --- public boolean SCHEDULING=false; ---- public boolean THREAD=false; ---- public boolean CONSCHECK=false; ---- public boolean INSTRUCTIONFAILURE=false; - public static double TRUEPROB=0.8; - public static boolean PRINTFLAT=false; - public int CORENUM = 1; ---- public String structfile; ---- public String main; --- /** Boolean flag which indicates whether compiler is compiling a task-based --- * program. */ --- public boolean WEBINTERFACE=false; --- public boolean TASK=false; --- public boolean DSM=false; --- public boolean PREFETCH=false; --- public boolean TASKSTATE=false; --- public boolean TAGSTATE=false; --- public boolean FLATIRGRAPH=false; --- public boolean FLATIRGRAPHTASKS=false; --- public boolean FLATIRGRAPHUSERMETHODS=false; --- public boolean FLATIRGRAPHLIBMETHODS=false; --- public boolean MULTICORE=false; --- public boolean OWNERSHIP=false; -- public int OWNERSHIPALLOCDEPTH=3; -- public boolean OWNERSHIPWRITEDOTS=false; -- public boolean OWNERSHIPWRITEALL=false; -- public String OWNERSHIPALIASFILE=null; --- public boolean OPTIONAL=false; --- public boolean RAW=false; --- public boolean SCHEDULING=false; - public boolean USEPROFILE=false; --- public boolean THREAD=false; --- public boolean CONSCHECK=false; --- public boolean INSTRUCTIONFAILURE=false; --- public static double TRUEPROB=0.8; --- public static boolean PRINTFLAT=false; - public static boolean PRINTSCHEDULING=false; - public static boolean PRINTSCHEDULESIM=false; --- public int CORENUM = 1; --- public String structfile; --- public String main; ------- --- public HashSet selfloops; - public HashSet excprefetch; ---- public SymbolTable classes; ---- public SymbolTable tasks; ---- public Set parsetrees; ---- public Hashtable treemethodmap; ---- public Hashtable flatmethodmap; ---- private HashSet arraytypes; ---- public Hashtable arraytonumber; ---- private int numclasses=0; ---- private int numtasks=0; ---- private int arraycount=0; --- public HashSet selfloops; --- public HashSet excprefetch; --- public SymbolTable classes; --- public SymbolTable tasks; --- public Set parsetrees; --- public Hashtable treemethodmap; --- public Hashtable flatmethodmap; --- private HashSet arraytypes; --- public Hashtable arraytonumber; --- private int numclasses=0; --- private int numtasks=0; --- private int arraycount=0; ------- ------- - private Hashtable analysisresult; - private Hashtable optionaltaskdescriptors; --- private Hashtable> optionaltaskdescriptors; --- private Hashtable>> analysisresults; --- private Hashtable> optionaltaskdescriptors; --- private Hashtable>> analysisresults; ------- ---- private Hashtable tagmap; ---- private int numtags=0; --- private Hashtable tagmap; --- private int numtags=0; ------- ---- public void addArrayType(TypeDescriptor td) { ---- if (!arraytypes.contains(td)) { ---- arraytypes.add(td); ---- arraytonumber.put(td,new Integer(arraycount++)); ---- } --- public void addArrayType(TypeDescriptor td) { --- if (!arraytypes.contains(td)) { --- arraytypes.add(td); --- arraytonumber.put(td,new Integer(arraycount++)); ------- } --- } ------- ---- public Iterator getArrayIterator() { ---- return arraytypes.iterator(); ---- } --- public Iterator getArrayIterator() { --- return arraytypes.iterator(); --- } ------- ---- public int getTagId(TagDescriptor tag) { ---- if (tagmap.containsKey(tag)) { ---- return ((Integer) tagmap.get(tag)).intValue(); ---- } else { ---- tagmap.put(tag, new Integer(numtags)); ---- return numtags++; ---- } --- public int getTagId(TagDescriptor tag) { --- if (tagmap.containsKey(tag)) { --- return ((Integer) tagmap.get(tag)).intValue(); --- } else { --- tagmap.put(tag, new Integer(numtags)); --- return numtags++; ------- } --- } ------- ---- public int getArrayNumber(TypeDescriptor td) { ---- return ((Integer)arraytonumber.get(td)).intValue(); ---- } --- public int getArrayNumber(TypeDescriptor td) { --- return ((Integer)arraytonumber.get(td)).intValue(); --- } ------- ---- public int numArrays() { ---- return arraytypes.size(); ---- } --- public int numArrays() { --- return arraytypes.size(); --- } ------- ---- public static TypeDescriptor getTypeDescriptor(int t) { ---- TypeDescriptor td=new TypeDescriptor(t); ---- return td; ---- } --- public static TypeDescriptor getTypeDescriptor(int t) { --- TypeDescriptor td=new TypeDescriptor(t); --- return td; --- } ------- ---- public static TypeDescriptor getTypeDescriptor(NameDescriptor n) { ---- TypeDescriptor td=new TypeDescriptor(n); ---- return td; ---- } --- public static TypeDescriptor getTypeDescriptor(NameDescriptor n) { --- TypeDescriptor td=new TypeDescriptor(n); --- return td; --- } ------- ---- public void addClass(ClassDescriptor tdn) { ---- if (classes.contains(tdn.getSymbol())) ---- throw new Error("Class "+tdn.getSymbol()+" defined twice"); ---- classes.add(tdn); ---- numclasses++; ---- } --- public void addClass(ClassDescriptor tdn) { --- if (classes.contains(tdn.getSymbol())) --- throw new Error("Class "+tdn.getSymbol()+" defined twice"); --- classes.add(tdn); --- numclasses++; --- } ------- ---- public int numClasses() { ---- return numclasses; ---- } --- public int numClasses() { --- return numclasses; --- } ------- ---- public BlockNode getMethodBody(MethodDescriptor md) { ---- return (BlockNode)treemethodmap.get(md); ---- } --- public BlockNode getMethodBody(MethodDescriptor md) { --- return (BlockNode)treemethodmap.get(md); --- } ------- ---- public BlockNode getMethodBody(TaskDescriptor td) { ---- return (BlockNode)treemethodmap.get(td); ---- } --- public BlockNode getMethodBody(TaskDescriptor td) { --- return (BlockNode)treemethodmap.get(td); --- } ------- ---- public SymbolTable getClassSymbolTable() { ---- return classes; ---- } --- public SymbolTable getClassSymbolTable() { --- return classes; --- } ------- ---- public SymbolTable getTaskSymbolTable() { ---- return tasks; ---- } --- public SymbolTable getTaskSymbolTable() { --- return tasks; --- } ------- ---- /** Returns Flat IR representation of MethodDescriptor md. */ --- /** Returns Flat IR representation of MethodDescriptor md. */ ------- ---- public FlatMethod getMethodFlat(MethodDescriptor md) { ---- return (FlatMethod)flatmethodmap.get(md); ---- } --- public FlatMethod getMethodFlat(MethodDescriptor md) { --- return (FlatMethod)flatmethodmap.get(md); --- } ------- ---- /** Returns Flat IR representation of TaskDescriptor td. */ --- /** Returns Flat IR representation of TaskDescriptor td. */ ------- ---- public FlatMethod getMethodFlat(TaskDescriptor td) { ---- return (FlatMethod)flatmethodmap.get(td); ---- } --- public FlatMethod getMethodFlat(TaskDescriptor td) { --- return (FlatMethod)flatmethodmap.get(td); --- } ------- ---- public void addTreeCode(MethodDescriptor md, BlockNode bn) { ---- treemethodmap.put(md,bn); ---- } --- public void addTreeCode(MethodDescriptor md, BlockNode bn) { --- treemethodmap.put(md,bn); --- } ------- ---- public void addTreeCode(TaskDescriptor td, BlockNode bn) { ---- treemethodmap.put(td,bn); ---- } --- public void addTreeCode(TaskDescriptor td, BlockNode bn) { --- treemethodmap.put(td,bn); --- } ------- ---- public void addFlatCode(MethodDescriptor md, FlatMethod bn) { ---- flatmethodmap.put(md,bn); ---- } --- public void addFlatCode(MethodDescriptor md, FlatMethod bn) { --- flatmethodmap.put(md,bn); --- } ------- ---- public void addFlatCode(TaskDescriptor td, FlatMethod bn) { ---- flatmethodmap.put(td,bn); ---- } --- public void addFlatCode(TaskDescriptor td, FlatMethod bn) { --- flatmethodmap.put(td,bn); --- } ------- ---- public void addTask(TaskDescriptor td) { ---- if (tasks.contains(td.getSymbol())) ---- throw new Error("Task "+td.getSymbol()+" defined twice"); ---- tasks.add(td); ---- numtasks++; ---- } --- public void addTask(TaskDescriptor td) { --- if (tasks.contains(td.getSymbol())) --- throw new Error("Task "+td.getSymbol()+" defined twice"); --- tasks.add(td); --- numtasks++; --- } -------} diff --cc Robust/src/IR/SymbolTable.java index 2c8bd2c5,2c8bd2c5,2c8bd2c5,2c8bd2c5,ed1d1337,ed1d1337,ed1d1337..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/SymbolTable.java +++ /dev/null @@@@@@@@ -1,125 -1,125 -1,125 -1,125 -1,125 -1,125 -1,125 +1,0 @@@@@@@@ -------package IR; ------- -------import java.util.*; ------- -------public class SymbolTable { ------- ---- private Hashtable table; ---- private SymbolTable parent; ---- private HashSet valueset; ---- ---- public SymbolTable() { ---- table = new Hashtable(); ---- valueset = new HashSet(); ---- this.parent = null; ---- } --- private Hashtable table; --- private SymbolTable parent; --- private HashSet valueset; ------- ---- public SymbolTable(SymbolTable parent) { ---- table = new Hashtable(); ---- this.parent = parent; ---- } --- public SymbolTable() { --- table = new Hashtable(); --- valueset = new HashSet(); --- this.parent = null; --- } ------- ---- public void add(Descriptor d) { ---- add(d.getSymbol(), d); ---- } ---- ---- public void add(String name, Descriptor d) { ---- if (!table.containsKey(name)) ---- table.put(name, new HashSet()); ---- HashSet hs=(HashSet)table.get(name); ---- hs.add(d); ---- valueset.add(d); ---- } --- public SymbolTable(SymbolTable parent) { --- table = new Hashtable(); --- this.parent = parent; --- } ------- ---- public Set getSet(String name) { ---- return getPSet(name); ---- } --- public void add(Descriptor d) { --- add(d.getSymbol(), d); --- } ------- ---- private HashSet getPSet(String name) { ---- HashSet hs=null; ---- if (parent!=null) ---- hs=parent.getPSet(name); ---- else ---- hs=new HashSet(); ---- if (table.containsKey(name)) { ---- hs.addAll((HashSet)table.get(name)); ---- } ---- return hs; ---- } --- public void add(String name, Descriptor d) { --- if (!table.containsKey(name)) --- table.put(name, new HashSet()); --- HashSet hs=(HashSet)table.get(name); --- hs.add(d); --- valueset.add(d); --- } ------- ---- public Set getSetFromSameScope(String name) { ---- return getPSetFromSameScope(name); ---- } --- public Set getSet(String name) { --- return getPSet(name); --- } ------- ---- private HashSet getPSetFromSameScope(String name) { ---- if (table.containsKey(name)) { ---- HashSet hs=(HashSet)table.get(name); ---- return hs; ---- } else ---- return new HashSet(); --- private HashSet getPSet(String name) { --- HashSet hs=null; --- if (parent!=null) --- hs=parent.getPSet(name); --- else --- hs=new HashSet(); --- if (table.containsKey(name)) { --- hs.addAll((HashSet)table.get(name)); ------- } --- return hs; --- } ------- ---- public Descriptor get(String name) { ---- Descriptor d = getFromSameScope(name); ---- if (d == null && parent != null) { ---- return parent.get(name); ---- } else { ---- return d; ---- } ---- } --- public Set getSetFromSameScope(String name) { --- return getPSetFromSameScope(name); --- } ------- ---- public Descriptor getFromSameScope(String name) { ---- if (table.containsKey(name)) { ---- HashSet hs=(HashSet) table.get(name); ---- return (Descriptor) hs.iterator().next(); ---- } else ---- return null; --- private HashSet getPSetFromSameScope(String name) { --- if (table.containsKey(name)) { --- HashSet hs=(HashSet)table.get(name); --- return hs; --- } else --- return new HashSet(); --- } ------- ---- } ---- ---- public Enumeration getNames() { ---- return table.keys(); --- public Descriptor get(String name) { --- Descriptor d = getFromSameScope(name); --- if (d == null && parent != null) { --- return parent.get(name); --- } else { --- return d; ------- } --- } ------- ---- public Iterator getNamesIterator() { ---- return table.keySet().iterator(); ---- } --- public Descriptor getFromSameScope(String name) { --- if (table.containsKey(name)) { --- HashSet hs=(HashSet) table.get(name); --- return (Descriptor) hs.iterator().next(); --- } else --- return null; ------- ---- public Set getValueSet() { ---- return valueset; ---- } --- } ------- ---- public Iterator getDescriptorsIterator() { ---- return getValueSet().iterator(); ---- } --- public Enumeration getNames() { --- return table.keys(); --- } ------- ---- public Set getAllValueSet() { ---- HashSet hs=null; ---- if (parent!=null) ---- hs=(HashSet) parent.getAllValueSet(); ---- else ---- hs=new HashSet(); ---- hs.addAll(valueset); ---- return hs; ---- } --- public Iterator getNamesIterator() { --- return table.keySet().iterator(); --- } ------- ---- public Iterator getAllDescriptorsIterator() { ---- return getAllValueSet().iterator(); ---- } --- public Set getValueSet() { --- return valueset; --- } ------- ---- public boolean contains(String name) { ---- return (get(name) != null); ---- } ---- ---- public SymbolTable getParent() { ---- return parent; ---- } ---- ---- public void setParent(SymbolTable parent) { ---- this.parent = parent; ---- } --- public Iterator getDescriptorsIterator() { --- return getValueSet().iterator(); --- } ------- ---- public String toString() { ---- return "ST: " + table.toString(); ---- } --- public Set getAllValueSet() { --- HashSet hs=null; --- if (parent!=null) --- hs=(HashSet) parent.getAllValueSet(); --- else --- hs=new HashSet(); --- hs.addAll(valueset); --- return hs; --- } --- --- public Iterator getAllDescriptorsIterator() { --- return getAllValueSet().iterator(); --- } --- --- public boolean contains(String name) { --- return (get(name) != null); --- } --- --- public SymbolTable getParent() { --- return parent; --- } --- --- public void setParent(SymbolTable parent) { --- this.parent = parent; --- } --- --- public String toString() { --- return "ST: " + table.toString(); --- } -------} diff --cc Robust/src/IR/TagDescriptor.java index 48a2e70a,48a2e70a,48a2e70a,48a2e70a,bb961d52,bb961d52,bb961d52..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/TagDescriptor.java +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------package IR; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- * represents a symbol in the language (var name, function name, etc). ------- */ ------- -------public class TagDescriptor extends Descriptor { ------- ---- public TagDescriptor(String identifier) { ---- super(identifier); ---- } --- public TagDescriptor(String identifier) { --- super(identifier); --- } ------- ---- public boolean equals(Object o) { ---- if (o instanceof TagDescriptor) { ---- TagDescriptor t=(TagDescriptor) o; ---- return getSymbol().equals(t.getSymbol()); ---- } else return false; ---- } ---- ---- public int hashCode() { ---- return getSymbol().hashCode(); ---- } --- public boolean equals(Object o) { --- if (o instanceof TagDescriptor) { --- TagDescriptor t=(TagDescriptor) o; --- return getSymbol().equals(t.getSymbol()); --- } else return false; --- } ------- ---- public String toString() { ---- return "Tag "+getSymbol(); ---- } --- public int hashCode() { --- return getSymbol().hashCode(); --- } --- --- public String toString() { --- return "Tag "+getSymbol(); --- } -------} diff --cc Robust/src/IR/TagVarDescriptor.java index a478f447,a478f447,a478f447,a478f447,4cca52da,4cca52da,4cca52da..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/TagVarDescriptor.java +++ /dev/null @@@@@@@@ -1,56 -1,56 -1,56 -1,56 -1,56 -1,56 -1,56 +1,0 @@@@@@@@ -------package IR; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- * represents a symbol in the language (var name, function name, etc). ------- */ ------- -------public class TagVarDescriptor extends Descriptor { ------- ---- protected TagDescriptor td; ---- protected String identifier; ---- ---- public TagVarDescriptor(TagDescriptor t, String identifier) { ---- super(identifier); ---- this.td=t; ---- this.identifier=identifier; ---- this.safename = "___" + name + "___"; ---- this.uniqueid=count++; ---- } --- protected TagDescriptor td; --- protected String identifier; ------- ---- public String getName() { ---- return identifier; ---- } --- public TagVarDescriptor(TagDescriptor t, String identifier) { --- super(identifier); --- this.td=t; --- this.identifier=identifier; --- this.safename = "___" + name + "___"; --- this.uniqueid=count++; --- } ------- ---- public TagDescriptor getTag() { ---- return td; ---- } --- public String getName() { --- return identifier; --- } ------- ---- public TypeDescriptor getType() { ---- return new TypeDescriptor(TypeDescriptor.TAG); ---- } --- public TagDescriptor getTag() { --- return td; --- } ------- ---- /* public boolean equals(Object o) { ---- if (o instanceof TagVarDescriptor) { ---- TagVarDescriptor tvd=(TagVarDescriptor)o; ---- if (tvd.identifier.equals(identifier)) { ---- if (tvd.td!=null) { ---- if (!tvd.td.equals(td)) ---- throw new Error(); ---- } else if (td!=null) ---- throw new Error(); ---- return true; ---- } ---- } ---- return false; ---- } --- public TypeDescriptor getType() { --- return new TypeDescriptor(TypeDescriptor.TAG); --- } ------- ---- public int hashCode() { ---- return identifier.hashCode(); ---- }*/ --- /* public boolean equals(Object o) { --- if (o instanceof TagVarDescriptor) { --- TagVarDescriptor tvd=(TagVarDescriptor)o; --- if (tvd.identifier.equals(identifier)) { --- if (tvd.td!=null) { --- if (!tvd.td.equals(td)) --- throw new Error(); --- } else if (td!=null) --- throw new Error(); --- return true; --- } --- } --- return false; --- } ------- ---- public String toString() { ---- return td.toString()+" "+identifier; ---- } --- public int hashCode() { --- return identifier.hashCode(); --- }*/ --- --- public String toString() { --- return td.toString()+" "+identifier; --- } -------} diff --cc Robust/src/IR/TaskDescriptor.java index fb8e784c,166f2284,166f2284,166f2284,a7152d91,a7152d91,a7152d91..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/TaskDescriptor.java +++ /dev/null @@@@@@@@ -1,115 -1,113 -1,113 -1,113 -1,113 -1,113 -1,113 +1,0 @@@@@@@@ -------package IR; -------import IR.Tree.FlagExpressionNode; -------import IR.Tree.TagExpressionList; -------import IR.Tree.FlagEffects; -------import java.util.Vector; -------import java.util.Hashtable; -------import java.util.Iterator; -------import IR.Tree.Modifiers; ------- -------/** ---- * Descriptor --- * Descriptor ------- * ------- */ ------- -------public class TaskDescriptor extends Descriptor { ------- ---- protected Hashtable flagstable; ---- protected Hashtable tagstable; ---- protected Vector vfe; ---- protected String identifier; ---- protected Vector params; ---- protected Vector optionals; ---- protected SymbolTable paramtable; --- protected Hashtable flagstable; --- protected Hashtable tagstable; --- protected Vector vfe; --- protected String identifier; --- protected Vector params; --- protected Vector optionals; --- protected SymbolTable paramtable; ------- ---- public TaskDescriptor(String identifier) { ---- super(identifier); ---- this.identifier=identifier; ---- this.uniqueid=count++; ---- flagstable=new Hashtable(); ---- tagstable=new Hashtable(); //BUGFIX - added initialization here ---- params=new Vector(); ---- optionals = new Vector(); ---- paramtable=new SymbolTable(); ---- } --- public TaskDescriptor(String identifier) { --- super(identifier); --- this.identifier=identifier; --- this.uniqueid=count++; --- flagstable=new Hashtable(); --- tagstable=new Hashtable(); //BUGFIX - added initialization here --- params=new Vector(); --- optionals = new Vector(); --- paramtable=new SymbolTable(); --- } ------- ---- public void addFlagEffects(Vector vfe) { ---- this.vfe=vfe; ---- } --- public void addFlagEffects(Vector vfe) { --- this.vfe=vfe; --- } ------- ---- public Vector getFlagEffects() { ---- return vfe; ---- } --- public Vector getFlagEffects() { --- return vfe; --- } ------- ---- public SymbolTable getParameterTable() { ---- return paramtable; ---- } --- public SymbolTable getParameterTable() { --- return paramtable; --- } ------- ---- public void addParameter(TypeDescriptor type, String paramname, FlagExpressionNode fen, TagExpressionList tel, boolean isoptional) { ---- if (paramname.equals("this")) ---- throw new Error("Can't have parameter named this"); ---- VarDescriptor vd=new VarDescriptor(type, paramname); ---- params.add(vd); ---- if (isoptional) optionals.add(vd); ---- if (fen!=null) ---- flagstable.put(vd, fen); ---- if (tel!=null) {//BUGFIX - added null check here...test with any bristlecone program ---- tagstable.put(vd, tel); ---- for(int i=0;i0) ---- str+=","; ---- str+=getVar(i)+" : "; ---- str+=getArg(i).printNode(0); ---- } ---- return str+")"; --- public String printNode(int indent) { --- String str="assert("+specname+"("; --- for(int i=0; i0) --- str+=","; --- str+=getVar(i)+" : "; --- str+=getArg(i).printNode(0); ------- } --- return str+")"; --- } -------} diff --cc Robust/src/IR/Tree/CreateObjectNode.java index 5f19aae2,5f19aae2,5f19aae2,5f19aae2,7c8230d4,7c8230d4,7c8230d4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/CreateObjectNode.java +++ /dev/null @@@@@@@@ -1,81 -1,81 -1,81 -1,81 -1,81 -1,81 -1,81 +1,0 @@@@@@@@ -------package IR.Tree; -------import java.util.Vector; -------import IR.TypeDescriptor; -------import IR.MethodDescriptor; ------- -------public class CreateObjectNode extends ExpressionNode { ---- TypeDescriptor td; ---- Vector argumentlist; ---- MethodDescriptor md; ---- FlagEffects fe; ---- boolean isglobal; --- TypeDescriptor td; --- Vector argumentlist; --- MethodDescriptor md; --- FlagEffects fe; --- boolean isglobal; ------- ---- public CreateObjectNode(TypeDescriptor type, boolean isglobal) { ---- td=type; ---- argumentlist=new Vector(); ---- this.isglobal=isglobal; ---- } --- public CreateObjectNode(TypeDescriptor type, boolean isglobal) { --- td=type; --- argumentlist=new Vector(); --- this.isglobal=isglobal; --- } ------- ---- public boolean isGlobal() { ---- return isglobal; ---- } --- public boolean isGlobal() { --- return isglobal; --- } ------- ---- public void addFlagEffects(FlagEffects fe) { ---- this.fe=fe; ---- } --- public void addFlagEffects(FlagEffects fe) { --- this.fe=fe; --- } ------- ---- public FlagEffects getFlagEffects() { ---- return fe; ---- } --- public FlagEffects getFlagEffects() { --- return fe; --- } ------- ---- public void addArgument(ExpressionNode en) { ---- argumentlist.add(en); ---- } --- public void addArgument(ExpressionNode en) { --- argumentlist.add(en); --- } ------- ---- public void setConstructor(MethodDescriptor md) { ---- this.md=md; ---- } --- public void setConstructor(MethodDescriptor md) { --- this.md=md; --- } ------- ---- public MethodDescriptor getConstructor() { ---- return md; ---- } --- public MethodDescriptor getConstructor() { --- return md; --- } ------- ---- public TypeDescriptor getType() { ---- return td; ---- } --- public TypeDescriptor getType() { --- return td; --- } ------- ---- public int numArgs() { ---- return argumentlist.size(); ---- } --- public int numArgs() { --- return argumentlist.size(); --- } ------- ---- public ExpressionNode getArg(int i) { ---- return (ExpressionNode) argumentlist.get(i); ---- } --- public ExpressionNode getArg(int i) { --- return (ExpressionNode) argumentlist.get(i); --- } ------- ---- public String printNode(int indent) { ---- String st; ---- boolean isarray=td.isArray(); ---- if (isarray) ---- st="new "+td.toString()+"["; ---- else ---- st="new "+td.toString()+"("; ---- for(int i=0;i= 0) { ---- return line; ---- } else { ---- if (parent != null) { ---- return parent.getLine(); ---- } else { ---- return 0; ---- } ---- } ---- } --- public SymbolTable getSymbolTable() { --- if (st == null) { --- if (parent != null) { --- return parent.getSymbolTable(); --- } else { --- return null; --- } --- } else { --- return st; --- } --- } --- */ ------- ---- public void setParent( ParseNode parent ) { ---- this.parent = parent; --- public int getLine() { --- if (line >= 0) { --- return line; --- } else { --- if (parent != null) { --- return parent.getLine(); --- } else { --- return 0; --- } ------- } --- } ------- ---- public ParseNode getParent() { ---- return parent; ---- } --- public void setParent(ParseNode parent) { --- this.parent = parent; --- } ------- ---- public ParseNode insertChild(ParseNode child) { ---- if (child == null) { ---- throw new NullPointerException("Can't add null node to parse tree"); ---- } --- public ParseNode getParent() { --- return parent; --- } ------- ---- children.insertElementAt(child, 0); ---- child.setParent(this); ---- return child; --- public ParseNode insertChild(ParseNode child) { --- if (child == null) { --- throw new NullPointerException("Can't add null node to parse tree"); ------- } ------- ---- public ParseNode insertChild(String newlabel) { ---- ParseNode child = new ParseNode(newlabel, -1); ---- return insertChild(child); ---- } --- children.insertElementAt(child, 0); --- child.setParent(this); --- return child; --- } ------- ---- public ParseNode addChild( ParseNode child ) { --- public ParseNode insertChild(String newlabel) { --- ParseNode child = new ParseNode(newlabel, -1); --- return insertChild(child); --- } ------- ---- if (child == null) { ---- throw new NullPointerException("Can't add null node to parse tree: "+getLabel()); ---- } --- public ParseNode addChild(ParseNode child) { ------- ---- children.addElement (child); ---- child.setParent(this); ---- return child; --- if (child == null) { --- throw new NullPointerException("Can't add null node to parse tree: "+getLabel()); ------- } ------- ---- public ParseNode addChild( String newlabel ) { ---- ---- ParseNode child = new ParseNode(newlabel, -1); ---- children.addElement(child); ---- child.setParent(this); ---- return child; ---- } --- children.addElement(child); --- child.setParent(this); --- return child; --- } ------- ---- public ParseNode addChild (String newlabel, int line) { ---- ParseNode child = new ParseNode(newlabel, line); ---- children.addElement(child); ---- child.setParent(this); ---- return child; ---- } --- public ParseNode addChild(String newlabel) { ------- ---- public ParseNodeVector getChildren() { ---- return children; ---- } --- ParseNode child = new ParseNode(newlabel, -1); --- children.addElement(child); --- child.setParent(this); --- return child; --- } ------- ---- public ParseNode getChild (String label) { ---- int i; ---- ParseNode p; --- public ParseNode addChild(String newlabel, int line) { --- ParseNode child = new ParseNode(newlabel, line); --- children.addElement(child); --- child.setParent(this); --- return child; --- } ------- ---- for (i = 0; i < children.size(); i++) { ---- p = children.elementAt(i); ---- if (p.getLabel().equals(label)) { ---- return p; ---- } ---- } --- public ParseNodeVector getChildren() { --- return children; --- } ------- ---- return null; ---- } --- public ParseNode getChild(String label) { --- int i; --- ParseNode p; ------- ---- public ParseNode getRoot() { ---- return (parent == null) ? this : parent.getRoot(); --- for (i = 0; i < children.size(); i++) { --- p = children.elementAt(i); --- if (p.getLabel().equals(label)) { --- return p; --- } ------- } ------- ---- public String getTerminal () { ---- ParseNode pn = children.elementAt(0); ---- if (pn == null) { ---- return null; ---- } else { ---- return pn.getLabel(); ---- } ---- } --- return null; --- } ------- ---- public ParseNode getFirstChild() { ---- return children.elementAt(0); --- public ParseNode getRoot() { --- return (parent == null) ? this : parent.getRoot(); --- } --- --- public String getTerminal() { --- ParseNode pn = children.elementAt(0); --- if (pn == null) { --- return null; --- } else { --- return pn.getLabel(); ------- } --- } ------- ---- public ParseNodeVector getChildren(String label) { ---- int i; ---- ParseNodeVector v = new ParseNodeVector(); --- public ParseNode getFirstChild() { --- return children.elementAt(0); --- } ------- ---- for (i = 0; i < children.size(); i++) { ---- ParseNode pn = children.elementAt(i); ---- if (pn.getLabel().equals(label)) ---- v.addElement(pn); ---- } --- public ParseNodeVector getChildren(String label) { --- int i; --- ParseNodeVector v = new ParseNodeVector(); ------- ---- return v; --- for (i = 0; i < children.size(); i++) { --- ParseNode pn = children.elementAt(i); --- if (pn.getLabel().equals(label)) --- v.addElement(pn); ------- } ------- ---- public String getNodeName() { ---- return label + " - " + getLine(); ---- } --- return v; --- } ------- ---- public int getNeighborCount() { ---- return children.size(); ---- } --- public String getNodeName() { --- return label + " - " + getLine(); --- } ------- ---- public Object getNeighbor(int index) { ---- return children.elementAt(index); ---- } --- public int getNeighborCount() { --- return children.size(); --- } ------- ---- public String doIndent(int indent) { --- public Object getNeighbor(int index) { --- return children.elementAt(index); --- } ------- ---- String output = new String(); ---- for(int i=0;i\n"; ---- } else { ---- output += doIndent(indent) + "<" + label + ">\n"; ---- indent += 2; ---- ---- if (recursive) { ---- for (int i = 0; i < children.size(); i++) { ---- Walkable w = (Walkable)children.elementAt(i); ---- output += w.PPrint(indent, true); ---- } ---- } else { ---- for (int i = 0; i < children.size(); i++) { ---- Walkable w = (Walkable)children.elementAt(i); ---- output += doIndent(indent) + "<" + w.getNodeName() + "/>\n"; ---- } ---- } ---- ---- indent -= 2; ---- output += doIndent(indent) + "\n"; --- String output = new String(); --- --- if (children.size()==0) { --- output += doIndent(indent) + "<" + label + "/>\n"; --- } else { --- output += doIndent(indent) + "<" + label + ">\n"; --- indent += 2; --- --- if (recursive) { --- for (int i = 0; i < children.size(); i++) { --- Walkable w = (Walkable)children.elementAt(i); --- output += w.PPrint(indent, true); --- } --- } else { --- for (int i = 0; i < children.size(); i++) { --- Walkable w = (Walkable)children.elementAt(i); --- output += doIndent(indent) + "<" + w.getNodeName() + "/>\n"; ------- } --- } ------- ---- return output; --- indent -= 2; --- output += doIndent(indent) + "\n"; ------- } --- --- return output; --- } ------- -------} ------- diff --cc Robust/src/IR/Tree/ParseNodeDOTVisitor.java index e9907284,e9907284,e9907284,e9907284,cbd2b653,cbd2b653,cbd2b653..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/ParseNodeDOTVisitor.java +++ /dev/null @@@@@@@@ -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 -1,71 +1,0 @@@@@@@@ -------/* ---- ---- Class: ParseNodeDOTVisitor ---- Author: Dan Roy ---- Purpose: Traverses a ParseNode tree and generates a DOT file that represents the parse --- --- Class: ParseNodeDOTVisitor --- Author: Dan Roy --- Purpose: Traverses a ParseNode tree and generates a DOT file that represents the parse ------- tree. ------- ---- */ --- */ ------- -------package IR.Tree; ------- -------import java.util.*; ------- -------public class ParseNodeDOTVisitor { ---- ---- java.io.PrintWriter output; ---- int tokennumber; ---- int color; ------- ---- private ParseNodeDOTVisitor(java.io.OutputStream output) { ---- tokennumber = 0; ---- color = 0; ---- this.output = new java.io.PrintWriter(output, true); ---- } --- java.io.PrintWriter output; --- int tokennumber; --- int color; ------- ---- private String getNewID(String name) { ---- tokennumber = tokennumber + 1; ---- return new String (name+tokennumber); ---- } --- private ParseNodeDOTVisitor(java.io.OutputStream output) { --- tokennumber = 0; --- color = 0; --- this.output = new java.io.PrintWriter(output, true); --- } ------- ---- public static void visit(java.io.OutputStream output, ParseNode root) { ---- ParseNodeDOTVisitor visitor = new ParseNodeDOTVisitor(output); ---- visitor.make(root); ---- } ---- ---- private void make(ParseNode root) { ---- output.println("digraph dotvisitor {"); ---- output.println("\tsize=\"7, 10\";"); ---- traverse(root, getNewID("root")); ---- output.println("}\n"); ---- } --- private String getNewID(String name) { --- tokennumber = tokennumber + 1; --- return new String(name+tokennumber); --- } ------- ---- private String newColor() { --- public static void visit(java.io.OutputStream output, ParseNode root) { --- ParseNodeDOTVisitor visitor = new ParseNodeDOTVisitor(output); --- visitor.make(root); --- } ------- --- private void make(ParseNode root) { --- output.println("digraph dotvisitor {"); --- output.println("\tsize=\"7, 10\";"); --- traverse(root, getNewID("root")); --- output.println("}\n"); --- } ------- ---- if (color == 0) { ---- color++; ---- return new String("red"); ---- } else if (color == 1) { ---- color++; ---- return new String("green"); ---- } else { ---- color = 0; ---- return new String("blue"); ---- } --- private String newColor() { --- --- --- if (color == 0) { --- color++; --- return new String("red"); --- } else if (color == 1) { --- color++; --- return new String("green"); --- } else { --- color = 0; --- return new String("blue"); ------- } --- } ------- ---- private void traverse(ParseNode node, String nodeid) { ---- output.println("\t" + nodeid + " [label=\"" + node.getLabel() + "\",shape=box];"); ---- ParseNodeVector children = node.getChildren(); ---- for (int i = 0; i < children.size(); i++) { ---- ParseNode child = children.elementAt(i); ---- String childid = getNewID("node"); ---- output.println("\t" + nodeid + " -> " + childid + ";"); ---- if (child.getLabel()=="rule") { ---- output.println("\tnode [color=" + newColor() + "];"); ---- } ---- traverse(child, childid); ---- } --- private void traverse(ParseNode node, String nodeid) { --- output.println("\t" + nodeid + " [label=\"" + node.getLabel() + "\",shape=box];"); --- ParseNodeVector children = node.getChildren(); --- for (int i = 0; i < children.size(); i++) { --- ParseNode child = children.elementAt(i); --- String childid = getNewID("node"); --- output.println("\t" + nodeid + " -> " + childid + ";"); --- if (child.getLabel()=="rule") { --- output.println("\tnode [color=" + newColor() + "];"); --- } --- traverse(child, childid); ------- } --- } -------} diff --cc Robust/src/IR/Tree/ParseNodeVector.java index efedcf66,efedcf66,efedcf66,efedcf66,112392be,112392be,112392be..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/ParseNodeVector.java +++ /dev/null @@@@@@@@ -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 +1,0 @@@@@@@@ -------package IR.Tree; ------- -------import java.util.Vector; ------- -------public class ParseNodeVector { ---- private Vector v; --- private Vector v; ------- ---- public ParseNodeVector() { ---- v = new Vector(); ---- } --- public ParseNodeVector() { --- v = new Vector(); --- } ------- ---- public void addElement(ParseNode pn) { ---- v.addElement(pn); ---- } --- public void addElement(ParseNode pn) { --- v.addElement(pn); --- } ------- ---- public void insertElementAt(ParseNode pn, int n) { ---- v.insertElementAt(pn, n); ---- } --- public void insertElementAt(ParseNode pn, int n) { --- v.insertElementAt(pn, n); --- } ------- ---- public ParseNode elementAt(int i) { ---- return (ParseNode) v.elementAt(i); ---- } --- public ParseNode elementAt(int i) { --- return (ParseNode) v.elementAt(i); --- } ------- ---- public int size() { ---- return v.size(); ---- } --- public int size() { --- return v.size(); --- } -------} diff --cc Robust/src/IR/Tree/ReturnNode.java index 780a4cbd,780a4cbd,780a4cbd,780a4cbd,6697d1d5,6697d1d5,6697d1d5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/ReturnNode.java +++ /dev/null @@@@@@@@ -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 +1,0 @@@@@@@@ -------package IR.Tree; ------- -------public class ReturnNode extends BlockStatementNode { ---- ExpressionNode en; --- ExpressionNode en; ------- ---- public ReturnNode() { ---- en=null; ---- } --- public ReturnNode() { --- en=null; --- } ------- ---- public ReturnNode(ExpressionNode en) { ---- this.en=en; ---- } --- public ReturnNode(ExpressionNode en) { --- this.en=en; --- } ------- ---- public ExpressionNode getReturnExpression() { ---- return en; ---- } --- public ExpressionNode getReturnExpression() { --- return en; --- } ------- ---- public String printNode(int indent) { ---- if (en==null) ---- return "return"; ---- else ---- return "return "+en.printNode(indent); ---- } ---- public int kind() { ---- return Kind.ReturnNode; ---- } --- public String printNode(int indent) { --- if (en==null) --- return "return"; --- else --- return "return "+en.printNode(indent); --- } --- public int kind() { --- return Kind.ReturnNode; --- } -------} diff --cc Robust/src/IR/Tree/SemanticCheck.java index af01c886,816ee712,816ee712,a12084d5,32577cc5,32577cc5,32577cc5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/SemanticCheck.java +++ /dev/null @@@@@@@@ -1,894 -1,978 -1,978 -1,978 -1,992 -1,992 -1,992 +1,0 @@@@@@@@ -------package IR.Tree; ------- -------import java.util.*; -------import IR.*; ------- -------public class SemanticCheck { ---- State state; ---- TypeUtil typeutil; ---- ---- public SemanticCheck(State state, TypeUtil tu) { ---- this.state=state; ---- this.typeutil=tu; ---- } ---- ---- public void semanticCheck() { ---- SymbolTable classtable=state.getClassSymbolTable(); ---- Iterator it=classtable.getDescriptorsIterator(); ---- // Do descriptors first ---- while(it.hasNext()) { ---- ClassDescriptor cd=(ClassDescriptor)it.next(); ---- //System.out.println("Checking class: "+cd); ---- //Set superclass link up ---- if (cd.getSuper()!=null) { ---- cd.setSuper(typeutil.getClass(cd.getSuper())); ---- // Link together Field, Method, and Flag tables so classes ---- // inherit these from their superclasses ---- cd.getFieldTable().setParent(cd.getSuperDesc().getFieldTable()); ---- cd.getMethodTable().setParent(cd.getSuperDesc().getMethodTable()); ---- cd.getFlagTable().setParent(cd.getSuperDesc().getFlagTable()); ---- } ---- ---- /* Check to see that fields are well typed */ ---- for(Iterator field_it=cd.getFields();field_it.hasNext();) { ---- FieldDescriptor fd=(FieldDescriptor)field_it.next(); ---- //System.out.println("Checking field: "+fd); ---- checkField(cd,fd); ---- } --- State state; --- TypeUtil typeutil; ------- ---- for(Iterator method_it=cd.getMethods();method_it.hasNext();) { ---- MethodDescriptor md=(MethodDescriptor)method_it.next(); ---- checkMethod(cd,md); ---- } ---- } --- public SemanticCheck(State state, TypeUtil tu) { --- this.state=state; --- this.typeutil=tu; --- } ------- ---- it=classtable.getDescriptorsIterator(); ---- // Do descriptors first ---- while(it.hasNext()) { ---- ClassDescriptor cd=(ClassDescriptor)it.next(); ---- for(Iterator method_it=cd.getMethods();method_it.hasNext();) { ---- MethodDescriptor md=(MethodDescriptor)method_it.next(); ---- checkMethodBody(cd,md); ---- } ---- } --- public void semanticCheck() { --- SymbolTable classtable=state.getClassSymbolTable(); --- Iterator it=classtable.getDescriptorsIterator(); --- // Do descriptors first --- while(it.hasNext()) { --- ClassDescriptor cd=(ClassDescriptor)it.next(); --- //System.out.println("Checking class: "+cd); --- //Set superclass link up --- if (cd.getSuper()!=null) { --- cd.setSuper(typeutil.getClass(cd.getSuper())); --- // Link together Field, Method, and Flag tables so classes --- // inherit these from their superclasses --- cd.getFieldTable().setParent(cd.getSuperDesc().getFieldTable()); --- cd.getMethodTable().setParent(cd.getSuperDesc().getMethodTable()); --- cd.getFlagTable().setParent(cd.getSuperDesc().getFlagTable()); --- } ------- ---- for(Iterator task_it=state.getTaskSymbolTable().getDescriptorsIterator();task_it.hasNext();) { ---- TaskDescriptor td=(TaskDescriptor)task_it.next(); ---- checkTask(td); ---- ---- } --- /* Check to see that fields are well typed */ --- for(Iterator field_it=cd.getFields(); field_it.hasNext();) { --- FieldDescriptor fd=(FieldDescriptor)field_it.next(); --- //System.out.println("Checking field: "+fd); --- checkField(cd,fd); --- } - --- --- for(Iterator method_it=cd.getMethods(); method_it.hasNext();) { --- MethodDescriptor md=(MethodDescriptor)method_it.next(); --- checkMethod(cd,md); --- } ------- } ------- ---- public void checkTypeDescriptor(TypeDescriptor td) { ---- if (td.isPrimitive()) ---- return; /* Done */ ---- else if (td.isClass()) { ---- String name=td.toString(); ---- ClassDescriptor field_cd=(ClassDescriptor)state.getClassSymbolTable().get(name); ---- if (field_cd==null) ---- throw new Error("Undefined class "+name); ---- td.setClassDescriptor(field_cd); ---- return; ---- } else if (td.isTag()) ---- return; ---- else ---- throw new Error(); --- it=classtable.getDescriptorsIterator(); --- // Do descriptors first --- while(it.hasNext()) { --- ClassDescriptor cd=(ClassDescriptor)it.next(); --- for(Iterator method_it=cd.getMethods(); method_it.hasNext();) { --- MethodDescriptor md=(MethodDescriptor)method_it.next(); --- checkMethodBody(cd,md); --- } ------- } ------- ---- public void checkField(ClassDescriptor cd, FieldDescriptor fd) { ---- checkTypeDescriptor(fd.getType()); --- for(Iterator task_it=state.getTaskSymbolTable().getDescriptorsIterator(); task_it.hasNext();) { --- TaskDescriptor td=(TaskDescriptor)task_it.next(); --- checkTask(td); --- ------- } --- } ------- ---- public void checkConstraintCheck(TaskDescriptor td, SymbolTable nametable, Vector ccs) { ---- if (ccs==null) ---- return; /* No constraint checks to check */ ---- for(int i=0;i=temps.size()) ---- temps.setSize(i+1); ---- temps.set(i, tmp); ---- } --- public int numTags() { --- return names.size(); --- } ------- ---- public TempDescriptor getTemp(int i) { ---- return (TempDescriptor) temps.get(i); ---- } --- public void setTemp(int i, TempDescriptor tmp) { --- if (i>=temps.size()) --- temps.setSize(i+1); --- temps.set(i, tmp); --- } ------- ---- public String getName(int i) { ---- return (String) names.get(i); ---- } --- public TempDescriptor getTemp(int i) { --- return (TempDescriptor) temps.get(i); --- } ------- ---- public String getType(int i) { ---- return (String) types.get(i); ---- } --- public String getName(int i) { --- return (String) names.get(i); --- } --- --- public String getType(int i) { --- return (String) types.get(i); --- } -------} ------- diff --cc Robust/src/IR/Tree/TaskExitNode.java index c26e0fc2,c26e0fc2,c26e0fc2,c26e0fc2,084b63bb,084b63bb,dbcb19ad..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/TaskExitNode.java +++ /dev/null @@@@@@@@ -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 -1,34 +1,0 @@@@@@@@ -------package IR.Tree; -------import java.util.Vector; ------- -------public class TaskExitNode extends BlockStatementNode { ---- Vector vfe; ---- Vector ccs; ---- public TaskExitNode(Vector vfe, Vector ccs) { ---- this.vfe=vfe; ---- this.ccs=ccs; ---- } --- Vector vfe; --- Vector ccs; -- public TaskExitNode(Vector vfe, Vector ccs) { - int m_taskexitindex; - - public TaskExitNode(Vector vfe, Vector ccs, int taskexitindex) { --- this.vfe=vfe; --- this.ccs=ccs; - this.m_taskexitindex = taskexitindex; --- } ------- ---- public String printNode(int indent) { ---- return "taskexit"; ---- } --- public String printNode(int indent) { --- return "taskexit"; --- } ------- ---- public Vector getFlagEffects() { ---- return vfe; ---- } --- public Vector getFlagEffects() { --- return vfe; --- } ------- ---- public Vector getChecks() { ---- return ccs; ---- } --- public Vector getChecks() { --- return ccs; --- } ------- ---- public int kind() { ---- return Kind.TaskExitNode; ---- } --- public int kind() { --- return Kind.TaskExitNode; - } - - public int getTaskExitIndex() { - return m_taskexitindex; --- } -------} diff --cc Robust/src/IR/Tree/TreeNode.java index 35233fc3,35233fc3,35233fc3,35233fc3,578cc6c6,578cc6c6,578cc6c6..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/IR/Tree/TreeNode.java +++ /dev/null @@@@@@@@ -1,18 -1,18 -1,18 -1,18 -1,18 -1,18 -1,18 +1,0 @@@@@@@@ -------package IR.Tree; ------- -------public class TreeNode { ---- public static final int INDENT=2; --- public static final int INDENT=2; ------- ---- public String printNode(int indent) { ---- return null; ---- } ---- public static String printSpace(int x) { ---- String sp=""; ---- for(int i=0;i0) --- return false; --- if (!getSymbol().equals(TypeUtil.StringClass)) --- return false; --- return true; ---- } --- public boolean isString() { --- if (type!=CLASS) --- return false; --- if (arraycount>0) --- return false; --- if (!getSymbol().equals(TypeUtil.StringClass)) --- return false; --- return true; --- } ------- ---- public int hashCode() { ---- int hashcode=type^arraycount; ---- if (type==CLASS) ---- hashcode^=getSymbol().hashCode(); ---- return hashcode; ---- } --- public int hashCode() { --- int hashcode=type^arraycount; --- if (type==CLASS) --- hashcode^=getSymbol().hashCode(); --- return hashcode; --- } ------- ---- public TypeDescriptor makeArray(State state) { ---- TypeDescriptor td=new TypeDescriptor(getSymbol()); ---- td.arraycount=arraycount+1; ---- td.type=type; ---- td.class_desc=class_desc; ---- state.addArrayType(td); ---- return td; ---- } --- public TypeDescriptor makeArray(State state) { --- TypeDescriptor td=new TypeDescriptor(getSymbol()); --- td.arraycount=arraycount+1; --- td.type=type; --- td.class_desc=class_desc; --- state.addArrayType(td); --- return td; --- } ------- ---- public boolean isArray() { ---- return (arraycount>0); ---- } --- public boolean isArray() { --- return (arraycount>0); --- } ------- ---- public int getArrayCount() { ---- return arraycount; ---- } --- public int getArrayCount() { --- return arraycount; --- } ------- ---- public TypeDescriptor dereference() { ---- TypeDescriptor td=new TypeDescriptor(getSymbol()); ---- if (arraycount==0) ---- throw new Error(); ---- td.arraycount=arraycount-1; ---- td.type=type; ---- td.class_desc=class_desc; ---- return td; ---- } --- public TypeDescriptor dereference() { --- TypeDescriptor td=new TypeDescriptor(getSymbol()); --- if (arraycount==0) --- throw new Error(); --- td.arraycount=arraycount-1; --- td.type=type; --- td.class_desc=class_desc; --- return td; --- } ------- ---- public String getSafeSymbol() { ---- if (isArray()) ---- return IR.Flat.BuildCode.arraytype; ---- else if (isClass()) ---- return class_desc.getSafeSymbol(); ---- else if (isByte()) ---- return "char"; ---- else if (isChar()) ---- return "short"; ---- else if (isShort()) ---- return "short"; ---- else if (isInt()) ---- return "int"; ---- else if (isBoolean()) //Booleans are ints in C ---- return "int"; ---- else if (isLong()) ---- return "long long"; ---- else if (isVoid()) ---- return "void"; ---- else if (isDouble()) ---- return "double"; ---- else if (isFloat()) ---- return "float"; ---- else throw new Error("Error Type: "+type); ---- } --- public String getSafeSymbol() { --- if (isArray()) --- return IR.Flat.BuildCode.arraytype; --- else if (isClass()) --- return class_desc.getSafeSymbol(); --- else if (isByte()) --- return "char"; --- else if (isChar()) --- return "short"; --- else if (isShort()) --- return "short"; --- else if (isInt()) --- return "int"; --- else if (isBoolean()) //Booleans are ints in C --- return "int"; --- else if (isLong()) --- return "long long"; --- else if (isVoid()) --- return "void"; --- else if (isDouble()) --- return "double"; --- else if (isFloat()) --- return "float"; --- else throw new Error("Error Type: "+type); --- } ------- ---- public String getRepairSymbol() { ---- if (isArray()) ---- return IR.Flat.BuildCode.arraytype; ---- else if (isClass()) ---- return class_desc.getSymbol(); ---- else if (isByte()) ---- return "byte"; ---- else if (isChar()) ---- return "short"; ---- else if (isShort()) ---- return "short"; ---- else if (isInt()) ---- return "int"; ---- else if (isBoolean()) //Booleans are ints in C ---- return "int"; ---- else if (isLong()) ---- return "long long"; ---- else if (isVoid()) ---- return "void"; ---- else if (isDouble()) ---- return "double"; ---- else if (isFloat()) ---- return "float"; ---- else throw new Error("Error Type: "+type); ---- } --- public String getRepairSymbol() { --- if (isArray()) --- return IR.Flat.BuildCode.arraytype; --- else if (isClass()) --- return class_desc.getSymbol(); --- else if (isByte()) --- return "byte"; --- else if (isChar()) --- return "short"; --- else if (isShort()) --- return "short"; --- else if (isInt()) --- return "int"; --- else if (isBoolean()) //Booleans are ints in C --- return "int"; --- else if (isLong()) --- return "long long"; --- else if (isVoid()) --- return "void"; --- else if (isDouble()) --- return "double"; --- else if (isFloat()) --- return "float"; --- else throw new Error("Error Type: "+type); --- } ------- ---- public String getSafeDescriptor() { ---- //Can't safely use [ in C ---- if (isArray()) ---- return "_AR_"+this.dereference().getSafeDescriptor(); ---- else if (isClass()) ---- return class_desc.getSafeDescriptor(); ---- else if (isByte()) ---- return "B"; ---- else if (isChar()) ---- return "C"; ---- else if (isShort()) ---- return "S"; ---- else if (isBoolean()) ---- return "Z"; ---- else if (isInt()) ---- return "I"; ---- else if (isLong()) ---- return "J"; ---- else if (isDouble()) ---- return "D"; ---- else if (isFloat()) ---- return "F"; ---- else if (isTag()) ---- return "T"; ---- else throw new Error(); ---- } --- public String getSafeDescriptor() { --- //Can't safely use [ in C --- if (isArray()) --- return "_AR_"+this.dereference().getSafeDescriptor(); --- else if (isClass()) --- return class_desc.getSafeDescriptor(); --- else if (isByte()) --- return "B"; --- else if (isChar()) --- return "C"; --- else if (isShort()) --- return "S"; --- else if (isBoolean()) --- return "Z"; --- else if (isInt()) --- return "I"; --- else if (isLong()) --- return "J"; --- else if (isDouble()) --- return "D"; --- else if (isFloat()) --- return "F"; --- else if (isTag()) --- return "T"; --- else throw new Error(); --- } ------- ---- public boolean isNumber() { ---- return (isIntegerType()||isFloat()||isDouble()); ---- } --- public boolean isNumber() { --- return (isIntegerType()||isFloat()||isDouble()); --- } ------- ---- public boolean isByte() { ---- return type==BYTE; ---- } ---- public boolean isNull() { ---- return type==NULL; ---- } ---- public boolean isShort() { ---- return type==SHORT; ---- } ---- public boolean isInt() { ---- return type==INT; ---- } ---- public boolean isLong() { ---- return type==LONG; ---- } ---- public boolean isChar() { ---- return type==CHAR; ---- } ---- public boolean isBoolean() { ---- return type==BOOLEAN; ---- } ---- public boolean isFloat() { ---- return type==FLOAT; ---- } ---- public boolean isDouble() { ---- return type==DOUBLE; ---- } ---- public boolean isVoid() { ---- return type==VOID; ---- } --- public boolean isByte() { --- return type==BYTE; --- } --- public boolean isNull() { --- return type==NULL; --- } --- public boolean isShort() { --- return type==SHORT; --- } --- public boolean isInt() { --- return type==INT; --- } --- public boolean isLong() { --- return type==LONG; --- } --- public boolean isChar() { --- return type==CHAR; --- } --- public boolean isBoolean() { --- return type==BOOLEAN; --- } --- public boolean isFloat() { --- return type==FLOAT; --- } --- public boolean isDouble() { --- return type==DOUBLE; --- } --- public boolean isVoid() { --- return type==VOID; --- } ------- ---- public boolean isPtr() { - return (isClass()||isNull()||isTag()); --- return (isClass()||isNull()||isTag()||isArray()); ---- } --- public boolean isPtr() { --- return (isClass()||isNull()||isTag()||isArray()); --- } ------- ---- public boolean isIntegerType() { ---- return (isInt()||isLong()||isShort()||isChar()||isByte()); ---- } --- public boolean isIntegerType() { --- return (isInt()||isLong()||isShort()||isChar()||isByte()); --- } ------- ---- public void setClassDescriptor(ClassDescriptor cd) { ---- class_desc=cd; ---- } ---- ---- public boolean isPrimitive() { ---- return ((type>=BYTE)&&(type<=DOUBLE)); ---- } --- public void setClassDescriptor(ClassDescriptor cd) { --- class_desc=cd; --- } ------- ---- public boolean isClass() { ---- return type==CLASS; ---- } ---- ---- public boolean isTag() { ---- return type==TAG; ---- } --- public boolean isPrimitive() { --- return ((type>=BYTE)&&(type<=DOUBLE)); --- } ------- ---- public TypeDescriptor(NameDescriptor name) { ---- super(name.toString()); ---- this.type=CLASS; ---- this.class_desc=null; ---- this.arraycount=0; ---- } --- public boolean isClass() { --- return type==CLASS; --- } ------- ---- public TypeDescriptor(String st) { ---- super(st); ---- this.type=CLASS; ---- this.class_desc=null; ---- this.arraycount=0; ---- } --- public boolean isTag() { --- return type==TAG; --- } ------- ---- public ClassDescriptor getClassDesc() { ---- return class_desc; ---- } - public boolean isImmutable() { - return isPrimitive() || isString(); - } - --- public TypeDescriptor(NameDescriptor name) { --- super(name.toString()); --- this.type=CLASS; --- this.class_desc=null; --- this.arraycount=0; --- } ------- ---- public TypeDescriptor(ClassDescriptor cd) { ---- super(cd.getSymbol()); ---- this.type=CLASS; ---- this.class_desc=cd; ---- this.arraycount=0; ---- } --- public TypeDescriptor(String st) { --- super(st); --- this.type=CLASS; --- this.class_desc=null; --- this.arraycount=0; --- } ------- ---- public TypeDescriptor(int t) { ---- super(decodeInt(t)); ---- this.type=t; ---- this.arraycount=0; ---- } --- public ClassDescriptor getClassDesc() { --- return class_desc; --- } ------- ---- public String toString() { --- if (type==CLASS) - if (type==CLASS) { ---- return name; --- else - } else - return decodeInt(type); - } --- public TypeDescriptor(ClassDescriptor cd) { --- super(cd.getSymbol()); --- this.type=CLASS; --- this.class_desc=cd; --- this.arraycount=0; --- } ---- - public String toPrettyString() { - if (type==CLASS) { - String str=name; - for(int i=0;i methodnumber; --- Hashtable classmethodcount; --- Hashtable localitynumber; --- State state; --- LocalityAnalysis locality; --- Hashtable methodnumber; --- Hashtable classmethodcount; --- Hashtable localitynumber; ------ ---- public int getMethodNumber(MethodDescriptor md) { - return ((Integer)methodnumber.get(md)).intValue(); --- return methodnumber.get(md).intValue(); ---- } --- public int getMethodNumber(MethodDescriptor md) { --- return methodnumber.get(md).intValue(); --- } - --- --- ---- public int getMethodCount(ClassDescriptor md) { - return ((Integer)classmethodcount.get(md)).intValue(); --- return classmethodcount.get(md).intValue(); --- } --- --- public int getLocalityNumber(LocalityBinding lb) { --- return localitynumber.get(lb).intValue(); ---- } --- public int getMethodCount(ClassDescriptor md) { --- return classmethodcount.get(md).intValue(); --- } ------- - public Virtual(State state) { --- public Virtual(State state, LocalityAnalysis locality) { ---- this.state=state; - methodnumber=new Hashtable(); - classmethodcount=new Hashtable(); --- this.locality=locality; --- classmethodcount=new Hashtable(); --- if (state.DSM) --- localitynumber=new Hashtable(); --- else --- methodnumber=new Hashtable(); ---- doAnalysis(); ---- } --- public int getLocalityNumber(LocalityBinding lb) { --- return localitynumber.get(lb).intValue(); --- } ------- ---- private void doAnalysis() { ---- Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); ---- while(classit.hasNext()) { ---- ClassDescriptor cd=(ClassDescriptor)classit.next(); - numberMethods(cd); --- if (state.DSM) --- numberLocality(cd); --- else --- numberMethods(cd); ---- } --- public Virtual(State state, LocalityAnalysis locality) { --- this.state=state; --- this.locality=locality; --- classmethodcount=new Hashtable(); --- if (state.DSM) --- localitynumber=new Hashtable(); --- else --- methodnumber=new Hashtable(); --- doAnalysis(); --- } --- --- private void doAnalysis() { --- Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); --- while(classit.hasNext()) { --- ClassDescriptor cd=(ClassDescriptor)classit.next(); --- if (state.DSM) --- numberLocality(cd); --- else --- numberMethods(cd); ------ } --- } ------ --- private int numberLocality(ClassDescriptor cd) { --- if (classmethodcount.containsKey(cd)) --- return classmethodcount.get(cd).intValue(); --- ClassDescriptor superdesc=cd.getSuperDesc(); --- int start=0; --- if (superdesc!=null) --- start=numberLocality(superdesc); --- private int numberLocality(ClassDescriptor cd) { --- if (classmethodcount.containsKey(cd)) --- return classmethodcount.get(cd).intValue(); --- ClassDescriptor superdesc=cd.getSuperDesc(); --- int start=0; --- if (superdesc!=null) --- start=numberLocality(superdesc); ------ --- if (locality.getClassBindings(cd)!=null) --- for(Iterator lbit=locality.getClassBindings(cd).iterator();lbit.hasNext();) { --- LocalityBinding lb=lbit.next(); --- MethodDescriptor md=lb.getMethod(); --- //Is it a static method or constructor --- if (md.isStatic()||md.getReturnType()==null) --- continue; --- --- if (superdesc!=null) { --- Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); --- boolean foundmatch=false; --- for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) { --- MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); --- if (md.matches(matchmd)) { --- Set lbset=locality.getMethodBindings(matchmd); --- if (lbset!=null) --- for(Iterator suplbit=lbset.iterator();suplbit.hasNext();) { --- LocalityBinding suplb=suplbit.next(); --- if (lb.contextMatches(suplb)) { --- foundmatch=true; --- localitynumber.put(lb, localitynumber.get(suplb)); --- break; --- } --- } --- break; --- } --- } --- if (!foundmatch) --- localitynumber.put(lb, new Integer(start++)); --- } else { --- localitynumber.put(lb, new Integer(start++)); --- } --- } --- classmethodcount.put(cd, new Integer(start)); --- return start; ---- } --- if (locality.getClassBindings(cd)!=null) --- for(Iterator lbit=locality.getClassBindings(cd).iterator(); lbit.hasNext();) { --- LocalityBinding lb=lbit.next(); --- MethodDescriptor md=lb.getMethod(); --- //Is it a static method or constructor --- if (md.isStatic()||md.getReturnType()==null) --- continue; ------- ---- private int numberMethods(ClassDescriptor cd) { ---- if (classmethodcount.containsKey(cd)) - return ((Integer)classmethodcount.get(cd)).intValue(); --- return classmethodcount.get(cd).intValue(); ---- ClassDescriptor superdesc=cd.getSuperDesc(); ---- int start=0; ---- if (superdesc!=null) ---- start=numberMethods(superdesc); ---- for(Iterator it=cd.getMethods();it.hasNext();) { ---- MethodDescriptor md=(MethodDescriptor)it.next(); ---- if (md.isStatic()||md.getReturnType()==null) ---- continue; ---- if (superdesc!=null) { ---- Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); ---- boolean foundmatch=false; ---- for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) { ---- MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); ---- if (md.matches(matchmd)) { ---- int num=((Integer)methodnumber.get(matchmd)).intValue(); ---- methodnumber.put(md, new Integer(num)); ---- foundmatch=true; ---- break; ---- } --- if (superdesc!=null) { --- Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); --- boolean foundmatch=false; --- for(Iterator matchit=possiblematches.iterator(); matchit.hasNext();) { --- MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); --- if (md.matches(matchmd)) { --- Set lbset=locality.getMethodBindings(matchmd); --- if (lbset!=null) --- for(Iterator suplbit=lbset.iterator(); suplbit.hasNext();) { --- LocalityBinding suplb=suplbit.next(); --- if (lb.contextMatches(suplb)) { --- foundmatch=true; --- localitynumber.put(lb, localitynumber.get(suplb)); --- break; --- } ------- } ---- if (!foundmatch) ---- methodnumber.put(md, new Integer(start++)); ---- } else { ---- methodnumber.put(md, new Integer(start++)); --- break; ------- } --- } --- if (!foundmatch) --- localitynumber.put(lb, new Integer(start++)); --- } else { --- localitynumber.put(lb, new Integer(start++)); ------- } ---- classmethodcount.put(cd, new Integer(start)); ---- return start; --- } --- classmethodcount.put(cd, new Integer(start)); --- return start; --- } --- --- private int numberMethods(ClassDescriptor cd) { --- if (classmethodcount.containsKey(cd)) --- return classmethodcount.get(cd).intValue(); --- ClassDescriptor superdesc=cd.getSuperDesc(); --- int start=0; --- if (superdesc!=null) --- start=numberMethods(superdesc); --- for(Iterator it=cd.getMethods(); it.hasNext();) { --- MethodDescriptor md=(MethodDescriptor)it.next(); --- if (md.isStatic()||md.getReturnType()==null) --- continue; --- if (superdesc!=null) { --- Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); --- boolean foundmatch=false; --- for(Iterator matchit=possiblematches.iterator(); matchit.hasNext();) { --- MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); --- if (md.matches(matchmd)) { --- int num=((Integer)methodnumber.get(matchmd)).intValue(); --- methodnumber.put(md, new Integer(num)); --- foundmatch=true; --- break; --- } --- } --- if (!foundmatch) --- methodnumber.put(md, new Integer(start++)); --- } else { --- methodnumber.put(md, new Integer(start++)); --- } ------- } --- classmethodcount.put(cd, new Integer(start)); --- return start; --- } -------} ------- diff --cc Robust/src/Interface/HTTPHeader.java index b862c5fc,b862c5fc,b862c5fc,b862c5fc,d3e753fe,79bd067a,79bd067a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/HTTPHeader.java +++ /dev/null @@@@@@@@ -1,110 -1,110 -1,110 -1,110 -1,109 -1,108 -1,108 +1,0 @@@@@@@@ -------package Interface; -------//**************************************************************************** -------// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -------// Program: JhttpServer -------// Date: April 24, 1998 -------//**************************************************************************** ------- ------- -------import java.net.*; -------import java.util.*; -------import java.io.*; ------- -------//**************************************************************************** -------// Class: httpResponse -------// Purpose: constructs the header to be returned by the server -------//**************************************************************************** ------- ---- public class HTTPHeader{ ---public class HTTPHeader { ------- ------- // make a hashtable of return codes to messages ------- static private HashStrings rc = new HashStrings(); ------- static ------- { ------- rc.put("200", "OK"); ------- rc.put("403", "Fobidden"); ------- rc.put("404", "Not found"); ------- rc.put("501", "Method not implemented"); ------- } ------- ------- // hashtable of content type matchings ------- static private HashStrings ct = new HashStrings(); // p. 817 ------- static ------- { ------- ct.put("txt", "text/plain"); ------- ct.put("text", "text/plain"); ------- ct.put("log", "text/plain"); ------- ct.put("htm", "text/html"); ------- ct.put("html", "text/html"); ------- ct.put("gif", "image/gif"); ------- ct.put("jpg", "image/jpg"); ------- ct.put("jpeg", "image/jpg"); ------- ct.put("jpe", "image/jpg"); ------- ct.put("mpg", "video/mpeg"); ------- ct.put("mpeg", "video/mpeg"); ------- ct.put("mpe", "video/mpeg"); ------- ct.put("qt", "video/quicktime"); ------- ct.put("mov", "video/quicktime"); ------- ct.put("au", "audio/basic"); ------- ct.put("snd", "audio/basic"); ------- ct.put("wav", "audio/x-wave"); ------- ct.put("class", "application/octet-stream"); ------- ct.put("ps", "application/postscript"); ------- } ---- --- -------//************************************************************************* -------// Constructor: send_header(int, String, int) -------// Purpose: Send an HTTP header -------//************************************************************************* ------- ------- static public void send_header(OutputStream out, int returnCode, ---- String filename, long fileLength){ ---- String contentType = getContentTypeFor(filename); ---- String returnString = (String) rc.get(String.valueOf(returnCode)); ---- String header; --- String filename, long fileLength) { --- String contentType = getContentTypeFor(filename); --- String returnString = (String) rc.get(String.valueOf(returnCode)); --- String header; ------- ---- header = "HTTP/1.0 " + returnCode + " " + returnString + "\n" + ---- "Date: " + "1/1/01" + "\n" + // date ---- "Expires: 1/1/00\n"+ ---- "Allow: GET\n" + // allowed methods ---- "MIME-Version: 1.0\n" + // mime version ---- "Server : SpinWeb Custom HTTP Server\n" + // server type ---- "Content-Type: " + contentType + "\n" + // type ---- "Content-Length: "+ fileLength + "\n\n"; // length ---- try{ ---- out.write(header.getBytes()); ---- } ---- catch(IOException e){ ---- e.printStackTrace(); // do nothing! ---- } --- header = "HTTP/1.0 " + returnCode + " " + returnString + "\n" + --- "Date: " + "1/1/01" + "\n" + // date --- "Expires: 1/1/00\n"+ --- "Allow: GET\n" + // allowed methods --- "MIME-Version: 1.0\n" + // mime version --- "Server : SpinWeb Custom HTTP Server\n" + // server type --- "Content-Type: " + contentType + "\n" + // type --- "Content-Length: "+ fileLength + "\n\n"; // length - try{ -- try { --- out.write(header.getBytes()); - } - catch(IOException e){ -- } catch(IOException e) { --- e.printStackTrace(); // do nothing! --- } ------- } ------- -------//************************************************************************* -------// Method: getContentTypeFor(String) -------// Purpose: Looks up the content type (MIME) in a hashtable for the given -------// file suffix. It removes any anchors (#) in case the string is -------// a URL and then operates on the name without path. -------//************************************************************************* ---- ---- static private String getContentTypeFor(String filename) ---- { --- --- static private String getContentTypeFor(String filename) { ------- int position = filename.lastIndexOf('#'); ------- if (position != -1) ------- filename = filename.substring(0, position - 1); ---- --- ------- File f = new File(filename); ------- String name = f.getName(); // name w/o directory ------- ------- position = name.lastIndexOf('.'); ---- --- ------- String contentType; ------- ------- if (position == -1) // if no extension, txt is assigned by default ---- contentType = "txt"; ---- else ---- contentType = name.substring(position + 1); ---- --- contentType = "txt"; --- else --- contentType = name.substring(position + 1); --- ------- return (String) ct.get(contentType); ---- } --- } ------- -------} diff --cc Robust/src/Interface/HTTPResponse.java index 74c532fe,74c532fe,74c532fe,74c532fe,00ce3a16,00ce3a16,00ce3a16..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/HTTPResponse.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------package Interface; ------- ------- ---- public class HTTPResponse{ ---- public int returnCode; ---- public long sentBytes; ---public class HTTPResponse { --- public int returnCode; --- public long sentBytes; -------} diff --cc Robust/src/Interface/HTTPServices.java index 30804fb8,30804fb8,30804fb8,30804fb8,5a2b19a5,4391a312,4391a312..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/HTTPServices.java +++ /dev/null @@@@@@@@ -1,82 -1,82 -1,82 -1,82 -1,82 -1,80 -1,80 +1,0 @@@@@@@@ -------package Interface; -------import java.net.*; -------import java.io.*; -------import java.util.*; ------- ---- public class HTTPServices{ ---public class HTTPServices { ------- ---- static private String webRoot = "."; --- static private String webRoot = "."; ------- ---- static private FileInputStream get_reader(String fileName,HTTPResponse resp) throws IOException{ ---- // if(fileName.equals("/daytime")){ ---- // String date_str = (new Date()).toString(); ---- // resp.sentBytes = date_str.length(); ---- // return ---- // new StringReader(date_str); ---- // } ---- ---- if(fileName.equals("/viewlog")) ---- fileName = LogFile.log_file_name; ---- else ---- fileName = webRoot + fileName; ---- ---- File f = new File(fileName); ---- resp.sentBytes = f.length(); ---- return new FileInputStream(f); ---- } --- static private FileInputStream get_reader(String fileName,HTTPResponse resp) throws IOException { ---// if(fileName.equals("/daytime")){ ---// String date_str = (new Date()).toString(); ---// resp.sentBytes = date_str.length(); ---// return ---// new StringReader(date_str); ---// } ------- ---- public static void GET_handler(String fileName, OutputStream out, HTTPResponse resp){ ---- ---- FileInputStream reader = null; ---- byte buffer[]; ---- int size; --- if(fileName.equals("/viewlog")) --- fileName = LogFile.log_file_name; --- else --- fileName = webRoot + fileName; ------- ---- if((reader = HEAD_handler_int(fileName,out,resp)) == null) return; --- File f = new File(fileName); --- resp.sentBytes = f.length(); --- return new FileInputStream(f); --- } ------- ---- buffer = new byte[1024]; --- public static void GET_handler(String fileName, OutputStream out, HTTPResponse resp) { ------- ---- try{ ---- while((size = reader.read(buffer,0,buffer.length)) != -1) ---- out.write(buffer,0,size); ---- reader.close(); ---- } ---- catch(IOException e){ ---- e.printStackTrace(); ---- resp.returnCode = 501; // error during transmision ---- } --- FileInputStream reader = null; --- byte buffer[]; --- int size; ------- ---- } --- if((reader = HEAD_handler_int(fileName,out,resp)) == null) return; ------- ---- public static void POST_handler(String fileName, OutputStream out, HTTPResponse resp){ ---- GET_handler(fileName,out, resp); --- buffer = new byte[1024]; --- - try{ -- try { --- while((size = reader.read(buffer,0,buffer.length)) != -1) --- out.write(buffer,0,size); --- reader.close(); - } - catch(IOException e){ -- } catch(IOException e) { --- e.printStackTrace(); --- resp.returnCode = 501; // error during transmision ------- } ------- ---- static private FileInputStream HEAD_handler_int(String fileName, ---- OutputStream out,HTTPResponse resp){ ---- FileInputStream reader = null; --- } ------- ---- try{ ---- reader = get_reader(fileName, resp); ---- resp.returnCode = 200; ---- } ---- catch(IOException e){ ---- resp.returnCode = 404; // file not found ---- } --- public static void POST_handler(String fileName, OutputStream out, HTTPResponse resp) { --- GET_handler(fileName,out, resp); --- } ------- ---- if(resp.returnCode == 200) ---- HTTPHeader.send_header(out, resp.returnCode, fileName, resp.sentBytes); ---- else{ ---- HTTPHeader.send_header(out, resp.returnCode, fileName, 0); ---- return null; ---- } ---- ---- return reader; --- static private FileInputStream HEAD_handler_int(String fileName, --- OutputStream out,HTTPResponse resp) { --- FileInputStream reader = null; --- - try{ -- try { --- reader = get_reader(fileName, resp); --- resp.returnCode = 200; ----- } ---- - catch(IOException e){ -- } catch(IOException e) { --- resp.returnCode = 404; // file not found --- } ------- ---- public static void HEAD_handler(String fileName, ---- OutputStream out, HTTPResponse resp){ ---- HEAD_handler_int(fileName,out,resp); --- if(resp.returnCode == 200) --- HTTPHeader.send_header(out, resp.returnCode, fileName, resp.sentBytes); - else{ -- else { --- HTTPHeader.send_header(out, resp.returnCode, fileName, 0); --- return null; ------- } --- --- return reader; --- } --- --- --- public static void HEAD_handler(String fileName, --- OutputStream out, HTTPResponse resp) { --- HEAD_handler_int(fileName,out,resp); --- } -------} ------- diff --cc Robust/src/Interface/HashStrings.java index 67065786,67065786,67065786,67065786,0f3bd801,0f3bd801,0f3bd801..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/HashStrings.java +++ /dev/null @@@@@@@@ -1,39 -1,39 -1,39 -1,39 -1,43 -1,43 -1,43 +1,0 @@@@@@@@ -------package Interface; ------- -------class HashStrings { ---- Pair p[]; // entries in the hash table ---- int f; // number of full entries ---- public HashStrings() { p = new Pair[38]; f = 0; } --- Pair p[]; // entries in the hash table --- int f; // number of full entries --- public HashStrings() { --- p = new Pair[38]; f = 0; --- } ------- ---- public void put(String key, String value) { ---- int n = p.length; ---- if (f == n-1) return; // cheese -- a diary product ---- int i = key.hashCode() % n; ---- while (p[i] != null) { ---- if (key.equals(p[i].key)) { ---- p[i] = new Pair(key, value); ---- return; ---- } ---- i = (i+1) % n; ---- } --- public void put(String key, String value) { --- int n = p.length; --- if (f == n-1) return; // cheese -- a diary product --- int i = key.hashCode() % n; --- while (p[i] != null) { --- if (key.equals(p[i].key)) { ------- p[i] = new Pair(key, value); ---- f = f + 1; --- return; --- } --- i = (i+1) % n; ------- } --- p[i] = new Pair(key, value); --- f = f + 1; --- } ------- ---- public String get(String key) { ---- int n = p.length; ---- int i = key.hashCode() % n; ---- while (p[i] != null) { ---- if (key.equals(p[i].key)) ---- return p[i].value; ---- i = (i+1) % n; ---- } ---- return null; --- public String get(String key) { --- int n = p.length; --- int i = key.hashCode() % n; --- while (p[i] != null) { --- if (key.equals(p[i].key)) --- return p[i].value; --- i = (i+1) % n; ------- } --- return null; --- } ------- -------} ------- -------class Pair { ---- String key, value; ---- Pair (String key, String value) { this.key = key; this.value = value; } --- String key, value; --- Pair (String key, String value) { --- this.key = key; this.value = value; --- } -------} diff --cc Robust/src/Interface/IdentityRelation.java index 04d28883,04d28883,04d28883,04d28883,efe41fda,efe41fda,efe41fda..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/IdentityRelation.java +++ /dev/null @@@@@@@@ -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 +1,0 @@@@@@@@ -------package Interface; ---- class IdentityRelation{ ---- String fieldname1; ---- String fieldname2; ---class IdentityRelation { --- String fieldname1; --- String fieldname2; ------- ---- public IdentityRelation(String fieldname1,String fieldname2) { ---- this.fieldname1=fieldname1; ---- this.fieldname2=fieldname2; ---- } ---- public String toString() { ---- return fieldname1+"."+fieldname2; ---- } --- public IdentityRelation(String fieldname1,String fieldname2) { --- this.fieldname1=fieldname1; --- this.fieldname2=fieldname2; --- } --- public String toString() { --- return fieldname1+"."+fieldname2; --- } ------- ---- public int hashCode() { ---- return fieldname1.hashCode()^fieldname2.hashCode(); ---- } --- public int hashCode() { --- return fieldname1.hashCode()^fieldname2.hashCode(); --- } ------- ---- public boolean equals(Object obj) { ---- if (obj instanceof IdentityRelation) { ---- IdentityRelation ir=(IdentityRelation) obj; ---- if (fieldname1.equals(ir.fieldname1)&& ---- fieldname2.equals(ir.fieldname2)) ---- return true; ---- } ---- return false; --- public boolean equals(Object obj) { --- if (obj instanceof IdentityRelation) { --- IdentityRelation ir=(IdentityRelation) obj; --- if (fieldname1.equals(ir.fieldname1)&& --- fieldname2.equals(ir.fieldname2)) --- return true; ------- } --- return false; --- } -------} diff --cc Robust/src/Interface/Imap.java index 33763fd8,33763fd8,33763fd8,33763fd8,a20f43c2,a20f43c2,a20f43c2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/Imap.java +++ /dev/null @@@@@@@@ -1,148 -1,148 -1,148 -1,148 -1,150 -1,150 -1,150 +1,0 @@@@@@@@ -------package Interface; -------import java.net.*; -------import java.io.*; -------import java.util.*; ------- -------class Imap { ---- private Rectangle[] rectangles; ---- private Point[] points; ---- long THRESHOLD=400; --- private Rectangle[] rectangles; --- private Point[] points; --- long THRESHOLD=400; ------- ---- public Imap(String filename) { ---- FileReader fr=null; ---- try { ---- fr=new FileReader(filename); ---- parseFile(fr); ---- fr.close(); ---- } catch (IOException e) { ---- System.out.println(e); ---- System.exit(-1); ---- } --- public Imap(String filename) { --- FileReader fr=null; --- try { --- fr=new FileReader(filename); --- parseFile(fr); --- fr.close(); --- } catch (IOException e) { --- System.out.println(e); --- System.exit(-1); ------- } ---- static class Rectangle { ---- String label; ---- int x1,y1,x2,y2; ---- public Rectangle(String label, int x1,int y1, int x2, int y2) { ---- this.label=label; ---- this.x1=x1; ---- this.y1=y1; ---- this.x2=x2; ---- this.y2=y2; ---- } --- } --- static class Rectangle { --- String label; --- int x1,y1,x2,y2; --- public Rectangle(String label, int x1,int y1, int x2, int y2) { --- this.label=label; --- this.x1=x1; --- this.y1=y1; --- this.x2=x2; --- this.y2=y2; ------- } --- } ------- ---- String parseclick(int x,int y) { ---- System.out.println(x+","+y); ---- for(int i=0;i=y)&& ---- (r.x2>=x)&&(r.y2<=y)) ---- return r.label; ---- } ---- long mindistance=Long.MAX_VALUE; ---- int minindex=-1; ---- for(int i=0;iTHRESHOLD) ---- return null; ---- else ---- return points[minindex].label; --- String parseclick(int x,int y) { --- System.out.println(x+","+y); --- for(int i=0; i=y)&& --- (r.x2>=x)&&(r.y2<=y)) --- return r.label; --- } --- long mindistance=Long.MAX_VALUE; --- int minindex=-1; --- for(int i=0; iTHRESHOLD) --- return null; --- else --- return points[minindex].label; --- } ------- ---- static class Point { ---- String label; ---- int x,y; ---- public Point(String label, int x,int y) { ---- this.label=label; ---- this.x=x; ---- this.y=y; ---- } --- static class Point { --- String label; --- int x,y; --- public Point(String label, int x,int y) { --- this.label=label; --- this.x=x; --- this.y=y; ------- } --- } ------- ---- void parseFile(FileReader fr) { ---- int firstchar=0; ---- ArrayList rectangles=new ArrayList(); ---- ArrayList points=new ArrayList(); ---- while(true) { ---- try { ---- firstchar=fr.read(); ---- } catch (Exception e) { ---- e.printStackTrace(); ---- System.exit(-1); ---- } ---- /* EOF?*/ ---- if (firstchar==-1) ---- break; ---- switch(firstchar) { ---- case'b': ---- case'#': ---- while(firstchar!='\n') { ---- try { ---- firstchar=fr.read(); ---- } catch (IOException e) { ---- e.printStackTrace(); ---- System.exit(-1); ---- } ---- } ---- break; ---- case'r': ---- { ---- nexttoken(fr,false); ---- String label=nexttoken(fr,false); ---- String x1=nexttoken(fr,true); ---- String y1=nexttoken(fr,true); ---- String x2=nexttoken(fr,true); ---- String y2=nexttoken(fr,true); ---- Rectangle r=new Rectangle(label,Integer.parseInt(x1),Integer.parseInt(y1), ---- Integer.parseInt(x2),Integer.parseInt(y2)); ---- rectangles.add(r); ---- } ---- break; ---- case'p': ---- { ---- nexttoken(fr,false); ---- String label=nexttoken(fr,false); ---- String x=nexttoken(fr,true); ---- String y=nexttoken(fr,true); ---- Point p=new Point(label,Integer.parseInt(x),Integer.parseInt(y)); ---- points.add(p); ---- } ---- break; ---- } --- void parseFile(FileReader fr) { --- int firstchar=0; --- ArrayList rectangles=new ArrayList(); --- ArrayList points=new ArrayList(); --- while(true) { --- try { --- firstchar=fr.read(); --- } catch (Exception e) { --- e.printStackTrace(); --- System.exit(-1); --- } --- /* EOF?*/ --- if (firstchar==-1) --- break; --- switch(firstchar) { --- case 'b': --- case '#': --- while(firstchar!='\n') { --- try { --- firstchar=fr.read(); --- } catch (IOException e) { --- e.printStackTrace(); --- System.exit(-1); --- } ------- } ---- this.rectangles=(Rectangle[]) rectangles.toArray(new Rectangle[rectangles.size()]); ---- this.points=(Point[]) points.toArray(new Point[points.size()]); --- break; --- --- case 'r': --- { --- nexttoken(fr,false); --- String label=nexttoken(fr,false); --- String x1=nexttoken(fr,true); --- String y1=nexttoken(fr,true); --- String x2=nexttoken(fr,true); --- String y2=nexttoken(fr,true); --- Rectangle r=new Rectangle(label,Integer.parseInt(x1),Integer.parseInt(y1), --- Integer.parseInt(x2),Integer.parseInt(y2)); --- rectangles.add(r); --- } --- break; --- --- case 'p': --- { --- nexttoken(fr,false); --- String label=nexttoken(fr,false); --- String x=nexttoken(fr,true); --- String y=nexttoken(fr,true); --- Point p=new Point(label,Integer.parseInt(x),Integer.parseInt(y)); --- points.add(p); --- } --- break; --- } ------- } --- this.rectangles=(Rectangle[])rectangles.toArray(new Rectangle[rectangles.size()]); --- this.points=(Point[])points.toArray(new Point[points.size()]); --- } ------- ---- String nexttoken(java.io.InputStreamReader isr,boolean commas) { ---- String string=""; ---- int c=0; ---- boolean looped=false; ---- while(true) { ---- try { ---- c=isr.read(); ---- } catch (IOException e) { ---- e.printStackTrace(); ---- System.exit(-1); ---- } ---- if ((c==' ')||(c=='\n')||(commas&&c==',')) { ---- if (!looped) { ---- looped=true; ---- continue; ---- } ---- return string; ---- } ---- string=string+new String(new char[]{(char)c}); ---- looped=true; --- String nexttoken(java.io.InputStreamReader isr,boolean commas) { --- String string=""; --- int c=0; --- boolean looped=false; --- while(true) { --- try { --- c=isr.read(); --- } catch (IOException e) { --- e.printStackTrace(); --- System.exit(-1); --- } --- if ((c==' ')||(c=='\n')||(commas&&c==',')) { --- if (!looped) { --- looped=true; --- continue; ------- } --- return string; --- } --- string=string+new String(new char[] {(char)c}); --- looped=true; ------- } --- } ------- -------} ------- diff --cc Robust/src/Interface/JhttpServer.java index 9cf67269,9cf67269,9cf67269,9cf67269,59c675ce,0ad96d64,0ad96d64..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/JhttpServer.java +++ /dev/null @@@@@@@@ -1,49 -1,49 -1,49 -1,49 -1,48 -1,46 -1,46 +1,0 @@@@@@@@ -------package Interface; ------- -------//**************************************************************************** -------// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -------// Program: JhttpServer -------// Date: April 24, 1998 -------//**************************************************************************** ------- -------import java.net.*; -------import java.io.*; ------- ---- public class JhttpServer extends Thread{ ---public class JhttpServer extends Thread { ------- ---- private ServerSocket server; ---- private WebInterface webinterface; --- private ServerSocket server; --- private WebInterface webinterface; ------- -------//**************************************************************************** -------// Constructor: JhttpServer(int) -------//**************************************************************************** ---- public JhttpServer(int port, WebInterface webinterface) ---- { ---- System.out.println("starting..."); ---- this.webinterface=webinterface; ---- try{ ---- System.out.println("creating the port"); ---- server = new ServerSocket(port); ---- } ---- catch (IOException e){ ---- System.err.println(e); ---- System.exit(1); ---- } --- public JhttpServer(int port, WebInterface webinterface) { --- System.out.println("starting..."); --- this.webinterface=webinterface; - try{ -- try { --- System.out.println("creating the port"); --- server = new ServerSocket(port); ----- } ---- ---- private void startWorker(Socket client) throws Exception { ---- (new JhttpWorker(client,false,webinterface)).start(); - catch (IOException e){ -- } catch (IOException e) { --- System.err.println(e); --- System.exit(1); ------- } --- } ------- ---- public void run(){ ---- // infinite loop ---- while (true){ ---- try{ ---- startWorker(server.accept()); ---- } ---- catch (Exception e){ ---- System.err.println(e); ---- } ---- } --- private void startWorker(Socket client) throws Exception { --- (new JhttpWorker(client,false,webinterface)).start(); --- } --- --- public void run() { --- // infinite loop - while (true){ - try{ -- while (true) { -- try { --- startWorker(server.accept()); - } - catch (Exception e){ -- } catch (Exception e) { --- System.err.println(e); --- } ------- } --- } -------} diff --cc Robust/src/Interface/JhttpWorker.java index 4613422f,4613422f,4613422f,4613422f,c5e3bfc1,f64c1b48,f64c1b48..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/JhttpWorker.java +++ /dev/null @@@@@@@@ -1,191 -1,191 -1,191 -1,191 -1,182 -1,179 -1,179 +1,0 @@@@@@@@ -------package Interface; -------//**************************************************************************** -------// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -------// Program: JhttpServer -------// Date: April 24, 1998 -------//**************************************************************************** ------- ------- -------import java.net.*; -------import java.io.*; -------import java.util.*; ------- -------//**************************************************************************** -------// Class: JhttpWorker -------// Purpose: Takes an HTTP request and executes it in a separate thread -------//**************************************************************************** ------- ---- public class JhttpWorker extends Thread{ ---- public String fileName = null; ---- public String methodType = null; ---- public String httpVersion = "http/1.0"; ---- private Socket client; ---- public int fileLength, returnCode; ---- private boolean logging; ---- private WebInterface webinterface; ---public class JhttpWorker extends Thread { --- public String fileName = null; --- public String methodType = null; --- public String httpVersion = "http/1.0"; --- private Socket client; --- public int fileLength, returnCode; --- private boolean logging; --- private WebInterface webinterface; ------- ---- public JhttpWorker(Socket client, boolean logging, WebInterface webinterface) { ---- this.client=client; ---- this.logging=logging; ---- this.webinterface=webinterface; ---- } ---- ---- public void run(){ ---- HTTPResponse resp = new HTTPResponse(); --- public JhttpWorker(Socket client, boolean logging, WebInterface webinterface) { --- this.client=client; --- this.logging=logging; --- this.webinterface=webinterface; --- } ------- ---- BufferedReader in = null; ---- OutputStream out = null; --- public void run() { --- HTTPResponse resp = new HTTPResponse(); ------- ---- resp.returnCode = 200; ---- resp.sentBytes = 0; --- BufferedReader in = null; --- OutputStream out = null; ------- ---- try { --- resp.returnCode = 200; --- resp.sentBytes = 0; ------- ---- in = new BufferedReader( ---- new InputStreamReader( ---- client.getInputStream())); --- try { ------- ---- out = client.getOutputStream(); ---- } ---- catch(IOException e){ ---- // I'm not too good at HTTP. Normally, we should put some ---- // error code here. Anyway, I have assumed that an error ---- // is equivalent to an unhandled request / method (501) ---- resp.returnCode = 501; ---- } --- in = new BufferedReader( --- new InputStreamReader( --- client.getInputStream())); ------- ---- if(resp.returnCode == 200){ ---- // call the appropriate hanndler ---- switch(method(in)){ --- out = client.getOutputStream(); - } - catch(IOException e){ -- } catch(IOException e) { --- // I'm not too good at HTTP. Normally, we should put some --- // error code here. Anyway, I have assumed that an error --- // is equivalent to an unhandled request / method (501) --- resp.returnCode = 501; --- } ------- ---- case 0: ---- if (webinterface.specialRequest(fileName)) { ---- String newfile=webinterface.handleresponse(fileName, out, resp); ---- if (newfile!=null) { ---- HTTPServices.GET_handler(newfile, out, resp); ---- } ---- } else ---- HTTPServices.GET_handler(fileName, out, resp); ---- break; ---- case 1: ---- HTTPServices.HEAD_handler(fileName, out, resp); ---- break; ---- case 2: ---- HTTPServices.POST_handler(fileName, out, resp); ---- break; ---- default: ---- resp.returnCode = 501; //error ---- } ---- ---- try{ ---- out.flush(); ---- if (logging) ---- LogFile.write_log(client,methodType,fileName,httpVersion, ---- resp.returnCode,resp.sentBytes); - if(resp.returnCode == 200){ -- if(resp.returnCode == 200) { --- // call the appropriate hanndler - switch(method(in)){ -- switch(method(in)) { ------- ---- out.close(); ---- in.close(); ---- client.close(); ---- } ---- catch(IOException e){ ---- ; // do nothing ---- } ---- } --- case 0: --- if (webinterface.specialRequest(fileName)) { --- String newfile=webinterface.handleresponse(fileName, out, resp); --- if (newfile!=null) { --- HTTPServices.GET_handler(newfile, out, resp); --- } --- } else --- HTTPServices.GET_handler(fileName, out, resp); --- break; ------- ---- // System.out.println(fileName + " is going to finish"); // debug --- case 1: --- HTTPServices.HEAD_handler(fileName, out, resp); --- break; --- --- case 2: --- HTTPServices.POST_handler(fileName, out, resp); --- break; --- --- default: --- resp.returnCode = 501; //error --- } --- - try{ -- try { --- out.flush(); --- if (logging) --- LogFile.write_log(client,methodType,fileName,httpVersion, --- resp.returnCode,resp.sentBytes); --- --- out.close(); --- in.close(); --- client.close(); - } - catch(IOException e){ -- } catch(IOException e) { --- ; // do nothing --- } ------- } ---- --- --- // System.out.println(fileName + " is going to finish"); // debug --- } --- -------//***************************************************************************** -------// Function: method() ---- // Purpose: Open an InputStream and parse the request made. ---// Purpose: Open an InputStream and parse the request made. -------// Note: Regardless of what method is requested, right now it performs a -------// GET operation. ---- // Calls: ---// Calls: -------// Returns: Boolean value for success or failure -------//***************************************************************************** ------- ---- private int method(BufferedReader in){ ---- int ret = -1; --- private int method(BufferedReader in) { --- int ret = -1; ------- ---- try{ ---- String line; ---- ---- // read just the first line ---- line = in.readLine(); ---- // only spaces used ---- StringTokenizer tok = new StringTokenizer(line, " "); ---- if (tok.hasMoreTokens()) // make sure there is a request ---- { ---- String str = tok.nextToken(); ---- ---- if ( str.equals("GET") ){ ---- ret = 0; ---- methodType = "GET"; ---- } ---- else if ( str.equals("HEAD") ){ ---- ret = 1; ---- methodType = "HEAD"; ---- } ---- else if ( str.equals("POST") ){ ---- ret = 2; ---- methodType = "POST"; ---- } ---- else{ ---- System.out.println("501 - unsupported request:" +str); ---- return -1; ---- } ---- } ---- else{ ---- // System.out.println("Request from browser was empty!"); ---- return -1; ---- } ---- ---- // get the filename ---- if (tok.hasMoreTokens()) ---- { ---- fileName = tok.nextToken(); ---- if(fileName.equals("/")) ---- { ---- fileName = "/index.html"; ---- } ---- } ---- else ---- { ---- // this is weird... why am i taking the first character of ---- // the filename if there are no more tokens? ---- // - catch should take care of this ---- fileName = fileName.substring(1); ---- } ---- ---- // read the http version number ---- // - right now nothing is done with this information ---- if (tok.hasMoreTokens()) ---- { ---- httpVersion = tok.nextToken(); ---- } ---- else ---- { ---- httpVersion = "http/1.0"; // default ---- } ---- ---- // read remainder of the browser's header ---- // - nothing done right now with this info... placeholder ---- while((line = in.readLine()) != null) ---- { ---- StringTokenizer token = new StringTokenizer(line," "); ---- ---- // do processing here ---- if(!token.hasMoreTokens()) ---- { ---- break; ---- } ---- } ---- } ---- catch(Exception e){ ---- System.err.println(e); - try{ -- try { --- String line; --- --- // read just the first line --- line = in.readLine(); --- // only spaces used --- StringTokenizer tok = new StringTokenizer(line, " "); - if (tok.hasMoreTokens()){ // make sure there is a request -- if (tok.hasMoreTokens()) { // make sure there is a request --- String str = tok.nextToken(); --- - if ( str.equals("GET") ){ -- if ( str.equals("GET") ) { --- ret = 0; --- methodType = "GET"; - } else if ( str.equals("HEAD") ) { -- } else if ( str.equals("HEAD") ) { --- ret = 1; --- methodType = "HEAD"; - } else if ( str.equals("POST") ) { -- } else if ( str.equals("POST") ) { --- ret = 2; --- methodType = "POST"; - } else{ -- } else { --- System.out.println("501 - unsupported request:" +str); ------- return -1; --- } - } else{ -- } else { --- // System.out.println("Request from browser was empty!"); --- return -1; ------- } ---- --- --- // get the filename - if (tok.hasMoreTokens()){ -- if (tok.hasMoreTokens()) { --- fileName = tok.nextToken(); - if(fileName.equals("/")){ -- if(fileName.equals("/")) { --- fileName = "/index.html"; --- } --- } else --- { --- // this is weird... why am i taking the first character of --- // the filename if there are no more tokens? --- // - catch should take care of this --- fileName = fileName.substring(1); --- } --- --- // read the http version number --- // - right now nothing is done with this information - if (tok.hasMoreTokens()){ -- if (tok.hasMoreTokens()) { --- httpVersion = tok.nextToken(); --- } else --- { --- httpVersion = "http/1.0"; // default --- } --- --- // read remainder of the browser's header --- // - nothing done right now with this info... placeholder - while((line = in.readLine()) != null){ -- while((line = in.readLine()) != null) { --- StringTokenizer token = new StringTokenizer(line," "); --- --- // do processing here - if(!token.hasMoreTokens()){ -- if(!token.hasMoreTokens()) { --- break; --- } --- } - } - catch(Exception e){ -- } catch(Exception e) { --- System.err.println(e); --- return -1; --- } --- ------- return ret; ------- } -------} diff --cc Robust/src/Interface/LogFile.java index 667b5489,667b5489,667b5489,667b5489,b52ea857,90f06ec8,90f06ec8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/LogFile.java +++ /dev/null @@@@@@@@ -1,73 -1,73 -1,73 -1,73 -1,73 -1,72 -1,72 +1,0 @@@@@@@@ -------package Interface; -------//**************************************************************************** -------// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -------// Program: JhttpServer -------// Date: April 24, 1998 -------//**************************************************************************** ------- ------- ------- -------import java.io.*; -------import java.util.*; -------import java.text.SimpleDateFormat; -------import java.net.*; ------- -------//**************************************************************************** -------// Class: logFile -------// Purpose: Handle the behavior for logging connections. The methods simply -------// add to the private data fields. Has implementation for standard -------// output, as well as output to file. -------// -------// An example log entry looks like: -------// -------// 1.2.3.4 - - [29/JAN/1998:21:40:30 -06] "GET /file.html HTTP/1.0" 200 472 -------// -------//**************************************************************************** ------- -------public class LogFile -------{ ---- static public final String log_file_name = "server.log"; --- static public final String log_file_name = "server.log"; ------- ---- static public String write_log(Socket s, String Method, String URI, ---- String Protocol, ---- int ReturnCode, long BytesSent){ --- static public String write_log(Socket s, String Method, String URI, --- String Protocol, --- int ReturnCode, long BytesSent) { ------- ---- // Socket.toString() calls (indirectly) some Hashtable.get ---- // method - I tool care of it! --- // Socket.toString() calls (indirectly) some Hashtable.get --- // method - I tool care of it! ------- ---- /* ---- String addr = s.toString(); ---- String Address = addr.substring(addr.indexOf('/') + 1, ---- addr.indexOf(',')); ---- */ --- /* --- String addr = s.toString(); --- String Address = addr.substring(addr.indexOf('/') + 1, --- addr.indexOf(',')); --- */ ------- ---- // SimpleDateFormat sdf = ---- // new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); // RFC 1123 ---- // sdf.setTimeZone(TimeZone.getTimeZone("GMT")); ---- // String Date = sdf.format(new Date()); --- // SimpleDateFormat sdf = --- // new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); // RFC 1123 --- // sdf.setTimeZone(TimeZone.getTimeZone("GMT")); --- // String Date = sdf.format(new Date()); ------- ---- String Entry = ---- /* Address + */ " - - [" + // IP address ---- "Date" + "] \"" + // date ---- Method + " " + // get, post, head ---- URI + " " + // filename ---- Protocol + "\" " + // http/1.? ---- ReturnCode + " " + // 200-500 ---- BytesSent + "\n"; // bytes sent --- String Entry = --- /* Address + */ " - - [" + // IP address --- "Date" + "] \"" + // date --- Method + " " + // get, post, head --- URI + " " + // filename --- Protocol + "\" " + // http/1.? --- ReturnCode + " " + // 200-500 --- BytesSent + "\n"; // bytes sent ------- ---- try{ ---- BufferedWriter out = new BufferedWriter( ---- new OutputStreamWriter( ---- new FileOutputStream(log_file_name, true))); ---- ---- out.write(Entry,0,Entry.length()); ---- out.flush(); ---- out.close(); ---- } ---- catch (IOException e){ ---- System.err.println("Gicu " + e); ---- } - try{ -- try { --- BufferedWriter out = new BufferedWriter( --- new OutputStreamWriter( --- new FileOutputStream(log_file_name, true))); ------- ---- return Entry; --- out.write(Entry,0,Entry.length()); --- out.flush(); --- out.close(); - } - catch (IOException e){ -- } catch (IOException e) { --- System.err.println("Gicu " + e); ------- } --- --- return Entry; --- } -------} diff --cc Robust/src/Interface/WebInterface.java index d7135100,17b71df4,17b71df4,17b71df4,472e9fa8,069527bd,069527bd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Interface/WebInterface.java +++ /dev/null @@@@@@@@ -1,278 -1,280 -1,280 -1,280 -1,280 -1,292 -1,292 +1,0 @@@@@@@@ -------package Interface; -------import java.io.*; -------import Analysis.TaskStateAnalysis.*; -------import IR.*; -------import java.util.*; -------import Util.Namer; ------- -------public class WebInterface { ---- TaskAnalysis taskanalysis; ---- TaskGraph taskgraph; ---- TagAnalysis taganalysis; ---- State state; ---- Hashtable flagstatemap; ---- Hashtable taskgraphmap; ---- Hashtable sourcenodemap; //to hold the filenames for each of the pages linked to the source nodes. ---- Hashtable taskmap; // to hold the filenames for each of the pages linked to tasks in the program. ---- GarbageAnalysis garbageanalysis; --- TaskAnalysis taskanalysis; --- TaskGraph taskgraph; --- TagAnalysis taganalysis; --- State state; --- Hashtable flagstatemap; --- Hashtable taskgraphmap; --- Hashtable sourcenodemap; //to hold the filenames for each of the pages linked to the source nodes. --- Hashtable taskmap; // to hold the filenames for each of the pages linked to tasks in the program. --- GarbageAnalysis garbageanalysis; ------- ---- public WebInterface(State state, TaskAnalysis taskanalysis, TaskGraph taskgraph, GarbageAnalysis garbageanalysis, TagAnalysis taganalysis) { ---- this.state=state; ---- this.taskanalysis=taskanalysis; ---- this.taskgraph=taskgraph; ---- this.garbageanalysis=garbageanalysis; ---- this.taganalysis=taganalysis; --- public WebInterface(State state, TaskAnalysis taskanalysis, TaskGraph taskgraph, GarbageAnalysis garbageanalysis, TagAnalysis taganalysis) { --- this.state=state; --- this.taskanalysis=taskanalysis; --- this.taskgraph=taskgraph; --- this.garbageanalysis=garbageanalysis; --- this.taganalysis=taganalysis; ------- ---- flagstatemap=new Hashtable(); ---- taskgraphmap=new Hashtable(); ---- taskmap = new Hashtable(); ---- sourcenodemap=new Hashtable(); ---- ---- for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();){ ---- TaskDescriptor td=(TaskDescriptor)it_tasks.next(); ---- taskmap.put("/"+td.getSymbol()+".html",td); ---- } ---- ---- for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor) it_classes.next(); ---- if(cd.hasFlags()){ ---- Vector rootnodes=taskanalysis.getRootNodes(cd); ---- ---- if(rootnodes!=null) ---- for(Iterator it_rootnodes=rootnodes.iterator();it_rootnodes.hasNext();){ ---- FlagState root=(FlagState)it_rootnodes.next(); ---- Vector cd_nodeid=new Vector(); //Vector is designed to contain only 2 elements: ClassDescriptor,Node label ---- // Both the values are required to correctly resolve the rootnode. ---- // Should think of a better way to do this, instead of using a vector(maybe a class) ---- cd_nodeid.addElement(cd); //adding the ClassDescriptor ---- cd_nodeid.addElement(root.getLabel()); //adding the Node label ---- System.out.println(cd+" "+root.getLabel()); ---- sourcenodemap.put("/"+cd.getSymbol()+"_"+root.getLabel()+".html",cd_nodeid); ---- } ---- } ---- } ---- } ---- ---- public boolean specialRequest(String filename) { ---- System.out.println(filename); ---- if (filename.equals("/index.html")) ---- return true; ---- if (filename.equals("/UnifiedTaskGraph.html")) ---- return true; ---- if (flagstatemap.containsKey(filename)) ---- return true; ---- if (taskgraphmap.containsKey(filename)) ---- return true; ---- if (taskmap.containsKey(filename)) ---- return true; ---- if (sourcenodemap.containsKey(filename)) ---- return true; ---- return false; ---- } --- flagstatemap=new Hashtable(); --- taskgraphmap=new Hashtable(); --- taskmap = new Hashtable(); --- sourcenodemap=new Hashtable(); ------- ---- public String handleresponse(String filename, OutputStream out, HTTPResponse resp) { ---- if (filename.equals("/index.html")) ---- return indexpage(out, resp); ---- if (filename.equals("/UnifiedTaskGraph.html")) ---- return unifiedTaskGraph(out,resp); ---- if (flagstatemap.containsKey(filename)) ---- return flagstate((ClassDescriptor) flagstatemap.get(filename), out, resp); ---- if (taskgraphmap.containsKey(filename)) ---- return taskstate((ClassDescriptor) taskgraphmap.get(filename), out, resp); ---- if (taskmap.containsKey(filename)) ---- return task((TaskDescriptor)taskmap.get(filename),out,resp); ---- if (sourcenodemap.containsKey(filename)) ---- return sourcenode((Vector) sourcenodemap.get(filename), out, resp); ---- return "NORESP"; - for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator(); it_tasks.hasNext();){ -- for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator(); it_tasks.hasNext();) { --- TaskDescriptor td=(TaskDescriptor)it_tasks.next(); --- taskmap.put("/"+td.getSymbol()+".html",td); ------- } ------- ---- private String task(TaskDescriptor td, OutputStream out, HTTPResponse resp){ ---- try{ ---- PrintWriter pw=new PrintWriter(out); ---- pw.println("

Task:   "+td.toString()+"


"); ---- printTask(td,pw); ---- ---- //printing out the classes that are instantiated by this task ---- pw.println("

Instantiated Classes:

"); ---- Set newstates=taganalysis.getFlagStates(td); ---- for(Iterator fsit=newstates.iterator();fsit.hasNext();) { ---- FlagState fsnew=(FlagState) fsit.next(); ---- ClassDescriptor cd=fsnew.getClassDescriptor(); ---- pw.println("  "+cd.getSymbol()+"
"); ---- pw.println("    "+fsnew.getTextLabel()+"
"); ---- } ---- ---- pw.flush(); ---- } catch (Exception e) {e.printStackTrace();System.exit(-1);} ---- return null; --- for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator(); it_classes.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor) it_classes.next(); - if(cd.hasFlags()){ -- if(cd.hasFlags()) { --- Vector rootnodes=taskanalysis.getRootNodes(cd); --- --- if(rootnodes!=null) - for(Iterator it_rootnodes=rootnodes.iterator(); it_rootnodes.hasNext();){ -- for(Iterator it_rootnodes=rootnodes.iterator(); it_rootnodes.hasNext();) { --- FlagState root=(FlagState)it_rootnodes.next(); --- Vector cd_nodeid=new Vector(); //Vector is designed to contain only 2 elements: ClassDescriptor,Node label --- // Both the values are required to correctly resolve the rootnode. --- // Should think of a better way to do this, instead of using a vector(maybe a class) --- cd_nodeid.addElement(cd); //adding the ClassDescriptor --- cd_nodeid.addElement(root.getLabel()); //adding the Node label --- System.out.println(cd+" "+root.getLabel()); --- sourcenodemap.put("/"+cd.getSymbol()+"_"+root.getLabel()+".html",cd_nodeid); --- } --- } ------- } --- } ------- ---- private String printTask(TaskDescriptor td, PrintWriter pw){ ---- try{ --- public boolean specialRequest(String filename) { --- System.out.println(filename); --- if (filename.equals("/index.html")) --- return true; --- if (filename.equals("/UnifiedTaskGraph.html")) --- return true; --- if (flagstatemap.containsKey(filename)) --- return true; --- if (taskgraphmap.containsKey(filename)) --- return true; --- if (taskmap.containsKey(filename)) --- return true; --- if (sourcenodemap.containsKey(filename)) --- return true; --- return false; --- } ------- ---- for(int i=0; i < td.numParameters();i++){ ---- pw.println("FlagState Graph:  "+td.getParamType(i)+"
"); ---- pw.println("Task Graph:        " ---- +td.getParamType(i)+"
"); ---- } ---- pw.flush(); ---- }catch(Exception e) {e.printStackTrace();System.exit(-1);} ---- return null; ---- } --- public String handleresponse(String filename, OutputStream out, HTTPResponse resp) { --- if (filename.equals("/index.html")) --- return indexpage(out, resp); --- if (filename.equals("/UnifiedTaskGraph.html")) --- return unifiedTaskGraph(out,resp); --- if (flagstatemap.containsKey(filename)) --- return flagstate((ClassDescriptor) flagstatemap.get(filename), out, resp); --- if (taskgraphmap.containsKey(filename)) --- return taskstate((ClassDescriptor) taskgraphmap.get(filename), out, resp); --- if (taskmap.containsKey(filename)) --- return task((TaskDescriptor)taskmap.get(filename),out,resp); --- if (sourcenodemap.containsKey(filename)) --- return sourcenode((Vector) sourcenodemap.get(filename), out, resp); --- return "NORESP"; --- } ------- ---- private String sourcenode(Vector cd_nodeid,OutputStream out, HTTPResponse resp){ ---- Vector rootnodes=taskanalysis.getRootNodes((ClassDescriptor)cd_nodeid.elementAt(0)); ---- for(Iterator it_rootnodes=rootnodes.iterator();it_rootnodes.hasNext();){ ---- FlagState root=(FlagState)it_rootnodes.next(); ---- if (root.getLabel().equals((String)cd_nodeid.elementAt(1))){ ---- try{ ---- PrintWriter pw=new PrintWriter(out); ---- pw.println("

Allocating tasks for "+root.getTextLabel()+":


"); ---- Vector tasks=root.getAllocatingTasks(); ---- for(Iterator it_tasks=tasks.iterator();it_tasks.hasNext();){ ---- TaskDescriptor td=(TaskDescriptor)it_tasks.next(); ---- pw.println("
Task:   "+td.toString()+"
"); ---- printTask(td,pw); ---- } ---- ---- } catch (Exception e) {e.printStackTrace();System.exit(-1);} ---- break; ---- } ---- ---- } ---- return null; ---- } --- private String task(TaskDescriptor td, OutputStream out, HTTPResponse resp) { - try{ -- try { --- PrintWriter pw=new PrintWriter(out); --- pw.println("

Task:   "+td.toString()+"


"); --- printTask(td,pw); ------- ---- private String flagstate(ClassDescriptor cd, OutputStream out, HTTPResponse resp) { ---- Set objects=taskanalysis.getFlagStates(cd); ---- File file=new File(cd.getSymbol()+".dot"); ---- File mapfile; ---- String str; ---- Vector namers=new Vector(); ---- namers.add(new Namer()); ---- namers.add(garbageanalysis); ---- namers.add(new Allocations()); ---- namers.add(new TaskEdges()); ---- try { ---- //Generate jpg ---- Runtime r=Runtime.getRuntime(); --- //printing out the classes that are instantiated by this task --- pw.println("

Instantiated Classes:

"); --- Set newstates=taganalysis.getFlagStates(td); --- for(Iterator fsit=newstates.iterator(); fsit.hasNext();) { --- FlagState fsnew=(FlagState) fsit.next(); --- ClassDescriptor cd=fsnew.getClassDescriptor(); --- pw.println("  "+cd.getSymbol()+"
"); --- pw.println("    "+fsnew.getTextLabel()+"
"); --- } ------- ---- FileOutputStream dotstream=new FileOutputStream(file,false); ---- FlagState.DOTVisitor.visit(dotstream, objects, namers); ---- dotstream.close(); ---- Process p=r.exec("dot -Tcmapx -o"+cd.getSymbol()+".map -Tjpg -o"+cd.getSymbol()+".jpg "+cd.getSymbol()+".dot"); ---- p.waitFor(); ---- p=r.exec("dot -Tps "+cd.getSymbol()+".dot -o"+cd.getSymbol()+".ps"); ---- p.waitFor(); --- pw.flush(); - } catch (Exception e) {e.printStackTrace(); System.exit(-1);} -- } catch (Exception e) { -- e.printStackTrace(); System.exit(-1); -- } --- return null; --- } ------- ---- mapfile=new File(cd.getSymbol()+".map"); ---- BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); ---- PrintWriter pw=new PrintWriter(out); ---- pw.println("ps
"); ---- //pw.println(""); ---- pw.println(""); ---- while((str=mapbr.readLine())!=null){ ---- pw.println(str); ---- } ---- ---- pw.flush(); ---- } catch (Exception e) {e.printStackTrace();System.exit(-1);} ---- return null; ---- } --- private String printTask(TaskDescriptor td, PrintWriter pw) { - try{ -- try { ------- ---- private String taskstate(ClassDescriptor cd, OutputStream out, HTTPResponse resp) { ---- Set objects=taskgraph.getTaskNodes(cd); ---- File file=new File(cd.getSymbol()+"-t.dot"); ---- File mapfile; ---- String str; ---- Vector namers=new Vector(); ---- namers.add(new Namer()); ---- namers.add(new TaskNodeNamer()); - for(int i=0; i < td.numParameters(); i++){ -- for(int i=0; i < td.numParameters(); i++) { --- pw.println("FlagState Graph:  "+td.getParamType(i)+"
"); --- pw.println("Task Graph:        " --- +td.getParamType(i)+"
"); --- } --- pw.flush(); - } catch(Exception e) {e.printStackTrace(); System.exit(-1);} -- } catch(Exception e) { -- e.printStackTrace(); System.exit(-1); -- } --- return null; --- } ------- ---- try { ---- //Generate jpg ---- Runtime r=Runtime.getRuntime(); ---- FileOutputStream dotstream=new FileOutputStream(file,false); ---- FlagState.DOTVisitor.visit(dotstream, objects,namers); ---- dotstream.close(); ---- Process p=r.exec("dot -Tcmapx -o"+cd.getSymbol()+"-t.map -Tjpg -o"+cd.getSymbol()+"-t.jpg "+cd.getSymbol()+"-t.dot"); ---- p.waitFor(); ---- p=r.exec("dot -Tps "+cd.getSymbol()+".dot -o"+cd.getSymbol()+"-t.ps"); ---- ---- p.waitFor(); --- private String sourcenode(Vector cd_nodeid,OutputStream out, HTTPResponse resp) { --- Vector rootnodes=taskanalysis.getRootNodes((ClassDescriptor)cd_nodeid.elementAt(0)); - for(Iterator it_rootnodes=rootnodes.iterator(); it_rootnodes.hasNext();){ -- for(Iterator it_rootnodes=rootnodes.iterator(); it_rootnodes.hasNext();) { --- FlagState root=(FlagState)it_rootnodes.next(); - if (root.getLabel().equals((String)cd_nodeid.elementAt(1))){ - try{ -- if (root.getLabel().equals((String)cd_nodeid.elementAt(1))) { -- try { --- PrintWriter pw=new PrintWriter(out); --- pw.println("

Allocating tasks for "+root.getTextLabel()+":


"); --- Vector tasks=root.getAllocatingTasks(); - for(Iterator it_tasks=tasks.iterator(); it_tasks.hasNext();){ -- for(Iterator it_tasks=tasks.iterator(); it_tasks.hasNext();) { --- TaskDescriptor td=(TaskDescriptor)it_tasks.next(); --- pw.println("
Task:   "+td.toString()+"
"); --- printTask(td,pw); --- } ------- ---- mapfile=new File(cd.getSymbol()+"-t.map"); ---- BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); ---- PrintWriter pw=new PrintWriter(out); ---- pw.println("ps
"); ---- // pw.println(""); ---- pw.println(""); - } catch (Exception e) {e.printStackTrace(); System.exit(-1);} -- } catch (Exception e) { -- e.printStackTrace(); System.exit(-1); -- } --- break; --- } ------- ---- while((str=mapbr.readLine())!=null){ ---- pw.println(str); ---- } ---- pw.flush(); ---- } catch (Exception e) {e.printStackTrace();System.exit(-1);} ---- return null; ------- } ---- ---- /* public void taskgraph( ---- */ --- return null; --- } ------- ---- private String indexpage(OutputStream out, HTTPResponse resp) { --- private String flagstate(ClassDescriptor cd, OutputStream out, HTTPResponse resp) { --- Set objects=taskanalysis.getFlagStates(cd); --- File file=new File(cd.getSymbol()+".dot"); --- File mapfile; --- String str; --- Vector namers=new Vector(); --- namers.add(new Namer()); --- namers.add(garbageanalysis); --- namers.add(new Allocations()); --- namers.add(new TaskEdges()); --- try { --- //Generate jpg --- Runtime r=Runtime.getRuntime(); ------- ---- PrintWriter pw=new PrintWriter(out); ---- for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { ---- ClassDescriptor cd=(ClassDescriptor) it_classes.next(); --- if (cd.hasFlags()){ ---- if (taskanalysis.getFlagStates(cd)!=null) { ---- pw.println(""+ cd.getSymbol() +""); ---- pw.println("
"); ---- flagstatemap.put("/"+cd.getSymbol()+".html", cd); ---- } ---- if (taskgraph.getTaskNodes(cd)!=null) { ---- pw.println("Task Graph "+ cd.getSymbol() +""); ---- pw.println("
"); ---- taskgraphmap.put("/"+cd.getSymbol()+"-t.html", cd); ---- } --- } --- FileOutputStream dotstream=new FileOutputStream(file,false); --- FlagState.DOTVisitor.visit(dotstream, objects, namers); --- dotstream.close(); --- Process p=r.exec("dot -Tcmapx -o"+cd.getSymbol()+".map -Tjpg -o"+cd.getSymbol()+".jpg "+cd.getSymbol()+".dot"); --- p.waitFor(); --- p=r.exec("dot -Tps "+cd.getSymbol()+".dot -o"+cd.getSymbol()+".ps"); --- p.waitFor(); --- --- mapfile=new File(cd.getSymbol()+".map"); --- BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); --- PrintWriter pw=new PrintWriter(out); --- pw.println("ps
"); --- //pw.println(""); --- pw.println(""); - while((str=mapbr.readLine())!=null){ -- while((str=mapbr.readLine())!=null) { --- pw.println(str); --- } --- --- pw.flush(); - } catch (Exception e) {e.printStackTrace(); System.exit(-1);} -- } catch (Exception e) { -- e.printStackTrace(); System.exit(-1); -- } --- return null; --- } --- --- private String taskstate(ClassDescriptor cd, OutputStream out, HTTPResponse resp) { --- Set objects=taskgraph.getTaskNodes(cd); --- File file=new File(cd.getSymbol()+"-t.dot"); --- File mapfile; --- String str; --- Vector namers=new Vector(); --- namers.add(new Namer()); --- namers.add(new TaskNodeNamer()); --- --- try { --- //Generate jpg --- Runtime r=Runtime.getRuntime(); --- FileOutputStream dotstream=new FileOutputStream(file,false); --- FlagState.DOTVisitor.visit(dotstream, objects,namers); --- dotstream.close(); --- Process p=r.exec("dot -Tcmapx -o"+cd.getSymbol()+"-t.map -Tjpg -o"+cd.getSymbol()+"-t.jpg "+cd.getSymbol()+"-t.dot"); --- p.waitFor(); --- p=r.exec("dot -Tps "+cd.getSymbol()+".dot -o"+cd.getSymbol()+"-t.ps"); --- --- p.waitFor(); --- --- mapfile=new File(cd.getSymbol()+"-t.map"); --- BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); --- PrintWriter pw=new PrintWriter(out); --- pw.println("ps
"); --- // pw.println(""); --- pw.println(""); --- - while((str=mapbr.readLine())!=null){ -- while((str=mapbr.readLine())!=null) { --- pw.println(str); --- } --- pw.flush(); - } catch (Exception e) {e.printStackTrace(); System.exit(-1);} -- } catch (Exception e) { -- e.printStackTrace(); System.exit(-1); -- } --- return null; --- } --- --- /* public void taskgraph( --- */ --- --- private String indexpage(OutputStream out, HTTPResponse resp) { --- --- PrintWriter pw=new PrintWriter(out); --- for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator(); it_classes.hasNext();) { --- ClassDescriptor cd=(ClassDescriptor) it_classes.next(); - if (cd.hasFlags()){ -- if (cd.hasFlags()) { --- if (taskanalysis.getFlagStates(cd)!=null) { --- pw.println(""+ cd.getSymbol() +""); --- pw.println("
"); --- flagstatemap.put("/"+cd.getSymbol()+".html", cd); ------- } ---- pw.println("

Program flow"); ---- pw.flush(); ---- return null; --- if (taskgraph.getTaskNodes(cd)!=null) { --- pw.println("Task Graph "+ cd.getSymbol() +""); --- pw.println("
"); --- taskgraphmap.put("/"+cd.getSymbol()+"-t.html", cd); --- } --- } ------- } ---- ---- private String unifiedTaskGraph(OutputStream out, HTTPResponse resp){ ---- Set objects=taskgraph.getAllTaskNodes(); ---- File file=new File("UnifiedTaskGraph.dot"); ---- String str; ---- Vector namers=new Vector(); ---- namers.add(new Namer()); ---- namers.add(new TaskNodeNamer()); --- pw.println("

Program flow"); --- pw.flush(); --- return null; --- } ------- ---- try { ---- //Generate jpg ---- Runtime r=Runtime.getRuntime(); ---- FileOutputStream dotstream=new FileOutputStream(file,false); ---- FlagState.DOTVisitor.visit(dotstream, objects, namers); ---- dotstream.close(); ---- Process p=r.exec("dot -Tjpg -oUnifiedTaskGraph.jpg -Tcmapx -oUnifiedTaskGraph.map UnifiedTaskGraph.dot"); ---- p.waitFor(); ---- p=r.exec("dot -Tps UnifiedTaskGraph.dot -oUnifiedTaskGraph.ps"); ---- ---- p.waitFor(); --- private String unifiedTaskGraph(OutputStream out, HTTPResponse resp) { --- Set objects=taskgraph.getAllTaskNodes(); --- File file=new File("UnifiedTaskGraph.dot"); --- String str; --- Vector namers=new Vector(); --- namers.add(new Namer()); --- namers.add(new TaskNodeNamer()); ------- ---- File mapfile=new File("UnifiedTaskGraph.map"); ---- BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); ---- PrintWriter pw=new PrintWriter(out); ---- pw.println("ps
"); ---- // pw.println(""); ---- pw.println(""); ---- ---- while((str=mapbr.readLine())!=null) ---- pw.println(str); ---- ---- pw.flush(); ---- } catch (Exception e) {e.printStackTrace();System.exit(-1);} ---- return null; ---- } --- try { --- //Generate jpg --- Runtime r=Runtime.getRuntime(); --- FileOutputStream dotstream=new FileOutputStream(file,false); --- FlagState.DOTVisitor.visit(dotstream, objects, namers); --- dotstream.close(); --- Process p=r.exec("dot -Tjpg -oUnifiedTaskGraph.jpg -Tcmapx -oUnifiedTaskGraph.map UnifiedTaskGraph.dot"); --- p.waitFor(); --- p=r.exec("dot -Tps UnifiedTaskGraph.dot -oUnifiedTaskGraph.ps"); --- --- p.waitFor(); --- --- File mapfile=new File("UnifiedTaskGraph.map"); --- BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); --- PrintWriter pw=new PrintWriter(out); --- pw.println("ps
"); --- // pw.println(""); --- pw.println(""); --- --- while((str=mapbr.readLine())!=null) --- pw.println(str); --- --- pw.flush(); - } catch (Exception e) {e.printStackTrace(); System.exit(-1);} -- } catch (Exception e) { -- e.printStackTrace(); System.exit(-1); -- } --- return null; --- } ------- -------} diff --cc Robust/src/Lex/BooleanLiteral.java index f013e641,f013e641,f013e641,f013e641,2bda29c5,2bda29c5,2bda29c5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/BooleanLiteral.java +++ /dev/null @@@@@@@@ -1,13 -1,13 -1,13 -1,13 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class BooleanLiteral extends Literal { ------- Boolean val; ---- BooleanLiteral(boolean b) { this.val = new Boolean(b); } --- BooleanLiteral(boolean b) { --- this.val = new Boolean(b); --- } ------- ---- Symbol token() { return new Symbol(Sym.BOOLEAN_LITERAL, val); } --- Symbol token() { --- return new Symbol(Sym.BOOLEAN_LITERAL, val); --- } ------- ---- public String toString() { return "BooleanLiteral <"+val.toString()+">"; } --- public String toString() { --- return "BooleanLiteral <"+val.toString()+">"; --- } -------} diff --cc Robust/src/Lex/CharacterLiteral.java index 87596f80,87596f80,87596f80,87596f80,e7e4d820,e7e4d820,e7e4d820..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/CharacterLiteral.java +++ /dev/null @@@@@@@@ -1,15 -1,15 -1,15 -1,15 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class CharacterLiteral extends Literal { ------- Character val; ---- CharacterLiteral(char c) { this.val = new Character(c); } --- CharacterLiteral(char c) { --- this.val = new Character(c); --- } ------- ---- Symbol token() { return new Symbol(Sym.CHARACTER_LITERAL, val); } --- Symbol token() { --- return new Symbol(Sym.CHARACTER_LITERAL, val); --- } ------- ---- public String toString() { ---- return "CharacterLiteral <"+Token.escape(val.toString())+">"; --- public String toString() { --- return "CharacterLiteral <"+Token.escape(val.toString())+">"; ------- } -------} diff --cc Robust/src/Lex/Comment.java index 6a0aae4b,6a0aae4b,6a0aae4b,6a0aae4b,2e02ff41,2e02ff41,2e02ff41..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Comment.java +++ /dev/null @@@@@@@@ -1,26 -1,26 -1,26 -1,26 -1,28 -1,28 -1,28 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class Comment extends InputElement { ------- private StringBuffer comment = new StringBuffer(); ------- ---- String getComment() { return comment.toString(); } --- String getComment() { --- return comment.toString(); --- } ------- ------- void appendLine(String more) { // 'more' is '\n' terminated. ------- int i=0; ------- ------- // skip leading white space. ------- for (; i ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------class FIFO { ------- java_cup.runtime.Symbol[] backing = new java_cup.runtime.Symbol[10]; ------- int start=0, end=0; ------- final Getter getter; ---- FIFO(Getter getter) { this.getter = getter; } ---- public boolean isEmpty() { return start==end; } --- FIFO(Getter getter) { --- this.getter = getter; --- } --- public boolean isEmpty() { --- return start==end; --- } ------- private boolean isFull() { ------- return start==end+1 || (start==0 && end==backing.length-1); ------- } ------- private int size() { ---- return ((end= size()) ------- put(getter.next()); ------- int index = start+i; ------- if (index >= backing.length) index -= backing.length; ------- ASSERT(0<= index && index < backing.length); ------- return backing[index]; ------- } ------- abstract static class Getter { ------- abstract java_cup.runtime.Symbol next() ---- throws java.io.IOException; --- throws java.io.IOException; ------- } ------- private static void ASSERT(boolean b) { ------- if (!b) throw new RuntimeException(); ------- } -------} ---- ---- --- --- diff --cc Robust/src/Lex/FloatLiteral.java index 99abf527,99abf527,99abf527,99abf527,50fba693,50fba693,50fba693..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/FloatLiteral.java +++ /dev/null @@@@@@@@ -1,10 -1,10 -1,10 -1,10 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class FloatLiteral extends NumericLiteral { ---- FloatLiteral(float f) { this.val = new Float(f); } --- FloatLiteral(float f) { --- this.val = new Float(f); --- } ------- ---- Symbol token() { return new Symbol(Sym.FLOATING_POINT_LITERAL, val); } --- Symbol token() { --- return new Symbol(Sym.FLOATING_POINT_LITERAL, val); --- } -------} diff --cc Robust/src/Lex/Identifier.java index 1dcf0530,1dcf0530,1dcf0530,1dcf0530,f3c787ab,f3c787ab,f3c787ab..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Identifier.java +++ /dev/null @@@@@@@@ -1,18 -1,18 -1,18 -1,18 -1,24 -1,24 -1,24 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------public class Identifier extends Token { ------- String identifier; ---- public Identifier(String identifier) { this.identifier=identifier; } --- public Identifier(String identifier) { --- this.identifier=identifier; --- } ------- ---- public String toString() { return "Identifier <"+identifier+">"; } --- public String toString() { --- return "Identifier <"+identifier+">"; --- } ------- ------- /* Ben Walter correctly pointed out that ------- * the first released version of this grammar/lexer did not ------- * return the string value of the identifier in the parser token. ------- * Should be fixed now. ;-) ------- */ ---- Symbol token() { return new Symbol(Sym.IDENTIFIER, identifier); } --- Symbol token() { --- return new Symbol(Sym.IDENTIFIER, identifier); --- } -------} diff --cc Robust/src/Lex/InputElement.java index 11858266,11858266,11858266,11858266,11858266,11858266,11858266..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/InputElement.java +++ /dev/null @@@@@@@@ -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class InputElement {} diff --cc Robust/src/Lex/IntegerLiteral.java index ba3e4ee3,ba3e4ee3,ba3e4ee3,ba3e4ee3,9ad2bb5f,9ad2bb5f,9ad2bb5f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/IntegerLiteral.java +++ /dev/null @@@@@@@@ -1,10 -1,10 -1,10 -1,10 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class IntegerLiteral extends NumericLiteral { ---- IntegerLiteral(int i) { this.val = new Integer(i); } --- IntegerLiteral(int i) { --- this.val = new Integer(i); --- } ------- ---- Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } --- Symbol token() { --- return new Symbol(Sym.INTEGER_LITERAL, val); --- } -------} diff --cc Robust/src/Lex/Keyword.java index 7d6ca909,f39079a1,f39079a1,f39079a1,32ddff93,32ddff93,32ddff93..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Keyword.java +++ /dev/null @@@@@@@@ -1,78 -1,79 -1,79 -1,79 -1,83 -1,83 -1,83 +1,0 @@@@@@@@ -------package Lex; ------- -------import java.util.Hashtable; -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class Keyword extends Token { ------- String keyword; ---- Keyword(String s) { keyword = s; } --- Keyword(String s) { --- keyword = s; --- } ------- ------- Symbol token() { ------- Integer i = (Integer) key_table.get(keyword); ------- return new Symbol(i.intValue()); ------- } ---- public String toString() { return "Keyword <"+keyword+">"; } --- public String toString() { --- return "Keyword <"+keyword+">"; --- } ------- ------- static private final Hashtable key_table = new Hashtable(); ------- static { ------- key_table.put("abstract", new Integer(Sym.ABSTRACT)); ------- key_table.put("assert", new Integer(Sym.ASSERT)); ------- key_table.put("boolean", new Integer(Sym.BOOLEAN)); ------- key_table.put("break", new Integer(Sym.BREAK)); ------- key_table.put("byte", new Integer(Sym.BYTE)); ------- key_table.put("case", new Integer(Sym.CASE)); ------- key_table.put("catch", new Integer(Sym.CATCH)); ------- key_table.put("char", new Integer(Sym.CHAR)); ------- key_table.put("class", new Integer(Sym.CLASS)); ------- key_table.put("const", new Integer(Sym.CONST)); ------- key_table.put("continue", new Integer(Sym.CONTINUE)); ------- key_table.put("default", new Integer(Sym.DEFAULT)); ------- key_table.put("do", new Integer(Sym.DO)); ------- key_table.put("double", new Integer(Sym.DOUBLE)); ------- key_table.put("else", new Integer(Sym.ELSE)); ------- key_table.put("enum", new Integer(Sym.ENUM)); ------- key_table.put("extends", new Integer(Sym.EXTENDS)); ------- key_table.put("final", new Integer(Sym.FINAL)); ------- key_table.put("finally", new Integer(Sym.FINALLY)); ------- key_table.put("float", new Integer(Sym.FLOAT)); ------- key_table.put("for", new Integer(Sym.FOR)); ------- key_table.put("goto", new Integer(Sym.GOTO)); ------- key_table.put("if", new Integer(Sym.IF)); ------- key_table.put("import", new Integer(Sym.IMPORT)); ------- key_table.put("instanceof", new Integer(Sym.INSTANCEOF)); ------- key_table.put("int", new Integer(Sym.INT)); ------ key_table.put("isavailable", new Integer(Sym.ISAVAILABLE)); ------- key_table.put("long", new Integer(Sym.LONG)); ------- key_table.put("native", new Integer(Sym.NATIVE)); ------- key_table.put("new", new Integer(Sym.NEW)); ------- key_table.put("package", new Integer(Sym.PACKAGE)); ------- key_table.put("private", new Integer(Sym.PRIVATE)); ------- key_table.put("protected", new Integer(Sym.PROTECTED)); ------- key_table.put("public", new Integer(Sym.PUBLIC)); ------- key_table.put("return", new Integer(Sym.RETURN)); ------- key_table.put("short", new Integer(Sym.SHORT)); ------- key_table.put("static", new Integer(Sym.STATIC)); ------- key_table.put("strictfp", new Integer(Sym.STRICTFP)); ------- key_table.put("super", new Integer(Sym.SUPER)); ------- key_table.put("switch", new Integer(Sym.SWITCH)); ------- key_table.put("synchronized", new Integer(Sym.SYNCHRONIZED)); ------- key_table.put("this", new Integer(Sym.THIS)); ------- key_table.put("throw", new Integer(Sym.THROW)); ------- key_table.put("throws", new Integer(Sym.THROWS)); ------- key_table.put("transient", new Integer(Sym.TRANSIENT)); ------- key_table.put("try", new Integer(Sym.TRY)); ------- key_table.put("void", new Integer(Sym.VOID)); ------- key_table.put("volatile", new Integer(Sym.VOLATILE)); ------- key_table.put("while", new Integer(Sym.WHILE)); ------- //Keywords for failure aware computation ------- key_table.put("flag", new Integer(Sym.FLAG)); ------- key_table.put("external", new Integer(Sym.EXTERNAL)); ------- key_table.put("optional", new Integer(Sym.OPTIONAL)); ------- key_table.put("tag", new Integer(Sym.TAG)); ------- key_table.put("task", new Integer(Sym.TASK)); ------- key_table.put("taskexit", new Integer(Sym.TASKEXIT)); ------- //Keywords for transactions ------- key_table.put("atomic", new Integer(Sym.ATOMIC)); ------- key_table.put("global", new Integer(Sym.GLOBAL)); ------- } -------} diff --cc Robust/src/Lex/Lexer.java index 2cdd84e9,1d7e4610,1d7e4610,1d7e4610,fee2448e,fee2448e,fee2448e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Lexer.java +++ /dev/null @@@@@@@@ -1,521 -1,522 -1,522 -1,522 -1,561 -1,561 -1,561 +1,0 @@@@@@@@ -------package Lex; ------- -------import java.io.Reader; -------import java.io.LineNumberReader; -------import Parse.Sym; ------- -------/* Java lexer. ------- * Copyright (C) 2002 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------public class Lexer { ------- LineNumberReader reader; ------- boolean isJava12; ------- boolean isJava14; ------- boolean isJava15; ------- String line = null; ------- int line_pos = 1; ------- int line_num = 0; ------- LineList lineL = new LineList(-line_pos, null); // sentinel for line #0 ---- --- ------- public Lexer(Reader reader) { ------- this.reader = new LineNumberReader(new EscapedUnicodeReader(reader)); ------- this.isJava12 = true; ------- this.isJava14 = true; ------- } ---- --- ------- public java_cup.runtime.Symbol nextToken() throws java.io.IOException { ------- java_cup.runtime.Symbol sym = ------- lookahead==null ? _nextToken() : lookahead.get(); ------- last = sym; ------- return sym; ------- } ------- private boolean shouldBePLT() throws java.io.IOException { ------- // look ahead to see if this LT should be changed to a PLT ------- if (last==null || last.sym!=Sym.IDENTIFIER) ------- return false; ------- if (lookahead==null) lookahead = new FIFO(new FIFO.Getter() { ---- java_cup.runtime.Symbol next() throws java.io.IOException ---- { return _nextToken(); } ---- }); --- java_cup.runtime.Symbol next() throws java.io.IOException --- { return _nextToken(); } --- }); ------- int i=0; ------- // skip past IDENTIFIER (DOT IDENTIFIER)* ------- if (lookahead.peek(i++).sym != Sym.IDENTIFIER) ------- return false; ------- while (lookahead.peek(i).sym == Sym.DOT) { ------- i++; ------- if (lookahead.peek(i++).sym != Sym.IDENTIFIER) ------- return false; ------- } ------- // skip past (LBRACK RBRACK)* ------- while (lookahead.peek(i).sym == Sym.LBRACK) { ------- i++; ------- if (lookahead.peek(i++).sym != Sym.RBRACK) ------- return false; ------- } ------- // now the next sym has to be one of LT GT COMMA EXTENDS IMPLEMENTS ------- switch(lookahead.peek(i).sym) { ------- default: ------- return false; --- ------- case Sym.LT: ------- case Sym.GT: ------- case Sym.COMMA: ------- case Sym.EXTENDS: ------- return true; ------- } ------- } ------- private java_cup.runtime.Symbol last = null; ------- private FIFO lookahead = null; ------- public java_cup.runtime.Symbol _nextToken() throws java.io.IOException { ------- /* tokens are: ------- * Identifiers/Keywords/true/false/null (start with java letter) ------- * numeric literal (start with number) ------- * character literal (start with single quote) ------- * string (start with double quote) ------- * separator (parens, braces, brackets, semicolon, comma, period) ------- * operator (equals, plus, minus, etc) ------- * whitespace ------- * comment (start with slash) ------- */ ------- InputElement ie; ------- int startpos, endpos; ------- do { ------- startpos = lineL.head + line_pos; ------- ie = getInputElement(); ------- if (ie instanceof DocumentationComment) ------- comment = ((Comment)ie).getComment(); ------- } while (!(ie instanceof Token)); ------- endpos = lineL.head + line_pos - 1; ------- ------- // System.out.println(ie.toString()); // uncomment to debug lexer. ------- java_cup.runtime.Symbol sym = ((Token)ie).token(); ------- // fix up left/right positions. ------- sym.left = startpos; sym.right = endpos; ------- // return token. ------- return sym; ------- } ------- public boolean debug_lex() throws java.io.IOException { ------- InputElement ie = getInputElement(); ------- System.out.println(ie); ------- return !(ie instanceof EOF); ------- } ------- ------- String comment; ---- public String lastComment() { return comment; } ---- public void clearComment() { comment=""; } ---- --- public String lastComment() { --- return comment; --- } --- public void clearComment() { --- comment=""; --- } --- ------- InputElement getInputElement() throws java.io.IOException { ------- if (line_num == 0) ------- nextLine(); ------- if (line==null) ------- return new EOF(); ------- if (line.length()<=line_pos) { // end of line. ------- nextLine(); ------- if (line==null) ------- return new EOF(); ------- } ---- --- ------- switch (line.charAt(line_pos)) { ------- ------- // White space: ---- case ' ': // ASCII SP ---- case '\t': // ASCII HT ---- case '\f': // ASCII FF ---- case '\n': // LineTerminator --- case ' ': // ASCII SP --- case '\t': // ASCII HT --- case '\f': // ASCII FF --- case '\n': // LineTerminator ------- return new WhiteSpace(consume()); ------- ------- // EOF character: ------- case '\020': // ASCII SUB ------- consume(); ------- return new EOF(); ------- ------- // Comment prefix: ------- case '/': ------- return getComment(); ------- ------- // else, a Token ------- default: ------- return getToken(); ------- } ------- } ------- // May get Token instead of Comment. ------- InputElement getComment() throws java.io.IOException { ------- String comment; ------- // line.charAt(line_pos+0) is '/' ------- switch (line.charAt(line_pos+1)) { ------- case '/': // EndOfLineComment ------- comment = line.substring(line_pos+2); ------- line_pos = line.length(); ------- return new EndOfLineComment(comment); --- ------- case '*': // TraditionalComment or DocumentationComment ------- line_pos += 2; ------- if (line.charAt(line_pos)=='*') { // DocumentationComment ------- return snarfComment(new DocumentationComment()); ------- } else { // TraditionalComment ------- return snarfComment(new TraditionalComment()); ------- } --- ------- default: // it's a token, not a comment. ------- return getToken(); ------- } ------- } ------- ------- Comment snarfComment(Comment c) throws java.io.IOException { ------- StringBuffer text=new StringBuffer(); ------- while(true) { // Grab CommentTail ------- while (line.charAt(line_pos)!='*') { // Add NotStar to comment. ------- int star_pos = line.indexOf('*', line_pos); ------- if (star_pos<0) { ------- text.append(line.substring(line_pos)); ------- c.appendLine(text.toString()); text.setLength(0); ------- line_pos = line.length(); ------- nextLine(); ---- if (line==null) --- if (line==null) ------- throw new Error("Unterminated comment at end of file."); ------- } else { ------- text.append(line.substring(line_pos, star_pos)); ------- line_pos=star_pos; ------- } ------- } ------- // At this point, line.charAt(line_pos)=='*' ------- // Grab CommentTailStar starting at line_pos+1. ------- if (line.charAt(line_pos+1)=='/') { // safe because line ends with '\n' ------- c.appendLine(text.toString()); line_pos+=2; return c; ------- } ------- text.append(line.charAt(line_pos++)); // add the '*' ------- } ------- } ------- ------- Token getToken() { ------- // Tokens are: Identifiers, Keywords, Literals, Separators, Operators. ------- switch (line.charAt(line_pos)) { ------- // Separators: (period is a special case) ------- case '(': ------- case ')': ------- case '{': ------- case '}': ------- case '[': ------- case ']': ------- case ';': ------- case ',': ------- return new Separator(consume()); ------- ------- // Operators: ------- case '=': ------- case '>': ------- case '<': ------- case '!': ------- case '~': ------- case '?': ------- case ':': ------- case '&': ------- case '|': ------- case '+': ------- case '-': ------- case '*': ------- case '/': ------- case '^': ------- case '%': ------- return getOperator(); --- ------- case '\'': ------- return getCharLiteral(); --- ------- case '\"': ------- return getStringLiteral(); ------- ------- // a period is a special case: ------- case '.': ------- if (Character.digit(line.charAt(line_pos+1),10)!=-1) ------- return getNumericLiteral(); ------- else if (isJava15 && ---- line.charAt(line_pos+1)=='.' && ---- line.charAt(line_pos+2)=='.') { --- line.charAt(line_pos+1)=='.' && --- line.charAt(line_pos+2)=='.') { ------- consume(); consume(); consume(); ------- return new Separator('\u2026'); // unicode ellipsis character. ------- } else return new Separator(consume()); ---- default: --- --- default: ------- break; ------- } ------- if (Character.isJavaIdentifierStart(line.charAt(line_pos))) ------- return getIdentifier(); ------- if (Character.isDigit(line.charAt(line_pos))) ------- return getNumericLiteral(); ------- throw new Error("Illegal character on line "+line_num); ------- } ------- ------- static final String[] keywords = new String[] { ------- "abstract", "assert", "atomic", "boolean", "break", "byte", "case", "catch", "char", ------- "class", "const", "continue", "default", "do", "double", "else", "enum", ---- "extends", "external", "final", "finally", --- "extends", "external", "final", "finally", ------- "flag", //keyword for failure aware computation ---- "float", "for", "global", "goto", "if", - "implements", "import", "instanceof", "int", "interface", "long", --- "float", "for", "global", "goto", "if", ------ "implements", "import", "instanceof", "int", "interface", "isavailable", --- "long", ---- "native", "new", "optional", "package", "private", "protected", "public", --- "long", --- "native", "new", "optional", "package", "private", "protected", "public", ------- "return", "short", "static", "strictfp", "super", "switch", "synchronized", ------- "tag", "task", "taskexit", //keywords for failure aware computation ------- "this", "throw", "throws", "transient", "try", "void", ---- "volatile", "while"}; --- "volatile", "while" --- }; ------- Token getIdentifier() { ------- // Get id string. ------- StringBuffer sb = new StringBuffer().append(consume()); ------- ------- if (!Character.isJavaIdentifierStart(sb.charAt(0))) ------- throw new Error("Invalid Java Identifier on line "+line_num); ------- while (Character.isJavaIdentifierPart(line.charAt(line_pos))) ------- sb.append(consume()); ------- String s = sb.toString(); ------- // Now check against boolean literals and null literal. ------- if (s.equals("null")) return new NullLiteral(); ------- if (s.equals("true")) return new BooleanLiteral(true); ------- if (s.equals("false")) return new BooleanLiteral(false); ------- // Check against keywords. ------- // pre-java 1.5 compatibility: ------- if (!isJava15 && s.equals("enum")) return new Identifier(s); ------- // pre-java 1.4 compatibility: ------- if (!isJava14 && s.equals("assert")) return new Identifier(s); ------- // pre-java 1.2 compatibility: ------- if (!isJava12 && s.equals("strictfp")) return new Identifier(s); ------- // use binary search. ------- for (int l=0, r=keywords.length; r > l; ) { ------- int x = (l+r)/2, cmp = s.compareTo(keywords[x]); ---- if (cmp < 0) r=x; else l=x+1; --- if (cmp < 0) r=x;else l=x+1; ------- if (cmp== 0) return new Keyword(s); ------- } ------- // not a keyword. ------- return new Identifier(s); ------- } ------- NumericLiteral getNumericLiteral() { ------- int i; ------- // leading decimal indicates float. ------- if (line.charAt(line_pos)=='.') ------- return getFloatingPointLiteral(); ------- // 0x indicates Hex. ------- if (line.charAt(line_pos)=='0' && ---- (line.charAt(line_pos+1)=='x' || ---- line.charAt(line_pos+1)=='X')) { ---- line_pos+=2; return getIntegerLiteral(/*base*/16); --- (line.charAt(line_pos+1)=='x' || --- line.charAt(line_pos+1)=='X')) { --- line_pos+=2; return getIntegerLiteral(/*base*/ 16); ------- } ------- // otherwise scan to first non-numeric ------- for (i=line_pos; Character.digit(line.charAt(i),10)!=-1; ) ------- i++; ------- switch(line.charAt(i)) { // discriminate based on first non-numeric ------- case '.': ------- case 'f': ------- case 'F': ------- case 'd': ------- case 'D': ------- case 'e': ------- case 'E': ------- return getFloatingPointLiteral(); --- ------- case 'L': ------- case 'l': ------- default: ------- if (line.charAt(line_pos)=='0') ---- return getIntegerLiteral(/*base*/8); ---- return getIntegerLiteral(/*base*/10); --- return getIntegerLiteral(/*base*/ 8); --- return getIntegerLiteral(/*base*/ 10); ------- } ------- } ------- NumericLiteral getIntegerLiteral(int radix) { ------- long val=0; ------- while (Character.digit(line.charAt(line_pos),radix)!=-1) ------- val = (val*radix) + Character.digit(consume(),radix); ------- if (line.charAt(line_pos) == 'l' || ---- line.charAt(line_pos) == 'L') { --- line.charAt(line_pos) == 'L') { ------- consume(); ------- return new LongLiteral(val); ---- } --- } ------- // we compare MAX_VALUE against val/2 to allow constants like ------- // 0xFFFF0000 to get past the test. (unsigned long->signed int) ------- if ((val/2) > Integer.MAX_VALUE || ---- val < Integer.MIN_VALUE) --- val < Integer.MIN_VALUE) ------- throw new Error("Constant does not fit in integer on line "+line_num); ------- return new IntegerLiteral((int)val); ------- } ------- NumericLiteral getFloatingPointLiteral() { ------- String rep = getDigits(); ------- if (line.charAt(line_pos)=='.') ------- rep+=consume() + getDigits(); ------- if (line.charAt(line_pos)=='e' || ---- line.charAt(line_pos)=='E') { --- line.charAt(line_pos)=='E') { ------- rep+=consume(); ------- if (line.charAt(line_pos)=='+' || ---- line.charAt(line_pos)=='-') --- line.charAt(line_pos)=='-') ------- rep+=consume(); ------- rep+=getDigits(); ------- } ------- try { ------- switch (line.charAt(line_pos)) { ------- case 'f': ------- case 'F': ------- consume(); ------- return new FloatLiteral(Float.valueOf(rep).floatValue()); --- ------- case 'd': ------- case 'D': ------- consume(); --- ------- /* falls through */ ------- default: ------- return new DoubleLiteral(Double.valueOf(rep).doubleValue()); ------- } ------- } catch (NumberFormatException e) { ------- throw new Error("Illegal floating-point on line "+line_num+": "+e); ------- } ------- } ------- String getDigits() { ------- StringBuffer sb = new StringBuffer(); ------- while (Character.digit(line.charAt(line_pos),10)!=-1) ------- sb.append(consume()); ------- return sb.toString(); ------- } ------- ------- Operator getOperator() { ------- char first = consume(); ------- char second= line.charAt(line_pos); ------- ------- switch(first) { ------- // single-character operators. ------- case '~': ------- case '?': ------- case ':': ------- return new Operator(new String(new char[] {first})); --- ------- // doubled operators ------- case '+': ------- case '-': ------- case '&': ------- case '|': ---- if (first==second) --- if (first==second) ------- return new Operator(new String(new char[] {first, consume()})); --- ------- default: ------- break; ------- } ------- // Check for trailing '=' ------- if (second=='=') ---- return new Operator(new String(new char[] {first, consume()})); --- return new Operator(new String(new char[] {first, consume()})); ------- ------- // Special-case '<<', '>>' and '>>>' ------- if ((first=='<' && second=='<') || // << ---- (first=='>' && second=='>')) { // >> --- (first=='>' && second=='>')) { // >> ------- String op = new String(new char[] {first, consume()}); ------- if (first=='>' && line.charAt(line_pos)=='>') // >>> ------- op += consume(); ------- if (line.charAt(line_pos)=='=') // <<=, >>=, >>>= ------- op += consume(); ------- return new Operator(op); ------- } ------- ------- // Otherwise return single operator. ------- return new Operator(new String(new char[] {first})); ------- } ------- ------- CharacterLiteral getCharLiteral() { ------- char firstquote = consume(); ------- char val; ------- switch (line.charAt(line_pos)) { ------- case '\\': ------- val = getEscapeSequence(); ------- break; --- ------- case '\'': ------- throw new Error("Invalid character literal on line "+line_num); --- ------- case '\n': ------- throw new Error("Invalid character literal on line "+line_num); --- ------- default: ------- val = consume(); ------- break; ------- } ------- char secondquote = consume(); ------- if (firstquote != '\'' || secondquote != '\'') ------- throw new Error("Invalid character literal on line "+line_num); ------- return new CharacterLiteral(val); ------- } ------- StringLiteral getStringLiteral() { ------- char openquote = consume(); ------- StringBuffer val = new StringBuffer(); ------- while (line.charAt(line_pos)!='\"') { ------- switch(line.charAt(line_pos)) { ------- case '\\': ------- val.append(getEscapeSequence()); ------- break; --- ------- case '\n': ------- throw new Error("Invalid string literal on line " + line_num); --- ------- default: ------- val.append(consume()); ------- break; ------- } ------- } ------- char closequote = consume(); ------- if (openquote != '\"' || closequote != '\"') ------- throw new Error("Invalid string literal on line " + line_num); ---- --- ------- return new StringLiteral(val.toString().intern()); ------- } ------- ------- char getEscapeSequence() { ------- if (consume() != '\\') ------- throw new Error("Invalid escape sequence on line " + line_num); ------- switch(line.charAt(line_pos)) { ------- case 'b': ------- consume(); return '\b'; --- ------- case 't': ------- consume(); return '\t'; --- ------- case 'n': ------- consume(); return '\n'; --- ------- case 'f': ------- consume(); return '\f'; --- ------- case 'r': ------- consume(); return '\r'; --- ------- case '\"': ------- consume(); return '\"'; --- ------- case '\'': ------- consume(); return '\''; --- ------- case '\\': ------- consume(); return '\\'; --- ------- case '0': ------- case '1': ------- case '2': ------- case '3': ------- return (char) getOctal(3); --- ------- case '4': ------- case '5': ------- case '6': ------- case '7': ------- return (char) getOctal(2); --- ------- default: ------- throw new Error("Invalid escape sequence on line " + line_num); ------- } ------- } ------- int getOctal(int maxlength) { ------- int i, val=0; ------- for (i=0; i0xFF)) // impossible. ------- throw new Error("Invalid octal escape sequence in line " + line_num); ------- return val; ------- } ------- ---- char consume() { return line.charAt(line_pos++); } --- char consume() { --- return line.charAt(line_pos++); --- } ------- void nextLine() throws java.io.IOException { ------- line=reader.readLine(); ---- if (line!=null) line=line+'\n'; --- if (line!=null) line=line+'\n'; ------- lineL = new LineList(lineL.head+line_pos, lineL); // for error reporting ---- line_pos=0; ---- line_num++; --- line_pos=0; --- line_num++; ------- } ------- ------- // Deal with error messages. ------- public void errorMsg(String msg, java_cup.runtime.Symbol info) { ------- int n=line_num, c=info.left-lineL.head; ------- for (LineList p = lineL; p!=null; p=p.tail, n--) ---- if (p.head<=info.left) { c=info.left-p.head; break; } --- if (p.head<=info.left) { --- c=info.left-p.head; break; --- } ------- System.err.println(msg+" at line "+n); ------- num_errors++; ------- } ------- private int num_errors = 0; ---- public int numErrors() { return num_errors; } ---- --- public int numErrors() { --- return num_errors; --- } --- ------- class LineList { ------- int head; ------- LineList tail; ---- LineList(int head, LineList tail) { this.head = head; this.tail = tail; } --- LineList(int head, LineList tail) { --- this.head = head; this.tail = tail; --- } ------- } -------} diff --cc Robust/src/Lex/Literal.java index e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe,e9a50cfe..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Literal.java +++ /dev/null @@@@@@@@ -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class Literal extends Token { } diff --cc Robust/src/Lex/LongLiteral.java index 25090aef,25090aef,25090aef,25090aef,fc368807,fc368807,fc368807..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/LongLiteral.java +++ /dev/null @@@@@@@@ -1,10 -1,10 -1,10 -1,10 -1,14 -1,14 -1,14 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class LongLiteral extends NumericLiteral { ---- LongLiteral(long l) { this.val = new Long(l); } --- LongLiteral(long l) { --- this.val = new Long(l); --- } ------- ---- Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } --- Symbol token() { --- return new Symbol(Sym.INTEGER_LITERAL, val); --- } -------} diff --cc Robust/src/Lex/NullLiteral.java index 20e69994,20e69994,20e69994,20e69994,a20eb75d,a20eb75d,a20eb75d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/NullLiteral.java +++ /dev/null @@@@@@@@ -1,12 -1,12 -1,12 -1,12 -1,17 -1,17 -1,17 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class NullLiteral extends Literal { ---- NullLiteral() { } --- NullLiteral() { --- } ------- ---- Symbol token() { return new Symbol(Sym.NULL_LITERAL); } --- Symbol token() { --- return new Symbol(Sym.NULL_LITERAL); --- } ------- ---- public String toString() { return "NullLiteral "; } --- public String toString() { --- return "NullLiteral "; --- } -------} diff --cc Robust/src/Lex/NumericLiteral.java index f67a135a,f67a135a,f67a135a,f67a135a,4f37adbd,4f37adbd,4f37adbd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/NumericLiteral.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,9 -1,9 -1,9 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class NumericLiteral extends Literal { ------- Number val; ------- ---- public String toString() { return "NumericLiteral <"+val.toString()+">"; } --- public String toString() { --- return "NumericLiteral <"+val.toString()+">"; --- } -------} diff --cc Robust/src/Lex/Operator.java index e1b26daf,e1b26daf,e1b26daf,e1b26daf,7173b331,7173b331,7173b331..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Operator.java +++ /dev/null @@@@@@@@ -1,58 -1,58 -1,58 -1,58 -1,62 -1,62 -1,62 +1,0 @@@@@@@@ -------package Lex; ------- -------import java.util.Hashtable; -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class Operator extends Token { ------- String which; ---- Operator(String which) { this.which = which; } --- Operator(String which) { --- this.which = which; --- } ------- ---- public String toString() { return "Operator <"+which+">"; } --- public String toString() { --- return "Operator <"+which+">"; --- } ------- ---- Symbol token() { --- Symbol token() { ------- Integer i = (Integer) op_table.get(which); ---- return new Symbol(i.intValue()); --- return new Symbol(i.intValue()); ------- } ------- ------- static private final Hashtable op_table = new Hashtable(); ------- static { ------- op_table.put("=", new Integer(Sym.EQ)); ------- op_table.put(">", new Integer(Sym.GT)); ------- op_table.put("<", new Integer(Sym.LT)); ------- op_table.put("!", new Integer(Sym.NOT)); ------- op_table.put("~", new Integer(Sym.COMP)); ------- op_table.put("?", new Integer(Sym.QUESTION)); ------- op_table.put(":", new Integer(Sym.COLON)); ------- op_table.put("==", new Integer(Sym.EQEQ)); ------- op_table.put("<=", new Integer(Sym.LTEQ)); ------- op_table.put(">=", new Integer(Sym.GTEQ)); ------- op_table.put("!=", new Integer(Sym.NOTEQ)); ------- op_table.put("&&", new Integer(Sym.ANDAND)); ------- op_table.put("||", new Integer(Sym.OROR)); ------- op_table.put("++", new Integer(Sym.PLUSPLUS)); ------- op_table.put("--", new Integer(Sym.MINUSMINUS)); ------- op_table.put("+", new Integer(Sym.PLUS)); ------- op_table.put("-", new Integer(Sym.MINUS)); ------- op_table.put("*", new Integer(Sym.MULT)); ------- op_table.put("/", new Integer(Sym.DIV)); ------- op_table.put("&", new Integer(Sym.AND)); ------- op_table.put("|", new Integer(Sym.OR)); ------- op_table.put("^", new Integer(Sym.XOR)); ------- op_table.put("%", new Integer(Sym.MOD)); ------- op_table.put("<<", new Integer(Sym.LSHIFT)); ------- op_table.put(">>", new Integer(Sym.RSHIFT)); ------- op_table.put(">>>", new Integer(Sym.URSHIFT)); ------- op_table.put("+=", new Integer(Sym.PLUSEQ)); ------- op_table.put("-=", new Integer(Sym.MINUSEQ)); ------- op_table.put("*=", new Integer(Sym.MULTEQ)); ------- op_table.put("/=", new Integer(Sym.DIVEQ)); ------- op_table.put("&=", new Integer(Sym.ANDEQ)); ------- op_table.put("|=", new Integer(Sym.OREQ)); ------- op_table.put("^=", new Integer(Sym.XOREQ)); ------- op_table.put("%=", new Integer(Sym.MODEQ)); ------- op_table.put("<<=", new Integer(Sym.LSHIFTEQ)); ------- op_table.put(">>=", new Integer(Sym.RSHIFTEQ)); ------- op_table.put(">>>=", new Integer(Sym.URSHIFTEQ)); ------- } -------} diff --cc Robust/src/Lex/Separator.java index 6a553bfd,6a553bfd,6a553bfd,6a553bfd,f2b1ac12,f2b1ac12,f2b1ac12..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Separator.java +++ /dev/null @@@@@@@@ -1,30 -1,30 -1,30 -1,30 -1,42 -1,42 -1,42 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class Separator extends Token { ------- char which; ---- Separator(char which) { this.which = which; } --- Separator(char which) { --- this.which = which; --- } ------- ------- Symbol token() { ------- switch(which) { ------- case '(': return new Symbol(Sym.LPAREN); --- ------- case ')': return new Symbol(Sym.RPAREN); --- ------- case '{': return new Symbol(Sym.LBRACE); --- ------- case '}': return new Symbol(Sym.RBRACE); --- ------- case '[': return new Symbol(Sym.LBRACK); --- ------- case ']': return new Symbol(Sym.RBRACK); --- ------- case ';': return new Symbol(Sym.SEMICOLON); --- ------- case ',': return new Symbol(Sym.COMMA); --- ------- case '.': return new Symbol(Sym.DOT); --- ------- case '\u2026': return new Symbol(Sym.ELLIPSIS); --- ------- default: ------- throw new Error("Invalid separator."); ------- } ------- } ------- ------- public String toString() { ------- return "Separator <"+which+">"; ------- } -------} diff --cc Robust/src/Lex/StringLiteral.java index c4830203,c4830203,c4830203,c4830203,8c5e1286,8c5e1286,8c5e1286..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/StringLiteral.java +++ /dev/null @@@@@@@@ -1,15 -1,15 -1,15 -1,15 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------package Lex; ------- -------import java_cup.runtime.Symbol; -------import Parse.Sym; ------- -------class StringLiteral extends Literal { ------- String val; ---- StringLiteral(String s) { this.val = s; } --- StringLiteral(String s) { --- this.val = s; --- } ------- ---- Symbol token() { return new Symbol(Sym.STRING_LITERAL, val); } --- Symbol token() { --- return new Symbol(Sym.STRING_LITERAL, val); --- } ------- ---- public String toString() { ---- return "StringLiteral <"+Token.escape(val)+">"; --- public String toString() { --- return "StringLiteral <"+Token.escape(val)+">"; ------- } -------} diff --cc Robust/src/Lex/Token.java index ec3a578d,ec3a578d,ec3a578d,ec3a578d,8cfb5c59,8cfb5c59,8cfb5c59..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Lex/Token.java +++ /dev/null @@@@@@@@ -1,21 -1,21 -1,21 -1,21 -1,24 -1,24 -1,24 +1,0 @@@@@@@@ -------package Lex; ------- -------abstract class Token extends InputElement { ------- abstract java_cup.runtime.Symbol token(); ------- ------- protected static String escape(String s) { ------- StringBuffer sb = new StringBuffer(); ------- for (int i=0; i"; ------- } -------} diff --cc Robust/src/Makefile index 0ae5fda8,d6dcc933,3aeaeddd,91de7309,91de7309,91de7309,169dc560..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Makefile +++ /dev/null @@@@@@@@ -1,100 -1,117 -1,132 -1,172 -1,172 -1,172 -1,173 +1,0 @@@@@@@@ -------CLASSFILES=Main/Main.class Lex/BooleanLiteral.class \ -------Lex/CharacterLiteral.class Lex/Comment.class \ -------Lex/DocumentationComment.class Lex/DoubleLiteral.class Lex/EOF.class \ -------Lex/EndOfLineComment.class Lex/EscapedUnicodeReader.class \ -------Lex/FIFO.class Lex/FloatLiteral.class Lex/Identifier.class \ -------Lex/InputElement.class Lex/IntegerLiteral.class Lex/Keyword.class \ -------Lex/Lexer.class Lex/Literal.class Lex/LongLiteral.class \ -------Lex/NullLiteral.class Lex/NumericLiteral.class Lex/Operator.class \ -------Lex/Separator.class Lex/StringLiteral.class Lex/Token.class \ -------Lex/TraditionalComment.class Lex/WhiteSpace.class \ -------IR/AssignOperation.class IR/ClassDescriptor.class IR/Descriptor.class \ -------IR/FieldDescriptor.class IR/FlagDescriptor.class \ -------IR/MethodDescriptor.class IR/NameDescriptor.class IR/Operation.class \ -------IR/State.class IR/SymbolTable.class IR/TagDescriptor.class \ -------IR/TagVarDescriptor.class IR/TaskDescriptor.class \ -------IR/TypeDescriptor.class IR/TypeUtil.class IR/VarDescriptor.class \ -------IR/Virtual.class IR/Flat/BuildCode.class IR/Flat/BuildFlat.class \ -------IR/Flat/FKind.class IR/Flat/FlatAtomicEnterNode.class \ -------IR/Flat/FlatAtomicExitNode.class IR/Flat/FlatBackEdge.class \ -------IR/Flat/FlatCall.class IR/Flat/FlatCastNode.class \ -------IR/Flat/FlatCheckNode.class IR/Flat/FlatCondBranch.class \ -------IR/Flat/FlatElementNode.class IR/Flat/FlatFieldNode.class \ -------IR/Flat/FlatFlagActionNode.class IR/Flat/FlatGlobalConvNode.class \ -------IR/Flat/FlatLiteralNode.class IR/Flat/FlatMethod.class \ -------IR/Flat/FlatNew.class IR/Flat/FlatNode.class IR/Flat/FlatNop.class \ -------IR/Flat/FlatOpNode.class IR/Flat/FlatReturnNode.class \ -------IR/Flat/FlatSetElementNode.class IR/Flat/FlatSetFieldNode.class \ -------IR/Flat/FlatTagDeclaration.class IR/Flat/NodePair.class \ ------IR/Flat/FlatPrefetchNode.class \ -------IR/Flat/ParamsObject.class IR/Flat/TempDescriptor.class \ -------IR/Flat/TempFlagPair.class IR/Flat/TempObject.class \ -------IR/Flat/TempTagPair.class IR/Tree/ArrayAccessNode.class \ -------IR/Tree/AssignmentNode.class IR/Tree/AtomicNode.class \ -------IR/Tree/BlockExpressionNode.class IR/Tree/BlockNode.class \ -------IR/Tree/BlockStatementNode.class IR/Tree/BuildIR.class \ -------IR/Tree/CastNode.class IR/Tree/ConstraintCheck.class \ -------IR/Tree/CreateObjectNode.class IR/Tree/DNFFlag.class \ -------IR/Tree/DNFFlagAtom.class IR/Tree/DeclarationNode.class \ -------IR/Tree/ExpressionNode.class IR/Tree/FieldAccessNode.class \ -------IR/Tree/FlagEffect.class IR/Tree/FlagEffects.class \ -------IR/Tree/FlagExpressionNode.class IR/Tree/FlagNode.class \ -------IR/Tree/FlagOpNode.class IR/Tree/IfStatementNode.class \ -------IR/Tree/Kind.class IR/Tree/LiteralNode.class IR/Tree/LoopNode.class \ -------IR/Tree/MethodInvokeNode.class IR/Tree/Modifiers.class \ -------IR/Tree/NameNode.class IR/Tree/OpNode.class IR/Tree/ParseNode.class \ -------IR/Tree/ParseNodeDOTVisitor.class IR/Tree/ParseNodeVector.class \ -------IR/Tree/ReturnNode.class IR/Tree/SemanticCheck.class \ -------IR/Tree/SubBlockNode.class IR/Tree/TagDeclarationNode.class \ -------IR/Tree/TagEffect.class IR/Tree/TagExpressionList.class \ -------IR/Tree/TaskExitNode.class IR/Tree/TreeNode.class \ -------IR/Tree/Walkable.class Analysis/CallGraph/CallGraph.class \ -------Analysis/Locality/GenerateConversions.class \ -------Analysis/Locality/LocalityAnalysis.class \ -------Analysis/Locality/LocalityBinding.class \ -------Analysis/Locality/TempNodePair.class \ -------Analysis/TaskStateAnalysis/Allocations.class \ -------Analysis/TaskStateAnalysis/EGEdge.class \ -------Analysis/TaskStateAnalysis/EGTaskNode.class \ -------Analysis/TaskStateAnalysis/ExecutionGraph.class \ -------Analysis/TaskStateAnalysis/FEdge.class \ -------Analysis/TaskStateAnalysis/FlagState.class \ -------Analysis/TaskStateAnalysis/GarbageAnalysis.class \ -------Analysis/TaskStateAnalysis/OptionalTaskDescriptor.class \ -------Analysis/TaskStateAnalysis/Predicate.class \ -------Analysis/TaskStateAnalysis/SafetyAnalysis.class \ -------Analysis/TaskStateAnalysis/TEdge.class \ -------Analysis/TaskStateAnalysis/TagAnalysis.class \ -------Analysis/TaskStateAnalysis/TagBinding.class \ -------Analysis/TaskStateAnalysis/TaskAnalysis.class \ -------Analysis/TaskStateAnalysis/TaskEdges.class \ -------Analysis/TaskStateAnalysis/TaskGraph.class \ -------Analysis/TaskStateAnalysis/TaskNode.class \ ------Analysis/TaskStateAnalysis/FlagComparator.class \ -------Analysis/TaskStateAnalysis/TaskNodeNamer.class Util/Edge.class \ ------Analysis/FlatIRGraph/FlatIRGraph.class \ ------Analysis/OwnershipAnalysis/OwnershipAnalysis.class \ ------Analysis/OwnershipAnalysis/OwnershipGraph.class \ ------Analysis/OwnershipAnalysis/OwnershipNode.class \ -----Analysis/OwnershipAnalysis/LabelNode.class \ -----Analysis/OwnershipAnalysis/HeapRegionNode.class \ - Analysis/OwnershipAnalysis/ReferenceEdgeProperties.class \ ----Analysis/OwnershipAnalysis/ReferenceEdge.class \ -----Analysis/OwnershipAnalysis/AllocationSite.class \ ----Analysis/OwnershipAnalysis/TokenTuple.class \ ----Analysis/OwnershipAnalysis/TokenTupleSet.class \ ----Analysis/OwnershipAnalysis/ReachabilitySet.class \ ----Analysis/OwnershipAnalysis/ChangeTuple.class \ ----Analysis/OwnershipAnalysis/ChangeTupleSet.class \ ----Analysis/OwnershipAnalysis/Canonical.class \ -Analysis/OwnershipAnalysis/MethodContext.class \ -------Util/GraphNode.class Util/Namer.class Util/Relation.class \ -------Interface/HTTPHeader.class Interface/HTTPResponse.class \ -------Interface/HTTPServices.class Interface/HashStrings.class \ -------Interface/JhttpServer.class Interface/JhttpWorker.class \ -------Interface/LogFile.class Interface/Pair.class \ - Interface/WebInterface.class - ------Interface/WebInterface.class Analysis/Prefetch/PrefetchAnalysis.class \ ------Analysis/Prefetch/PrefetchPair.class Analysis/Prefetch/PairMap.class \ ------Analysis/Prefetch/IndexDescriptor.class \ ------Analysis/Scheduling/ClassNode.class \ ------Analysis/Scheduling/ScheduleAnalysis.class \ ------Analysis/Scheduling/ScheduleEdge.class \ - Analysis/Scheduling/ScheduleNode.class -----Analysis/Scheduling/ScheduleNode.class \ -----Analysis/Scheduling/CoreSimulator.class \ -----Analysis/Scheduling/FIFORSchedule.class \ -----Analysis/Scheduling/ObjectSimulator.class \ -----Analysis/Scheduling/RuntimeSchedule.class \ -----Analysis/Scheduling/Schedule.class \ -----Analysis/Scheduling/ScheduleSimulator.class \ -----Analysis/Scheduling/SchedulingUtil.class \ -----Analysis/Scheduling/TaskSimulator.class \ -----Analysis/Scheduling/TransTaskSimulator.class ------- ----JAVAFILES=IR/*.java \ ---- IR/Flat/*.java \ ---- IR/Tree/*.java \ ---- Main/*.java \ ---- Analysis/CallGraph/*.java \ ---- Analysis/FlatIRGraph/*.java \ ---- Analysis/Locality/*.java \ ---- Analysis/OwnershipAnalysis/*.java \ ---- Analysis/Prefetch/*.java \ ---- Analysis/Scheduling/*.java \ ---- Analysis/TaskStateAnalysis/*.java \ ---- Util/*.java \ ---- ClassLibrary/*.java \ ---- ClassLibrary/gnu/*.java \ ---- Interface/*.java \ ---- Lex/*.java ------- ----CFILES=Runtime/*.c \ ---- Runtime/*.h \ ---- Runtime/DSTM/interface/*.c \ ---- Runtime/DSTM/interface/*.h ------- -- all: Parse/Sym.class Parse/Parser.class $(CLASSFILES) javadoc -----all: compiler javadoc ----- ---- compiler: Parse/Sym.class Parse/Parser.class $(CLASSFILES) -compiler: Parse/Sym.class Parse/Parser.class $(CLASSFILES) ------ ------wc: ------ wc Interface/*.java Analysis/*/*.java IR/*.java IR/*/*.java Lex/*.java Util/*.java ClassLibrary/*.java ------ ------wcrun: ------ wc Runtime/*.[c,h] ------- -------Parse/Parser.java Parse/Sym.java: Parse/java14.cup ------- cd Parse && \ ------- java -cp ../../cup:$(CLASSPATH) java_cup.Main -parser Parser -symbols Sym < java14.cup ------- -------%.class: %.java ------ javac -cp ../cup:.:$(CLASSPATH) $< - ./ourjavac -cp ../cup:.:$(CLASSPATH) $< ---- ----tabbing: ---- uncrustify -c java.cfg --no-backup $(JAVAFILES) ---- uncrustify -c c.cfg --no-backup $(CFILES) ---- ----commit: tabbing ---- cvs commit . ---- ----update: tabbing ---- cvs update -d . ---- ----mytabbing: ---- uncrustify -c myjava.cfg --no-backup $(JAVAFILES) ---- uncrustify -c myc.cfg --no-backup $(CFILES) ------- -------javadoc: ------- mkdir javadoc - javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Main - javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Analysis.Locality Analysis.Prefetch Main Analysis.OwnershipAnalysis ----- javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Analysis.Locality Analysis.Prefetch Main Analysis.OwnershipAnalysis Analysis.Scheduling ------- -------clean: - rm IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class ------ rm -f IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class Analysis/Prefetch/*.class Analysis/FlatIRGraph/*.class Analysis/OwnershipAnalysis/*.class Analysis/Scheduling/*.class ------- -------cleandoc: ------- rm -rf javadoc diff --cc Robust/src/Parse/java14.cup index 0f3afd38,85d18b58,85d18b58,85d18b58,85d18b58,85d18b58,85d18b58..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Parse/java14.cup +++ /dev/null @@@@@@@@ -1,1809 -1,1843 -1,1843 -1,1843 -1,1843 -1,1843 -1,1843 +1,0 @@@@@@@@ -------package Parse; ------- -------import java_cup.runtime.*; -------import Lex.Lexer; -------import IR.Tree.*; ------- -------/* Java 1.4 parser for CUP. ------- * Copyright (C) 2002-2003 C. Scott Ananian ------- * This program is released under the terms of the GPL; see the file ------- * COPYING for more details. There is NO WARRANTY on this code. ------- */ ------- -------/* -------JDK 1.4 Features added: ------- assertion statement. ------- statement_without_trailing_substatement ::= ... ------- | assert_statement ; ------- assert_statement ::= ------- ASSERT expression SEMICOLON ------- | ASSERT expression COLON expression SEMICOLON ------- ; -------*/ -------parser code {: ------- Lexer lexer; ------- ------- public Parser(Lexer l) { ------- this(); ------- lexer=l; ------- } ------- ------- public void syntax_error(java_cup.runtime.Symbol current) { ------- report_error("Syntax error (" + current.sym + ")", current); ------- } ------- public void report_error(String message, java_cup.runtime.Symbol info) { ------- lexer.errorMsg(message, info); ------- } -------:}; ------- -------scan with {: return lexer.nextToken(); :}; ------- -------terminal BOOLEAN; // primitive_type -------terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -------terminal FLOAT, DOUBLE; // floating_point_type -------terminal LBRACK, RBRACK; // array_type -------terminal java.lang.String IDENTIFIER; // name -------terminal DOT; // qualified_name -------terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -------terminal PACKAGE; // package_declaration -------terminal IMPORT; // import_declaration -------terminal PUBLIC, PROTECTED, PRIVATE; // modifier -------terminal STATIC; // modifier -------terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -------terminal CLASS; // class_declaration -------terminal EXTENDS; // super -------//terminal IMPLEMENTS; // interfaces -------terminal VOID; // method_header -------terminal THROWS; // throws -------terminal THIS, SUPER; // explicit_constructor_invocation -------//terminal INTERFACE; // interface_declaration -------terminal IF, ELSE; // if_then_statement, if_then_else_statement -------terminal SWITCH; // switch_statement -------terminal CASE, DEFAULT; // switch_label -------terminal DO, WHILE; // while_statement, do_statement -------terminal FOR; // for_statement -------terminal BREAK; // break_statement -------terminal CONTINUE; // continue_statement -------terminal RETURN; // return_statement -------terminal THROW; // throw_statement -------terminal TRY; // try_statement -------terminal CATCH; // catch_clause -------terminal FINALLY; // finally -------terminal NEW; // class_instance_creation_expression -------terminal PLUSPLUS; // postincrement_expression -------terminal MINUSMINUS; // postdecrement_expression -------terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -------terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -------terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -------terminal EQEQ, NOTEQ; // equality_expression -------terminal AND; // and_expression -------terminal XOR; // exclusive_or_expression -------terminal OR; // inclusive_or_expression -------terminal ANDAND; // conditional_and_expression -------terminal OROR; // conditional_or_expression -------terminal QUESTION; // conditional_expression -------terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -------terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -------terminal ANDEQ, XOREQ, OREQ; // assignment_operator ------- -------terminal java.lang.Number INTEGER_LITERAL; -------terminal java.lang.Number FLOATING_POINT_LITERAL; -------terminal java.lang.Boolean BOOLEAN_LITERAL; -------terminal java.lang.Character CHARACTER_LITERAL; -------terminal java.lang.String STRING_LITERAL; -------terminal NULL_LITERAL; ------- -------// Reserved but unused: -------terminal CONST, GOTO; -------// strictfp keyword, new in Java 1.2 -------terminal STRICTFP; -------// assert keyword, new in Java 1.4 -------terminal ASSERT; // assert_statement -------// lexer compatibility with Java 1.5 -------terminal ELLIPSIS; -------terminal ENUM; ------- ------- -------// 19.2) The Syntactic Grammar -------non terminal ParseNode goal; -------// 19.3) Lexical Structure -------non terminal ParseNode literal; -------// 19.4) Types, Values, and Variables -------non terminal ParseNode type, primitive_type, numeric_type; -------non terminal ParseNode integral_type, floating_point_type; -------non terminal ParseNode reference_type; -------non terminal ParseNode class_or_interface_type; -------non terminal ParseNode class_type; -------//non terminal ParseNode interface_type; -------non terminal ParseNode array_type; -------// 19.5) Names -------non terminal ParseNode name, simple_name, qualified_name; -------// 19.6) Packages -------non terminal ParseNode compilation_unit; -------non terminal ParseNode package_declaration_opt, package_declaration; -------non terminal ParseNode import_declarations_opt, import_declarations; -------non terminal ParseNode type_declarations_opt, type_declarations; -------non terminal ParseNode import_declaration; -------non terminal ParseNode single_type_import_declaration; -------non terminal ParseNode type_import_on_demand_declaration; -------non terminal ParseNode type_declaration; -------// 19.7) Productions used only in the LALR(1) grammar -------non terminal ParseNode modifiers_opt, modifiers, modifier; -------// 19.8.1) Class Declaration -------non terminal ParseNode class_declaration, super, super_opt; -------//non terminal interfaces, interfaces_opt, interface_type_list; -------non terminal ParseNode class_body; -------non terminal ParseNode class_body_declarations, class_body_declarations_opt; -------non terminal ParseNode class_body_declaration, class_member_declaration; -------// 19.8.2) Field Declarations -------non terminal ParseNode field_declaration, variable_declarators, variable_declarator; -------non terminal ParseNode variable_declarator_id; -------non terminal ParseNode variable_initializer; -------// 19.8.3) Method Declarations -------non terminal ParseNode method_declaration, method_header, method_declarator; -------non terminal ParseNode formal_parameter_list_opt, formal_parameter_list; -------non terminal ParseNode formal_parameter; -------//non terminal ParseNode throws_opt; -------//non terminal ParseNode throws; -------//non terminal ParseNode class_type_list; -------non terminal ParseNode method_body; -------// 19.8.4) Static Initializers -------//non terminal ParseNode static_initializer; -------// 19.8.5) Constructor Declarations -------non terminal ParseNode constructor_declaration, constructor_declarator; -------non terminal ParseNode constructor_body; - //non terminal ParseNode explicit_constructor_invocation; ------non terminal ParseNode explicit_constructor_invocation; -------// 19.9.1) Interface Declarations -------//non terminal ParseNode interface_declaration; -------//non terminal ParseNode extends_interfaces_opt, extends_interfaces; -------//non terminal ParseNode interface_body; -------//non terminal ParseNode interface_member_declarations_opt, interface_member_declarations; -------//non terminal ParseNode interface_member_declaration, constant_declaration; -------//non terminal ParseNode abstract_method_declaration; -------// 19.10) Arrays -------//non terminal ParseNode array_initializer; -------//non terminal ParseNode variable_initializers; -------// 19.11) Blocks and Statements -------non terminal ParseNode block; -------non terminal ParseNode block_statements_opt, block_statements, block_statement; -------non terminal ParseNode local_variable_declaration_statement, local_variable_declaration; -------non terminal ParseNode statement, statement_no_short_if; -------non terminal ParseNode statement_without_trailing_substatement; -------non terminal ParseNode empty_statement; -------//non terminal ParseNode labeled_statement, labeled_statement_no_short_if; -------non terminal ParseNode expression_statement, statement_expression; -------non terminal ParseNode if_then_statement; -------non terminal ParseNode if_then_else_statement, if_then_else_statement_no_short_if; -------//non terminal ParseNode switch_statement, switch_block; -------//non terminal ParseNode switch_block_statement_groups; -------//non terminal ParseNode switch_block_statement_group; -------//non terminal ParseNode switch_labels, switch_label; -------non terminal ParseNode while_statement, while_statement_no_short_if; -------non terminal ParseNode do_statement; -------non terminal ParseNode for_statement, for_statement_no_short_if; -------non terminal ParseNode for_init_opt, for_init; -------non terminal ParseNode for_update_opt, for_update; -------non terminal ParseNode statement_expression_list; -------//non terminal ParseNode identifier_opt; -------non terminal ParseNode break_statement, continue_statement; -------non terminal ParseNode return_statement; -------//non terminal ParseNode throw_statement; -------//non terminal ParseNode synchronized_statement, try_statement; -------//non terminal ParseNode catches_opt; -------//non terminal ParseNode catches, catch_clause; -------//non terminal ParseNode finally; -------//non terminal ParseNode assert_statement; -------// 19.12) Expressions -------non terminal ParseNode primary, primary_no_new_array; -------non terminal ParseNode class_instance_creation_expression; -------non terminal ParseNode cons_argument_list_opt, cons_argument_list; -------non terminal ParseNode argument_list_opt, argument_list; -------//non terminal ParseNode array_creation_init; -------non terminal ParseNode array_creation_uninit; -------non terminal ParseNode dim_exprs, dim_expr; -------non terminal Integer dims_opt, dims; -------non terminal ParseNode field_access, method_invocation; -------non terminal ParseNode array_access; -------non terminal ParseNode postfix_expression; -------non terminal ParseNode postincrement_expression, postdecrement_expression; -------non terminal ParseNode unary_expression, unary_expression_not_plus_minus; -------non terminal ParseNode preincrement_expression, predecrement_expression; -------non terminal ParseNode cast_expression; -------non terminal ParseNode multiplicative_expression, additive_expression; -------non terminal ParseNode shift_expression, relational_expression, equality_expression; -------non terminal ParseNode and_expression, exclusive_or_expression, inclusive_or_expression; -------non terminal ParseNode conditional_and_expression, conditional_or_expression; -------non terminal ParseNode conditional_expression; -------non terminal ParseNode assignment_expression; -------non terminal ParseNode assignment; -------non terminal ParseNode assignment_operator; -------non terminal ParseNode expression_opt, expression; -------//non terminal ParseNode constant_expression; -------//failure aware computation keywords -------terminal FLAG; -------terminal OPTIONAL; ------terminal ISAVAILABLE; -------terminal EXTERNAL; -------terminal TAG; -------terminal TASK; -------terminal TASKEXIT; -------non terminal ParseNode flag_declaration; -------non terminal ParseNode task_declaration; -------non terminal ParseNode task_parameter_list; -------non terminal ParseNode task_parameter; -------non terminal ParseNode flag_expression; -------non terminal ParseNode flag_andexpression; -------non terminal ParseNode flag_notexpression; -------non terminal ParseNode task_exitstatement; -------non terminal ParseNode flag_effects_opt; -------non terminal ParseNode flag_effects; -------non terminal ParseNode flag_effect; -------non terminal ParseNode flag_list; -------non terminal ParseNode flag_list_opt; -------non terminal ParseNode flag_change; ------- -------non terminal ParseNode cons_checks_opt; -------non terminal ParseNode cons_checks; -------non terminal ParseNode cons_check; ------- -------non terminal ParseNode tag_variable_declaration_statement; -------non terminal ParseNode tag_expression_list; -------non terminal ParseNode tag_expression; -------non terminal ParseNode tag_list; -------non terminal ParseNode tag_list_opt; -------non terminal ParseNode tag_change; ------- -------//distributed transaction keywords -------terminal ATOMIC; -------terminal GLOBAL; -------non terminal ParseNode atomic_statement; ------- ------- -------start with goal; ------- ------- -------// Task declarations -------task_declaration ::= ------- TASK IDENTIFIER:id LPAREN task_parameter_list:tpl RPAREN ------- flag_effects_opt:feo ------- method_body:body ------- {: ------- ParseNode pn=new ParseNode("task_declaration"); ------- pn.addChild("name").addChild(id); ------- pn.addChild(tpl); ------- pn.addChild(feo); ------- pn.addChild("body").addChild(body); ------- RESULT=pn; ------- :}; ------- -------task_parameter_list ::= ------- task_parameter:fp {: ------- ParseNode pn=new ParseNode("task_parameter_list"); ------- pn.addChild(fp); ------- RESULT=pn; ------- :} ------- | task_parameter_list:fpl COMMA task_parameter:fp {: ------- fpl.addChild(fp); ------- RESULT=fpl; ------- :} ------- ; ------- -------task_parameter ::= ------- type:type variable_declarator_id:name LBRACE flag_expression:exp RBRACE {: ------- ParseNode pn=new ParseNode("task_parameter"); ------- pn.addChild(type); ------- pn.addChild(name); ------- pn.addChild("flag").addChild(exp); ------- RESULT=pn; ------- :} ------- | type:type variable_declarator_id:name LBRACE flag_expression:exp RBRACE LBRACE tag_expression_list:texp RBRACE {: ------- ParseNode pn=new ParseNode("task_parameter"); ------- pn.addChild(type); ------- pn.addChild(name); ------- pn.addChild("flag").addChild(exp); ------- pn.addChild("tag").addChild(texp); ------- RESULT=pn; ------- :} ------- | type:type variable_declarator_id:name LBRACE RBRACE LBRACE tag_expression_list:texp RBRACE {: ------- ParseNode pn=new ParseNode("task_parameter"); ------- pn.addChild(type); ------- pn.addChild(name); ------- pn.addChild("tag").addChild(texp); ------- RESULT=pn; ------- :} ------- | OPTIONAL task_parameter:fp {: ------- ParseNode pn=new ParseNode("task_parameter"); ------- pn.addChild("optional").addChild(fp); ------- RESULT=pn; ------- :} ------- ------- ; ------- -------tag_expression_list ::= tag_expression:te {: ------- ParseNode pn=new ParseNode("tag_expression_list"); ------- pn.addChild(te); ------- RESULT=pn; ------- :} ------- | tag_expression_list:tel COMMA tag_expression:te {: ------- tel.addChild(te); ------- RESULT=tel; ------- :} ------- ; ------- -------tag_expression ::= IDENTIFIER:type IDENTIFIER:id {: ------- ParseNode pn=new ParseNode("tag_expression"); ------- pn.addChild("type").addChild(type); ------- pn.addChild("single").addChild(id); ------- RESULT=pn; ------- :} ------- ; ------- -------tag_list_opt ::= LBRACE tag_list:fl RBRACE {:RESULT=fl;:} ------- | LBRACE RBRACE {: RESULT = new ParseNode("empty"); :} ------- | {: RESULT = new ParseNode("empty"); :} ------- ; ------- -------tag_list ::= tag_change:fc {: ------- ParseNode pn=new ParseNode("tag_list"); ------- pn.addChild(fc); ------- RESULT=pn; ------- :} ------- | tag_list:fl COMMA tag_change:fc {: ------- fl.addChild(fc); ------- RESULT=fl; ------- :}; ------- -------tag_change ::= IDENTIFIER:id {: ------- RESULT=new ParseNode("name").addChild(id).getRoot(); ------- :} ------- | NOT IDENTIFIER:id {: ------- RESULT=new ParseNode("not").addChild("name").addChild(id).getRoot(); ------- :}; ------- -------flag_expression ::= ------- flag_andexpression:exp {: ------- RESULT=exp; ------- :} ------- | flag_expression:exp1 OROR flag_andexpression:exp2 {: ------- ParseNode pn=new ParseNode("or"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; ------- -------flag_andexpression ::= ------- flag_notexpression:exp {: RESULT=exp; :} ------- | flag_notexpression:exp1 ANDAND flag_andexpression:exp2 {: ------- ParseNode pn=new ParseNode("and"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; ------- -------flag_notexpression ::= ------- NOT flag_notexpression:exp {: ------- ParseNode pn=new ParseNode("not"); ------- pn.addChild(exp); ------- RESULT=pn; ------- :} ------- | LPAREN flag_expression:exp RPAREN {: ------- RESULT=exp; ------- :} ------- | IDENTIFIER:id {: ------- ParseNode pn=new ParseNode("name"); ------- pn.addChild(id); ------- RESULT=pn; ------- :} ------- ; ------- -------task_exitstatement ::= TASKEXIT flag_effects_opt:opt cons_checks_opt:cco SEMICOLON {: ------- RESULT=(new ParseNode("taskexit")).addChild(opt).getRoot().addChild(cco).getRoot(); ------- :}; ------- -------cons_checks_opt ::= ASSERT LPAREN cons_checks:cc RPAREN {: RESULT=cc; :} ------- | {: RESULT = new ParseNode("empty"); :} ------- ; ------- -------cons_checks ::= cons_check:cc {: ------- ParseNode pn=new ParseNode("cons_checks"); ------- pn.addChild(cc); ------- RESULT=pn; ------- :} ------- | cons_checks:ccs COMMA cons_check:cc {: ------- ccs.addChild(cc); ------- RESULT=ccs; ------- :}; ------- -------cons_check ::= IDENTIFIER:name LPAREN cons_argument_list_opt:args RPAREN {: ------- ParseNode pn=new ParseNode("cons_check"); ------- pn.addChild("name").addChild("identifier").addChild(name); ------- pn.addChild(args); ------- RESULT=pn; ------- :}; ------- -------flag_effects_opt ::= LPAREN flag_effects:fe RPAREN {:RESULT=fe;:} ------- | {: RESULT = new ParseNode("empty"); :} ------- ; ------- -------flag_effects ::= flag_effect:fe {: ------- ParseNode pn=new ParseNode("flag_effects_list"); ------- pn.addChild(fe); ------- RESULT=pn; ------- :} ------- | flag_effects:fes COMMA flag_effect:fe {: ------- fes.addChild(fe); ------- RESULT=fes; ------- :}; ------- -------flag_effect ::= IDENTIFIER:id LBRACE flag_list:fl RBRACE tag_list_opt:tlo {: ------- ParseNode pn=new ParseNode("flag_effect"); ------- pn.addChild("name").addChild(id); ------- pn.addChild(fl); ------- pn.addChild(tlo); ------- RESULT=pn; ------- :} ------- | IDENTIFIER:id LBRACE RBRACE LBRACE tag_list:tl RBRACE {: ------- ParseNode pn=new ParseNode("flag_effect"); ------- pn.addChild("name").addChild(id); ------- pn.addChild(tl); ------- RESULT=pn; ------- :}; ------- -------flag_list_opt ::= LBRACE flag_list:fl RBRACE {:RESULT=fl;:} ------- | LBRACE RBRACE {: RESULT = new ParseNode("empty"); :} ------- | ------- {: RESULT = new ParseNode("empty"); :} ------- ; ------- -------flag_list ::= flag_change:fc {: ------- ParseNode pn=new ParseNode("flag_list"); ------- pn.addChild(fc); ------- RESULT=pn; ------- :} ------- | flag_list:fl COMMA flag_change:fc {: ------- fl.addChild(fc); ------- RESULT=fl; ------- :}; ------- -------flag_change ::= IDENTIFIER:id {: ------- RESULT=new ParseNode("name").addChild(id).getRoot(); ------- :} | ------- NOT IDENTIFIER:id {: ------- RESULT=new ParseNode("not").addChild("name").addChild(id).getRoot(); ------- :}; ------- -------// 19.2) The Syntactic Grammar -------goal ::= compilation_unit:cu ------- {: ------- RESULT = cu; ------- :} ------- ; ------- -------// 19.3) Lexical Structure. ------- ------- -------literal ::= INTEGER_LITERAL:integer_lit ------- {: ------- ParseNode pn=new ParseNode("literal"); ------- pn.addChild("integer").setLiteral(integer_lit); ------- RESULT=pn; ------- :} ------- | FLOATING_POINT_LITERAL:float_lit ------- {: ------- ParseNode pn=new ParseNode("literal"); ------- pn.addChild("float").setLiteral(float_lit); ------- RESULT=pn; ------- :} ------- | BOOLEAN_LITERAL:boolean_lit ------- {: ------- ParseNode pn=new ParseNode("literal"); ------- pn.addChild("boolean").setLiteral(boolean_lit); ------- RESULT=pn; ------- :} ------- | CHARACTER_LITERAL:char_lit ------- {: ------- ParseNode pn=new ParseNode("literal"); ------- pn.addChild("char").setLiteral(char_lit); ------- RESULT=pn; ------- :} ------- | STRING_LITERAL:string_lit ------- {: ------- ParseNode pn=new ParseNode("literal"); ------- pn.addChild("string").setLiteral(string_lit); ------- RESULT=pn; ------- :} ------- | NULL_LITERAL ------- {: ------- RESULT=(new ParseNode("literal")).addChild("null").getRoot(); ------- :} ------- ; ------- -------// 19.4) Types, Values, and Variables -------type ::= primitive_type:type {: RESULT=type; :} ------- | reference_type:type {: RESULT=type; :} ------- ; ------- -------primitive_type ::= ------- numeric_type:type {: RESULT=type; :} ------- | BOOLEAN {: RESULT=(new ParseNode("type")).addChild("boolean").getRoot(); :} ------- ; -------numeric_type::= integral_type:type {: RESULT=type; :} ------- | floating_point_type:type {: RESULT=type; :} ------- ; -------integral_type ::= ------- BYTE {: RESULT=(new ParseNode("type")).addChild("byte").getRoot(); :} ------- | SHORT {: RESULT=(new ParseNode("type")).addChild("short").getRoot(); :} ------- | INT {: RESULT=(new ParseNode("type")).addChild("int").getRoot(); :} ------- | LONG {: RESULT=(new ParseNode("type")).addChild("long").getRoot(); :} ------- | CHAR {: RESULT=(new ParseNode("type")).addChild("char").getRoot(); :} ------- ; -------floating_point_type ::= ------- FLOAT {: RESULT=(new ParseNode("type")).addChild("float").getRoot(); :} ------- | DOUBLE {: RESULT=(new ParseNode("type")).addChild("double").getRoot(); :} ------- ; ------- -------reference_type ::= ------- class_or_interface_type:type {: RESULT=type; :} ------- | array_type:type {: RESULT=type; :} ------- ; -------class_or_interface_type ::= name:name {: ------- RESULT=(new ParseNode("type")).addChild("class").addChild(name).getRoot(); ------- :}; ------- -------class_type ::= class_or_interface_type:type {: RESULT=type; :}; -------//interface_type ::= class_or_interface_type; ------- -------array_type ::= primitive_type:prim dims:dims {: ------- ParseNode pn=(new ParseNode("type")).addChild("array"); ------- pn.addChild("basetype").addChild(prim); ------- pn.addChild("dims").setLiteral(dims); ------- RESULT=pn.getRoot(); ------- :} ------- | name:name dims:dims {: ------- ParseNode pn=(new ParseNode("type")).addChild("array"); ------- pn.addChild("basetype").addChild("type").addChild("class").addChild(name); ------- pn.addChild("dims").setLiteral(dims); ------- RESULT=pn.getRoot(); ------- :} ------- ; ------- -------// 19.5) Names -------name ::= simple_name:name {: RESULT=name; :} ------- | qualified_name:name {: RESULT=name; :} ------- ; -------simple_name ::= IDENTIFIER:id {: ------- RESULT=(new ParseNode("name")).addChild("identifier").addChild(id).getRoot(); ------- :} ------- ; -------qualified_name ::= name:name DOT IDENTIFIER:id {: ------- ParseNode pn=new ParseNode("name"); ------- pn.addChild("base").addChild(name); ------- pn.addChild("identifier").addChild(id); ------- RESULT=pn; ------- :} ------- ; ------- -------// 19.6) Packages -------compilation_unit ::= ------- package_declaration_opt:pdo ------- import_declarations_opt:ido ------- type_declarations_opt:tdo {: ------- ParseNode pn=new ParseNode("compilation_unit"); ------- pn.addChild(tdo); ------- pn.addChild("packages").addChild(pdo); ------- pn.addChild("imports").addChild(ido); ------- RESULT=pn; ------- :} ------- ; -------package_declaration_opt ::= package_declaration:pdo {: ------- RESULT=pdo; ------- :} | ------- {: RESULT=new ParseNode("empty"); :} -------; ------- -------import_declarations_opt ::= import_declarations:ido {: ------- RESULT=ido; ------- :} | ------- {: RESULT=new ParseNode("empty"); :} -------; -------type_declarations_opt ::= type_declarations:tds {: ------- RESULT=tds; ------- :} | ------- {: RESULT=new ParseNode("empty"); :} ------- ; ------- -------import_declarations ::= ------- import_declaration:id {: ------- ParseNode pn=new ParseNode("import_decls_list"); ------- pn.addChild(id); ------- RESULT=pn; ------- :} ------- | import_declarations:ids import_declaration:id {: ------- ids.addChild(id); ------- RESULT=ids; ------- :} ------- ; ------- -------type_declarations ::= ------- type_declaration:td {: ------- ParseNode pn=new ParseNode("type_declaration_list"); ------- pn.addChild(td); ------- RESULT=pn; ------- :} ------- | type_declarations:tds type_declaration:td {: ------- tds.addChild(td); ------- RESULT=tds; ------- :} ------- ; ------- -------package_declaration ::= ------- PACKAGE name:name SEMICOLON {: ------- ParseNode pn=new ParseNode("package"); ------- pn.addChild(name); ------- RESULT=pn; ------- :} ------- ; -------import_declaration ::= ------- single_type_import_declaration:sid {: RESULT=sid; :} ------- | type_import_on_demand_declaration:iod {: RESULT=iod; :} ------- ; -------single_type_import_declaration ::= ------- IMPORT name:name SEMICOLON {: ------- ParseNode pn=new ParseNode("import_single"); ------- pn.addChild(name); ------- RESULT=pn; -------:} ------- ; -------type_import_on_demand_declaration ::= ------- IMPORT name:name DOT MULT SEMICOLON {: ------- ParseNode pn=new ParseNode("import_ondemand"); ------- pn.addChild(name); ------- RESULT=pn; ------- :} ------- ; ------- -------type_declaration ::= ------- class_declaration:cd ------- {: ------- RESULT=cd; ------- :} ------- | task_declaration:td ------- {: ------- RESULT=td; ------- :} -------// | interface_declaration ------- | SEMICOLON {: RESULT=new ParseNode("empty"); :} ------- ; ------- -------// 19.7) Productions used only in the LALR(1) grammar -------modifiers_opt::= ------- {: RESULT=new ParseNode("empty"); :} ------- | modifiers:mo {: ------- RESULT=mo; ------- :} ------- ; -------modifiers ::= modifier:mo {: ------- ParseNode pn=new ParseNode("modifier_list"); ------- pn.addChild(mo); ------- RESULT=pn; ------- :} ------- | modifiers:mos modifier:mo {: ------- mos.addChild(mo); ------- RESULT=mos; ------- :} ------- ; -------modifier ::= ------- PUBLIC {: RESULT=new ParseNode("public"); :}| ------- PROTECTED {: RESULT=new ParseNode("protected"); :}| ------- PRIVATE {: RESULT=new ParseNode("private"); :}| ------- STATIC {: RESULT=new ParseNode("static"); :} | -------// ABSTRACT | ------- FINAL {: RESULT=new ParseNode("final"); :}| ------- NATIVE {: RESULT=new ParseNode("native"); :} | ------- SYNCHRONIZED {: RESULT=new ParseNode("synchronized"); :} | ------- ATOMIC {: RESULT=new ParseNode("atomic"); :} -------// TRANSIENT | -------// VOLATILE | -------// STRICTFP // note that semantic analysis must check that the ------- // context of the modifier allows strictfp. ------- ; ------- -------// 19.8) Classes ------- -------// 19.8.1) Class Declaration: -------class_declaration ::= ------- modifiers_opt:mo CLASS IDENTIFIER:id super_opt:so //interfaces_opt -------class_body:body ------- {: ------- ParseNode pn=new ParseNode("class_declaration"); ------- pn.addChild("modifiers").addChild(mo); ------- pn.addChild("name").addChild(id); ------- pn.addChild("super").addChild(so); ------- pn.addChild("classbody").addChild(body); ------- RESULT=pn; ------- :} ------- ; -------super ::= EXTENDS class_type:classtype {: ------- RESULT=classtype; ------- :} ------- ; -------super_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | super:su {: ------- RESULT=su; ------- :} ------- ; ------- -------//interfaces ::= IMPLEMENTS interface_type_list -------// ; -------//interfaces_opt::= -------// | interfaces -------// ; -------//interface_type_list ::= -------// interface_type -------// | interface_type_list COMMA interface_type -------// ; ------- -------class_body ::= LBRACE class_body_declarations_opt:cbdo RBRACE {: RESULT=cbdo; :} ------- ; ------- -------class_body_declarations_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | class_body_declarations:cbd {: RESULT=cbd; :}; ------- -------class_body_declarations ::= ------- class_body_declaration:cbd {: ------- ParseNode pn=new ParseNode("class_body_declaration_list"); ------- pn.addChild(cbd); ------- RESULT=pn; ------- :} ------- | class_body_declarations:cbds class_body_declaration:cbd {: ------- cbds.addChild(cbd); ------- RESULT=cbds; ------- :} ------- ; ------- -------class_body_declaration ::= ------- class_member_declaration:member {: ------- RESULT=(new ParseNode("member")).addChild(member).getRoot(); ------- :} -------// | static_initializer ------- | constructor_declaration:constructor {: ------- RESULT=(new ParseNode("constructor")).addChild(constructor).getRoot(); ------- :} ------- | block:block {: ------- RESULT=(new ParseNode("block")).addChild(block).getRoot(); -------:} ------- ; -------class_member_declaration ::= ------- //failure aware computation ------- flag_declaration:flag {: ------- RESULT=(new ParseNode("flag")).addChild(flag).getRoot(); ------- :} ------- | ------- field_declaration:field {: ------- RESULT=(new ParseNode("field")).addChild(field).getRoot(); ------- :} ------- | method_declaration:method {: ------- RESULT=(new ParseNode("method")).addChild(method).getRoot(); ------- :} ------- /* repeat the prod for 'class_declaration' here: */ -------// | modifiers_opt CLASS IDENTIFIER super_opt class_body -------// | interface_declaration ------- | SEMICOLON {: RESULT=new ParseNode("empty"); :} ------- ; ------- -------//Failure aware computation -------flag_declaration ::= ------- FLAG IDENTIFIER:id SEMICOLON {: ------- ParseNode pn=new ParseNode("flag_declaration"); ------- pn.addChild("name").addChild(id); ------- RESULT=pn; ------- :} | ------- EXTERNAL FLAG IDENTIFIER:id SEMICOLON {: ------- ParseNode pn=new ParseNode("flag_declaration"); ------- pn.addChild("name").addChild(id); ------- pn.addChild("external"); ------- RESULT=pn; ------- :} ------- ; ------- -------// 19.8.2) Field Declarations -------field_declaration ::= ------- modifiers_opt:mo type:type variable_declarators:var SEMICOLON {: ------- ParseNode pn=new ParseNode("field_declaration"); ------- pn.addChild("modifier").addChild(mo); ------- pn.addChild("type").addChild(type); ------- pn.addChild("variables").addChild(var); ------- RESULT=pn; ------- :} | ------- modifiers_opt:mo GLOBAL type:type variable_declarators:var SEMICOLON {: ------- ParseNode pn=new ParseNode("field_declaration"); ------- pn.addChild("modifier").addChild(mo); ------- pn.addChild("type").addChild(type); ------- pn.addChild("variables").addChild(var); ------- pn.addChild("global"); ------- RESULT=pn; ------- :} ------- ; ------- -------variable_declarators ::= ------- variable_declarator:vd {: ------- ParseNode pn=new ParseNode("variable_declarators_list"); ------- pn.addChild(vd); ------- RESULT=pn; ------- :} ------- | variable_declarators:vds COMMA variable_declarator:vd {: ------- vds.addChild(vd); ------- RESULT=vds; ------- :} ------- ; -------variable_declarator ::= ------- variable_declarator_id:id {: ------- ParseNode pn=new ParseNode("variable_declarator"); ------- pn.addChild(id); ------- RESULT=pn; ------- :} ------- | variable_declarator_id:id EQ variable_initializer:init {: ------- ParseNode pn=new ParseNode("variable_declarator"); ------- pn.addChild(id); ------- pn.addChild("initializer").addChild(init); ------- RESULT=pn; ------- :} ------- ; -------variable_declarator_id ::= ------- IDENTIFIER:id {: ------- RESULT=(new ParseNode("single")).addChild(id).getRoot();:} ------- | variable_declarator_id:id LBRACK RBRACK {: ------- RESULT=(new ParseNode("array")).addChild(id).getRoot();:} ------- ; -------variable_initializer ::= ------- expression:exp {: RESULT=exp; :} -------// | array_initializer ------- ; ------- -------// 19.8.3) Method Declarations -------method_declaration ::= ------- method_header:header method_body:body {: ------- ParseNode pn=new ParseNode("method_declaration"); ------- pn.addChild(header); ------- pn.addChild("body").addChild(body); ------- RESULT=pn; ------- :} ------- ; -------method_header ::= ------- modifiers_opt:mo type:type method_declarator:decl //throws_opt ------- {: ------- ParseNode pn=new ParseNode("method_header"); ------- pn.addChild("modifiers").addChild(mo); ------- pn.addChild("returntype").addChild(type); ------- pn.addChild(decl); ------- RESULT=pn; ------- :} ------- | modifiers_opt:mo VOID method_declarator:decl //throws_opt ------- {: ------- ParseNode pn=new ParseNode("method_header"); ------- pn.addChild("modifiers").addChild(mo); ------- pn.addChild(decl); ------- RESULT=pn; ------- :} ------- ; -------method_declarator ::= ------- IDENTIFIER:id LPAREN formal_parameter_list_opt:params RPAREN {: ------- ParseNode pn=new ParseNode("method_declarator"); ------- pn.addChild("name").addChild(id); ------- pn.addChild("parameters").addChild(params); ------- RESULT=pn; ------- :} -------// | method_declarator LBRACK RBRACK // deprecated -------// be careful; the above production also allows 'void foo() []' ------- ; -------formal_parameter_list_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | formal_parameter_list:fpl {: ------- RESULT=fpl; ------- :} ------- ; -------formal_parameter_list ::= ------- formal_parameter:fp {: ------- ParseNode pn=new ParseNode("formal_parameter_list"); ------- pn.addChild(fp); ------- RESULT=pn; ------- :} ------- | formal_parameter_list:fpl COMMA formal_parameter:fp {: ------- fpl.addChild(fp); ------- RESULT=fpl; ------- :} ------- ; -------formal_parameter ::= ------- type:type variable_declarator_id:name {: ------- ParseNode pn=new ParseNode("formal_parameter"); ------- pn.addChild(type); ------- pn.addChild(name); ------- RESULT=pn; ------- :} ------- | ------- TAG variable_declarator_id:name {: ------- ParseNode pn=new ParseNode("tag_parameter"); ------- pn.addChild(name); ------- RESULT=pn; ------- :} -------// | FINAL type variable_declarator_id ------- ; -------//throws_opt ::= -------// | throws -------// ; -------//throws ::= THROWS class_type_list -------// ; -------//class_type_list ::= -------// class_type -------// | class_type_list COMMA class_type -------// ; -------method_body ::= block:block {: ------- RESULT=block; ------- :} ------- | SEMICOLON {: RESULT=new ParseNode("empty"); :} ------- ; ------- -------// 19.8.4) Static Initializers -------//static_initializer ::= -------// STATIC block -------// ; ------- -------// 19.8.5) Constructor Declarations -------constructor_declaration ::= ------- modifiers_opt:mo constructor_declarator:cd -------//throws_opt ------- constructor_body:body {: ------- ParseNode pn=new ParseNode("constructor_declaration"); ------- pn.addChild("modifiers").addChild(mo); ------- pn.addChild(cd); ------- pn.addChild("body").addChild(body); ------- RESULT=pn; ------- :} | ------- modifiers_opt:mo GLOBAL constructor_declarator:cd -------//throws_opt ------- constructor_body:body {: ------- ParseNode pn=new ParseNode("constructor_declaration"); ------- pn.addChild("global"); ------- pn.addChild("modifiers").addChild(mo); ------- pn.addChild(cd); ------- pn.addChild("body").addChild(body); ------- RESULT=pn; ------- :} ------- ; -------constructor_declarator ::= ------- simple_name:name LPAREN formal_parameter_list_opt:fplo RPAREN {: ------- ParseNode pn=new ParseNode("constructor_declarator"); ------- pn.addChild(name); ------- pn.addChild("parameters").addChild(fplo); ------- RESULT=pn; ------- :} ------- ; -------constructor_body ::= - // LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE | - // LBRACE explicit_constructor_invocation RBRACE | ------ LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE {: ------ ParseNode pn=new ParseNode("constructor_body"); ------ pn.addChild(eci); ------ pn.addChild(bs); ------ RESULT=pn; ------ :} | ------ LBRACE explicit_constructor_invocation:eci RBRACE {: ------ ParseNode pn=new ParseNode("constructor_body"); ------ pn.addChild(eci); ------ RESULT=pn; ------ :} | ------- LBRACE block_statements:block RBRACE {: ------- ParseNode pn=new ParseNode("constructor_body"); ------- pn.addChild(block); ------- RESULT=pn; ------- :} ------- | LBRACE RBRACE {: RESULT=new ParseNode("empty"); :} ------- ; - //explicit_constructor_invocation ::= ------explicit_constructor_invocation ::= -------// THIS LPAREN argument_list_opt RPAREN SEMICOLON - // | SUPER LPAREN argument_list_opt RPAREN SEMICOLON ------// | ------SUPER LPAREN argument_list_opt:alo RPAREN SEMICOLON {: ------ ParseNode pn=new ParseNode("superinvoke"); ------ pn.addChild(alo); ------ RESULT=pn; ------:} -------// | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON -------// | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - // ; ------ ; ------- -------// 19.9) Interfaces ------- -------// 19.9.1) Interface Declarations -------//interface_declaration ::= -------// modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt -------// interface_body -------// ; -------//extends_interfaces_opt ::= -------// | extends_interfaces -------// ; -------//extends_interfaces ::= -------// EXTENDS interface_type -------// | extends_interfaces COMMA interface_type -------// ; -------//interface_body ::= -------// LBRACE interface_member_declarations_opt RBRACE -------// ; -------//interface_member_declarations_opt ::= -------// | interface_member_declarations -------// ; -------//interface_member_declarations ::= -------// interface_member_declaration -------// | interface_member_declarations interface_member_declaration -------// ; -------//interface_member_declaration ::= -------// constant_declaration -------// | abstract_method_declaration -------// | class_declaration -------// | interface_declaration -------// | SEMICOLON -------// ; -------//constant_declaration ::= -------// field_declaration -------// // need to semantically check that modifiers of field declaration -------// // include only PUBLIC, STATIC, or FINAL. Other modifiers are -------// // disallowed. -------// ; -------//abstract_method_declaration ::= -------// method_header SEMICOLON -------// ; ------- ------- -------// 19.10) Arrays -------//array_initializer ::= -------// LBRACE variable_initializers COMMA RBRACE -------// | LBRACE variable_initializers RBRACE -------// | LBRACE COMMA RBRACE -------// | LBRACE RBRACE -------// ; -------//variable_initializers ::= -------// variable_initializer -------// | variable_initializers COMMA variable_initializer -------// ; ------- -------// 19.11) Blocks and Statements -------block ::= LBRACE block_statements_opt:bso RBRACE {: ------- RESULT=bso; ------- :} ------- ; -------block_statements_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | block_statements:bs {: ------- RESULT=bs; ------- :} ------- ; -------block_statements ::= ------- block_statement:bs {: ------- ParseNode pn=new ParseNode("block_statement_list"); ------- pn.addChild(bs); ------- RESULT=pn; ------- :} ------- | block_statements:bss block_statement:bs {: ------- bss.addChild(bs); ------- RESULT=bss; ------- :} ------- ; -------block_statement ::= ------- tag_variable_declaration_statement:tvds {: ------- RESULT=tvds; ------- :} ------- | local_variable_declaration_statement:lvds {: ------- RESULT=lvds; ------- :} ------- | statement:statement {: ------- RESULT=statement; ------- :} -------// | class_declaration -------// | interface_declaration ------- ; -------tag_variable_declaration_statement ::= ------- TAG IDENTIFIER:id EQ NEW TAG LPAREN IDENTIFIER:type RPAREN SEMICOLON {: ------- ParseNode pn=new ParseNode("tag_declaration"); ------- pn.addChild("single").addChild(id); ------- pn.addChild("type").addChild(type); ------- RESULT=pn; ------- :} ------- ; -------local_variable_declaration_statement ::= ------- local_variable_declaration:lvd SEMICOLON {: ------- RESULT=lvd; ------- :} ------- ; -------local_variable_declaration ::= ------- type:type variable_declarators:var {: ------- ParseNode pn=new ParseNode("local_variable_declaration"); ------- pn.addChild(type); ------- pn.addChild(var); ------- RESULT=pn; -------:} -------// | FINAL type variable_declarators ------- ; -------statement ::= statement_without_trailing_substatement:st {: ------- RESULT=st; ------- :} -------// | labeled_statement:st {: RESULT=st; :} ------- | if_then_statement:st {: RESULT=st; :} ------- | if_then_else_statement:st {: RESULT=st; :} ------- | while_statement:st {: RESULT=st; :} ------- | for_statement:st {: RESULT=st; :} ------- ; -------statement_no_short_if ::= ------- statement_without_trailing_substatement:st {: RESULT=st; :} -------// | labeled_statement_no_short_if:st {: RESULT=st; :} ------- | if_then_else_statement_no_short_if:st {: RESULT=st; :} ------- | while_statement_no_short_if:st {: RESULT=st; :} ------- | for_statement_no_short_if:st {: RESULT=st; :} ------- ; -------statement_without_trailing_substatement ::= ------- block:st {: RESULT=st; :} ------- | empty_statement:st {: RESULT=st; :} ------- | expression_statement:st {: RESULT=st; :} -------// | switch_statement ------- | do_statement:dos {:RESULT=dos; :} ------- | break_statement:st {: RESULT=st; :} ------- | continue_statement:st {: RESULT=st; :} ------- | return_statement:st {: RESULT=st; :} ------- | task_exitstatement:st {: RESULT=st; :} ------- | atomic_statement:st {: RESULT=st; :} -------// | synchronized_statement -------// | throw_statement -------// | try_statement -------// | assert_statement ------- ; -------empty_statement ::= ------- SEMICOLON {: RESULT=new ParseNode("nop"); :} ------- ; -------//labeled_statement ::= -------// IDENTIFIER COLON statement -------// ; -------//labeled_statement_no_short_if ::= -------// IDENTIFIER COLON statement_no_short_if -------// ; -------expression_statement ::= ------- statement_expression:se SEMICOLON {: ------- ParseNode pn=new ParseNode("expression"); ------- pn.addChild(se); ------- RESULT=pn; :} ------- ; -------statement_expression ::= ------- assignment:st {: RESULT=st; :} ------- | preincrement_expression:st {: RESULT=st; :} ------- | predecrement_expression:st {: RESULT=st; :} ------- | postincrement_expression:st {: RESULT=st; :} ------- | postdecrement_expression:st {: RESULT=st; :} ------- | method_invocation:st {: RESULT=st; :} ------- | class_instance_creation_expression:st {: RESULT=st; :} ------- ; -------if_then_statement ::= ------- IF LPAREN expression:exp RPAREN statement:st {: ------- ParseNode pn=new ParseNode("ifstatement"); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("statement").addChild(st); ------- RESULT=pn; ------- :} ------- ; -------if_then_else_statement ::= ------- IF LPAREN expression:exp RPAREN statement_no_short_if:st ------- ELSE statement:else_st {: ------- ParseNode pn=new ParseNode("ifstatement"); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("statement").addChild(st); ------- pn.addChild("else_statement").addChild(else_st); ------- RESULT=pn; ------- :} ------- ; -------if_then_else_statement_no_short_if ::= ------- IF LPAREN expression:exp RPAREN statement_no_short_if:st ------- ELSE statement_no_short_if:else_st {: ------- ParseNode pn=new ParseNode("ifstatement"); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("statement").addChild(st); ------- pn.addChild("else_statement").addChild(else_st); ------- RESULT=pn; ------- :} ------- ; -------//switch_statement ::= -------// SWITCH LPAREN expression RPAREN switch_block -------// ; -------//switch_block ::= -------// LBRACE switch_block_statement_groups switch_labels RBRACE -------// | LBRACE switch_block_statement_groups RBRACE -------// | LBRACE switch_labels RBRACE -------// | LBRACE RBRACE -------// ; -------//switch_block_statement_groups ::= -------// switch_block_statement_group -------// | switch_block_statement_groups switch_block_statement_group -------// ; -------//switch_block_statement_group ::= -------// switch_labels block_statements -------// ; -------//switch_labels ::= -------// switch_label -------// | switch_labels switch_label -------// ; -------//switch_label ::= -------// CASE constant_expression COLON -------// | DEFAULT COLON -------// ; ------- -------while_statement ::= ------- WHILE LPAREN expression:exp RPAREN statement:st {: ------- ParseNode pn=new ParseNode("whilestatement"); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("statement").addChild(st); ------- RESULT=pn; ------- :} ------- ; -------while_statement_no_short_if ::= ------- WHILE LPAREN expression:exp RPAREN statement_no_short_if:st {: ------- ParseNode pn=new ParseNode("whilestatement"); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("statement").addChild(st); ------- RESULT=pn; ------- :} ------- ; -------do_statement ::= ------- DO statement:st WHILE LPAREN expression:exp RPAREN SEMICOLON {: ------- ParseNode pn=new ParseNode("dowhilestatement"); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("statement").addChild(st); ------- RESULT=pn; ------- :} ------- ; -------for_statement ::= ------- FOR LPAREN for_init_opt:init SEMICOLON expression_opt:exp SEMICOLON ------- for_update_opt:update RPAREN statement:st {: ------- ParseNode pn=new ParseNode("forstatement"); ------- pn.addChild("initializer").addChild(init); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("update").addChild(update); ------- pn.addChild("statement").addChild(st); ------- RESULT=pn; ------- :} ------- ; -------for_statement_no_short_if ::= ------- FOR LPAREN for_init_opt:init SEMICOLON expression_opt:exp SEMICOLON ------- for_update_opt:update RPAREN statement_no_short_if:st {: ------- ParseNode pn=new ParseNode("forstatement"); ------- pn.addChild("initializer").addChild(init); ------- pn.addChild("condition").addChild(exp); ------- pn.addChild("update").addChild(update); ------- pn.addChild("statement").addChild(st); ------- RESULT=pn; ------- :} ------- ; -------for_init_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | for_init:init {: RESULT=init; :} ------- ; -------for_init ::= statement_expression_list:list {: RESULT=list; :} ------- | local_variable_declaration:decl {: RESULT=decl; :} ------- ; -------for_update_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | for_update:update {: RESULT=update; :} ------- ; -------for_update ::= statement_expression_list:list {: RESULT=list; :} ------- ; -------statement_expression_list ::= ------- statement_expression:expr {: ------- RESULT=(new ParseNode("statement_expression_list")).addChild(expr).getRoot(); ------- :} ------- | statement_expression_list:list COMMA statement_expression:expr {: ------- list.addChild(expr); ------- RESULT=list; ------- :} ------- ; ------- -------//identifier_opt ::= -------// | IDENTIFIER -------// ; ------- -------break_statement ::= ------- BREAK -------//identifier_opt -------SEMICOLON {: RESULT=new ParseNode("break"); :} ------- ; ------- -------continue_statement ::= ------- CONTINUE -------//identifier_opt -------SEMICOLON -------{: RESULT=new ParseNode("continue"); :} ------- ; -------return_statement ::= ------- RETURN expression_opt:exp SEMICOLON {: ------- RESULT=(new ParseNode("return")).addChild(exp).getRoot(); :} ------- ; -------//throw_statement ::= -------// THROW expression SEMICOLON -------// ; -------//synchronized_statement ::= -------// SYNCHRONIZED LPAREN expression RPAREN block -------// ; -------atomic_statement ::= ------- ATOMIC block:blk {: ------- RESULT=(new ParseNode("atomic")).addChild(blk).getRoot(); ------- :} ------- ; -------//try_statement ::= -------// TRY block catches -------// | TRY block catches_opt finally -------// ; -------//catches_opt ::= -------// | catches -------// ; -------//catches ::= catch_clause -------// | catches catch_clause -------// ; -------//catch_clause ::= -------// CATCH LPAREN formal_parameter RPAREN block -------// ; -------//finally ::= FINALLY block -------// ; -------//assert_statement ::= -------// ASSERT expression SEMICOLON -------// | ASSERT expression COLON expression SEMICOLON -------// ; ------- -------// 19.12) Expressions -------primary ::= primary_no_new_array:st {: ------- RESULT=st; :} -------// | array_creation_init:st {: -------// RESULT=st; -------// :} ------- | array_creation_uninit:st {: ------- RESULT=st; ------- :} ------- ; -------primary_no_new_array ::= ------- literal:lit {: RESULT=lit; :} ------- | THIS {: RESULT=new ParseNode("this"); :} ------- | LPAREN expression:exp RPAREN {: RESULT=exp; :} ------- | class_instance_creation_expression:exp {: RESULT=exp; :} ------- | field_access:exp {: RESULT=exp; :} ------- | method_invocation:exp {: RESULT=exp; :} ------- | array_access:exp {: RESULT=exp; :} ------ | ISAVAILABLE LPAREN IDENTIFIER:id RPAREN {: ------ ParseNode pn=new ParseNode("isavailable"); ------ pn.addChild(id); ------ RESULT=pn; ------ :} -------// | primitive_type DOT CLASS -------// | VOID DOT CLASS -------// | array_type DOT CLASS -------// | name DOT CLASS -------// | name DOT THIS ------- ; -------class_instance_creation_expression ::= ------- NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {: ------- ParseNode pn=new ParseNode("createobject"); ------- pn.addChild(type); ------- pn.addChild(args); ------- pn.addChild(feo); ------- RESULT=pn; ------- :} ------- //Global object ------- | GLOBAL NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {: ------- ParseNode pn=new ParseNode("createobject"); ------- pn.addChild(type); ------- pn.addChild(args); ------- pn.addChild(feo); ------- pn.addChild("global"); ------- RESULT=pn; ------- :} ------- | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE RBRACE LBRACE tag_list:tl RBRACE {: ------- ParseNode pn=new ParseNode("createobject"); ------- pn.addChild(type); ------- pn.addChild(args); ------- pn.addChild(tl); ------- RESULT=pn; ------- :} ------- | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE flag_list:fl RBRACE LBRACE tag_list:tl RBRACE {: ------- ParseNode pn=new ParseNode("createobject"); ------- pn.addChild(type); ------- pn.addChild(args); ------- pn.addChild(fl); ------- pn.addChild(tl); ------- RESULT=pn; ------- :} ------- -------// | NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body -------// | primary DOT NEW IDENTIFIER -------// LPAREN argument_list_opt RPAREN {: -------// -------// :} -------// | primary DOT NEW IDENTIFIER -------// LPAREN argument_list_opt RPAREN class_body -------// | name DOT NEW IDENTIFIER -------// LPAREN argument_list_opt RPAREN -------// | name DOT NEW IDENTIFIER -------// LPAREN argument_list_opt RPAREN class_body ------- ; -------cons_argument_list_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | cons_argument_list:args {: RESULT=args; :} ------- ; ------- -------cons_argument_list ::= ------- IDENTIFIER:id COLON expression:exp {: ------- ParseNode pn=new ParseNode("cons_argument_list"); ------- ParseNode pnarg=pn.addChild("binding"); ------- pnarg.addChild("var").addChild(id); ------- pnarg.addChild("exp").addChild(exp); ------- RESULT=pn; ------- :} ------- | argument_list:list COMMA IDENTIFIER:id COLON expression:exp {: ------- ParseNode pnarg=new ParseNode("binding"); ------- pnarg.addChild("var").addChild(id); ------- pnarg.addChild("exp").addChild(exp); ------- list.addChild(pnarg); ------- RESULT=list; ------- :} ------- ; ------- -------argument_list_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | argument_list:args {: RESULT=args; :} ------- ; ------- -------argument_list ::= ------- expression:exp {: ------- ParseNode pn=new ParseNode("argument_list"); ------- pn.addChild(exp); ------- RESULT=pn; ------- :} ------- | argument_list:list COMMA expression:exp {: ------- list.addChild(exp); ------- RESULT=list; ------- :} ------- ; -------array_creation_uninit ::= ------- NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {: ------- ParseNode pn=new ParseNode("createarray"); ------- pn.addChild(type); ------- pn.addChild(dimexpr); ------- pn.addChild("dims_opt").setLiteral(dims); ------- RESULT=pn; ------- :} ------- | NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {: ------- ParseNode pn=new ParseNode("createarray"); ------- pn.addChild(type); ------- pn.addChild(dimexpr); ------- pn.addChild("dims_opt").setLiteral(dims); ------- RESULT=pn; ------- :} - | NEW GLOBAL primitive_type:type dim_exprs:dimexpr dims_opt:dims {: ------ | GLOBAL NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {: ------- ParseNode pn=new ParseNode("createarray"); ------- pn.addChild(type); ------- pn.addChild(dimexpr); ------- pn.addChild("dims_opt").setLiteral(dims); ------- pn.addChild("global"); ------- RESULT=pn; ------- :} - | NEW GLOBAL class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {: ------ | GLOBAL NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {: ------- ParseNode pn=new ParseNode("createarray"); ------- pn.addChild(type); ------- pn.addChild(dimexpr); ------- pn.addChild("dims_opt").setLiteral(dims); ------- pn.addChild("global"); ------- RESULT=pn; ------- :} ------- ; -------//array_creation_init ::= -------// NEW primitive_type dims array_initializer -------// | NEW class_or_interface_type dims array_initializer -------// ; -------dim_exprs ::= dim_expr:exp {: ------- ParseNode pn=new ParseNode("dim_exprs"); ------- pn.addChild(exp); ------- RESULT=pn; :} ------- | dim_exprs:base dim_expr:exp {: ------- base.addChild(exp); ------- RESULT=base; ------- :} ------- ; -------dim_expr ::= LBRACK expression:exp RBRACK {: RESULT=exp; :} ------- ; -------dims_opt ::= {: RESULT=new Integer(0); :} ------- | dims:dims {: RESULT = dims; :} ------- ; ------- -------dims ::= LBRACK RBRACK {: RESULT=new Integer(1); :} ------- | dims:dims LBRACK RBRACK {: RESULT=new Integer(dims.intValue()+1); :} ------- ; ------- -------field_access ::= ------- primary:base DOT IDENTIFIER:id {: ------- ParseNode pn=new ParseNode("fieldaccess"); ------- pn.addChild("base").addChild(base); ------- pn.addChild("field").addChild(id); ------- RESULT=pn; -------:} -------// | SUPER DOT IDENTIFIER -------// | name DOT SUPER DOT IDENTIFIER ------- ; -------method_invocation ::= ------- name:name LPAREN argument_list_opt:args RPAREN {: ------- ParseNode pn=new ParseNode("methodinvoke1"); ------- pn.addChild(name); ------- pn.addChild(args); ------- RESULT=pn; ------- :} ------- | primary:base DOT IDENTIFIER:name LPAREN argument_list_opt:args RPAREN {: ------- ParseNode pn=new ParseNode("methodinvoke2"); ------- pn.addChild("base").addChild(base); ------- pn.addChild("id").addChild(name); ------- pn.addChild(args); ------- RESULT=pn; ------- :} - // | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------ | SUPER DOT IDENTIFIER:id LPAREN argument_list_opt:args RPAREN {: ------ ParseNode name=new ParseNode("name"); ------ name.addChild("base").addChild("name").addChild("identifier").addChild("super"); ------ name.addChild("identifier").addChild(id); ------ ParseNode pn=new ParseNode("methodinvoke1"); ------ pn.addChild(name); ------ pn.addChild(args); ------ RESULT=pn; ------ :} -------// | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ------- ; -------array_access ::= ------- name:name LBRACK expression:exp RBRACK {: ------- ParseNode pn=new ParseNode("arrayaccess"); ------- pn.addChild("base").addChild(name); ------- pn.addChild("index").addChild(exp); ------- RESULT=pn; ------- :} ------- | primary_no_new_array:base LBRACK expression:exp RBRACK {: ------- ParseNode pn=new ParseNode("arrayaccess"); ------- pn.addChild("base").addChild(base); ------- pn.addChild("index").addChild(exp); ------- RESULT=pn; ------- :} -------// | array_creation_init:init LBRACK expression:exp RBRACK {: -------// ParseNode pn=new ParseNode("arrayaccess"); -------// pn.addChild("init").addChild(init); -------// pn.addChild("index").addChild(exp); -------// RESULT=pn; -------// :} ------- ; -------postfix_expression ::= ------- primary:exp {: ------- RESULT=exp; :} ------- | name:exp {: RESULT=exp; :} ------- | postincrement_expression:exp {: RESULT=exp; :} ------- | postdecrement_expression:exp {: RESULT=exp; :} ------- ; -------postincrement_expression ::= ------- postfix_expression:exp PLUSPLUS ------- {: RESULT=(new ParseNode("postinc")).addChild(exp).getRoot(); :} ------- ; -------postdecrement_expression ::= ------- postfix_expression:exp MINUSMINUS ------- {: RESULT=(new ParseNode("postdec")).addChild(exp).getRoot(); :} ------- ; -------unary_expression ::= ------- preincrement_expression:exp {: RESULT=exp; :} ------- | predecrement_expression:exp {: RESULT=exp; :} ------- | PLUS unary_expression:exp ------- {: RESULT=(new ParseNode("unaryplus")).addChild(exp).getRoot(); :} ------- | MINUS unary_expression:exp ------- {: RESULT=(new ParseNode("unaryminus")).addChild(exp).getRoot(); :} ------- | unary_expression_not_plus_minus:exp {: ------- RESULT=exp; :} ------- ; -------preincrement_expression ::= ------- PLUSPLUS unary_expression:exp ------- {: RESULT=(new ParseNode("preinc")).addChild(exp).getRoot(); :} ------- ; -------predecrement_expression ::= ------- MINUSMINUS unary_expression:exp ------- {: RESULT=(new ParseNode("predec")).addChild(exp).getRoot(); :} ------- ; -------unary_expression_not_plus_minus ::= ------- postfix_expression:exp {: ------- RESULT=exp; :} - // | COMP unary_expression ------ | COMP unary_expression:exp ------ {: RESULT=(new ParseNode("comp")).addChild(exp).getRoot(); :} ------- | NOT unary_expression:exp ------- {: RESULT=(new ParseNode("not")).addChild(exp).getRoot(); :} ------- | cast_expression:exp {: RESULT=exp; :} ------- ; -------cast_expression ::= ------- LPAREN primitive_type:type ------- //dims_opt ------- RPAREN unary_expression:exp {: ------- ParseNode pn=new ParseNode("cast1"); ------- pn.addChild("type").addChild(type); ------- pn.addChild("exp").addChild(exp); ------- RESULT=pn; ------- :} ------- | LPAREN expression:type RPAREN unary_expression_not_plus_minus:exp {: ------- ParseNode pn=new ParseNode("cast2"); ------- pn.addChild("type").addChild(type); ------- pn.addChild("exp").addChild(exp); ------- RESULT=pn; ------- ------- :} -------// | LPAREN name dims RPAREN unary_expression_not_plus_minus ------- ; -------multiplicative_expression ::= ------- unary_expression:exp {: ------- RESULT=exp; :} ------- | multiplicative_expression:exp1 MULT unary_expression:exp2 {: ------- ParseNode pn=new ParseNode("mult"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | multiplicative_expression:exp1 DIV unary_expression:exp2 {: ------- ParseNode pn=new ParseNode("div"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | multiplicative_expression:exp1 MOD unary_expression:exp2 {: ------- ParseNode pn=new ParseNode("mod"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------additive_expression ::= ------- multiplicative_expression:exp {: ------- RESULT=exp; :} ------- | additive_expression:exp1 PLUS multiplicative_expression:exp2 {: ------- ParseNode pn=new ParseNode("add"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | additive_expression:exp1 MINUS multiplicative_expression:exp2 {: ------- ParseNode pn=new ParseNode("sub"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------shift_expression ::= ------- additive_expression:exp {: ------- RESULT=exp; :} ------- | shift_expression:exp1 LSHIFT additive_expression:exp2 {: ------- ParseNode pn=new ParseNode("leftshift"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | shift_expression:exp1 RSHIFT additive_expression:exp2 {: ------- ParseNode pn=new ParseNode("rightshift"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} - // | shift_expression URSHIFT additive_expression ------ | shift_expression:exp1 URSHIFT additive_expression:exp2 {: ------ ParseNode pn=new ParseNode("urightshift"); ------ pn.addChild(exp1); ------ pn.addChild(exp2); ------ RESULT=pn; ------ :} ------- ; -------relational_expression ::= ------- shift_expression:exp {: ------- RESULT=exp; :} ------- | relational_expression:exp1 LT shift_expression:exp2 {: ------- ParseNode pn=new ParseNode("comp_lt"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | relational_expression:exp1 GT shift_expression:exp2 {: ------- ParseNode pn=new ParseNode("comp_gt"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | relational_expression:exp1 LTEQ shift_expression:exp2 {: ------- ParseNode pn=new ParseNode("comp_lte"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | relational_expression:exp1 GTEQ shift_expression:exp2 {: ------- ParseNode pn=new ParseNode("comp_gte"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} -------// | relational_expression INSTANCEOF reference_type ------- ; ------- -------equality_expression ::= ------- relational_expression:exp {: ------- RESULT=exp; :} ------- | equality_expression:exp1 EQEQ relational_expression:exp2 {: ------- ParseNode pn=new ParseNode("equal"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- | equality_expression:exp1 NOTEQ relational_expression:exp2 {: ------- ParseNode pn=new ParseNode("not_equal"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------and_expression ::= ------- equality_expression:exp {: ------- RESULT=exp; :} ------- | and_expression:exp1 AND equality_expression:exp2 {: ------- ParseNode pn=new ParseNode("bitwise_and"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------exclusive_or_expression ::= ------- and_expression:expr {: ------- RESULT=expr; ------- :} ------- | exclusive_or_expression:exp1 XOR and_expression:exp2 {: ------- ParseNode pn=new ParseNode("bitwise_xor"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; -------:} ------- ; -------inclusive_or_expression ::= ------- exclusive_or_expression:exclor {: ------- RESULT=exclor; :} ------- | inclusive_or_expression:exp1 OR exclusive_or_expression:exp2 {: ------- ParseNode pn=new ParseNode("bitwise_or"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------conditional_and_expression ::= ------- inclusive_or_expression:inclor {: ------- RESULT=inclor; :} ------- | conditional_and_expression:exp1 ANDAND inclusive_or_expression:exp2 {: ------- ParseNode pn=new ParseNode("logical_and"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------conditional_or_expression ::= ------- conditional_and_expression:condand {: ------- RESULT=condand; :} ------- | conditional_or_expression:exp1 OROR conditional_and_expression:exp2 {: ------- ParseNode pn=new ParseNode("logical_or"); ------- pn.addChild(exp1); ------- pn.addChild(exp2); ------- RESULT=pn; ------- :} ------- ; -------conditional_expression ::= ------- conditional_or_expression:condor {: ------- RESULT=condor; :} -------// | conditional_or_expression QUESTION expression -------// COLON conditional_expression ------- ; -------assignment_expression ::= ------- conditional_expression:expr {: ------- RESULT=expr; :} | ------- assignment:assign {: ------- RESULT=assign; :} ------- ; -------// semantic check necessary here to ensure a valid left-hand side. -------// allowing a parenthesized variable here on the lhs was introduced in -------// JLS 2; thanks to Eric Blake for pointing this out. -------assignment ::= postfix_expression:lvalue assignment_operator:op assignment_expression:rvalue {: ------- ParseNode pn=new ParseNode("assignment"); ------- pn.addChild("op").addChild(op); ------- ParseNode pnargs=pn.addChild("args"); ------- pnargs.addChild(lvalue); ------- pnargs.addChild(rvalue); ------- RESULT=pn; ------- :} ------- ; -------assignment_operator ::= ------- EQ {: RESULT=new ParseNode("eq"); :} ------- | MULTEQ {: RESULT=new ParseNode("multeq"); :} ------- | DIVEQ {: RESULT=new ParseNode("diveq"); :} ------- | MODEQ {: RESULT=new ParseNode("modeq"); :} ------- | PLUSEQ {: RESULT=new ParseNode("pluseq"); :} ------- | MINUSEQ {: RESULT=new ParseNode("minuseq"); :} ------- | LSHIFTEQ {: RESULT=new ParseNode("lshifteq"); :} ------- | RSHIFTEQ {: RESULT=new ParseNode("rshifteq"); :} - // | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :} ------ | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :} ------- | ANDEQ {: RESULT=new ParseNode("andeq"); :} ------- | XOREQ {: RESULT=new ParseNode("xoreq"); :} ------- | OREQ {: RESULT=new ParseNode("oreq"); :} ------- ; -------expression_opt ::= ------- {: RESULT=new ParseNode("empty"); :} ------- | expression:exp {: ------- RESULT=exp; :} ------- ; -------expression ::= assignment_expression:exp {: ------- RESULT=exp; :} ------- ; -------//constant_expression ::= -------// expression -------// ; diff --cc Robust/src/README index 55b17231,b623359c,b623359c,df13bf73,df13bf73,df13bf73,df13bf73..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/README +++ /dev/null @@@@@@@@ -1,1 -1,2 -1,2 -1,4 -1,4 -1,4 -1,4 +1,0 @@@@@@@@ -------See the wiki page at http://demsky.eecs.uci.edu/compiler/ ------ ----To set emacs tabbing add to your .emacs file: ----(setq c-basic-offset 2) diff --cc Robust/src/RepairTest/TaskExample.java index f34922be,f34922be,f34922be,f34922be,f34922be,f34922be,f34922be..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/RepairTest/TaskExample.java +++ /dev/null @@@@@@@@ -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 -1,48 +1,0 @@@@@@@@ -------class Example { ------- flag needoperation; ------- flag needprinting; ------- public Example() {} ------- ------- ------- int operation; ------- int x; ------- int y; ------- int z; -------} ------- -------/* Startup object is generated with the initialstate flag set by the ------- * system to start the computation up */ ------- -------task Startup(StartupObject s {initialstate}) { ------- for(int i=0;i<10;i++) { ------- Example e=new Example() {needoperation}; ------- e.x=i; ------- e.y=2; ------- e.operation=i%2; ------- } ------- ------- taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -------} ------- -------/* Fails for x=1 */ ------- -------task DoOperation(Example e{needoperation}) { ------- e.z=10*e.y/(e.x-1); ------- ------- if (e.operation==0) ------- /* Print the result */ ------- taskexit(e {!needoperation, needprinting}) assert (Example(e : e)); ------- else ------- /* Don't print the result */ ------- taskexit(e {!needoperation}) assert (Example(e : e)); -------} ------- -------/* Note that we can write arbitrary boolean expressions for flag ------- * expressions. For example, needprinting && ! needoperation would ------- * also be a legal flag expression */ ------- -------task DoPrint(Example e{needprinting}) { ------- System.printInt(e.z); ------- System.printString("\n"); ------- taskexit(e {!needprinting}); -------} diff --cc Robust/src/RepairTest/specs/Example/Example.constraints index e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/RepairTest/specs/Example/Example.constraints +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------[forall e in Example], e.X > 0; diff --cc Robust/src/RepairTest/specs/Example/Example.label index d9a35afd,d9a35afd,d9a35afd,d9a35afd,d9a35afd,d9a35afd,d9a35afd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/RepairTest/specs/Example/Example.label +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------Example * e; diff --cc Robust/src/RepairTest/specs/Example/Example.model index f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/RepairTest/specs/Example/Example.model +++ /dev/null @@@@@@@@ -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 +1,0 @@@@@@@@ -------[], true => e in Example; -------[forall l in Example], true => in X; -------[forall l in Example], true => in Y; -------[forall l in Example], true => in Z; diff --cc Robust/src/RepairTest/specs/Example/Example.space index 41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/RepairTest/specs/Example/Example.space +++ /dev/null @@@@@@@@ -1,6 -1,6 -1,6 -1,6 -1,6 -1,6 -1,6 +1,0 @@@@@@@@ -------// Space Definition Language File ------- -------set Example(Example); -------X: Example -> int; -------Y: Example -> int; -------Z: Example -> int; diff --cc Robust/src/RepairTest/specs/Example2/Example2.constraints index e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c,e7f6d25c..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/RepairTest/specs/Example2/Example2.constraints +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------[forall e in Example], e.X > 0; diff --cc Robust/src/RepairTest/specs/Example2/Example2.label index d9a35afd,d9a35afd,d9a35afd,d9a35afd,d9a35afd,d9a35afd,d9a35afd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/RepairTest/specs/Example2/Example2.label +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------Example * e; diff --cc Robust/src/RepairTest/specs/Example2/Example2.model index f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d,f6b2b86d..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/RepairTest/specs/Example2/Example2.model +++ /dev/null @@@@@@@@ -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 +1,0 @@@@@@@@ -------[], true => e in Example; -------[forall l in Example], true => in X; -------[forall l in Example], true => in Y; -------[forall l in Example], true => in Z; diff --cc Robust/src/RepairTest/specs/Example2/Example2.space index 41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9,41bdc3b9..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/RepairTest/specs/Example2/Example2.space +++ /dev/null @@@@@@@@ -1,6 -1,6 -1,6 -1,6 -1,6 -1,6 -1,6 +1,0 @@@@@@@@ -------// Space Definition Language File ------- -------set Example(Example); -------X: Example -> int; -------Y: Example -> int; -------Z: Example -> int; diff --cc Robust/src/Runtime/DSTM/docs/commitnotes index ee0c5503,ee0c5503,ee0c5503,ee0c5503,ee0c5503,ee0c5503,ee0c5503..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/docs/commitnotes +++ /dev/null @@@@@@@@ -1,77 -1,77 -1,77 -1,77 -1,77 -1,77 -1,77 +1,0 @@@@@@@@ -------Per object possibilities: ------- -------1) Lock acquired, version id matches ------- -------2) No lock, but version id matches ------- -------3) Version id doesn't match ------- -------4) Not here ------- -------Participant responses to coordinator ------- -------A) DISAGREE (if we ever see at least 1 #3) ------- -------B) AGREE (all #1) ------- -------C) AGREE BUT MISSING OBJECTS (mixture of #1 and #4 - no #2 or #3) - -------return list of oid's for missing objects (need to build list) ------- -------D) SOFT ABORT (need #2, could have #1, #4, can't have #3) - make sure -------there are no #3's ------- -------Coordinator: ------- -------I) ABORT (Any A's) (rerun computation, clear out transaction records, etc...) ------- -------II) COMMIT (All B's) - do local commit, free storage ------- -------III) ABORT BUT RETRY COMMIT (don't rerun computation) (Need D, can -------have B's, can have C', no A's) ------- -------IV) ABORT BUT RETRY COMMIT WITH RELOCATING (don't rerun computation, -------but relookup all missing objects) (Need C, can have B's, no A's, no -------D's) ------- -------Other machine involved in transaction: ------- -------I) COMMIT - commit object into store, send ACK to coordinator ------- -------II) ABORT - unlock objects, free transaction resources, send ACK to coordinator ------- -------III) Coordinator unreachable: ------- ------- 1) Elect leader out of reachable nodes (choose smallest reachable mid) ------- ------- 2) leader queries everyone for what they've heard -------(ABORT/COMMIT/nothing) ------- ------- 3) If anyone has heard commit from original leader, all commit ------- ------- 4) If anyone has heard abort from original leader, all abort ------- ------- 5) Otherwise leader does following: ------- ------- for each mid in group send SUSPICIOUS_ABORT() ------- ------- receive acknowledgements from mid's ------- ------- for each mid in group send TRUST_ONLY(nodes that send -------acknowledgements) ------- ------- In case 5, machines become suspicious of all current machines -------not on the list. When first contacting (or being contacted by a -------machine isn't in the list, it is suspicious of all current machines -------except the leader). The machine won't talk to a machine it is -------suspicious of until it can verify that the other machines made the -------same decision on all "suspicious" transactions. ------- -------COORDINATOR: ------- -------Once it has received ACK's from all other machines in transaction: ------- -------1) It sends a recycle transaction id message (they don't need to -------remember the ABORT/COMMIT result of that id anymore) ------- -------2) After sending all these messages and receiving ack's, it marks it -------local copy of transaction id recyclable diff --cc Robust/src/Runtime/DSTM/docs/messages index dbe9c94e,993a16e8,993a16e8,993a16e8,993a16e8,993a16e8,993a16e8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/docs/messages +++ /dev/null @@@@@@@@ -1,70 -1,72 -1,72 -1,72 -1,72 -1,72 -1,72 +1,0 @@@@@@@@ -------control = 1 byte, number of objects = 2 bytes ------- -------Client messages: ------- tuples for read objects, modified objects -------OBJECT_FOUND - control, object ------>OBJECT_FOUND - control, sizeof object, object ------->OBJECT_NOT_FOUND - control ------->OBJECTS_FOUND - control, number of objects, objects ------->OBJECTS_NOT_FOUND - control, number of objects, oids ------->TRANS_AGREE - control ------->TRANS_DISAGREE - control ------>TRANS_AGREE_BUT_MISSING_OBJECTS - control, number of objects, objects ------>TRANS_SOFT_ABORT - control, control bit identifying is missing objects present of not, number of objects, objects ------->TRANS_SUCCESSFUL - control ------- -------possible conversations (conversation means a tcp connection is maintained throughout): ------- -------OBJECT_FOUND ------- -------OBJECT_NOT_FOUND ------- -------OBJECTS_FOUND ------- -------OBJECTS_NOT_FOUND ------- -------(some objects found, others not) -------OBJECTS_NOT_FOUND ------->OBJECTS_FOUND ------- -------OBJECT_FOUND ------- -------OBJECT_NOT_FOUND ------- -------OBJECTS_FOUND ------- -------OBJECTS_NOT_FOUND ------- -------(some objects found, others not) -------OBJECTS_NOT_FOUND ------->OBJECTS_FOUND ------- -------TRANS_DISAGREE -------TRANS_AGREE -------TRANS_AGREE -------TRANS_SUCCESSFUL ------- diff --cc Robust/src/Runtime/DSTM/docs/prefetchnotes index 1c90595f,1c90595f,1c90595f,1c90595f,1c90595f,1c90595f,1c90595f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/docs/prefetchnotes +++ /dev/null @@@@@@@@ -1,61 -1,61 -1,61 -1,61 -1,61 -1,61 -1,61 +1,0 @@@@@@@@ -------Q: Why prefetching? ------- -------Possible prefech calls -------a) for array fields -------b) for pointer fields -------c) for typecasted oid's ------- -------e.g. -------==== -------x.y.z -------x.y.r -------x.y.r.t -------x[i].z -------((Integer) x).z ------- -------control = 1 byte, oid = 4 bytes, new oid = 4 bytes, depth = 1/ 2 bytes, name/type = 2 bytes, offset = 2 bytes, index = 2 bytes, typecastcheck = 2 bytes, ------- ------- new oid = The oid found at the Participant side that can be sent to Coordinator sending prefetch message ------- -------Assumptions -------=========== ------- -------1. Assume a max object size ------- Q: Why? -------2. ------- -------Procedure: -------1. Compiler identifies which oids and oids.offset field to prefetch(analysing the C code) -------and supplies that information to the Coordinator machine wanting to commit transaction. ------- Q: How does compiler convey this to a machine? (Design compiler interface) ------- -------2. Machine distinguishes and classifies tuples as "shared" or "unique" ------- e.g. while prefetching x.y.z and a.y.z if variable x == a then considered shared else unique ------- also consider the case of x.y.z and a.y.z.t where x == a ( Then prefetch only a.y.z.t) -------3. If not available in local machine, look up location table and make piles to send ------- prefetch control messages to all the Particpant machines from which prefetch is required. -------4. Iteratively look up the data field of the objects at the Particpant side to find objects ------- and send them across to Coordinator. -------5. Coordinator takes inventory and finds out the location of the objs not found yet. ------- Q: How to implement if some objects are not found through prefetch? ------- -------Coordinator messages: ------- -------table = nodes; --- ctable->size = size; --- ctable->numelements = 0; // Initial number of elements in the hash --- ctable->loadfactor = loadfactor; --- --- return ctable; ---- chashtable_t *ctable; - chashlistnode_t *nodes; - int i; - --- chashlistnode_t *nodes; --- int i; --- ---- if((ctable = calloc(1, sizeof(chashtable_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return NULL; - } - - // Allocate space for the hash table - if((nodes = calloc(size, sizeof(chashlistnode_t))) == NULL) { --- } --- --- // Allocate space for the hash table --- if((nodes = calloc(size, sizeof(chashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- free(ctable); ---- return NULL; - } - --- } --- ---- ctable->table = nodes; - ctable->size = size; --- ctable->size = size; ---- ctable->mask = (size << 1)-1; ---- ctable->numelements = 0; // Initial number of elements in the hash ---- ctable->loadfactor = loadfactor; - --- ---- return ctable; -------} ------- -------//Finds the right bin in the hash table --- unsigned int chashFunction(chashtable_t *table, unsigned int key) { --- return ( key % (table->size)); ----static INLINE unsigned int chashFunction(chashtable_t *table, unsigned int key) { - return ( key & (table->mask))>>1;//throw away low order bit --- return ( key & (table->mask))>>1; //throw away low order bit -------} ------- -------//Store objects and their pointers into hash -------unsigned int chashInsert(chashtable_t *table, unsigned int key, void *val) { --- unsigned int newsize; --- int index; --- chashlistnode_t *ptr, *node; --- --- if(table->numelements > (table->loadfactor * table->size)) { --- //Resize --- newsize = 2 * table->size + 1; --- chashResize(table,newsize); --- } ---- unsigned int newsize; ---- int index; ---- chashlistnode_t *ptr, *node; - --- ---- if(table->numelements > (table->loadfactor * table->size)) { ---- //Resize ---- newsize = table->size << 1; ---- chashResize(table,newsize); ---- } ------- --- ptr = table->table; --- table->numelements++; --- index = chashFunction(table, key); ---- ptr = table->table; ---- table->numelements++; ---- index = chashFunction(table, key); -------#ifdef DEBUG - printf("DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); -- printf("chashInsert(): DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); ---- printf("chashInsert(): DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); -------#endif --- if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable --- ptr[index].key = key; --- ptr[index].val = val; --- } else { // Insert in the beginning of linked list --- if ((node = calloc(1, sizeof(chashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return 1; --- } --- node->key = key; --- node->val = val; --- node->next = ptr[index].next; --- ptr[index].next = node; --- } --- return 0; - if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable --- if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable ---- ptr[index].key = key; ---- ptr[index].val = val; ---- } else { // Insert in the beginning of linked list ---- if ((node = calloc(1, sizeof(chashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- return 1; ---- } ---- node->key = key; ---- node->val = val; ---- node->next = ptr[index].next; ---- ptr[index].next = node; ---- } ---- return 0; -------} ------- -------// Search for an address for a given oid --- void *chashSearch(chashtable_t *table, unsigned int key) { --- int index; --- chashlistnode_t *ptr, *node; --- --- ptr = table->table; --- index = chashFunction(table, key); --- node = &ptr[index]; --- while(node != NULL) { --- if(node->key == key) { --- return node->val; --- } --- node = node->next; --- } --- return NULL; ----INLINE void * chashSearch(chashtable_t *table, unsigned int key) { ---- //REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE ---- chashlistnode_t *node = &table->table[(key & table->mask)>>1]; - --- ---- while(node != NULL) { ---- if(node->key == key) { ---- return node->val; ---- } ---- node = node->next; ---- } ---- return NULL; -------} ------- -------unsigned int chashRemove(chashtable_t *table, unsigned int key) { --- int index; --- chashlistnode_t *curr, *prev; --- chashlistnode_t *ptr, *node; --- --- ptr = table->table; --- index = chashFunction(table,key); --- curr = &ptr[index]; ---- int index; ---- chashlistnode_t *curr, *prev; ---- chashlistnode_t *ptr, *node; - --- ---- ptr = table->table; ---- index = chashFunction(table,key); ---- curr = &ptr[index]; ------- --- for (; curr != NULL; curr = curr->next) { --- if (curr->key == key) { // Find a match in the hash table --- table->numelements--; // Decrement the number of elements in the global hashtable --- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of chashlistnode_t --- curr->key = 0; --- curr->val = NULL; --- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of chashlistnode_t connected --- curr->key = curr->next->key; --- curr->val = curr->next->val; --- node = curr->next; --- curr->next = curr->next->next; --- free(node); --- } else { // Regular delete from linked listed --- prev->next = curr->next; --- free(curr); --- } --- return 0; --- } --- prev = curr; --- } --- return 1; ---- for (; curr != NULL; curr = curr->next) { ---- if (curr->key == key) { // Find a match in the hash table ---- table->numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of chashlistnode_t --- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of chashlistnode_t ---- curr->key = 0; ---- curr->val = NULL; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of chashlistnode_t connected --- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of chashlistnode_t connected ---- curr->key = curr->next->key; ---- curr->val = curr->next->val; ---- node = curr->next; ---- curr->next = curr->next->next; ---- free(node); - } else { // Regular delete from linked listed --- } else { // Regular delete from linked listed ---- prev->next = curr->next; ---- free(curr); ---- } ---- return 0; - } - prev = curr; --- } --- prev = curr; ---- } ---- return 1; -------} ------- -------unsigned int chashResize(chashtable_t *table, unsigned int newsize) { --- chashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list --- unsigned int oldsize; --- int isfirst; // Keeps track of the first element in the chashlistnode_t for each bin in hashtable --- int i,index; --- chashlistnode_t *newnode; --- --- ptr = table->table; --- oldsize = table->size; --- --- if((node = calloc(newsize, sizeof(chashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } --- --- table->table = node; //Update the global hashtable upon resize() --- table->size = newsize; --- table->numelements = 0; --- --- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table --- curr = &ptr[i]; --- isfirst = 1; --- while (curr != NULL) { //Inner loop to go through linked lists --- if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL --- break; //key = val =0 for element if not present within the hash table --- } --- next = curr->next; --- --- index = chashFunction(table, curr->key); - chashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list --- chashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list ---- unsigned int oldsize; ---- int isfirst; // Keeps track of the first element in the chashlistnode_t for each bin in hashtable - int i,index; - chashlistnode_t *newnode; - --- int i,index; --- chashlistnode_t *newnode; --- ---- ptr = table->table; ---- oldsize = table->size; - --- ---- if((node = calloc(newsize, sizeof(chashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } - - table->table = node; //Update the global hashtable upon resize() --- --- table->table = node; //Update the global hashtable upon resize() ---- table->size = newsize; ---- table->mask = (newsize << 1)-1; ---- table->numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table --- --- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table ---- curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //key = val =0 for element if not present within the hash table --- isfirst = 1; --- while (curr != NULL) { //Inner loop to go through linked lists --- if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL --- break; //key = val =0 for element if not present within the hash table ---- } ---- next = curr->next; - --- ---- index = chashFunction(table, curr->key); -------#ifdef DEBUG --- printf("DEBUG(resize) -> index = %d, key = %d, val = %x\n", index, curr->key, curr->val); ---- printf("DEBUG(resize) -> index = %d, key = %d, val = %x\n", index, curr->key, curr->val); -------#endif --- // Insert into the new table --- if(table->table[index].next == NULL && table->table[index].key == 0) { --- table->table[index].key = curr->key; --- table->table[index].val = curr->val; --- table->numelements++; --- }else { --- if((newnode = calloc(1, sizeof(chashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return 1; --- } --- newnode->key = curr->key; --- newnode->val = curr->val; --- newnode->next = table->table[index].next; --- table->table[index].next = newnode; --- table->numelements++; --- } --- --- //free the linked list of chashlistnode_t if not the first element in the hash table --- if (isfirst != 1) { --- free(curr); --- } --- --- isfirst = 0; --- curr = next; --- } --- } --- --- free(ptr); //Free the memory of the old hash table --- return 0; ---- // Insert into the new table - if(table->table[index].next == NULL && table->table[index].key == 0) { --- if(table->table[index].next == NULL && table->table[index].key == 0) { ---- table->table[index].key = curr->key; ---- table->table[index].val = curr->val; ---- table->numelements++; - }else { - if((newnode = calloc(1, sizeof(chashlistnode_t))) == NULL) { --- } else { --- if((newnode = calloc(1, sizeof(chashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- return 1; - } --- } ---- newnode->key = curr->key; ---- newnode->val = curr->val; ---- newnode->next = table->table[index].next; - table->table[index].next = newnode; --- table->table[index].next = newnode; ---- table->numelements++; - } - --- } --- ---- //free the linked list of chashlistnode_t if not the first element in the hash table ---- if (isfirst != 1) { ---- free(curr); - } - --- } --- ---- isfirst = 0; ---- curr = next; ---- } ---- } - - free(ptr); //Free the memory of the old hash table --- --- free(ptr); //Free the memory of the old hash table ---- return 0; -------} ------- -------//Delete the entire hash table -- void chashDelete(chashtable_t *table) { -----void chashDelete(chashtable_t *ctable) { --- int i, isFirst; --- chashlistnode_t *ptr, *curr, *next; -- ptr = table->table; - ptr = ctable->table; --- -- for(i=0 ; isize ; i++) { - for(i=0 ; isize ; i++) { --- curr = &ptr[i]; --- isFirst = 1 ; --- while(curr != NULL) { --- next = curr->next; --- if(isFirst != 1) { --- free(curr); --- } --- isFirst = 0; --- curr = next; --- } --- } --- --- free(ptr); -- free(table); -- table = NULL; - ptr = NULL; - free(ctable); - ctable = NULL; ---- int i, isFirst; ---- chashlistnode_t *ptr, *curr, *next; ---- ptr = ctable->table; - --- ---- for(i=0 ; isize ; i++) { ---- curr = &ptr[i]; ---- isFirst = 1 ; ---- while(curr != NULL) { ---- next = curr->next; ---- if(isFirst != 1) { ---- free(curr); ---- } ---- isFirst = 0; ---- curr = next; ---- } ---- } - --- ---- free(ptr); ---- ptr = NULL; ---- free(ctable); ---- ctable = NULL; -------} diff --cc Robust/src/Runtime/DSTM/interface/clookup.h index b71abfd5,b71abfd5,b71abfd5,475a66f0,4a078d2c,4a078d2c,4a078d2c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/clookup.h +++ /dev/null @@@@@@@@ -1,34 -1,34 -1,34 -1,35 -1,35 -1,35 -1,35 +1,0 @@@@@@@@ -------#ifndef _CLOOKUP_H_ -------#define _CLOOKUP_H_ ------- -------#include -------#include ------- --- #define LOADFACTOR 0.75 --- #define HASH_SIZE 100 ----#define CLOADFACTOR 0.25 ----#define CHASH_SIZE 1024 ------- -------typedef struct chashlistnode { ---- unsigned int key; ---- void *val; //this can be cast to another type or used to point to a larger structure ---- struct chashlistnode *next; --- unsigned int key; --- void *val; //this can be cast to another type or used to point to a larger structure --- struct chashlistnode *next; -------} chashlistnode_t; ------- -------typedef struct chashtable { --- chashlistnode_t *table; // points to beginning of hash table --- unsigned int size; --- unsigned int numelements; --- float loadfactor; - chashlistnode_t *table; // points to beginning of hash table --- chashlistnode_t *table; // points to beginning of hash table ---- unsigned int size; ---- unsigned int mask; ---- unsigned int numelements; ---- float loadfactor; -------} chashtable_t; ------- -------/* Prototypes for hash*/ -------chashtable_t *chashCreate(unsigned int size, float loadfactor); --- unsigned int chashFunction(chashtable_t *table, unsigned int key); ----static unsigned int chashFunction(chashtable_t *table, unsigned int key); -------unsigned int chashInsert(chashtable_t *table, unsigned int key, void *val); -------void *chashSearch(chashtable_t *table, unsigned int key); //returns val, NULL if not found -------unsigned int chashRemove(chashtable_t *table, unsigned int key); //returns -1 if not found -------unsigned int chashResize(chashtable_t *table, unsigned int newsize); -------void chashDelete(chashtable_t *table); -------/* end hash */ ------- -------#endif ------- diff --cc Robust/src/Runtime/DSTM/interface/dht.c index e0ef4445,e0ef4445,e0ef4445,cccbcfcd,768a8e33,3fd73494,3fd73494..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/dht.c +++ /dev/null @@@@@@@@ -1,1751 -1,1751 -1,1751 -1,1750 -1,1652 -1,1638 -1,1638 +1,0 @@@@@@@@ -------/******************************************************************************* -------* dht.c -------* -------* High-performance Distributed Hash Table for finding the location of objects -------* in a Distributed Shared Transactional Memory system. -------* -------* Creator: Erik Rubow -------* -------* TODO: -------* 1) Instead of having dhtInsertMult, dhtSearchMult, etc. call their single-key -------* counterparts repeatedly, define some new messages to handle it more -------* efficiently. -------* 2) Improve the efficiency of functions that work with hostArray, hostReplied, -------* and blockOwnerArray. -------* 3) Currently a join or leave causes a rebuild of the entire hash table. -------* Implement more graceful join and leave procedures. -------* 4) Fine tune timeout values for performance, possibly implement a backoff -------* algorithm to prevent overloading the network. -------* 5) Whatever else I'm forgetting -------* -------*******************************************************************************/ -------/******************************************************************************* -------* Includes -------*******************************************************************************/ ------- -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include -------#include --- #include -------#include -------#include "dht.h" -------#include "clookup.h" //this works for now, do we need anything better? -------#include "mlookup.h" ------- -------/******************************************************************************* -------* Local Defines, Structs -------*******************************************************************************/ ------- -------#define MAX_MSG_SIZE 1500 -------#define UDP_PORT 2157 -------#define INIT_HOST_ALLOC 3 -------#define INIT_NUM_BLOCKS 16 -------#define DEFAULT_INTERFACE "eth0" -------#define TIMEOUT_PERIOD 100 -------#define INSERT_TIMEOUT_MS 500 -------#define INSERT_RETRIES 50 -------#define REMOVE_TIMEOUT_MS 500 -------#define REMOVE_RETRIES 50 -------#define SEARCH_TIMEOUT_MS 500 -------#define SEARCH_RETRIES 50 ------- -------//message types -------//make sure this matches msg_types global var -------enum -------{ ---- INSERT_CMD, ---- INSERT_RES, ---- REMOVE_CMD, ---- REMOVE_RES, ---- SEARCH_CMD, ---- SEARCH_RES, ---- WHO_IS_LEADER_CMD, ---- WHO_IS_LEADER_RES, ---- JOIN_REQ, ---- JOIN_RES, ---- LEAVE_REQ, ---- LEAVE_RES, ---- DHT_UPDATE_CMD, ---- DHT_UPDATE_RES, ---- ELECT_LEADER_CMD, ---- ELECT_LEADER_RES, ---- CONGRATS_CMD, ---- REBUILD_REQ, ---- REBUILD_CMD, ---- FILL_DHT_CMD, ---- FILL_DHT_RES, ---- RESUME_NORMAL_CMD, ---- RESUME_NORMAL_RES, ---- NUM_MSG_TYPES --- INSERT_CMD, --- INSERT_RES, --- REMOVE_CMD, --- REMOVE_RES, --- SEARCH_CMD, --- SEARCH_RES, --- WHO_IS_LEADER_CMD, --- WHO_IS_LEADER_RES, --- JOIN_REQ, --- JOIN_RES, --- LEAVE_REQ, --- LEAVE_RES, --- DHT_UPDATE_CMD, --- DHT_UPDATE_RES, --- ELECT_LEADER_CMD, --- ELECT_LEADER_RES, --- CONGRATS_CMD, --- REBUILD_REQ, --- REBUILD_CMD, --- FILL_DHT_CMD, --- FILL_DHT_RES, --- RESUME_NORMAL_CMD, --- RESUME_NORMAL_RES, --- NUM_MSG_TYPES -------}; ------- -------//states -------//make sure this matches state_names, timeout_vals, and retry_vals global vars -------enum -------{ ---- INIT1_STATE, ---- INIT2_STATE, ---- NORMAL_STATE, ---- LEAD_NORMAL1_STATE, ---- LEAD_NORMAL2_STATE, ---- ELECT1_STATE, ---- ELECT2_STATE, ---- REBUILD0_STATE, ---- REBUILD1_STATE, ---- REBUILD2_STATE, ---- REBUILD3_STATE, ---- REBUILD4_STATE, ---- REBUILD5_STATE, ---- LEAD_REBUILD1_STATE, ---- LEAD_REBUILD2_STATE, ---- LEAD_REBUILD3_STATE, ---- LEAD_REBUILD4_STATE, ---- EXIT1_STATE, ---- EXIT2_STATE, ---- NUM_STATES --- INIT1_STATE, --- INIT2_STATE, --- NORMAL_STATE, --- LEAD_NORMAL1_STATE, --- LEAD_NORMAL2_STATE, --- ELECT1_STATE, --- ELECT2_STATE, --- REBUILD0_STATE, --- REBUILD1_STATE, --- REBUILD2_STATE, --- REBUILD3_STATE, --- REBUILD4_STATE, --- REBUILD5_STATE, --- LEAD_REBUILD1_STATE, --- LEAD_REBUILD2_STATE, --- LEAD_REBUILD3_STATE, --- LEAD_REBUILD4_STATE, --- EXIT1_STATE, --- EXIT2_STATE, --- NUM_STATES -------}; ------- -------//status codes -------enum -------{ ---- OPERATION_OK, ---- KEY_NOT_FOUND, ---- NOT_KEY_OWNER, ---- NOT_LEADER, ---- INTERNAL_ERROR --- OPERATION_OK, --- KEY_NOT_FOUND, --- NOT_KEY_OWNER, --- NOT_LEADER, --- INTERNAL_ERROR -------}; ------- ---- struct hostData ---- { ---- unsigned int ipAddr; ---- unsigned int maxKeyCapacity; ---struct hostData { --- unsigned int ipAddr; --- unsigned int maxKeyCapacity; -------}; ------- -------/******************************************************************************* -------* Local Function Prototypes -------*******************************************************************************/ ------- -------int msgSizeOk(unsigned char *msg, unsigned int size); -------unsigned short read2(unsigned char *msg); -------unsigned int read4(unsigned char *msg); -------void write2(unsigned char *ptr, unsigned short tmp); -------void write4(unsigned char *ptr, unsigned int tmp); -------unsigned int getMyIpAddr(const char *interfaceStr); -------int udpSend(unsigned char *msg, unsigned int size, unsigned int destIp); -------int udpSendAll(unsigned char *msg, unsigned int size); -------unsigned int hash(unsigned int x); -------unsigned int getKeyOwner(unsigned int key); -------void setState(unsigned int newState); -------void makeAssignments(); -------int addHost(struct hostData newHost); -------int removeHost(unsigned int ipAddr); -------void removeUnresponsiveHosts(); -------int checkReplied(unsigned int ipAddr); -------int allReplied(); -------void writeHostList(); -------void dhtLog(const char *format, ...); -------void *fillTask(); -------void *udpListen(); ------- -------/******************************************************************************* -------* Global Variables -------*******************************************************************************/ ------- -------//make sure this matches enumeration above -------const char *msg_types[NUM_MSG_TYPES] = -------{ ---- "INSERT_CMD", ---- "INSERT_RES", ---- "REMOVE_CMD", ---- "REMOVE_RES", ---- "SEARCH_CMD", ---- "SEARCH_RES", ---- "WHO_IS_LEADER_CMD", ---- "WHO_IS_LEADER_RES", ---- "JOIN_REQ", ---- "JOIN_RES", ---- "LEAVE_REQ", ---- "LEAVE_RES", ---- "DHT_UPDATE_CMD", ---- "DHT_UPDATE_RES", ---- "ELECT_LEADER_CMD", ---- "ELECT_LEADER_RES", ---- "CONGRATS_CMD", ---- "REBUILD_REQ", ---- "REBUILD_CMD", ---- "FILL_DHT_CMD", ---- "FILL_DHT_RES", ---- "RESUME_NORMAL_CMD", ---- "RESUME_NORMAL_RES" --- "INSERT_CMD", --- "INSERT_RES", --- "REMOVE_CMD", --- "REMOVE_RES", --- "SEARCH_CMD", --- "SEARCH_RES", --- "WHO_IS_LEADER_CMD", --- "WHO_IS_LEADER_RES", --- "JOIN_REQ", --- "JOIN_RES", --- "LEAVE_REQ", --- "LEAVE_RES", --- "DHT_UPDATE_CMD", --- "DHT_UPDATE_RES", --- "ELECT_LEADER_CMD", --- "ELECT_LEADER_RES", --- "CONGRATS_CMD", --- "REBUILD_REQ", --- "REBUILD_CMD", --- "FILL_DHT_CMD", --- "FILL_DHT_RES", --- "RESUME_NORMAL_CMD", --- "RESUME_NORMAL_RES" -------}; ------- -------const char *state_names[NUM_STATES] = -------{ ---- "INIT1_STATE", ---- "INIT2_STATE", ---- "NORMAL_STATE", ---- "LEAD_NORMAL1_STATE", ---- "LEAD_NORMAL2_STATE", ---- "ELECT1_STATE", ---- "ELECT2_STATE", ---- "REBUILD0_STATE", ---- "REBUILD1_STATE", ---- "REBUILD2_STATE", ---- "REBUILD3_STATE", ---- "REBUILD4_STATE", ---- "REBUILD5_STATE", ---- "LEAD_REBUILD1_STATE", ---- "LEAD_REBUILD2_STATE", ---- "LEAD_REBUILD3_STATE", ---- "LEAD_REBUILD4_STATE", ---- "EXIT1_STATE", ---- "EXIT2_STATE", --- "INIT1_STATE", --- "INIT2_STATE", --- "NORMAL_STATE", --- "LEAD_NORMAL1_STATE", --- "LEAD_NORMAL2_STATE", --- "ELECT1_STATE", --- "ELECT2_STATE", --- "REBUILD0_STATE", --- "REBUILD1_STATE", --- "REBUILD2_STATE", --- "REBUILD3_STATE", --- "REBUILD4_STATE", --- "REBUILD5_STATE", --- "LEAD_REBUILD1_STATE", --- "LEAD_REBUILD2_STATE", --- "LEAD_REBUILD3_STATE", --- "LEAD_REBUILD4_STATE", --- "EXIT1_STATE", --- "EXIT2_STATE", -------}; ------- -------//note: { 0, 0 } means no timeout ---- struct timeval timeout_vals[NUM_STATES] = ---- { ---- { 0, 500000 }, //INIT1_STATE ---- { 0, 500000 }, //INIT2_STATE ---- { 0, 0 }, //NORMAL_STATE ---- { 0, 0 }, //LEAD_NORMAL1_STATE ---- { 3, 0 }, //LEAD_NORMAL2_STATE ---- { 1, 0 }, //ELECT1_STATE ---- { 1, 0 }, //ELECT2_STATE ---- { 0, 500000 }, //REBUILD0_STATE ---- { 0, 500000 }, //REBUILD1_STATE ---- { 10, 0 }, //REBUILD2_STATE ---- { 10, 0 }, //REBUILD3_STATE ---- { 10, 0 }, //REBUILD4_STATE ---- { 1, 0 }, //REBUILD5_STATE ---- { 1, 0 }, //LEAD_REBUILD1_STATE ---- { 1, 0 }, //LEAD_REBUILD2_STATE ---- { 10, 0 }, //LEAD_REBUILD3_STATE ---- { 10, 0 }, //LEAD_REBUILD4_STATE ---- { 0, 500000 }, //EXIT1_STATE ---- { 0, 0 } //EXIT2_STATE ---struct timeval timeout_vals[NUM_STATES] ={ --- { 0, 500000 }, //INIT1_STATE --- { 0, 500000 }, //INIT2_STATE --- { 0, 0 }, //NORMAL_STATE --- { 0, 0 }, //LEAD_NORMAL1_STATE --- { 3, 0 }, //LEAD_NORMAL2_STATE --- { 1, 0 }, //ELECT1_STATE --- { 1, 0 }, //ELECT2_STATE --- { 0, 500000 }, //REBUILD0_STATE --- { 0, 500000 }, //REBUILD1_STATE --- { 10, 0 }, //REBUILD2_STATE --- { 10, 0 }, //REBUILD3_STATE --- { 10, 0 }, //REBUILD4_STATE --- { 1, 0 }, //REBUILD5_STATE --- { 1, 0 }, //LEAD_REBUILD1_STATE --- { 1, 0 }, //LEAD_REBUILD2_STATE --- { 10, 0 }, //LEAD_REBUILD3_STATE --- { 10, 0 }, //LEAD_REBUILD4_STATE --- { 0, 500000 }, //EXIT1_STATE --- { 0, 0 } //EXIT2_STATE -------}; ------- -------int retry_vals[NUM_STATES] = -------{ ---- 100, //INIT1_STATE ---- 10, //INIT2_STATE ---- 0, //NORMAL_STATE ---- 0, //LEAD_NORMAL1_STATE ---- 0, //LEAD_NORMAL2_STATE ---- 10, //ELECT1_STATE ---- 10, //ELECT2_STATE ---- 10, //REBUILD0_STATE ---- 10, //REBUILD1_STATE ---- 0, //REBUILD2_STATE ---- 0, //REBUILD3_STATE ---- 0, //REBUILD4_STATE ---- 10, //REBUILD5_STATE ---- 10, //LEAD_REBUILD1_STATE ---- 10, //LEAD_REBUILD2_STATE ---- 10, //LEAD_REBUILD3_STATE ---- 10, //LEAD_REBUILD4_STATE ---- 10, //EXIT1_STATE ---- 0 //EXIT2_STATE --- 100, //INIT1_STATE --- 10, //INIT2_STATE --- 0, //NORMAL_STATE --- 0, //LEAD_NORMAL1_STATE --- 0, //LEAD_NORMAL2_STATE --- 10, //ELECT1_STATE --- 10, //ELECT2_STATE --- 10, //REBUILD0_STATE --- 10, //REBUILD1_STATE --- 0, //REBUILD2_STATE --- 0, //REBUILD3_STATE --- 0, //REBUILD4_STATE --- 10, //REBUILD5_STATE --- 10, //LEAD_REBUILD1_STATE --- 10, //LEAD_REBUILD2_STATE --- 10, //LEAD_REBUILD3_STATE --- 10, //LEAD_REBUILD4_STATE --- 10, //EXIT1_STATE --- 0 //EXIT2_STATE -------}; ------- -------FILE *logfile; -------struct hostData myHostData; -------pthread_t threadUdpListen; -------pthread_t threadFillTask; -------//status of fillTask: 0 = ready to run, 1 = running, 2 = completed, 3 = error -------int fillStatus; -------struct pollfd udpPollSock; -------unsigned int state; -------unsigned int seed; -------unsigned int leader; -------unsigned int electionOriginator; -------unsigned int electionParent; -------unsigned int hostArraySize = 0; -------struct hostData *hostArray = NULL; -------unsigned int numBlocks = 0; -------unsigned short *blockOwnerArray = NULL; -------unsigned char *hostReplied = NULL; -------pthread_mutex_t stateMutex; -------pthread_cond_t stateCond; -------chashtable_t *myHashTable; -------unsigned int numHosts; -------struct timeval timer; -------int timerSet; -------int timeoutCntr; ------- -------/******************************************************************************* -------* Interface Function Definitions -------*******************************************************************************/ ------- ---- void dhtInit(unsigned int seedIpAddr, unsigned int maxKeyCapacity) ---- { ---- struct in_addr tmpAddr; ---- char filename[23] = "dht-"; ---- struct sockaddr_in myAddr; ---- struct sockaddr_in seedAddr; ---- socklen_t socklen = sizeof(struct sockaddr_in); ---- char initMsg; ---void dhtInit(unsigned int seedIpAddr, unsigned int maxKeyCapacity) { --- struct in_addr tmpAddr; --- char filename[23] = "dht-"; --- struct sockaddr_in myAddr; --- struct sockaddr_in seedAddr; --- socklen_t socklen = sizeof(struct sockaddr_in); --- char initMsg; ------- ---- tmpAddr.s_addr = htonl(getMyIpAddr(DEFAULT_INTERFACE)); ---- strcat(filename, inet_ntoa(tmpAddr)); ---- strcat(filename, ".log"); ---- printf("log file: %s\n", filename); --- tmpAddr.s_addr = htonl(getMyIpAddr(DEFAULT_INTERFACE)); --- strcat(filename, inet_ntoa(tmpAddr)); --- strcat(filename, ".log"); --- printf("log file: %s\n", filename); ------- ---- logfile = fopen(filename, "w"); ---- dhtLog("dhtInit(): inializing...\n"); --- logfile = fopen(filename, "w"); --- dhtLog("dhtInit(): inializing...\n"); ------- ---- myHostData.ipAddr = getMyIpAddr(DEFAULT_INTERFACE); ---- myHostData.maxKeyCapacity = maxKeyCapacity; --- myHostData.ipAddr = getMyIpAddr(DEFAULT_INTERFACE); --- myHostData.maxKeyCapacity = maxKeyCapacity; ------- ---- seed = seedIpAddr; ---- leader = 0; ---- electionOriginator = 0; ---- electionParent = 0; ---- hostArraySize = INIT_HOST_ALLOC; ---- hostArray = calloc(hostArraySize, sizeof(struct hostData)); ---- hostReplied = calloc(hostArraySize, sizeof(unsigned char)); ---- hostArray[0] = myHostData; ---- numHosts = 1; ---- numBlocks = INIT_NUM_BLOCKS; ---- blockOwnerArray = calloc(numBlocks, sizeof(unsigned short)); ---- pthread_mutex_init(&stateMutex, NULL); ---- pthread_cond_init(&stateCond, NULL); ---- myHashTable = chashCreate(HASH_SIZE, LOADFACTOR); --- seed = seedIpAddr; --- leader = 0; --- electionOriginator = 0; --- electionParent = 0; --- hostArraySize = INIT_HOST_ALLOC; --- hostArray = calloc(hostArraySize, sizeof(struct hostData)); --- hostReplied = calloc(hostArraySize, sizeof(unsigned char)); --- hostArray[0] = myHostData; --- numHosts = 1; --- numBlocks = INIT_NUM_BLOCKS; --- blockOwnerArray = calloc(numBlocks, sizeof(unsigned short)); --- pthread_mutex_init(&stateMutex, NULL); --- pthread_cond_init(&stateCond, NULL); --- myHashTable = chashCreate(HASH_SIZE, LOADFACTOR); ------- ---- udpPollSock.fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); ---- if (udpPollSock.fd < 0) ---- perror("dhtInit():socket()"); --- udpPollSock.fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); --- if (udpPollSock.fd < 0) --- perror("dhtInit():socket()"); ------- ---- udpPollSock.events = POLLIN; ---- ---- bzero(&myAddr, socklen); ---- myAddr.sin_family = AF_INET; ---- myAddr.sin_addr.s_addr = htonl(INADDR_ANY); ---- myAddr.sin_port = htons(UDP_PORT); --- udpPollSock.events = POLLIN; ------- ---- if (bind(udpPollSock.fd, (struct sockaddr *)&myAddr, socklen) < 0) ---- perror("dhtInit():bind()"); --- bzero(&myAddr, socklen); --- myAddr.sin_family = AF_INET; --- myAddr.sin_addr.s_addr = htonl(INADDR_ANY); --- myAddr.sin_port = htons(UDP_PORT); ------- ---- if (seed == 0) ---- { ---- dhtLog("I am the leader\n"); ---- leader = myHostData.ipAddr; ---- setState(LEAD_NORMAL1_STATE); ---- } ---- else ---- { ---- initMsg = WHO_IS_LEADER_CMD; ---- udpSend(&initMsg, 1, seed); ---- setState(INIT1_STATE); ---- } --- if (bind(udpPollSock.fd, (struct sockaddr *)&myAddr, socklen) < 0) --- perror("dhtInit():bind()"); ------- ---- if (pthread_create(&threadUdpListen, NULL, udpListen, NULL) != 0) ---- dhtLog("dhtInit() - ERROR creating threadUdpListen\n"); - if (seed == 0){ -- if (seed == 0) { --- dhtLog("I am the leader\n"); --- leader = myHostData.ipAddr; --- setState(LEAD_NORMAL1_STATE); --- } else --- { --- initMsg = WHO_IS_LEADER_CMD; --- udpSend(&initMsg, 1, seed); --- setState(INIT1_STATE); --- } ------- ---- return; --- if (pthread_create(&threadUdpListen, NULL, udpListen, NULL) != 0) --- dhtLog("dhtInit() - ERROR creating threadUdpListen\n"); --- --- return; -------} ------- ---- void dhtExit() ---- { //TODO: do this gracefully, wait for response from leader, etc. ---- char msg; ---void dhtExit() { //TODO: do this gracefully, wait for response from leader, etc. --- char msg; ------- ---- msg = LEAVE_REQ; ---- udpSend(&msg, 1, leader); ---- dhtLog("dhtExit(): cleaning up...\n"); ---- pthread_cancel(threadUdpListen); ---- close(udpPollSock.fd); ---- free(hostArray); ---- free(hostReplied); ---- free(blockOwnerArray); ---- fclose(logfile); --- msg = LEAVE_REQ; --- udpSend(&msg, 1, leader); --- dhtLog("dhtExit(): cleaning up...\n"); --- pthread_cancel(threadUdpListen); --- close(udpPollSock.fd); --- free(hostArray); --- free(hostReplied); --- free(blockOwnerArray); --- fclose(logfile); ------- ---- return; --- return; -------} ------- ---- int dhtInsert(unsigned int key, unsigned int val) ---- { ---- struct sockaddr_in toAddr; ---- struct sockaddr_in fromAddr; ---- socklen_t socklen = sizeof(struct sockaddr_in); ---- struct pollfd pollsock; ---- char inBuffer[2]; ---- char outBuffer[9]; ---- ssize_t bytesRcvd; ---- int i; ---- int retval; ---- int status = -1; ---int dhtInsert(unsigned int key, unsigned int val) { --- struct sockaddr_in toAddr; --- struct sockaddr_in fromAddr; --- socklen_t socklen = sizeof(struct sockaddr_in); --- struct pollfd pollsock; --- char inBuffer[2]; --- char outBuffer[9]; --- ssize_t bytesRcvd; --- int i; --- int retval; --- int status = -1; ------- ---- bzero((char *)&toAddr, socklen); ---- toAddr.sin_family = AF_INET; ---- toAddr.sin_port = htons(UDP_PORT); --- bzero((char *)&toAddr, socklen); --- toAddr.sin_family = AF_INET; --- toAddr.sin_port = htons(UDP_PORT); ------- ---- while (status != OPERATION_OK) ---- { ---- pthread_mutex_lock(&stateMutex); ---- while (!(state == NORMAL_STATE || state == LEAD_NORMAL1_STATE ---- || state == LEAD_NORMAL2_STATE || state == REBUILD4_STATE ---- || state == LEAD_REBUILD3_STATE)) ---- pthread_cond_wait(&stateCond, &stateMutex); ---- toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); ---- pthread_mutex_unlock(&stateMutex); - while (status != OPERATION_OK){ -- while (status != OPERATION_OK) { --- pthread_mutex_lock(&stateMutex); --- while (!(state == NORMAL_STATE || state == LEAD_NORMAL1_STATE --- || state == LEAD_NORMAL2_STATE || state == REBUILD4_STATE --- || state == LEAD_REBUILD3_STATE)) --- pthread_cond_wait(&stateCond, &stateMutex); --- toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); --- pthread_mutex_unlock(&stateMutex); ------- ---- if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ---- { ---- perror("dhtInsert():socket()"); ---- return -1; ---- } ---- pollsock.events = POLLIN; - if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){ -- if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { --- perror("dhtInsert():socket()"); --- return -1; --- } --- pollsock.events = POLLIN; ------- ---- outBuffer[0] = INSERT_CMD; ---- write4(&outBuffer[1], key); ---- write4(&outBuffer[5], val); --- outBuffer[0] = INSERT_CMD; --- write4(&outBuffer[1], key); --- write4(&outBuffer[5], val); ------- ---- for (i = 0; i < INSERT_RETRIES; i++) ---- { ---- if (sendto(pollsock.fd, outBuffer, 9, 0, (struct sockaddr *)&toAddr, ---- socklen) < 0) ---- { ---- perror("dhtInsert():sendto()"); ---- break; ---- } ---- retval = poll(&pollsock, 1, INSERT_TIMEOUT_MS); ---- if (retval < 0) ---- { ---- perror("dhtInsert():poll()"); ---- break; ---- } ---- if (retval > 0) ---- { ---- bytesRcvd = recvfrom(pollsock.fd, inBuffer, 2, 0, ---- (struct sockaddr *)&fromAddr, &socklen); ---- if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr ---- && fromAddr.sin_port == toAddr.sin_port ---- && bytesRcvd == 2 && inBuffer[0] == INSERT_RES) ---- { ---- status = inBuffer[1]; //status from remote host ---- break; ---- } ---- } ---- } ---- if (status != OPERATION_OK) ---- { ---- pthread_mutex_lock(&stateMutex); ---- setState(REBUILD0_STATE); ---- outBuffer[0] = REBUILD_REQ; ---- udpSend(outBuffer, 1, leader); ---- pthread_mutex_unlock(&stateMutex); ---- } - for (i = 0; i < INSERT_RETRIES; i++) - { -- for (i = 0; i < INSERT_RETRIES; i++) { --- if (sendto(pollsock.fd, outBuffer, 9, 0, (struct sockaddr *)&toAddr, - socklen) < 0){ -- socklen) < 0) { --- perror("dhtInsert():sendto()"); --- break; --- } --- retval = poll(&pollsock, 1, INSERT_TIMEOUT_MS); - if (retval < 0){ -- if (retval < 0) { --- perror("dhtInsert():poll()"); --- break; --- } - if (retval > 0){ -- if (retval > 0) { --- bytesRcvd = recvfrom(pollsock.fd, inBuffer, 2, 0, --- (struct sockaddr *)&fromAddr, &socklen); --- if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr --- && fromAddr.sin_port == toAddr.sin_port - && bytesRcvd == 2 && inBuffer[0] == INSERT_RES){ -- && bytesRcvd == 2 && inBuffer[0] == INSERT_RES) { --- status = inBuffer[1]; //status from remote host --- break; ------- } --- } --- } - if (status != OPERATION_OK){ -- if (status != OPERATION_OK) { --- pthread_mutex_lock(&stateMutex); --- setState(REBUILD0_STATE); --- outBuffer[0] = REBUILD_REQ; --- udpSend(outBuffer, 1, leader); --- pthread_mutex_unlock(&stateMutex); --- } --- } ------- ---- close(pollsock.fd); --- close(pollsock.fd); ------- ---- return status; --- return status; -------} ------- ---- int dhtInsertMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals) ---- { ---- int status; ---- int i; ---int dhtInsertMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals) { --- int status; --- int i; ------- ---- status = 0; ---- for (i = 0; i < numKeys; i++) ---- { ---- if (dhtInsert(keys[i], vals[i]) != 0) ---- status = -1; ---- } ---- return status; --- status = 0; - for (i = 0; i < numKeys; i++) - { -- for (i = 0; i < numKeys; i++) { --- if (dhtInsert(keys[i], vals[i]) != 0) --- status = -1; --- } --- return status; -------} ------- ---- int dhtRemove(unsigned int key) ---- { ---- struct sockaddr_in toAddr; ---- struct sockaddr_in fromAddr; ---- socklen_t socklen = sizeof(struct sockaddr_in); ---- struct pollfd pollsock; ---- char inBuffer[2]; ---- char outBuffer[5]; ---- ssize_t bytesRcvd; ---- int i; ---- int retval; ---- int status = -1; ---int dhtRemove(unsigned int key) { --- struct sockaddr_in toAddr; --- struct sockaddr_in fromAddr; --- socklen_t socklen = sizeof(struct sockaddr_in); --- struct pollfd pollsock; --- char inBuffer[2]; --- char outBuffer[5]; --- ssize_t bytesRcvd; --- int i; --- int retval; --- int status = -1; ------- ---- bzero((char *)&toAddr, socklen); ---- toAddr.sin_family = AF_INET; ---- toAddr.sin_port = htons(UDP_PORT); --- bzero((char *)&toAddr, socklen); --- toAddr.sin_family = AF_INET; --- toAddr.sin_port = htons(UDP_PORT); ------- ---- while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) ---- { ---- pthread_mutex_lock(&stateMutex); ---- while (!(state == NORMAL_STATE || state == LEAD_NORMAL1_STATE ---- || state == LEAD_NORMAL2_STATE)) ---- pthread_cond_wait(&stateCond, &stateMutex); ---- toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); ---- pthread_mutex_unlock(&stateMutex); - while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)){ -- while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) { --- pthread_mutex_lock(&stateMutex); --- while (!(state == NORMAL_STATE || state == LEAD_NORMAL1_STATE --- || state == LEAD_NORMAL2_STATE)) --- pthread_cond_wait(&stateCond, &stateMutex); --- toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); --- pthread_mutex_unlock(&stateMutex); ------- ---- if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ---- { ---- perror("dhtRemove():socket()"); ---- return -1; ---- } ---- pollsock.events = POLLIN; - if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){ -- if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { --- perror("dhtRemove():socket()"); --- return -1; --- } --- pollsock.events = POLLIN; ------- ---- outBuffer[0] = REMOVE_CMD; ---- write4(&outBuffer[1], key); --- outBuffer[0] = REMOVE_CMD; --- write4(&outBuffer[1], key); ------- ---- for (i = 0; i < REMOVE_RETRIES; i++) ---- { ---- if (sendto(pollsock.fd, outBuffer, 5, 0, (struct sockaddr *)&toAddr, ---- socklen) < 0) ---- { ---- perror("dhtRemove():sendto()"); ---- break; ---- } ---- retval = poll(&pollsock, 1, REMOVE_TIMEOUT_MS); ---- if (retval < 0) ---- { ---- perror("dhtRemove():poll()"); ---- break; ---- } ---- if (retval > 0) ---- { ---- bytesRcvd = recvfrom(pollsock.fd, inBuffer, 2, 0, ---- (struct sockaddr *)&fromAddr, &socklen); ---- if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr ---- && fromAddr.sin_port == toAddr.sin_port ---- && bytesRcvd == 2 && inBuffer[0] == REMOVE_RES) ---- { ---- status = inBuffer[1]; //status from remote host ---- break; ---- } ---- } ---- } ---- if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) ---- { ---- pthread_mutex_lock(&stateMutex); ---- setState(REBUILD0_STATE); ---- outBuffer[0] = REBUILD_REQ; ---- udpSend(outBuffer, 1, leader); ---- pthread_mutex_unlock(&stateMutex); ---- } - for (i = 0; i < REMOVE_RETRIES; i++) - { -- for (i = 0; i < REMOVE_RETRIES; i++) { --- if (sendto(pollsock.fd, outBuffer, 5, 0, (struct sockaddr *)&toAddr, - socklen) < 0){ -- socklen) < 0) { --- perror("dhtRemove():sendto()"); --- break; --- } --- retval = poll(&pollsock, 1, REMOVE_TIMEOUT_MS); - if (retval < 0){ -- if (retval < 0) { --- perror("dhtRemove():poll()"); --- break; --- } - if (retval > 0){ -- if (retval > 0) { --- bytesRcvd = recvfrom(pollsock.fd, inBuffer, 2, 0, --- (struct sockaddr *)&fromAddr, &socklen); --- if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr --- && fromAddr.sin_port == toAddr.sin_port - && bytesRcvd == 2 && inBuffer[0] == REMOVE_RES){ -- && bytesRcvd == 2 && inBuffer[0] == REMOVE_RES) { --- status = inBuffer[1]; //status from remote host --- break; ------- } --- } --- } - if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)){ -- if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) { --- pthread_mutex_lock(&stateMutex); --- setState(REBUILD0_STATE); --- outBuffer[0] = REBUILD_REQ; --- udpSend(outBuffer, 1, leader); --- pthread_mutex_unlock(&stateMutex); --- } --- } ------- ---- close(pollsock.fd); --- close(pollsock.fd); ------- ---- return status; --- return status; -------} ------- ---- int dhtRemoveMult(unsigned int numKeys, unsigned int *keys) ---- { ---- int status; ---- int i; ---int dhtRemoveMult(unsigned int numKeys, unsigned int *keys) { --- int status; --- int i; ------- ---- status = 0; ---- for (i = 0; i < numKeys; i++) ---- { ---- if (dhtRemove(keys[i]) != 0) ---- status = -1; ---- } ---- return status; --- status = 0; - for (i = 0; i < numKeys; i++) - { -- for (i = 0; i < numKeys; i++) { --- if (dhtRemove(keys[i]) != 0) --- status = -1; --- } --- return status; -------} ------- ---- int dhtSearch(unsigned int key, unsigned int *val) ---- { ---- struct sockaddr_in toAddr; ---- struct sockaddr_in fromAddr; ---- socklen_t socklen = sizeof(struct sockaddr_in); ---- struct pollfd pollsock; ---- char inBuffer[6]; ---- char outBuffer[5]; ---- ssize_t bytesRcvd; ---- int i; ---- int retval; ---- int status = -1; ---int dhtSearch(unsigned int key, unsigned int *val) { --- struct sockaddr_in toAddr; --- struct sockaddr_in fromAddr; --- socklen_t socklen = sizeof(struct sockaddr_in); --- struct pollfd pollsock; --- char inBuffer[6]; --- char outBuffer[5]; --- ssize_t bytesRcvd; --- int i; --- int retval; --- int status = -1; ------- ---- bzero((char *)&toAddr, socklen); ---- toAddr.sin_family = AF_INET; ---- toAddr.sin_port = htons(UDP_PORT); --- bzero((char *)&toAddr, socklen); --- toAddr.sin_family = AF_INET; --- toAddr.sin_port = htons(UDP_PORT); ------- ---- while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) ---- { ---- pthread_mutex_lock(&stateMutex); ---- while (numBlocks == 0) ---- pthread_cond_wait(&stateCond, &stateMutex); ---- toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); ---- pthread_mutex_unlock(&stateMutex); - while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)){ -- while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) { --- pthread_mutex_lock(&stateMutex); --- while (numBlocks == 0) --- pthread_cond_wait(&stateCond, &stateMutex); --- toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); --- pthread_mutex_unlock(&stateMutex); ------- ---- if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ---- { ---- perror("dhtSearch():socket()"); ---- return -1; ---- } ---- pollsock.events = POLLIN; - if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){ -- if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { --- perror("dhtSearch():socket()"); --- return -1; --- } --- pollsock.events = POLLIN; ------- ---- outBuffer[0] = SEARCH_CMD; ---- write4(&outBuffer[1], key); --- outBuffer[0] = SEARCH_CMD; --- write4(&outBuffer[1], key); ------- ---- for (i = 0; i < SEARCH_RETRIES; i++) ---- { ---- if (sendto(pollsock.fd, outBuffer, 5, 0, (struct sockaddr *)&toAddr, ---- socklen) < 0) ---- { ---- perror("dhtSearch():sendto()"); ---- break; ---- } ---- retval = poll(&pollsock, 1, SEARCH_TIMEOUT_MS); ---- if (retval < 0) ---- { ---- perror("dhtSearch():poll()"); ---- break; ---- } ---- if (retval > 0) ---- { ---- bytesRcvd = recvfrom(pollsock.fd, inBuffer, 6, 0, ---- (struct sockaddr *)&fromAddr, &socklen); ---- if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr ---- && fromAddr.sin_port == toAddr.sin_port ---- && bytesRcvd == 6 && inBuffer[0] == SEARCH_RES) ---- { ---- status = inBuffer[1]; //status from remote host ---- *val = read4(&inBuffer[2]); ---- break; ---- } ---- } ---- } ---- if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) ---- { ---- pthread_mutex_lock(&stateMutex); ---- setState(REBUILD0_STATE); ---- outBuffer[0] = REBUILD_REQ; ---- udpSend(outBuffer, 1, leader); ---- pthread_mutex_unlock(&stateMutex); ---- } - for (i = 0; i < SEARCH_RETRIES; i++) - { -- for (i = 0; i < SEARCH_RETRIES; i++) { --- if (sendto(pollsock.fd, outBuffer, 5, 0, (struct sockaddr *)&toAddr, - socklen) < 0){ -- socklen) < 0) { --- perror("dhtSearch():sendto()"); --- break; --- } --- retval = poll(&pollsock, 1, SEARCH_TIMEOUT_MS); - if (retval < 0){ -- if (retval < 0) { --- perror("dhtSearch():poll()"); --- break; --- } - if (retval > 0){ -- if (retval > 0) { --- bytesRcvd = recvfrom(pollsock.fd, inBuffer, 6, 0, --- (struct sockaddr *)&fromAddr, &socklen); --- if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr --- && fromAddr.sin_port == toAddr.sin_port - && bytesRcvd == 6 && inBuffer[0] == SEARCH_RES){ -- && bytesRcvd == 6 && inBuffer[0] == SEARCH_RES) { --- status = inBuffer[1]; //status from remote host --- *val = read4(&inBuffer[2]); --- break; ------- } --- } --- } - if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)){ -- if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) { --- pthread_mutex_lock(&stateMutex); --- setState(REBUILD0_STATE); --- outBuffer[0] = REBUILD_REQ; --- udpSend(outBuffer, 1, leader); --- pthread_mutex_unlock(&stateMutex); --- } --- } ------- ---- close(pollsock.fd); --- close(pollsock.fd); ------- ---- return status; --- return status; -------} ------- ---- int dhtSearchMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals) ---- { ---- int i; ---- int status = 0; ---- for (i = 0; i < numKeys; i++) ---- { ---- if (dhtSearch(keys[i], &vals[i]) != 0) ---- status = -1; ---- } ---- return status; ---int dhtSearchMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals) { --- int i; --- int status = 0; - for (i = 0; i < numKeys; i++) - { -- for (i = 0; i < numKeys; i++) { --- if (dhtSearch(keys[i], &vals[i]) != 0) --- status = -1; --- } --- return status; -------} ------- -------/******************************************************************************* -------* Local Function Definitions -------*******************************************************************************/ ------- ---- int msgSizeOk(unsigned char *msg, unsigned int size) ---- { ---- unsigned short tmpNumHosts; ---- unsigned short tmpNumBlocks; ---int msgSizeOk(unsigned char *msg, unsigned int size) { --- unsigned short tmpNumHosts; --- unsigned short tmpNumBlocks; ------- ---- if (size < 1) ---- return 1; --- if (size < 1) --- return 1; ------- ---- switch (msg[0]) ---- { ---- case WHO_IS_LEADER_CMD: ---- case LEAVE_REQ: ---- case LEAVE_RES: ---- case DHT_UPDATE_RES: ---- case REBUILD_REQ: ---- case REBUILD_CMD: ---- case FILL_DHT_CMD: ---- case FILL_DHT_RES: ---- case RESUME_NORMAL_CMD: ---- case RESUME_NORMAL_RES: ---- return (size == 1); ---- case INSERT_RES: ---- case REMOVE_RES: ---- case JOIN_RES: ---- return (size == 2); ---- case REMOVE_CMD: ---- case SEARCH_CMD: ---- case WHO_IS_LEADER_RES: ---- case JOIN_REQ: ---- case ELECT_LEADER_CMD: ---- return (size == 5); ---- case SEARCH_RES: ---- return (size == 6); ---- case INSERT_CMD: ---- return (size == 9); ---- case DHT_UPDATE_CMD: ---- if (size < 5) ---- return 1; ---- tmpNumHosts = read2(&msg[1]); ---- tmpNumBlocks = read2(&msg[3]); ---- return (size == (5+sizeof(struct hostData)*tmpNumHosts+2*tmpNumBlocks)); ---- case ELECT_LEADER_RES: ---- if (size < 2) ---- return 1; ---- if (msg[1] == 0xFF) ---- return (size == 2); ---- if (size < 4) ---- return 1; ---- tmpNumHosts = read2(&msg[2]); ---- return (size == (4 + sizeof(struct hostData) * tmpNumHosts)); ---- case CONGRATS_CMD: ---- if (size < 3) ---- return 1; ---- tmpNumHosts = read2(&msg[1]); ---- return (size == (3 + sizeof(struct hostData) * tmpNumHosts)); ---- default: ---- return 1; ---- } - switch (msg[0]){ -- switch (msg[0]) { --- case WHO_IS_LEADER_CMD: --- case LEAVE_REQ: --- case LEAVE_RES: --- case DHT_UPDATE_RES: --- case REBUILD_REQ: --- case REBUILD_CMD: --- case FILL_DHT_CMD: --- case FILL_DHT_RES: --- case RESUME_NORMAL_CMD: --- case RESUME_NORMAL_RES: --- return (size == 1); --- --- case INSERT_RES: --- case REMOVE_RES: --- case JOIN_RES: --- return (size == 2); --- --- case REMOVE_CMD: --- case SEARCH_CMD: --- case WHO_IS_LEADER_RES: --- case JOIN_REQ: --- case ELECT_LEADER_CMD: --- return (size == 5); --- --- case SEARCH_RES: --- return (size == 6); --- --- case INSERT_CMD: --- return (size == 9); --- --- case DHT_UPDATE_CMD: --- if (size < 5) --- return 1; --- tmpNumHosts = read2(&msg[1]); --- tmpNumBlocks = read2(&msg[3]); --- return (size == (5+sizeof(struct hostData)*tmpNumHosts+2*tmpNumBlocks)); --- --- case ELECT_LEADER_RES: --- if (size < 2) --- return 1; --- if (msg[1] == 0xFF) --- return (size == 2); --- if (size < 4) --- return 1; --- tmpNumHosts = read2(&msg[2]); --- return (size == (4 + sizeof(struct hostData) * tmpNumHosts)); --- --- case CONGRATS_CMD: --- if (size < 3) --- return 1; --- tmpNumHosts = read2(&msg[1]); --- return (size == (3 + sizeof(struct hostData) * tmpNumHosts)); --- --- default: --- return 1; --- } -------} ------- ---- unsigned short read2(unsigned char *ptr) ---- { ---- unsigned short tmp = (ptr[1] << 8) | ptr[0]; ---- return tmp; ---unsigned short read2(unsigned char *ptr) { --- unsigned short tmp = (ptr[1] << 8) | ptr[0]; --- return tmp; -------} ------- ---- unsigned int read4(unsigned char *ptr) ---- { ---- unsigned int tmp = (ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]; ---- return tmp; ---unsigned int read4(unsigned char *ptr) { --- unsigned int tmp = (ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]; --- return tmp; -------} ------- ---- void write2(unsigned char *ptr, unsigned short tmp) ---- { ---- ptr[1] = (tmp >> 8) & 0xFF; ---- ptr[0] = tmp & 0xFF; ---- return; ---void write2(unsigned char *ptr, unsigned short tmp) { --- ptr[1] = (tmp >> 8) & 0xFF; --- ptr[0] = tmp & 0xFF; --- return; -------} ------- ---- void write4(unsigned char *ptr, unsigned int tmp) ---- { ---- ptr[3] = (tmp >> 24) & 0xFF; ---- ptr[2] = (tmp >> 16) & 0xFF; ---- ptr[1] = (tmp >> 8) & 0xFF; ---- ptr[0] = tmp & 0xFF; ---- return; ---void write4(unsigned char *ptr, unsigned int tmp) { --- ptr[3] = (tmp >> 24) & 0xFF; --- ptr[2] = (tmp >> 16) & 0xFF; --- ptr[1] = (tmp >> 8) & 0xFF; --- ptr[0] = tmp & 0xFF; --- return; -------} ------- ---- unsigned int getMyIpAddr(const char *interfaceStr) ---- { ---- int sock; ---- struct ifreq interfaceInfo; ---- struct sockaddr_in *myAddr = (struct sockaddr_in *)&interfaceInfo.ifr_addr; ---unsigned int getMyIpAddr(const char *interfaceStr) { --- int sock; --- struct ifreq interfaceInfo; --- struct sockaddr_in *myAddr = (struct sockaddr_in *)&interfaceInfo.ifr_addr; ------- ---- memset(&interfaceInfo, 0, sizeof(struct ifreq)); --- memset(&interfaceInfo, 0, sizeof(struct ifreq)); ------- ---- if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) ---- { ---- perror("getMyIpAddr():socket()"); ---- return 1; ---- } - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){ -- if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { --- perror("getMyIpAddr():socket()"); --- return 1; --- } ------- ---- strcpy(interfaceInfo.ifr_name, interfaceStr); ---- myAddr->sin_family = AF_INET; ---- ---- if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0) ---- { ---- perror("getMyIpAddr():ioctl()"); ---- return 1; ---- } --- strcpy(interfaceInfo.ifr_name, interfaceStr); --- myAddr->sin_family = AF_INET; ------- ---- return ntohl(myAddr->sin_addr.s_addr); - if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0){ -- if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0) { --- perror("getMyIpAddr():ioctl()"); --- return 1; --- } --- --- return ntohl(myAddr->sin_addr.s_addr); -------} ------- ---- int udpSend(unsigned char *msg, unsigned int size, unsigned int destIp) ---- { ---- struct sockaddr_in peerAddr; ---- socklen_t socklen = sizeof(struct sockaddr_in); ---int udpSend(unsigned char *msg, unsigned int size, unsigned int destIp) { --- struct sockaddr_in peerAddr; --- socklen_t socklen = sizeof(struct sockaddr_in); ------- ---- bzero(&peerAddr, socklen); ---- peerAddr.sin_family = AF_INET; ---- peerAddr.sin_addr.s_addr = htonl(destIp); ---- peerAddr.sin_port = htons(UDP_PORT); --- bzero(&peerAddr, socklen); --- peerAddr.sin_family = AF_INET; --- peerAddr.sin_addr.s_addr = htonl(destIp); --- peerAddr.sin_port = htons(UDP_PORT); ------- ---- if (size >= 1) ---- { ---- if (msg[0] < NUM_MSG_TYPES) ---- dhtLog("udpSend(): sending %s to %s, %d bytes\n", msg_types[msg[0]], ---- inet_ntoa(peerAddr.sin_addr), size); ---- else ---- dhtLog("udpSend(): sending unknown message to %s, %d bytes\n", ---- inet_ntoa(peerAddr.sin_addr), size); ---- } - if (size >= 1){ -- if (size >= 1) { --- if (msg[0] < NUM_MSG_TYPES) --- dhtLog("udpSend(): sending %s to %s, %d bytes\n", msg_types[msg[0]], --- inet_ntoa(peerAddr.sin_addr), size); --- else --- dhtLog("udpSend(): sending unknown message to %s, %d bytes\n", --- inet_ntoa(peerAddr.sin_addr), size); --- } ------- ---- if (sendto(udpPollSock.fd, (void *)msg, size, 0, (struct sockaddr *)&peerAddr, ---- socklen) < 0) ---- { ---- perror("udpSend():sendto()"); ---- return -1; ---- } ---- ---- return 0; --- if (sendto(udpPollSock.fd, (void *)msg, size, 0, (struct sockaddr *)&peerAddr, - socklen) < 0){ -- socklen) < 0) { --- perror("udpSend():sendto()"); --- return -1; --- } --- --- return 0; -------} ------- ---- int udpSendAll(unsigned char *msg, unsigned int size) ---- { ---- int i; ---- int status = 0; ---- for (i = 0; i < numHosts; i++) ---- { ---- if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)) ---- { ---- if (udpSend(msg, size, hostArray[i].ipAddr) != 0) ---- status = -1; ---- } ---- } ---- return status; ---int udpSendAll(unsigned char *msg, unsigned int size) { --- int i; --- int status = 0; - for (i = 0; i < numHosts; i++) - { - if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)){ -- for (i = 0; i < numHosts; i++) { -- if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)) { --- if (udpSend(msg, size, hostArray[i].ipAddr) != 0) --- status = -1; --- } --- } --- return status; -------} ------- -------//note: make sure this is only executed in a valid state, where numBlocks != 0 ---- unsigned int hash(unsigned int x) ---- { ---- return (x % numBlocks); ---unsigned int hash(unsigned int x) { --- return (x % numBlocks); -------} ------- -------//note: make sure this is only executed in a valid state, where these arrays -------// are allocated and the index mappings are consistent ---- unsigned int getKeyOwner(unsigned int key) ---- { ---- return hostArray[blockOwnerArray[hash(key)]].ipAddr; ---unsigned int getKeyOwner(unsigned int key) { --- return hostArray[blockOwnerArray[hash(key)]].ipAddr; -------} ------- -------//sets state and timer, if applicable ---- void setState(unsigned int newState) ---- { ---- struct timeval now; ---- int i; ---- ---- gettimeofday(&now, NULL); ---- ---- if (newState >= NUM_STATES) ---- { ---- dhtLog("setState(): ERROR: invalid state %d\n", newState); ---- } ---- else ---- { ---- if (timeout_vals[newState].tv_sec == 0 ---- && timeout_vals[newState].tv_usec == 0) ---- { //no timer ---- timerSet = 0; ---- } ---- else ---- { ---- timeradd(&now, &timeout_vals[newState], &timer); ---- timerSet = 1; ---- } ---- timeoutCntr = 0; ---- state = newState; ---- //TODO: only do this for states that require it ---- for (i = 0; i < numHosts; i++) ---- hostReplied[i] = 0; ---void setState(unsigned int newState) { --- struct timeval now; --- int i; ------- ---- dhtLog("setState(): state set to %s\n", state_names[state]); ---- } --- gettimeofday(&now, NULL); ------- ---- return; - if (newState >= NUM_STATES){ -- if (newState >= NUM_STATES) { --- dhtLog("setState(): ERROR: invalid state %d\n", newState); --- } else --- { --- if (timeout_vals[newState].tv_sec == 0 - && timeout_vals[newState].tv_usec == 0){ //no timer -- && timeout_vals[newState].tv_usec == 0) { //no timer --- timerSet = 0; --- } else --- { --- timeradd(&now, &timeout_vals[newState], &timer); --- timerSet = 1; --- } --- timeoutCntr = 0; --- state = newState; --- //TODO: only do this for states that require it --- for (i = 0; i < numHosts; i++) --- hostReplied[i] = 0; --- --- dhtLog("setState(): state set to %s\n", state_names[state]); --- } --- --- return; -------} ------- -------//TODO: improve these simple and inefficient functions ---- int checkReplied(unsigned int ipAddr) ---- { ---- int i; ---int checkReplied(unsigned int ipAddr) { --- int i; ------- ---- i = findHost(ipAddr); --- i = findHost(ipAddr); ------- ---- if (i == -1) ---- return -1; --- if (i == -1) --- return -1; ------- ---- hostReplied[i] = 1; --- hostReplied[i] = 1; ------- ---- return 0; --- return 0; -------} ------- ---- int allReplied() ---- { ---- int i; ---int allReplied() { --- int i; ------- ---- for (i = 0; i < numHosts; i++) ---- if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)) ---- return 0; ---- ---- return 1; --- for (i = 0; i < numHosts; i++) --- if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)) --- return 0; --- --- return 1; -------} ------- ---- int findHost(unsigned int ipAddr) ---- { ---- int i; ---int findHost(unsigned int ipAddr) { --- int i; ------- ---- for (i = 0; i < numHosts; i++) ---- if (hostArray[i].ipAddr == ipAddr) ---- return i; //found, return index ---- ---- return -1; //not found --- for (i = 0; i < numHosts; i++) --- if (hostArray[i].ipAddr == ipAddr) --- return i; //found, return index --- --- return -1; //not found -------} ------- ---- int removeHost(unsigned int ipAddr) ---- { ---- int i, j; ---int removeHost(unsigned int ipAddr) { --- int i, j; ------- ---- i = findHost(ipAddr); --- i = findHost(ipAddr); ------- ---- if (i == -1) ---- return -1; --- if (i == -1) --- return -1; ------- ---- for (j = 0; j < numBlocks; j++) ---- { ---- if (blockOwnerArray[j] == i) ---- blockOwnerArray[j] = 0; //TODO: is this what I want to have happen? ---- else if (blockOwnerArray[j] > i) ---- blockOwnerArray[j]--; ---- } - for (j = 0; j < numBlocks; j++) - { -- for (j = 0; j < numBlocks; j++) { --- if (blockOwnerArray[j] == i) --- blockOwnerArray[j] = 0; //TODO: is this what I want to have happen? --- else if (blockOwnerArray[j] > i) --- blockOwnerArray[j]--; --- } ------- ---- for (; i < numHosts - 1; i++) ---- { ---- hostArray[i] = hostArray[i+1]; ---- hostReplied[i] = hostReplied[i+1]; ---- } ---- numHosts--; - for (; i < numHosts - 1; i++) - { -- for (; i < numHosts - 1; i++) { --- hostArray[i] = hostArray[i+1]; --- hostReplied[i] = hostReplied[i+1]; --- } --- numHosts--; ------- ---- return 0; --- return 0; -------} ------- ---- void removeUnresponsiveHosts() ---- { ---- int i; ---void removeUnresponsiveHosts() { --- int i; ------- ---- for (i = 0; i < numHosts; i++) ---- { ---- if (!hostReplied[i] && hostArray[i].ipAddr != myHostData.ipAddr) ---- removeHost(hostArray[i].ipAddr); ---- } - for (i = 0; i < numHosts; i++) - { -- for (i = 0; i < numHosts; i++) { --- if (!hostReplied[i] && hostArray[i].ipAddr != myHostData.ipAddr) --- removeHost(hostArray[i].ipAddr); --- } -------} ------- ---- int addHost(struct hostData newHost) ---- { ---- struct hostData *newHostArray; ---- unsigned char *newHostReplied; ---- int i; ---- int j; ---int addHost(struct hostData newHost) { --- struct hostData *newHostArray; --- unsigned char *newHostReplied; --- int i; --- int j; ------- ---- for (i = 0; i < numHosts; i++) - for (i = 0; i < numHosts; i++) - { - if (hostArray[i].ipAddr == newHost.ipAddr){ -- for (i = 0; i < numHosts; i++) { -- if (hostArray[i].ipAddr == newHost.ipAddr) { --- hostArray[i] = newHost; --- hostReplied[i] = 0; --- return 0; - } else if (hostArray[i].ipAddr > newHost.ipAddr) { - if (numHosts == hostArraySize){ -- } else if (hostArray[i].ipAddr > newHost.ipAddr) { -- if (numHosts == hostArraySize) { --- newHostArray = calloc(2 * hostArraySize, sizeof(struct hostData)); --- newHostReplied = calloc(2 * hostArraySize, sizeof(unsigned char)); --- memcpy(newHostArray, hostArray, (i * sizeof(struct hostData))); --- memcpy(newHostReplied, hostReplied, (i * sizeof(unsigned char))); --- newHostArray[i] = newHost; --- newHostReplied[i] = 0; --- memcpy(&newHostArray[i+1], &hostArray[i], ((numHosts - i) * --- sizeof(struct hostData))); --- memcpy(&newHostReplied[i+1], &hostReplied[i], ((numHosts - i) * --- sizeof(unsigned char))); --- free(hostArray); --- free(hostReplied); --- hostArray = newHostArray; --- hostReplied = newHostReplied; --- hostArraySize = 2 * hostArraySize; --- } else --- { - for (j = numHosts; j > i; j--) ----- { ---- if (hostArray[i].ipAddr == newHost.ipAddr) ---- { ---- hostArray[i] = newHost; ---- hostReplied[i] = 0; ---- return 0; ---- } ---- else if (hostArray[i].ipAddr > newHost.ipAddr) ---- { ---- if (numHosts == hostArraySize) ---- { ---- newHostArray = calloc(2 * hostArraySize, sizeof(struct hostData)); ---- newHostReplied = calloc(2 * hostArraySize, sizeof(unsigned char)); ---- memcpy(newHostArray, hostArray, (i * sizeof(struct hostData))); ---- memcpy(newHostReplied, hostReplied, (i * sizeof(unsigned char))); ---- newHostArray[i] = newHost; ---- newHostReplied[i] = 0; ---- memcpy(&newHostArray[i+1], &hostArray[i], ((numHosts - i) * ---- sizeof(struct hostData))); ---- memcpy(&newHostReplied[i+1], &hostReplied[i], ((numHosts - i) * ---- sizeof(unsigned char))); ---- free(hostArray); ---- free(hostReplied); ---- hostArray = newHostArray; ---- hostReplied = newHostReplied; ---- hostArraySize = 2 * hostArraySize; ---- } ---- else ---- { ---- for (j = numHosts; j > i; j--) ---- { ---- hostArray[j] = hostArray[j-1]; ---- hostReplied[j] = hostReplied[j-1]; ---- } ---- hostArray[i] = newHost; ---- hostReplied[i] = 0; ---- } ---- for(j = 0; j < numBlocks; j++) ---- { ---- if (blockOwnerArray[j] >= i) ---- blockOwnerArray[j]++; ---- } ---- numHosts++; ---- return 1; ---- } -- for (j = numHosts; j > i; j--) { --- hostArray[j] = hostArray[j-1]; --- hostReplied[j] = hostReplied[j-1]; ------- } --- hostArray[i] = newHost; --- hostReplied[i] = 0; --- } - for(j = 0; j < numBlocks; j++) - { -- for(j = 0; j < numBlocks; j++) { --- if (blockOwnerArray[j] >= i) --- blockOwnerArray[j]++; --- } --- numHosts++; --- return 1; --- } --- } ------- ---- //nothing greater, add to end ---- if (numHosts == hostArraySize) ---- { ---- newHostArray = calloc(2 * hostArraySize, sizeof(struct hostData)); ---- newHostReplied = calloc(2 * hostArraySize, sizeof(unsigned char)); ---- memcpy(newHostArray, hostArray, (numHosts * sizeof(struct hostData))); ---- memcpy(newHostReplied, hostReplied, (numHosts * sizeof(unsigned char))); ---- free(hostArray); ---- free(hostReplied); ---- hostArray = newHostArray; ---- hostReplied = newHostReplied; ---- hostArraySize = 2 * hostArraySize; ---- } --- //nothing greater, add to end - if (numHosts == hostArraySize){ -- if (numHosts == hostArraySize) { --- newHostArray = calloc(2 * hostArraySize, sizeof(struct hostData)); --- newHostReplied = calloc(2 * hostArraySize, sizeof(unsigned char)); --- memcpy(newHostArray, hostArray, (numHosts * sizeof(struct hostData))); --- memcpy(newHostReplied, hostReplied, (numHosts * sizeof(unsigned char))); --- free(hostArray); --- free(hostReplied); --- hostArray = newHostArray; --- hostReplied = newHostReplied; --- hostArraySize = 2 * hostArraySize; --- } ------- ---- hostArray[numHosts] = newHost; ---- hostReplied[numHosts] = 0; ---- numHosts++; ---- return 1; --- hostArray[numHosts] = newHost; --- hostReplied[numHosts] = 0; --- numHosts++; --- return 1; -------} ------- ---- void makeAssignments() ---- { ---- int i; ---void makeAssignments() { --- int i; ------- ---- if (numBlocks < numHosts) ---- { ---- free(blockOwnerArray); ---- while (numBlocks < numHosts) ---- numBlocks *= 2; ---- blockOwnerArray = calloc(numBlocks, sizeof(unsigned short)); ---- } - if (numBlocks < numHosts){ -- if (numBlocks < numHosts) { --- free(blockOwnerArray); --- while (numBlocks < numHosts) --- numBlocks *= 2; --- blockOwnerArray = calloc(numBlocks, sizeof(unsigned short)); --- } ------- ---- for (i = 0; i < numBlocks; i++) ---- blockOwnerArray[i] = i % numHosts; --- for (i = 0; i < numBlocks; i++) --- blockOwnerArray[i] = i % numHosts; ------- ---- return; --- return; -------} ------- ---- void writeHostList() ---- { ---- int i; ---- struct in_addr tmpAddr; ---void writeHostList() { --- int i; --- struct in_addr tmpAddr; ------- ---- fprintf(logfile, "numHosts = %d\n", numHosts); ---- for (i = 0; i < numHosts; i++) ---- { ---- tmpAddr.s_addr = htonl(hostArray[i].ipAddr); ---- fprintf(logfile, "%d) %s, %d\n", i, inet_ntoa(tmpAddr), ---- hostArray[i].maxKeyCapacity); ---- } ---- return; --- fprintf(logfile, "numHosts = %d\n", numHosts); - for (i = 0; i < numHosts; i++) - { -- for (i = 0; i < numHosts; i++) { --- tmpAddr.s_addr = htonl(hostArray[i].ipAddr); --- fprintf(logfile, "%d) %s, %d\n", i, inet_ntoa(tmpAddr), --- hostArray[i].maxKeyCapacity); --- } --- return; -------} ------- ---- void dhtLog(const char *format, ...) ---- { ---- va_list args; ---void dhtLog(const char *format, ...) { --- va_list args; -------// struct timeval now; ------- -------// if (gettimeofday(&now, NULL) < 0) -------// { perror("dhtLog():gettimeofday()"); } ---- va_start(args, format); --- va_start(args, format); -------// if (fprintf(logfile, "%d.%06d:", now.tv_sec, now.tv_usec) < 0) -------// { perror("dhtLog():fprintf()"); } ---- if (vfprintf(logfile, format, args) < 0) ---- { perror("dhtLog():vfprintf()"); } ---- if (fflush(logfile) == EOF) ---- { perror("dhtLog():fflush()"); } ---- va_end(args); - if (vfprintf(logfile, format, args) < 0){ -- if (vfprintf(logfile, format, args) < 0) { --- perror("dhtLog():vfprintf()"); --- } - if (fflush(logfile) == EOF){ -- if (fflush(logfile) == EOF) { --- perror("dhtLog():fflush()"); --- } --- va_end(args); ------- ---- return; --- return; -------} ------- ---- void *fillTask() ---- { ---- unsigned int *vals; ---- unsigned int *keys; ---- unsigned int numKeys; ---- int i; ---- ---- vals = mhashGetKeys(&numKeys); //note: key of mhash is val of dht ---- keys = calloc(numKeys, sizeof(unsigned int)); ---void *fillTask() { --- unsigned int *vals; --- unsigned int *keys; --- unsigned int numKeys; --- int i; ------- ---- for (i = 0; i < numKeys; i++) ---- keys[i] = myHostData.ipAddr; --- vals = mhashGetKeys(&numKeys); //note: key of mhash is val of dht --- keys = calloc(numKeys, sizeof(unsigned int)); ------- ---- if (dhtInsertMult(numKeys, keys, vals) == 0) ---- fillStatus = 2; ---- else ---- fillStatus = 3; ---- ---- pthread_exit(NULL); --- for (i = 0; i < numKeys; i++) --- keys[i] = myHostData.ipAddr; --- --- if (dhtInsertMult(numKeys, keys, vals) == 0) --- fillStatus = 2; --- else --- fillStatus = 3; --- --- pthread_exit(NULL); -------} ------- ---- void *udpListen() ---- { ---- ssize_t bytesRcvd; ---- struct sockaddr_in peerAddr; ---- unsigned int peerIp; ---- socklen_t socklen = sizeof(struct sockaddr_in); ---- unsigned char inBuffer[MAX_MSG_SIZE]; ---- unsigned char outBuffer[MAX_MSG_SIZE]; ---- int pollret; ---- struct timeval now; ---- struct in_addr tmpAddr; ---- struct hostData tmpHost; ---- unsigned int tmpKey; ---- unsigned int tmpVal; ---- struct hostData *hostDataPtr; ---- unsigned short *uShortPtr; ---- unsigned int tmpUInt; ---- unsigned int tmpUShort; ---- int i; ---- unsigned int oldState; ---void *udpListen() { --- ssize_t bytesRcvd; --- struct sockaddr_in peerAddr; --- unsigned int peerIp; --- socklen_t socklen = sizeof(struct sockaddr_in); --- unsigned char inBuffer[MAX_MSG_SIZE]; --- unsigned char outBuffer[MAX_MSG_SIZE]; --- int pollret; --- struct timeval now; --- struct in_addr tmpAddr; --- struct hostData tmpHost; --- unsigned int tmpKey; --- unsigned int tmpVal; --- struct hostData *hostDataPtr; --- unsigned short *uShortPtr; --- unsigned int tmpUInt; --- unsigned int tmpUShort; --- int i; --- unsigned int oldState; ------- ---- dhtLog("udpListen(): linstening on port %d...\n", UDP_PORT); --- dhtLog("udpListen(): linstening on port %d...\n", UDP_PORT); ------- ---- while (1) ---- { ---- pollret = poll(&udpPollSock, 1, TIMEOUT_PERIOD); ---- pthread_mutex_lock(&stateMutex); ---- oldState = state; ---- if (pollret < 0) ---- { ---- perror("udpListen():poll()"); ---- } ---- else if (pollret > 0) ---- { ---- bytesRcvd = recvfrom(udpPollSock.fd, inBuffer, MAX_MSG_SIZE, 0, ---- (struct sockaddr *)&peerAddr, &socklen); ---- if (bytesRcvd < 1) ---- { ---- dhtLog("udpListen(): ERROR: bytesRcvd = %d\n", bytesRcvd); ---- } ---- else if (inBuffer[0] >= NUM_MSG_TYPES) ---- { ---- dhtLog("udpListen(): ERROR: unknown msg type = %d\n", inBuffer[0]); ---- } ---- else if (!msgSizeOk(inBuffer, bytesRcvd)) ---- { ---- dhtLog("udpListen(): ERROR: msg size not ok: type = %s\n, size = %d\n", ---- msg_types[inBuffer[0]], bytesRcvd); ---- } ---- else if (state == EXIT2_STATE) ---- { ---- //do nothing ---- } ---- else if (state == INIT1_STATE) ---- { //after initialization with seed, do not proceed until seed replies ---- dhtLog("udpListen(): received %s from %s, %d bytes\n", ---- msg_types[inBuffer[0]], inet_ntoa(peerAddr.sin_addr), bytesRcvd); ---- for (i = 0; i < bytesRcvd; i++) ---- dhtLog(" %x", inBuffer[i]); ---- dhtLog("\n"); ---- peerIp = ntohl(peerAddr.sin_addr.s_addr); ---- if (peerIp == seed && inBuffer[0] == WHO_IS_LEADER_RES) ---- { ---- tmpHost.ipAddr = peerIp; ---- tmpHost.maxKeyCapacity = 0; ---- addHost(tmpHost); ---- writeHostList(); ---- leader = read4(&inBuffer[1]); ---- tmpAddr.s_addr = htonl(leader); ---- dhtLog("leader = %s\n", inet_ntoa(tmpAddr)); ---- if (leader != 0) ---- { ---- setState(INIT2_STATE); ---- outBuffer[0] = JOIN_REQ; ---- write4(&outBuffer[1], myHostData.maxKeyCapacity); ---- udpSend(outBuffer, 5, leader); ---- } ---- else ---- { ---- electionOriginator = myHostData.ipAddr; ---- setState(ELECT1_STATE); ---- outBuffer[0] = ELECT_LEADER_CMD; ---- write4(&outBuffer[1], myHostData.ipAddr); //originator = me ---- udpSendAll(outBuffer, 5); ---- } ---- } ---- } ---- else ---- { ---- dhtLog("udpListen(): received %s from %s, %d bytes\n", ---- msg_types[inBuffer[0]], inet_ntoa(peerAddr.sin_addr), bytesRcvd); ---- for (i = 0; i < bytesRcvd; i++) ---- dhtLog(" %x", inBuffer[i]); ---- dhtLog("\n"); ---- peerIp = ntohl(peerAddr.sin_addr.s_addr); ---- switch (inBuffer[0]) ---- { ---- case INSERT_CMD: ---- if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE ---- || state == LEAD_NORMAL2_STATE || state == REBUILD4_STATE ---- || state == REBUILD5_STATE || state == LEAD_REBUILD3_STATE) ---- { ---- tmpKey = read4(&inBuffer[1]); ---- tmpVal = read4(&inBuffer[5]); ---- outBuffer[0] = INSERT_RES; ---- if (getKeyOwner(tmpKey) == myHostData.ipAddr) ---- { ---- if (chashInsert(myHashTable, tmpKey, (void *)tmpVal) == 0) ---- outBuffer[1] = OPERATION_OK; ---- else ---- outBuffer[1] = INTERNAL_ERROR; ---- } ---- else ---- { ---- outBuffer[1] = NOT_KEY_OWNER; ---- } ---- //reply to client socket ---- sendto(udpPollSock.fd, outBuffer, 2, 0, ---- (struct sockaddr *)&peerAddr, socklen); ---- } ---- break; ---- case REMOVE_CMD: ---- if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE ---- || state == LEAD_NORMAL2_STATE) ---- { ---- tmpKey = read4(&inBuffer[1]); ---- outBuffer[0] = REMOVE_RES; ---- if (getKeyOwner(tmpKey) == myHostData.ipAddr) ---- { ---- if (chashRemove(myHashTable, tmpKey) == 0) ---- outBuffer[1] = OPERATION_OK; ---- else ---- outBuffer[1] = KEY_NOT_FOUND; ---- } ---- else ---- { ---- outBuffer[1] = NOT_KEY_OWNER; ---- } ---- //reply to client socket ---- sendto(udpPollSock.fd, outBuffer, 2, 0, ---- (struct sockaddr *)&peerAddr, socklen); ---- } ---- break; ---- case SEARCH_CMD: ---- if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE ---- || state == LEAD_NORMAL2_STATE) ---- { ---- tmpKey = read4(&inBuffer[1]); ---- outBuffer[0] = SEARCH_RES; ---- if (getKeyOwner(tmpKey) == myHostData.ipAddr) ---- { ---- if ((tmpVal = (unsigned int)chashSearch(myHashTable, tmpKey)) != 0) ---- { ---- outBuffer[1] = OPERATION_OK; ---- write4(&outBuffer[2], tmpVal); ---- } ---- else ---- { ---- outBuffer[1] = KEY_NOT_FOUND; ---- write4(&outBuffer[2], 0); ---- } ---- } ---- else ---- { ---- outBuffer[1] = NOT_KEY_OWNER; ---- write4(&outBuffer[2], 0); ---- } ---- //reply to client socket ---- sendto(udpPollSock.fd, outBuffer, 6, 0, ---- (struct sockaddr *)&peerAddr, socklen); ---- } ---- break; ---- case WHO_IS_LEADER_CMD: ---- tmpHost.ipAddr = peerIp; ---- tmpHost.maxKeyCapacity = 0; ---- addHost(tmpHost); ---- writeHostList(); ---- outBuffer[0] = WHO_IS_LEADER_RES; ---- //leader == 0 means I don't know who it is ---- write4(&outBuffer[1], leader); ---- udpSend(outBuffer, 5, peerIp); ---- break; ---- case JOIN_REQ: ---- if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) ---- { ---- tmpHost.ipAddr = peerIp; ---- tmpHost.maxKeyCapacity = read4(&inBuffer[1]); ---- addHost(tmpHost); ---- writeHostList(); ---- if (state == LEAD_NORMAL1_STATE) ---- setState(LEAD_NORMAL2_STATE); ---- outBuffer[0] = JOIN_RES; ---- outBuffer[1] = 0; //status, success ---- udpSend(outBuffer, 2, peerIp); ---- } ---- else if (state == LEAD_REBUILD1_STATE) ---- { ---- //note: I don't need to addHost(). ---- checkReplied(peerIp); ---- outBuffer[0] = JOIN_RES; ---- outBuffer[1] = 0; //status, success ---- udpSend(outBuffer, 2, peerIp); ---- if (allReplied()) ---- { ---- makeAssignments(); ---- setState(LEAD_REBUILD2_STATE); ---- outBuffer[0] = DHT_UPDATE_CMD; ---- write2(&outBuffer[1], numHosts); ---- write2(&outBuffer[3], numBlocks); ---- memcpy(&outBuffer[5], hostArray, numHosts*sizeof(struct hostData)); ---- memcpy(&outBuffer[5+numHosts*sizeof(struct hostData)], ---- blockOwnerArray, numBlocks*2); ---- udpSendAll(outBuffer, 5 + sizeof(struct hostData) * numHosts ---- + 2 * numBlocks); ---- } ---- } ---- break; ---- case JOIN_RES: ---- if (state == REBUILD1_STATE) ---- { ---- setState(REBUILD2_STATE); ---- } ---- else if (state == INIT2_STATE) ---- { ---- setState(NORMAL_STATE); ---- } ---- break; ---- case LEAVE_REQ: ---- if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) ---- { //TODO: make this graceful, instead of just rebuilding ---- removeHost(peerIp); ---- if (state != LEAD_NORMAL2_STATE) ---- setState(LEAD_NORMAL2_STATE); ---- } ---- break; ---- case DHT_UPDATE_CMD: ---- if (state == REBUILD2_STATE && peerIp == leader) ---- { ---- free(hostArray); ---- free(blockOwnerArray); ---- numHosts = read2(&inBuffer[1]); ---- numBlocks = read2(&inBuffer[3]); ---- while (hostArraySize < numHosts) ---- hostArraySize *= 2; ---- hostArray = calloc(hostArraySize, sizeof(struct hostData)); ---- blockOwnerArray = calloc(numBlocks, 2); ---- memcpy(hostArray, &inBuffer[5], numHosts*sizeof(struct hostData)); ---- memcpy(blockOwnerArray, &inBuffer[5+numHosts*sizeof(struct hostData)], numBlocks*2); ---- writeHostList(); ---- setState(REBUILD3_STATE); ---- outBuffer[0] = DHT_UPDATE_RES; ---- udpSend(outBuffer, 1, peerIp); ---- } ---- break; ---- case DHT_UPDATE_RES: ---- if (state == LEAD_REBUILD2_STATE) ---- { ---- checkReplied(peerIp); ---- if (allReplied()) ---- { ---- setState(LEAD_REBUILD3_STATE); ---- outBuffer[0] = FILL_DHT_CMD; ---- udpSendAll(outBuffer, 1); ---- if (fillStatus != 0) ---- dhtLog("udpListen(): ERROR: fillTask already running\n"); ---- fillStatus = 1; ---- if (pthread_create(&threadFillTask, NULL, fillTask, NULL) != 0) ---- dhtLog("udpListen(): ERROR creating threadFillTask\n"); ---- } ---- } ---- break; ---- case ELECT_LEADER_CMD: ---- tmpUInt = read4(&inBuffer[1]); ---- if ((state == ELECT1_STATE || state == ELECT2_STATE) ---- && tmpUInt >= electionOriginator) ---- { //already participating in a higher-priority election ---- outBuffer[0] = ELECT_LEADER_RES; ---- outBuffer[1] = 0xFF; ---- udpSend(outBuffer, 2, peerIp); ---- } ---- else ---- { //join election ---- electionOriginator = tmpUInt; ---- electionParent = peerIp; ---- setState(ELECT1_STATE); ---- outBuffer[0] = ELECT_LEADER_CMD; ---- write4(&outBuffer[1], electionOriginator); ---- //don't bother forwarding the message to originator or parent ---- checkReplied(electionOriginator); ---- checkReplied(electionParent); ---- if (allReplied()) ---- { //in case that is everybody I know of ---- setState(ELECT2_STATE); ---- outBuffer[0] = ELECT_LEADER_RES; ---- outBuffer[1] = 0; ---- write2(&outBuffer[2], numHosts); ---- memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) ---- * numHosts); ---- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, ---- electionParent); ---- } ---- else ---- { ---- udpSendAll(outBuffer, 5); ---- } ---- } ---- break; ---- case ELECT_LEADER_RES: ---- if (state == ELECT1_STATE) ---- { ---- checkReplied(peerIp); ---- if (inBuffer[1] != 0xFF) ---- { ---- tmpUShort = read2(&inBuffer[2]); ---- hostDataPtr = (struct hostData *)&inBuffer[4]; ---- for (i = 0; i < tmpUShort; i++) ---- addHost(hostDataPtr[i]); ---- writeHostList(); ---- } ---- if (allReplied()) ---- { ---- setState(ELECT2_STATE); ---- if (electionOriginator == myHostData.ipAddr) ---- { ---- leader = hostArray[0].ipAddr; ---- if (leader == myHostData.ipAddr) ---- { //I am the leader ---- dhtLog("I am the leader!\n"); ---- setState(LEAD_REBUILD1_STATE); ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- } ---- else ---- { //notify leader ---- outBuffer[0] = CONGRATS_CMD; ---- write2(&outBuffer[1], numHosts); ---- hostDataPtr = (struct hostData *)&outBuffer[3]; ---- for (i = 0; i < numHosts; i++) ---- hostDataPtr[i] = hostArray[i]; ---- udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, ---- leader); ---- } ---- } ---- else ---- { ---- outBuffer[0] = ELECT_LEADER_RES; ---- outBuffer[1] = 0; ---- write2(&outBuffer[2], numHosts); ---- hostDataPtr = (struct hostData *)&outBuffer[4]; ---- for (i = 0; i < numHosts; i++) ---- hostDataPtr[i] = hostArray[i]; ---- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, ---- electionParent); ---- } ---- } ---- } ---- break; ---- case CONGRATS_CMD: ---- if (state == ELECT2_STATE) ---- { //I am the leader ---- leader = myHostData.ipAddr; ---- dhtLog("I am the leader!\n"); ---- tmpUShort = read2(&inBuffer[1]); ---- hostDataPtr = (struct hostData *)&inBuffer[3]; ---- for (i = 0; i < tmpUShort; i++) ---- addHost(hostDataPtr[i]); ---- writeHostList(); ---- setState(LEAD_REBUILD1_STATE); ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- } ---- break; ---- case REBUILD_REQ: ---- if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) ---- { ---- setState(LEAD_REBUILD1_STATE); ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- } ---- break; ---- case REBUILD_CMD: ---- leader = peerIp; //consider this a declaration of authority ---- setState(REBUILD1_STATE); ---- outBuffer[0] = JOIN_REQ; ---- write4(&outBuffer[1], myHostData.maxKeyCapacity); ---- udpSend(outBuffer, 5, leader); ---- break; ---- case FILL_DHT_CMD: ---- if (state == REBUILD3_STATE && peerIp == leader) ---- { ---- setState(REBUILD4_STATE); ---- if (fillStatus != 0) ---- dhtLog("udpListen(): ERROR: fillTask already running\n"); ---- fillStatus = 1; ---- if (pthread_create(&threadFillTask, NULL, fillTask, NULL) != 0) ---- dhtLog("udpListen(): ERROR creating threadFillTask\n"); ---- } ---- break; ---- case FILL_DHT_RES: ---- if (state == LEAD_REBUILD3_STATE) ---- { ---- checkReplied(peerIp); ---- if (allReplied() && fillStatus == 2) ---- { ---- fillStatus = 0; ---- setState(LEAD_REBUILD4_STATE); ---- outBuffer[0] = RESUME_NORMAL_CMD; ---- udpSendAll(outBuffer, 1); ---- } ---- } ---- break; ---- case RESUME_NORMAL_CMD: ---- if (state == REBUILD5_STATE && peerIp == leader) ---- { ---- setState(NORMAL_STATE); ---- outBuffer[0] = RESUME_NORMAL_RES; ---- udpSend(outBuffer, 1, leader); ---- } ---- break; ---- case RESUME_NORMAL_RES: ---- if (state == LEAD_REBUILD4_STATE) ---- { ---- checkReplied(peerIp); ---- if (allReplied()) ---- { ---- setState(LEAD_NORMAL1_STATE); ---- } ---- } ---- break; ---- } ---- } ---- } ---- if (state == REBUILD4_STATE) ---- { ---- switch (fillStatus) ---- { ---- case 0: dhtLog("udpListen(): ERROR: fillStatus=0 in REBUILD4_STATE\n"); ---- break; ---- case 1: //do nothing ---- break; ---- case 2: //done filling the dht, notify leader ---- fillStatus = 0; ---- setState(REBUILD5_STATE); ---- outBuffer[0] = FILL_DHT_RES; ---- udpSend(outBuffer, 1, leader); ---- break; ---- case 3: //error encountered -> restart rebuild ---- fillStatus = 0; ---- setState(REBUILD0_STATE); ---- outBuffer[0] = REBUILD_REQ; ---- udpSend(outBuffer, 1, leader); ---- break; ---- } ---- } ---- if (state == LEAD_REBUILD3_STATE) ---- { ---- switch (fillStatus) ---- { ---- case 0: dhtLog("udpListen(): ERROR: fillStatus=0 in LEAD_REBUILD3_STATE\n"); ---- break; ---- case 1: //do nothing ---- break; ---- case 2: //I'm done, now is everybody else also done? ---- if (allReplied()) ---- { ---- fillStatus = 0; ---- setState(LEAD_REBUILD4_STATE); ---- outBuffer[0] = RESUME_NORMAL_CMD; ---- udpSendAll(outBuffer, 1); ---- } ---- break; ---- case 3: //error encountered -> restart rebuild ---- fillStatus = 0; ---- setState(LEAD_REBUILD1_STATE); ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- break; ---- } ---- } ---- if (timerSet) ---- { ---- gettimeofday(&now, NULL); ---- if (timercmp(&now, &timer, >)) ---- { ---- if (timeoutCntr < retry_vals[state]) ---- { ---- timeoutCntr++; ---- timeradd(&now, &timeout_vals[state], &timer); ---- dhtLog("udpListen(): retry: %d\n", timeoutCntr); ---- switch (state) ---- { ---- case INIT1_STATE: ---- outBuffer[0] = WHO_IS_LEADER_CMD; ---- udpSend(outBuffer, 1, seed); ---- break; ---- case INIT2_STATE: ---- outBuffer[0] = JOIN_REQ; ---- write4(&outBuffer[1], myHostData.maxKeyCapacity); ---- udpSend(outBuffer, 5, leader); ---- break; ---- case ELECT1_STATE: ---- outBuffer[0] = ELECT_LEADER_CMD; ---- write4(&outBuffer[1], electionOriginator); ---- udpSendAll(outBuffer, 5); ---- break; ---- case ELECT2_STATE: ---- if (electionOriginator == myHostData.ipAddr) ---- { //retry notify leader ---- outBuffer[0] = CONGRATS_CMD; ---- write2(&outBuffer[1], numHosts); ---- memcpy(&outBuffer[3], hostArray, sizeof(struct hostData) ---- * numHosts); ---- udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, ---- leader); ---- } ---- else ---- { ---- outBuffer[0] = ELECT_LEADER_RES; ---- outBuffer[1] = 0; ---- write2(&outBuffer[2], numHosts); ---- memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) ---- * numHosts); ---- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, ---- electionParent); ---- } ---- break; ---- case REBUILD0_STATE: ---- outBuffer[0] = REBUILD_REQ; ---- udpSend(outBuffer, 1, leader); ---- break; ---- case REBUILD1_STATE: ---- outBuffer[0] = JOIN_REQ; ---- write4(&outBuffer[1], myHostData.maxKeyCapacity); ---- udpSend(outBuffer, 5, leader); ---- break; ---- case REBUILD5_STATE: ---- outBuffer[0] = FILL_DHT_RES; ---- udpSend(outBuffer, 1, leader); ---- break; ---- case LEAD_REBUILD1_STATE: ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- break; ---- case LEAD_REBUILD2_STATE: ---- outBuffer[0] = DHT_UPDATE_CMD; ---- write2(&outBuffer[1], numHosts); ---- write2(&outBuffer[3], numBlocks); ---- memcpy(&outBuffer[5], hostArray, numHosts ---- * sizeof(struct hostData)); ---- memcpy(&outBuffer[5+numHosts*sizeof(struct hostData)], ---- blockOwnerArray, numBlocks*2); ---- udpSendAll(outBuffer, 5 + sizeof(struct hostData) * numHosts ---- + 2 * numBlocks); ---- break; ---- case LEAD_REBUILD3_STATE: ---- outBuffer[0] = FILL_DHT_CMD; ---- udpSendAll(outBuffer, 1); ---- break; ---- case LEAD_REBUILD4_STATE: ---- outBuffer[0] = RESUME_NORMAL_CMD; ---- udpSendAll(outBuffer, 1); ---- break; ---- case EXIT1_STATE: //TODO... ---- break; ---- case NORMAL_STATE: ---- case LEAD_NORMAL1_STATE: ---- case LEAD_NORMAL2_STATE: ---- case REBUILD2_STATE: ---- case REBUILD3_STATE: ---- case REBUILD4_STATE: ---- case EXIT2_STATE: //we shouldn't get here ---- break; ---- } ---- } ---- else ---- { ---- dhtLog("udpListen(): timed out in state %s after %d retries\n", ---- state_names[state], timeoutCntr); ---- switch (state) ---- { ---- case INIT1_STATE: ---- setState(EXIT2_STATE); ---- break; ---- case LEAD_NORMAL2_STATE: ---- setState(LEAD_REBUILD1_STATE); ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- break; ---- case ELECT1_STATE: ---- dhtLog("removing unresponsive hosts, before:\n"); ---- writeHostList(); ---- removeUnresponsiveHosts(); ---- dhtLog("after\n"); ---- writeHostList(); ---- setState(ELECT2_STATE); ---- if (electionOriginator == myHostData.ipAddr) ---- { ---- leader = hostArray[0].ipAddr; ---- if (leader == myHostData.ipAddr) ---- { //I am the leader ---- dhtLog("I am the leader!\n"); ---- setState(LEAD_REBUILD1_STATE); ---- outBuffer[0] = REBUILD_CMD; ---- udpSendAll(outBuffer, 1); ---- } ---- else ---- { //notify leader ---- outBuffer[0] = CONGRATS_CMD; ---- write2(&outBuffer[1], numHosts); ---- memcpy(&outBuffer[3], hostArray, sizeof(struct hostData) ---- * numHosts); ---- udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, ---- leader); ---- } ---- } ---- else ---- { ---- outBuffer[0] = ELECT_LEADER_RES; ---- outBuffer[1] = 0; ---- write2(&outBuffer[2], numHosts); ---- memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) ---- * numHosts); ---- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, ---- electionParent); ---- } ---- break; ---- case INIT2_STATE: ---- case ELECT2_STATE: ---- case REBUILD0_STATE: ---- case REBUILD1_STATE: ---- case REBUILD2_STATE: ---- case REBUILD3_STATE: ---- case REBUILD4_STATE: ---- case REBUILD5_STATE: ---- case LEAD_REBUILD1_STATE: ---- case LEAD_REBUILD2_STATE: ---- case LEAD_REBUILD3_STATE: ---- case LEAD_REBUILD4_STATE: ---- //start election ---- electionOriginator = myHostData.ipAddr; ---- setState(ELECT1_STATE); ---- outBuffer[0] = ELECT_LEADER_CMD; ---- write4(&outBuffer[1], myHostData.ipAddr); //originator = me ---- udpSendAll(outBuffer, 5); ---- break; ---- case EXIT1_STATE: ---- setState(EXIT2_STATE); ---- break; ---- case NORMAL_STATE: ---- case LEAD_NORMAL1_STATE: ---- case EXIT2_STATE: //we shouldn't get here ---- break; ---- } ---- } ---- } - while (1){ -- while (1) { --- pollret = poll(&udpPollSock, 1, TIMEOUT_PERIOD); --- pthread_mutex_lock(&stateMutex); --- oldState = state; - if (pollret < 0){ -- if (pollret < 0) { --- perror("udpListen():poll()"); - } else if (pollret > 0) { -- } else if (pollret > 0) { --- bytesRcvd = recvfrom(udpPollSock.fd, inBuffer, MAX_MSG_SIZE, 0, --- (struct sockaddr *)&peerAddr, &socklen); - if (bytesRcvd < 1){ -- if (bytesRcvd < 1) { --- dhtLog("udpListen(): ERROR: bytesRcvd = %d\n", bytesRcvd); - } else if (inBuffer[0] >= NUM_MSG_TYPES) { -- } else if (inBuffer[0] >= NUM_MSG_TYPES) { --- dhtLog("udpListen(): ERROR: unknown msg type = %d\n", inBuffer[0]); - } else if (!msgSizeOk(inBuffer, bytesRcvd)) { -- } else if (!msgSizeOk(inBuffer, bytesRcvd)) { --- dhtLog("udpListen(): ERROR: msg size not ok: type = %s\n, size = %d\n", --- msg_types[inBuffer[0]], bytesRcvd); - } else if (state == EXIT2_STATE) { -- } else if (state == EXIT2_STATE) { --- //do nothing - } else if (state == INIT1_STATE) { //after initialization with seed, do not proceed until seed replies -- } else if (state == INIT1_STATE) { //after initialization with seed, do not proceed until seed replies --- dhtLog("udpListen(): received %s from %s, %d bytes\n", --- msg_types[inBuffer[0]], inet_ntoa(peerAddr.sin_addr), bytesRcvd); --- for (i = 0; i < bytesRcvd; i++) --- dhtLog(" %x", inBuffer[i]); --- dhtLog("\n"); --- peerIp = ntohl(peerAddr.sin_addr.s_addr); - if (peerIp == seed && inBuffer[0] == WHO_IS_LEADER_RES){ -- if (peerIp == seed && inBuffer[0] == WHO_IS_LEADER_RES) { --- tmpHost.ipAddr = peerIp; --- tmpHost.maxKeyCapacity = 0; --- addHost(tmpHost); --- writeHostList(); --- leader = read4(&inBuffer[1]); --- tmpAddr.s_addr = htonl(leader); --- dhtLog("leader = %s\n", inet_ntoa(tmpAddr)); - if (leader != 0){ -- if (leader != 0) { --- setState(INIT2_STATE); --- outBuffer[0] = JOIN_REQ; --- write4(&outBuffer[1], myHostData.maxKeyCapacity); --- udpSend(outBuffer, 5, leader); --- } else --- { --- electionOriginator = myHostData.ipAddr; --- setState(ELECT1_STATE); --- outBuffer[0] = ELECT_LEADER_CMD; --- write4(&outBuffer[1], myHostData.ipAddr); //originator = me --- udpSendAll(outBuffer, 5); --- } --- } --- } else --- { --- dhtLog("udpListen(): received %s from %s, %d bytes\n", --- msg_types[inBuffer[0]], inet_ntoa(peerAddr.sin_addr), bytesRcvd); --- for (i = 0; i < bytesRcvd; i++) --- dhtLog(" %x", inBuffer[i]); --- dhtLog("\n"); --- peerIp = ntohl(peerAddr.sin_addr.s_addr); - switch (inBuffer[0]){ -- switch (inBuffer[0]) { --- case INSERT_CMD: --- if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE --- || state == LEAD_NORMAL2_STATE || state == REBUILD4_STATE - || state == REBUILD5_STATE || state == LEAD_REBUILD3_STATE){ -- || state == REBUILD5_STATE || state == LEAD_REBUILD3_STATE) { --- tmpKey = read4(&inBuffer[1]); --- tmpVal = read4(&inBuffer[5]); --- outBuffer[0] = INSERT_RES; - if (getKeyOwner(tmpKey) == myHostData.ipAddr){ -- if (getKeyOwner(tmpKey) == myHostData.ipAddr) { --- if (chashInsert(myHashTable, tmpKey, (void *)tmpVal) == 0) --- outBuffer[1] = OPERATION_OK; --- else --- outBuffer[1] = INTERNAL_ERROR; --- } else --- { --- outBuffer[1] = NOT_KEY_OWNER; --- } --- //reply to client socket --- sendto(udpPollSock.fd, outBuffer, 2, 0, --- (struct sockaddr *)&peerAddr, socklen); --- } --- break; --- --- case REMOVE_CMD: --- if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE){ -- || state == LEAD_NORMAL2_STATE) { --- tmpKey = read4(&inBuffer[1]); --- outBuffer[0] = REMOVE_RES; - if (getKeyOwner(tmpKey) == myHostData.ipAddr){ -- if (getKeyOwner(tmpKey) == myHostData.ipAddr) { --- if (chashRemove(myHashTable, tmpKey) == 0) --- outBuffer[1] = OPERATION_OK; --- else --- outBuffer[1] = KEY_NOT_FOUND; --- } else --- { --- outBuffer[1] = NOT_KEY_OWNER; --- } --- //reply to client socket --- sendto(udpPollSock.fd, outBuffer, 2, 0, --- (struct sockaddr *)&peerAddr, socklen); --- } --- break; --- --- case SEARCH_CMD: --- if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE){ -- || state == LEAD_NORMAL2_STATE) { --- tmpKey = read4(&inBuffer[1]); --- outBuffer[0] = SEARCH_RES; - if (getKeyOwner(tmpKey) == myHostData.ipAddr){ - if ((tmpVal = (unsigned int)chashSearch(myHashTable, tmpKey)) != 0){ -- if (getKeyOwner(tmpKey) == myHostData.ipAddr) { -- if ((tmpVal = (unsigned int)chashSearch(myHashTable, tmpKey)) != 0) { --- outBuffer[1] = OPERATION_OK; --- write4(&outBuffer[2], tmpVal); --- } else --- { --- outBuffer[1] = KEY_NOT_FOUND; --- write4(&outBuffer[2], 0); --- } --- } else --- { --- outBuffer[1] = NOT_KEY_OWNER; --- write4(&outBuffer[2], 0); --- } --- //reply to client socket --- sendto(udpPollSock.fd, outBuffer, 6, 0, --- (struct sockaddr *)&peerAddr, socklen); --- } --- break; --- --- case WHO_IS_LEADER_CMD: --- tmpHost.ipAddr = peerIp; --- tmpHost.maxKeyCapacity = 0; --- addHost(tmpHost); --- writeHostList(); --- outBuffer[0] = WHO_IS_LEADER_RES; --- //leader == 0 means I don't know who it is --- write4(&outBuffer[1], leader); --- udpSend(outBuffer, 5, peerIp); --- break; --- --- case JOIN_REQ: - if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE){ -- if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) { --- tmpHost.ipAddr = peerIp; --- tmpHost.maxKeyCapacity = read4(&inBuffer[1]); --- addHost(tmpHost); --- writeHostList(); --- if (state == LEAD_NORMAL1_STATE) --- setState(LEAD_NORMAL2_STATE); --- outBuffer[0] = JOIN_RES; --- outBuffer[1] = 0; //status, success --- udpSend(outBuffer, 2, peerIp); - } else if (state == LEAD_REBUILD1_STATE) { -- } else if (state == LEAD_REBUILD1_STATE) { --- //note: I don't need to addHost(). --- checkReplied(peerIp); --- outBuffer[0] = JOIN_RES; --- outBuffer[1] = 0; //status, success --- udpSend(outBuffer, 2, peerIp); - if (allReplied()){ -- if (allReplied()) { --- makeAssignments(); --- setState(LEAD_REBUILD2_STATE); --- outBuffer[0] = DHT_UPDATE_CMD; --- write2(&outBuffer[1], numHosts); --- write2(&outBuffer[3], numBlocks); --- memcpy(&outBuffer[5], hostArray, numHosts*sizeof(struct hostData)); --- memcpy(&outBuffer[5+numHosts*sizeof(struct hostData)], --- blockOwnerArray, numBlocks*2); --- udpSendAll(outBuffer, 5 + sizeof(struct hostData) * numHosts --- + 2 * numBlocks); --- } --- } --- break; --- --- case JOIN_RES: - if (state == REBUILD1_STATE){ -- if (state == REBUILD1_STATE) { --- setState(REBUILD2_STATE); - } else if (state == INIT2_STATE) { -- } else if (state == INIT2_STATE) { --- setState(NORMAL_STATE); --- } --- break; --- --- case LEAVE_REQ: - if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE){ //TODO: make this graceful, instead of just rebuilding -- if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) { //TODO: make this graceful, instead of just rebuilding --- removeHost(peerIp); --- if (state != LEAD_NORMAL2_STATE) --- setState(LEAD_NORMAL2_STATE); --- } --- break; --- --- case DHT_UPDATE_CMD: - if (state == REBUILD2_STATE && peerIp == leader){ -- if (state == REBUILD2_STATE && peerIp == leader) { --- free(hostArray); --- free(blockOwnerArray); --- numHosts = read2(&inBuffer[1]); --- numBlocks = read2(&inBuffer[3]); --- while (hostArraySize < numHosts) --- hostArraySize *= 2; --- hostArray = calloc(hostArraySize, sizeof(struct hostData)); --- blockOwnerArray = calloc(numBlocks, 2); --- memcpy(hostArray, &inBuffer[5], numHosts*sizeof(struct hostData)); --- memcpy(blockOwnerArray, &inBuffer[5+numHosts*sizeof(struct hostData)], numBlocks*2); --- writeHostList(); --- setState(REBUILD3_STATE); --- outBuffer[0] = DHT_UPDATE_RES; --- udpSend(outBuffer, 1, peerIp); --- } --- break; --- --- case DHT_UPDATE_RES: - if (state == LEAD_REBUILD2_STATE){ -- if (state == LEAD_REBUILD2_STATE) { --- checkReplied(peerIp); - if (allReplied()){ -- if (allReplied()) { --- setState(LEAD_REBUILD3_STATE); --- outBuffer[0] = FILL_DHT_CMD; --- udpSendAll(outBuffer, 1); --- if (fillStatus != 0) --- dhtLog("udpListen(): ERROR: fillTask already running\n"); --- fillStatus = 1; --- if (pthread_create(&threadFillTask, NULL, fillTask, NULL) != 0) --- dhtLog("udpListen(): ERROR creating threadFillTask\n"); --- } --- } --- break; --- --- case ELECT_LEADER_CMD: --- tmpUInt = read4(&inBuffer[1]); --- if ((state == ELECT1_STATE || state == ELECT2_STATE) - && tmpUInt >= electionOriginator){ //already participating in a higher-priority election -- && tmpUInt >= electionOriginator) { //already participating in a higher-priority election --- outBuffer[0] = ELECT_LEADER_RES; --- outBuffer[1] = 0xFF; --- udpSend(outBuffer, 2, peerIp); --- } else --- { //join election --- electionOriginator = tmpUInt; --- electionParent = peerIp; --- setState(ELECT1_STATE); --- outBuffer[0] = ELECT_LEADER_CMD; --- write4(&outBuffer[1], electionOriginator); --- //don't bother forwarding the message to originator or parent --- checkReplied(electionOriginator); --- checkReplied(electionParent); - if (allReplied()){ //in case that is everybody I know of -- if (allReplied()) { //in case that is everybody I know of --- setState(ELECT2_STATE); --- outBuffer[0] = ELECT_LEADER_RES; --- outBuffer[1] = 0; --- write2(&outBuffer[2], numHosts); --- memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) --- * numHosts); --- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, --- electionParent); --- } else --- { --- udpSendAll(outBuffer, 5); --- } --- } --- break; --- --- case ELECT_LEADER_RES: - if (state == ELECT1_STATE){ -- if (state == ELECT1_STATE) { --- checkReplied(peerIp); - if (inBuffer[1] != 0xFF){ -- if (inBuffer[1] != 0xFF) { --- tmpUShort = read2(&inBuffer[2]); --- hostDataPtr = (struct hostData *)&inBuffer[4]; --- for (i = 0; i < tmpUShort; i++) --- addHost(hostDataPtr[i]); --- writeHostList(); --- } - if (allReplied()){ -- if (allReplied()) { --- setState(ELECT2_STATE); - if (electionOriginator == myHostData.ipAddr){ -- if (electionOriginator == myHostData.ipAddr) { --- leader = hostArray[0].ipAddr; - if (leader == myHostData.ipAddr){ //I am the leader -- if (leader == myHostData.ipAddr) { //I am the leader --- dhtLog("I am the leader!\n"); --- setState(LEAD_REBUILD1_STATE); --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- } else --- { //notify leader --- outBuffer[0] = CONGRATS_CMD; --- write2(&outBuffer[1], numHosts); --- hostDataPtr = (struct hostData *)&outBuffer[3]; --- for (i = 0; i < numHosts; i++) --- hostDataPtr[i] = hostArray[i]; --- udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, --- leader); ------- } ---- if (state != oldState) ---- pthread_cond_broadcast(&stateCond); ---- pthread_mutex_unlock(&stateMutex); --- } else --- { --- outBuffer[0] = ELECT_LEADER_RES; --- outBuffer[1] = 0; --- write2(&outBuffer[2], numHosts); --- hostDataPtr = (struct hostData *)&outBuffer[4]; --- for (i = 0; i < numHosts; i++) --- hostDataPtr[i] = hostArray[i]; --- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, --- electionParent); --- } --- } --- } --- break; --- --- case CONGRATS_CMD: - if (state == ELECT2_STATE){ //I am the leader -- if (state == ELECT2_STATE) { //I am the leader --- leader = myHostData.ipAddr; --- dhtLog("I am the leader!\n"); --- tmpUShort = read2(&inBuffer[1]); --- hostDataPtr = (struct hostData *)&inBuffer[3]; --- for (i = 0; i < tmpUShort; i++) --- addHost(hostDataPtr[i]); --- writeHostList(); --- setState(LEAD_REBUILD1_STATE); --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- } --- break; --- --- case REBUILD_REQ: - if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE){ -- if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) { --- setState(LEAD_REBUILD1_STATE); --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- } --- break; --- --- case REBUILD_CMD: --- leader = peerIp; //consider this a declaration of authority --- setState(REBUILD1_STATE); --- outBuffer[0] = JOIN_REQ; --- write4(&outBuffer[1], myHostData.maxKeyCapacity); --- udpSend(outBuffer, 5, leader); --- break; --- --- case FILL_DHT_CMD: - if (state == REBUILD3_STATE && peerIp == leader){ -- if (state == REBUILD3_STATE && peerIp == leader) { --- setState(REBUILD4_STATE); --- if (fillStatus != 0) --- dhtLog("udpListen(): ERROR: fillTask already running\n"); --- fillStatus = 1; --- if (pthread_create(&threadFillTask, NULL, fillTask, NULL) != 0) --- dhtLog("udpListen(): ERROR creating threadFillTask\n"); --- } --- break; --- --- case FILL_DHT_RES: - if (state == LEAD_REBUILD3_STATE){ -- if (state == LEAD_REBUILD3_STATE) { --- checkReplied(peerIp); - if (allReplied() && fillStatus == 2){ -- if (allReplied() && fillStatus == 2) { --- fillStatus = 0; --- setState(LEAD_REBUILD4_STATE); --- outBuffer[0] = RESUME_NORMAL_CMD; --- udpSendAll(outBuffer, 1); --- } --- } --- break; --- --- case RESUME_NORMAL_CMD: - if (state == REBUILD5_STATE && peerIp == leader){ -- if (state == REBUILD5_STATE && peerIp == leader) { --- setState(NORMAL_STATE); --- outBuffer[0] = RESUME_NORMAL_RES; --- udpSend(outBuffer, 1, leader); --- } --- break; --- --- case RESUME_NORMAL_RES: - if (state == LEAD_REBUILD4_STATE){ -- if (state == LEAD_REBUILD4_STATE) { --- checkReplied(peerIp); - if (allReplied()){ -- if (allReplied()) { --- setState(LEAD_NORMAL1_STATE); --- } --- } --- break; --- } --- } --- } - if (state == REBUILD4_STATE){ - switch (fillStatus){ -- if (state == REBUILD4_STATE) { -- switch (fillStatus) { --- case 0: dhtLog("udpListen(): ERROR: fillStatus=0 in REBUILD4_STATE\n"); --- break; --- --- case 1: //do nothing --- break; --- --- case 2: //done filling the dht, notify leader --- fillStatus = 0; --- setState(REBUILD5_STATE); --- outBuffer[0] = FILL_DHT_RES; --- udpSend(outBuffer, 1, leader); --- break; --- --- case 3: //error encountered -> restart rebuild --- fillStatus = 0; --- setState(REBUILD0_STATE); --- outBuffer[0] = REBUILD_REQ; --- udpSend(outBuffer, 1, leader); --- break; --- } --- } - if (state == LEAD_REBUILD3_STATE){ - switch (fillStatus){ -- if (state == LEAD_REBUILD3_STATE) { -- switch (fillStatus) { --- case 0: dhtLog("udpListen(): ERROR: fillStatus=0 in LEAD_REBUILD3_STATE\n"); --- break; --- --- case 1: //do nothing --- break; --- --- case 2: //I'm done, now is everybody else also done? - if (allReplied()){ -- if (allReplied()) { --- fillStatus = 0; --- setState(LEAD_REBUILD4_STATE); --- outBuffer[0] = RESUME_NORMAL_CMD; --- udpSendAll(outBuffer, 1); --- } --- break; --- --- case 3: //error encountered -> restart rebuild --- fillStatus = 0; --- setState(LEAD_REBUILD1_STATE); --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- break; --- } --- } - if (timerSet){ -- if (timerSet) { --- gettimeofday(&now, NULL); - if (timercmp(&now, &timer, >)){ - if (timeoutCntr < retry_vals[state]){ -- if (timercmp(&now, &timer, >)) { -- if (timeoutCntr < retry_vals[state]) { --- timeoutCntr++; --- timeradd(&now, &timeout_vals[state], &timer); --- dhtLog("udpListen(): retry: %d\n", timeoutCntr); - switch (state){ -- switch (state) { --- case INIT1_STATE: --- outBuffer[0] = WHO_IS_LEADER_CMD; --- udpSend(outBuffer, 1, seed); --- break; --- --- case INIT2_STATE: --- outBuffer[0] = JOIN_REQ; --- write4(&outBuffer[1], myHostData.maxKeyCapacity); --- udpSend(outBuffer, 5, leader); --- break; --- --- case ELECT1_STATE: --- outBuffer[0] = ELECT_LEADER_CMD; --- write4(&outBuffer[1], electionOriginator); --- udpSendAll(outBuffer, 5); --- break; --- --- case ELECT2_STATE: - if (electionOriginator == myHostData.ipAddr){ //retry notify leader -- if (electionOriginator == myHostData.ipAddr) { //retry notify leader --- outBuffer[0] = CONGRATS_CMD; --- write2(&outBuffer[1], numHosts); --- memcpy(&outBuffer[3], hostArray, sizeof(struct hostData) --- * numHosts); --- udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, --- leader); --- } else --- { --- outBuffer[0] = ELECT_LEADER_RES; --- outBuffer[1] = 0; --- write2(&outBuffer[2], numHosts); --- memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) --- * numHosts); --- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, --- electionParent); --- } --- break; --- --- case REBUILD0_STATE: --- outBuffer[0] = REBUILD_REQ; --- udpSend(outBuffer, 1, leader); --- break; --- --- case REBUILD1_STATE: --- outBuffer[0] = JOIN_REQ; --- write4(&outBuffer[1], myHostData.maxKeyCapacity); --- udpSend(outBuffer, 5, leader); --- break; --- --- case REBUILD5_STATE: --- outBuffer[0] = FILL_DHT_RES; --- udpSend(outBuffer, 1, leader); --- break; --- --- case LEAD_REBUILD1_STATE: --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- break; --- --- case LEAD_REBUILD2_STATE: --- outBuffer[0] = DHT_UPDATE_CMD; --- write2(&outBuffer[1], numHosts); --- write2(&outBuffer[3], numBlocks); --- memcpy(&outBuffer[5], hostArray, numHosts --- * sizeof(struct hostData)); --- memcpy(&outBuffer[5+numHosts*sizeof(struct hostData)], --- blockOwnerArray, numBlocks*2); --- udpSendAll(outBuffer, 5 + sizeof(struct hostData) * numHosts --- + 2 * numBlocks); --- break; --- --- case LEAD_REBUILD3_STATE: --- outBuffer[0] = FILL_DHT_CMD; --- udpSendAll(outBuffer, 1); --- break; --- --- case LEAD_REBUILD4_STATE: --- outBuffer[0] = RESUME_NORMAL_CMD; --- udpSendAll(outBuffer, 1); --- break; --- --- case EXIT1_STATE: //TODO... --- break; --- --- case NORMAL_STATE: --- case LEAD_NORMAL1_STATE: --- case LEAD_NORMAL2_STATE: --- case REBUILD2_STATE: --- case REBUILD3_STATE: --- case REBUILD4_STATE: --- case EXIT2_STATE: //we shouldn't get here --- break; --- } --- } else --- { --- dhtLog("udpListen(): timed out in state %s after %d retries\n", --- state_names[state], timeoutCntr); - switch (state){ -- switch (state) { --- case INIT1_STATE: --- setState(EXIT2_STATE); --- break; --- --- case LEAD_NORMAL2_STATE: --- setState(LEAD_REBUILD1_STATE); --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- break; --- --- case ELECT1_STATE: --- dhtLog("removing unresponsive hosts, before:\n"); --- writeHostList(); --- removeUnresponsiveHosts(); --- dhtLog("after\n"); --- writeHostList(); --- setState(ELECT2_STATE); - if (electionOriginator == myHostData.ipAddr){ -- if (electionOriginator == myHostData.ipAddr) { --- leader = hostArray[0].ipAddr; - if (leader == myHostData.ipAddr){ //I am the leader -- if (leader == myHostData.ipAddr) { //I am the leader --- dhtLog("I am the leader!\n"); --- setState(LEAD_REBUILD1_STATE); --- outBuffer[0] = REBUILD_CMD; --- udpSendAll(outBuffer, 1); --- } else --- { //notify leader --- outBuffer[0] = CONGRATS_CMD; --- write2(&outBuffer[1], numHosts); --- memcpy(&outBuffer[3], hostArray, sizeof(struct hostData) --- * numHosts); --- udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, --- leader); --- } --- } else --- { --- outBuffer[0] = ELECT_LEADER_RES; --- outBuffer[1] = 0; --- write2(&outBuffer[2], numHosts); --- memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) --- * numHosts); --- udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, --- electionParent); --- } --- break; --- --- case INIT2_STATE: --- case ELECT2_STATE: --- case REBUILD0_STATE: --- case REBUILD1_STATE: --- case REBUILD2_STATE: --- case REBUILD3_STATE: --- case REBUILD4_STATE: --- case REBUILD5_STATE: --- case LEAD_REBUILD1_STATE: --- case LEAD_REBUILD2_STATE: --- case LEAD_REBUILD3_STATE: --- case LEAD_REBUILD4_STATE: --- //start election --- electionOriginator = myHostData.ipAddr; --- setState(ELECT1_STATE); --- outBuffer[0] = ELECT_LEADER_CMD; --- write4(&outBuffer[1], myHostData.ipAddr); //originator = me --- udpSendAll(outBuffer, 5); --- break; --- --- case EXIT1_STATE: --- setState(EXIT2_STATE); --- break; --- --- case NORMAL_STATE: --- case LEAD_NORMAL1_STATE: --- case EXIT2_STATE: //we shouldn't get here --- break; --- } ------- } --- } --- } --- if (state != oldState) --- pthread_cond_broadcast(&stateCond); --- pthread_mutex_unlock(&stateMutex); --- } -------} ------- diff --cc Robust/src/Runtime/DSTM/interface/dht.h index 344ab530,344ab530,344ab530,344ab530,2a955ba5,2a955ba5,2a955ba5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/dht.h +++ /dev/null @@@@@@@@ -1,38 -1,38 -1,38 -1,38 -1,38 -1,38 -1,38 +1,0 @@@@@@@@ -------#ifndef _DHT_H -------#define _DHT_H ------- -------#include ------- -------/******************************************************************************* -------* Local Structs -------*******************************************************************************/ ------- -------#define DHT_NO_KEY_LIMIT 0xFFFFFFFF ------- -------/******************************************************************************* -------* Interface Function Prototypes -------*******************************************************************************/ ------- -------//called by host which joins (or starts) the system -------void dhtInit(unsigned int seedIp, unsigned int maxKeyCapaciy); -------//exit system, cleanup -------void dhtExit(); ------- -------//called by whoever performs the creation, move, deletion ------- -------//returns 0 if successful, -1 if an error occurred -------int dhtInsert(unsigned int key, unsigned int val); -------//simultaneously inserts the key-val pairs in the given arrays ---- int dhtInsertMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals); ---int dhtInsertMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals); -------//returns 0 if successful, -1 if an error occurred -------int dhtRemove(unsigned int key); -------//simultaneously delete the keys in the given array -------int dhtRemoveMult(unsigned int numKeys, unsigned int *keys); -------//returns 0 if successful and copies val into *val, -------// 1 if key not found, -1 if an error occurred -------int dhtSearch(unsigned int key, unsigned int *val); -------//simultaneously search for the vals that correspond to the given keys. -------// result is placed in vals[] -------int dhtSearchMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals); -------#endif ------- diff --cc Robust/src/Runtime/DSTM/interface/dstm.c index 62f6955f,a7a8cf40,a7a8cf40,a7a8cf40,a7a8cf40,a7a8cf40,a7a8cf40..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/dstm.c +++ /dev/null @@@@@@@@ -1,19 -1,9 -1,9 -1,9 -1,9 -1,9 -1,9 +1,0 @@@@@@@@ -------#include "dstm.h" ------- -------extern int classsize[]; ------- -------/* BEGIN object header */ - - // Get a new object id - unsigned int getNewOID(void) { - static int id = 1; - return id++; - } ------- - // Get the size of the object for a given type - unsigned int objSize(objheader_t *object) { - return classsize[object->type]; - } ------- -------/* END object header */ ------- diff --cc Robust/src/Runtime/DSTM/interface/ip.c index d959f49c,bbd8e2f6,bbd8e2f6,9c97347e,81237854,d5c6b45a,d5c6b45a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/ip.c +++ /dev/null @@@@@@@@ -1,70 -1,101 -1,101 -1,104 -1,101 -1,101 -1,101 +1,0 @@@@@@@@ -------#include -------#include -------#include "ip.h" -------#include -------#include -------#include -------#include -------#include ------#include ------#include ------- -------#define LISTEN_PORT 2156 ------- -------unsigned int iptoMid(char *addr) { ---- ip_t i; ---- unsigned int mid; --- ip_t i; --- unsigned int mid; ------- ---- sscanf(addr, "%d.%d.%d.%d", &i.a, &i.b, &i.c, &i.d); ---- mid = (i.a << 24) | (i.b << 16) | (i.c << 8) | i.d; ---- fflush(stdout); ---- return mid; --- sscanf(addr, "%d.%d.%d.%d", &i.a, &i.b, &i.c, &i.d); --- mid = (i.a << 24) | (i.b << 16) | (i.c << 8) | i.d; --- fflush(stdout); --- return mid; -------} ------- -------void midtoIP(unsigned int mid, char *ptr) { ---- ip_t i; --- ip_t i; ------- ---- i.a = (mid & 0xff000000) >> 24; ---- i.b = (mid & 0x00ff0000) >> 16; ---- i.c = (mid & 0x0000ff00) >> 8; ---- i.d = mid & 0x000000ff; ---- sprintf(ptr, "%d.%d.%d.%d", i.a, i.b, i.c, i.d); --- i.a = (mid & 0xff000000) >> 24; --- i.b = (mid & 0x00ff0000) >> 16; --- i.c = (mid & 0x0000ff00) >> 8; --- i.d = mid & 0x000000ff; --- sprintf(ptr, "%d.%d.%d.%d", i.a, i.b, i.c, i.d); ----#ifdef DEBUG - printf("DEBUG-> midtoIP() mid = %d.%d.%d.%d\n", i.a, i.b, i.c, i.d); --- printf("DEBUG-> midtoIP() mid = %d.%d.%d.%d\n", i.a, i.b, i.c, i.d); ----#endif ---- return; --- return; -------} ------- -------int checkServer(int mid, char *machineip) { ---- int tmpsd; ---- struct sockaddr_in serv_addr; ---- char m[20]; --- int tmpsd; --- struct sockaddr_in serv_addr; --- char m[20]; ------- ---- strncpy(m, machineip, strlen(machineip)); ---- // Foreach machine you want to transact with ---- // check if its up and running ---- if ((tmpsd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { ---- perror(""); ---- return(-1); ---- } ---- bzero((char*) &serv_addr, sizeof(serv_addr)); ---- serv_addr.sin_family = AF_INET; ---- serv_addr.sin_port = htons(LISTEN_PORT); ---- midtoIP(mid, m); ---- m[15] = '\0'; ---- serv_addr.sin_addr.s_addr = inet_addr(m); ---- while (connect(tmpsd, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr)) < 0) { ---- sleep(1); ---- } ---- close(tmpsd); ---- return 0; --- strncpy(m, machineip, strlen(machineip)); --- // Foreach machine you want to transact with --- // check if its up and running --- if ((tmpsd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { --- perror(""); --- return(-1); --- } --- bzero((char*) &serv_addr, sizeof(serv_addr)); --- serv_addr.sin_family = AF_INET; --- serv_addr.sin_port = htons(LISTEN_PORT); --- midtoIP(mid, m); --- m[15] = '\0'; --- serv_addr.sin_addr.s_addr = inet_addr(m); --- while (connect(tmpsd, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr)) < 0) { --- sleep(1); --- } --- close(tmpsd); --- return 0; ------} ------ --- unsigned int getMyIpAddr(const char *interfaceStr) --- { --- int sock; --- struct ifreq interfaceInfo; --- struct sockaddr_in *myAddr = (struct sockaddr_in *)&interfaceInfo.ifr_addr; ---unsigned int getMyIpAddr(const char *interfaceStr) { --- int sock; --- struct ifreq interfaceInfo; --- struct sockaddr_in *myAddr = (struct sockaddr_in *)&interfaceInfo.ifr_addr; ------ --- memset(&interfaceInfo, 0, sizeof(struct ifreq)); --- memset(&interfaceInfo, 0, sizeof(struct ifreq)); ------ --- if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) --- { --- perror("getMyIpAddr():socket()"); --- return 1; --- } - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){ -- if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { --- perror("getMyIpAddr():socket()"); --- return 1; --- } ------ --- strcpy(interfaceInfo.ifr_name, interfaceStr); --- myAddr->sin_family = AF_INET; --- --- if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0) --- { --- perror("getMyIpAddr():ioctl()"); --- return 1; --- } --- strcpy(interfaceInfo.ifr_name, interfaceStr); --- myAddr->sin_family = AF_INET; ------ --- close(sock); - if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0){ -- if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0) { --- perror("getMyIpAddr():ioctl()"); --- return 1; --- } ------ --- return ntohl(myAddr->sin_addr.s_addr); --- close(sock); --- --- return ntohl(myAddr->sin_addr.s_addr); -------} ------ -------/* ---- main() { ---- unsigned int mid; ---- ip_t i; ---- char ip[16]; --- main() { --- unsigned int mid; --- ip_t i; --- char ip[16]; ------- ---- memset(ip, 0, 16); ---- mid = iptoMid("192.10.0.1"); ---- printf("mid = %x\n", mid); ---- midtoIP(mid, ip); ---- ip[15] = '\0'; ---- printf("%s\n",ip); ---- } ---- */ --- memset(ip, 0, 16); --- mid = iptoMid("192.10.0.1"); --- printf("mid = %x\n", mid); --- midtoIP(mid, ip); --- ip[15] = '\0'; --- printf("%s\n",ip); --- } --- */ diff --cc Robust/src/Runtime/DSTM/interface/ip.h index 4dcc5f76,29db799c,29db799c,29db799c,cbac6e64,cbac6e64,cbac6e64..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/ip.h +++ /dev/null @@@@@@@@ -1,15 -1,16 -1,16 -1,16 -1,16 -1,16 -1,16 +1,0 @@@@@@@@ -------#ifndef _ip_h_ -------#define _ip_h_ ------- -------typedef struct ip { ---- short a; ---- short b; ---- short c; ---- short d; ---- }ip_t; --- short a; --- short b; --- short c; --- short d; ---} ip_t; ------- -------unsigned int iptoMid(char *); -------void midtoIP(unsigned int, char *); -------int checkServer(int, char *); ------unsigned int getMyIpAddr(const char *interfaceStr); ------- -------#endif diff --cc Robust/src/Runtime/DSTM/interface/llookup.c index cc989a28,30760978,30760978,30760978,ec49a90a,ec49a90a,ec49a90a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/llookup.c +++ /dev/null @@@@@@@@ -1,195 -1,228 -1,228 -1,228 -1,224 -1,224 -1,224 +1,0 @@@@@@@@ -------/************************************************************************************************ ---- IMP NOTE: --- IMP NOTE: ------- All llookup hash function prototypes returns 0 on sucess and 1 otherwise ------- llookup hash is an array of lhashlistnode_t ------- oid = mid = 0 in a given lhashlistnode_t for each bin in the hash table ONLY if the entry is empty => ------- the OID's can be any unsigned int except 0 ------- ------- Uses pthreads. compile using -lpthread option ---- ***************************************************************************************************/ --- ***************************************************************************************************/ -------#include "llookup.h" ------ ------#ifdef SIMPLE_LLOOKUP ------ ------extern unsigned int *hostIpAddrs; ------extern unsigned int oidsPerBlock; ------ --- unsigned int lhashCreate(unsigned int size, float loadfactor) --- { --- return 0; ---unsigned int lhashCreate(unsigned int size, float loadfactor) { --- return 0; ------} ------ --- unsigned int lhashInsert(unsigned int oid, unsigned int mid) --- { --- return 0; ---unsigned int lhashInsert(unsigned int oid, unsigned int mid) { --- return 0; ------} ------ --- unsigned int lhashSearch(unsigned int oid) --- { --- if (oidsPerBlock == 0) --- return hostIpAddrs[0]; --- else --- return hostIpAddrs[oid / oidsPerBlock]; ---unsigned int lhashSearch(unsigned int oid) { --- if (oidsPerBlock == 0) --- return hostIpAddrs[0]; --- else --- return hostIpAddrs[oid / oidsPerBlock]; ------} ------ --- unsigned int lhashRemove(unsigned int oid) --- { --- return 0; ---unsigned int lhashRemove(unsigned int oid) { --- return 0; ------} ------ ------#else ------- ---- lhashtable_t llookup; //Global Hash table ---lhashtable_t llookup; //Global Hash table ------- ---- // Creates a hash table with size and an array of lhashlistnode_t ---// Creates a hash table with size and an array of lhashlistnode_t -------unsigned int lhashCreate(unsigned int size, float loadfactor) { ---- lhashlistnode_t *nodes; ---- int i; --- lhashlistnode_t *nodes; --- int i; ------- ---- // Allocate space for the hash table ---- if((nodes = calloc(size, sizeof(lhashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } ---- ---- llookup.table = nodes; ---- llookup.size = size; ---- llookup.numelements = 0; // Initial number of elements in the hash ---- llookup.loadfactor = loadfactor; ---- //Initialize the pthread_mutex variable ---- pthread_mutex_init(&llookup.locktable, NULL); ---- return 0; --- // Allocate space for the hash table --- if((nodes = calloc(size, sizeof(lhashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } --- --- llookup.table = nodes; --- llookup.size = size; --- llookup.numelements = 0; // Initial number of elements in the hash --- llookup.loadfactor = loadfactor; --- //Initialize the pthread_mutex variable --- pthread_mutex_init(&llookup.locktable, NULL); --- return 0; -------} ------- -------// Assign to oids to bins inside hash table -------unsigned int lhashFunction(unsigned int oid) { ---- return( oid % (llookup.size)); --- return( oid % (llookup.size)); -------} ------- -------// Insert oid and mid mapping into the hash table -------unsigned int lhashInsert(unsigned int oid, unsigned int mid) { ---- unsigned int newsize; ---- int index; ---- lhashlistnode_t *ptr, *node; ---- ---- if (llookup.numelements > (llookup.loadfactor * llookup.size)) { ---- //Resize Table ---- newsize = 2 * llookup.size + 1; ---- pthread_mutex_lock(&llookup.locktable); ---- lhashResize(newsize); ---- pthread_mutex_unlock(&llookup.locktable); ---- } ---- ---- ptr = llookup.table; ---- llookup.numelements++; ---- ---- index = lhashFunction(oid); --- unsigned int newsize; --- int index; --- lhashlistnode_t *ptr, *node; --- --- if (llookup.numelements > (llookup.loadfactor * llookup.size)) { --- //Resize Table --- newsize = 2 * llookup.size + 1; --- pthread_mutex_lock(&llookup.locktable); --- lhashResize(newsize); --- pthread_mutex_unlock(&llookup.locktable); --- } --- --- ptr = llookup.table; --- llookup.numelements++; --- --- index = lhashFunction(oid); -------#ifdef DEBUG ---- printf("DEBUG(insert) oid = %d, mid =%d, index =%d\n",oid,mid, index); --- printf("DEBUG(insert) oid = %d, mid =%d, index =%d\n",oid,mid, index); -------#endif ---- pthread_mutex_lock(&llookup.locktable); ---- if(ptr[index].next == NULL && ptr[index].oid == 0) { // Insert at the first position in the hashtable ---- ptr[index].oid = oid; ---- ptr[index].mid = mid; ---- } else { // Insert in the linked list ---- if ((node = calloc(1, sizeof(lhashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- pthread_mutex_unlock(&llookup.locktable); ---- return 1; ---- } ---- node->oid = oid; ---- node->mid = mid; ---- node->next = ptr[index].next; ---- ptr[index].next = node; ---- } ---- ---- pthread_mutex_unlock(&llookup.locktable); ---- return 0; --- pthread_mutex_lock(&llookup.locktable); --- if(ptr[index].next == NULL && ptr[index].oid == 0) { // Insert at the first position in the hashtable --- ptr[index].oid = oid; --- ptr[index].mid = mid; --- } else { // Insert in the linked list --- if ((node = calloc(1, sizeof(lhashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- pthread_mutex_unlock(&llookup.locktable); --- return 1; --- } --- node->oid = oid; --- node->mid = mid; --- node->next = ptr[index].next; --- ptr[index].next = node; --- } --- --- pthread_mutex_unlock(&llookup.locktable); --- return 0; -------} ------- -------// Return mid for a given oid in the hash table -------unsigned int lhashSearch(unsigned int oid) { ---- int index; ---- lhashlistnode_t *ptr, *node; --- int index; --- lhashlistnode_t *ptr, *node; ------- ---- ptr = llookup.table; // Address of the beginning of hash table ---- index = lhashFunction(oid); ---- node = &ptr[index]; ---- pthread_mutex_lock(&llookup.locktable); ---- while(node != NULL) { ---- if(node->oid == oid) { ---- pthread_mutex_unlock(&llookup.locktable); ---- return node->mid; ---- } ---- node = node->next; ---- } ---- pthread_mutex_unlock(&llookup.locktable); ---- return 0; --- ptr = llookup.table; // Address of the beginning of hash table --- index = lhashFunction(oid); --- node = &ptr[index]; --- pthread_mutex_lock(&llookup.locktable); --- while(node != NULL) { --- if(node->oid == oid) { --- pthread_mutex_unlock(&llookup.locktable); --- return node->mid; --- } --- node = node->next; --- } --- pthread_mutex_unlock(&llookup.locktable); --- return 0; -------} ------- -------// Remove an entry from the hash table -------unsigned int lhashRemove(unsigned int oid) { ---- int index; ---- lhashlistnode_t *curr, *prev; ---- lhashlistnode_t *ptr, *node; ---- ---- ptr = llookup.table; ---- index = lhashFunction(oid); ---- curr = &ptr[index]; ---- ---- pthread_mutex_lock(&llookup.locktable); ---- for (; curr != NULL; curr = curr->next) { ---- if (curr->oid == oid) { // Find a match in the hash table ---- llookup.numelements--; // Decrement the number of elements in the global hashtable ---- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of lhashlistnode_t ---- curr->oid = 0; ---- curr->mid = 0; ---- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of lhashlistnode_t connected ---- curr->oid = curr->next->oid; ---- curr->mid = curr->next->mid; ---- node = curr->next; ---- curr->next = curr->next->next; ---- free(node); ---- } else { // Regular delete from linked listed ---- prev->next = curr->next; ---- free(curr); ---- } ---- pthread_mutex_unlock(&llookup.locktable); ---- return 0; ---- } ---- prev = curr; ---- } ---- pthread_mutex_unlock(&llookup.locktable); ---- return 1; --- int index; --- lhashlistnode_t *curr, *prev; --- lhashlistnode_t *ptr, *node; --- --- ptr = llookup.table; --- index = lhashFunction(oid); --- curr = &ptr[index]; --- --- pthread_mutex_lock(&llookup.locktable); --- for (; curr != NULL; curr = curr->next) { --- if (curr->oid == oid) { // Find a match in the hash table --- llookup.numelements--; // Decrement the number of elements in the global hashtable --- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of lhashlistnode_t --- curr->oid = 0; --- curr->mid = 0; --- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of lhashlistnode_t connected --- curr->oid = curr->next->oid; --- curr->mid = curr->next->mid; --- node = curr->next; --- curr->next = curr->next->next; --- free(node); --- } else { // Regular delete from linked listed --- prev->next = curr->next; --- free(curr); --- } --- pthread_mutex_unlock(&llookup.locktable); --- return 0; --- } --- prev = curr; --- } --- pthread_mutex_unlock(&llookup.locktable); --- return 1; -------} ------- -------// Resize table -------unsigned int lhashResize(unsigned int newsize) { ---- lhashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next lhashlistnodes in a linked list ---- unsigned int oldsize; ---- int isfirst; // Keeps track of the first element in the lhashlistnode_t for each bin in hashtable ---- int i,index; ---- lhashlistnode_t *newnode; ---- ---- ptr = llookup.table; ---- oldsize = llookup.size; ---- ---- if((node = calloc(newsize, sizeof(lhashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } --- lhashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next lhashlistnodes in a linked list --- unsigned int oldsize; --- int isfirst; // Keeps track of the first element in the lhashlistnode_t for each bin in hashtable --- int i,index; --- lhashlistnode_t *newnode; ------- ---- llookup.table = node; //Update the global hashtable upon resize() ---- llookup.size = newsize; ---- llookup.numelements = 0; --- ptr = llookup.table; --- oldsize = llookup.size; ------- ---- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table ---- curr = &ptr[i]; ---- isfirst = 1; ---- while (curr != NULL) { //Inner loop to go through linked lists ---- if (curr->oid == 0) { //Exit inner loop if there the first element for a given bin/index is NULL ---- break; //oid = mid =0 for element if not present within the hash table ---- } ---- next = curr->next; ---- index = lhashFunction(curr->oid); ---- // Insert into the new table ---- if(llookup.table[index].next == NULL && llookup.table[index].oid == 0) { ---- llookup.table[index].oid = curr->oid; ---- llookup.table[index].mid = curr->mid; ---- llookup.numelements++; ---- }else { ---- if((newnode = calloc(1, sizeof(lhashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- return 1; ---- } ---- newnode->oid = curr->oid; ---- newnode->mid = curr->mid; ---- newnode->next = llookup.table[index].next; ---- llookup.table[index].next = newnode; ---- llookup.numelements++; ---- } ---- ---- //free the linked list of lhashlistnode_t if not the first element in the hash table ---- if (isfirst != 1) { ---- free(curr); ---- } ---- ---- isfirst = 0; ---- curr = next; --- if((node = calloc(newsize, sizeof(lhashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } ------- ---- } --- llookup.table = node; //Update the global hashtable upon resize() --- llookup.size = newsize; --- llookup.numelements = 0; --- --- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table --- curr = &ptr[i]; --- isfirst = 1; --- while (curr != NULL) { //Inner loop to go through linked lists --- if (curr->oid == 0) { //Exit inner loop if there the first element for a given bin/index is NULL --- break; //oid = mid =0 for element if not present within the hash table --- } --- next = curr->next; --- index = lhashFunction(curr->oid); --- // Insert into the new table --- if(llookup.table[index].next == NULL && llookup.table[index].oid == 0) { --- llookup.table[index].oid = curr->oid; --- llookup.table[index].mid = curr->mid; --- llookup.numelements++; --- } else { --- if((newnode = calloc(1, sizeof(lhashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return 1; ------- } --- newnode->oid = curr->oid; --- newnode->mid = curr->mid; --- newnode->next = llookup.table[index].next; --- llookup.table[index].next = newnode; --- llookup.numelements++; --- } ------- ---- free(ptr); //Free the memory of the old hash table ---- return 0; --- //free the linked list of lhashlistnode_t if not the first element in the hash table --- if (isfirst != 1) { --- free(curr); --- } --- --- isfirst = 0; --- curr = next; --- --- } --- } --- --- free(ptr); //Free the memory of the old hash table --- return 0; -------} ------ ------#endif ------ diff --cc Robust/src/Runtime/DSTM/interface/llookup.h index 7a70b9bd,20dbac72,20dbac72,29c0d304,3f9f44c7,3f9f44c7,3f9f44c7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/llookup.h +++ /dev/null @@@@@@@@ -1,32 -1,40 -1,40 -1,40 -1,40 -1,40 -1,40 +1,0 @@@@@@@@ -------#ifndef _LLOOKUP_H_ -------#define _LLOOKUP_H_ ------- -------#include -------#include -------#include ------ ------#define SIMPLE_LLOOKUP ------- --- #define LOADFACTOR 0.75 ----#define LOADFACTOR 0.5 -------#define HASH_SIZE 100 ------- -------typedef struct lhashlistnode { ---- unsigned int oid; ---- unsigned int mid; ---- struct lhashlistnode *next; --- unsigned int oid; --- unsigned int mid; --- struct lhashlistnode *next; -------} lhashlistnode_t; ------- -------typedef struct lhashtable { ---- lhashlistnode_t *table; // points to beginning of hash table ---- unsigned int size; ---- unsigned int numelements; ---- float loadfactor; ---- pthread_mutex_t locktable; --- lhashlistnode_t *table; // points to beginning of hash table --- unsigned int size; --- unsigned int numelements; --- float loadfactor; --- pthread_mutex_t locktable; -------} lhashtable_t; ------- - unsigned int lhashCreate(unsigned int size, float loadfactor);// returns 0 for success and 0 for failure - unsigned int lhashFunction(unsigned int oid); // returns 0 for success and 0 for failure - unsigned int lhashInsert(unsigned int oid, unsigned int mid); // returns 0 for success and 0 for failure - unsigned int lhashSearch(unsigned int oid); //returns mid, 0 if not found - unsigned int lhashRemove(unsigned int oid); //returns 0 if not success - unsigned int lhashResize(unsigned int newsize); // returns 0 for success and 0 for failure ------//returns 0 for success and 1 for failure ------unsigned int lhashCreate(unsigned int size, float loadfactor); ------//returns 0 for success and 1 for failure ------unsigned int lhashInsert(unsigned int oid, unsigned int mid); ------//returns mid, 0 if not found ------unsigned int lhashSearch(unsigned int oid); ------//returns 0 for success and 1 for failure ------unsigned int lhashRemove(unsigned int oid); ------ ------//helper functions ------unsigned int lhashResize(unsigned int newsize); ------unsigned int lhashFunction(unsigned int oid); ------- -------#endif diff --cc Robust/src/Runtime/DSTM/interface/machinepile.c index 9b5c416f,c27ea01b,c27ea01b,10b5aed8,9d4a15de,9d4a15de,9d4a15de..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/machinepile.c +++ /dev/null @@@@@@@@ -1,53 -1,85 -1,85 -1,80 -1,80 -1,80 -1,80 +1,0 @@@@@@@@ -------#include "machinepile.h" ------- - int insertPile(int mid, unsigned int oid, short numoffset, short *offset, prefetchpile_t *head) { -- prefetchpile_t *insertPile(int mid, unsigned int oid, short numoffset, short *offset, prefetchpile_t *head) { --- prefetchpile_t *tmp = head; -- prefetchpile_t *ptr; --- objpile_t *objnode; --- unsigned int *oidarray; - int ntuples; -- short *offvalues; -- int i; --- char found = 0; ----void insertPile(int mid, unsigned int oid, short numoffset, short *offset, prefetchpile_t **head) { ---- prefetchpile_t *ptr; ---- objpile_t *objnode; ---- unsigned int *oidarray; ---- objpile_t **tmp; ------- --- while (tmp != NULL) { --- if (tmp->mid == mid) { // Found a match with exsisting machine id --- if ((objnode = (objpile_t *) calloc(1, sizeof(objpile_t))) == NULL) { --- printf("Calloc error: %s %d\n", __FILE__, __LINE__); - return -1; -- return NULL; -- } -- if ((offvalues = (short *) calloc(numoffset, sizeof(short))) == NULL) { -- printf("Calloc error: %s %d\n", __FILE__, __LINE__); -- return NULL; --- } --- /* Fill objpiles DS */ --- objnode->oid = oid; --- objnode->numoffset = numoffset; - objnode->offset = offset; -- for(i = 0; ioffset = offvalues; --- objnode->next = tmp->objpiles; --- tmp->objpiles = objnode; --- found = 1; --- break; --- } --- tmp = tmp->next; --- } - if (!found) {// Not found => insert new mid DS - if ((tmp = (prefetchpile_t *) calloc(1, sizeof(prefetchpile_t))) == NULL) { - printf("Calloc error: %s %d\n", __FILE__, __LINE__); - return -1; - } - tmp->mid = mid; - if ((objnode = (objpile_t *) calloc(1, sizeof(objpile_t))) == NULL) { - printf("Calloc error: %s %d\n", __FILE__, __LINE__); - return -1; ---- //Loop through the machines - for(;1;head=&((*head)->next)) { --- for(; 1; head=&((*head)->next)) { ---- int tmid; ---- if ((*head)==NULL||(tmid=(*head)->mid)>mid) { ---- prefetchpile_t * tmp = (prefetchpile_t *) malloc(sizeof(prefetchpile_t)); ---- tmp->mid = mid; ---- objnode = malloc(sizeof(objpile_t)); ---- objnode->offset = offset; ---- objnode->oid = oid; ---- objnode->numoffset = numoffset; ---- objnode->next = NULL; ---- tmp->objpiles = objnode; ---- tmp->next = *head; ---- *head=tmp; ---- return; ---- } ------ -- tmp = head; -- if(found != 1) { -- if(tmp->mid == 0) {//First time -- tmp->mid = mid; -- if ((objnode = (objpile_t *) calloc(1, sizeof(objpile_t))) == NULL) { -- printf("Calloc error: %s %d\n", __FILE__, __LINE__); -- return NULL; -- } -- if ((offvalues = (short *) calloc(numoffset, sizeof(short))) == NULL) { -- printf("Calloc error: %s %d\n", __FILE__, __LINE__); -- return NULL; -- } -- // Fill objpiles DS -- objnode->oid = oid; -- objnode->numoffset = numoffset; -- for(i = 0; ioffset = offvalues; -- objnode->next = NULL; -- tmp->objpiles = objnode; -- tmp->next = NULL; -- } else { -- if ((tmp = (prefetchpile_t *) calloc(1, sizeof(prefetchpile_t))) == NULL) { -- printf("Calloc error: %s %d\n", __FILE__, __LINE__); -- return NULL; -- } -- tmp->mid = mid; -- if ((objnode = (objpile_t *) calloc(1, sizeof(objpile_t))) == NULL) { -- printf("Calloc error: %s %d\n", __FILE__, __LINE__); -- return NULL; -- } -- if ((offvalues = (short *) calloc(numoffset, sizeof(short))) == NULL) { -- printf("Calloc error: %s %d\n", __FILE__, __LINE__); -- return NULL; -- } -- // Fill objpiles DS -- objnode->oid = oid; -- objnode->numoffset = numoffset; -- for(i = 0; ioffset = offvalues; -- objnode->next = NULL; -- tmp->objpiles = objnode; -- tmp->next = head; -- head = tmp; --- } - /* Fill objpiles DS */ - objnode->oid = oid; - objnode->numoffset = numoffset; - objnode->offset = offset; - objnode->next = tmp->objpiles; // i.e., objnode->next = NULL; - tmp->objpiles = objnode; - tmp->next = head; - head = tmp; --- } - return 0; - } ---- //keep looking ---- if (tmid < mid) ---- continue; - --- ---- //found mid list - for(tmp=&((*head)->objpiles);1;tmp=&((*tmp)->next)) { --- for(tmp=&((*head)->objpiles); 1; tmp=&((*tmp)->next)) { ---- int toid; ---- int matchstatus; - ---- - //TODO - int deletePile() { ---- if ((*tmp)==NULL||((toid=(*tmp)->oid)>oid)) { ---- objnode = (objpile_t *) malloc(sizeof(objpile_t)); ---- objnode->offset = offset; ---- objnode->oid = oid; ---- objnode->numoffset = numoffset; ---- objnode->next = *tmp; ---- *tmp = objnode; ---- return; ---- } ---- if (toid < oid) ---- continue; - --- ---- /* Fill objpiles DS */ ---- int i; ---- int onumoffset=(*tmp)->numoffset; ---- short * ooffset=(*tmp)->offset; - ---- - return 0; -- -- return head; - for(i=0;ionumoffset) { ---- //We've matched, let's just extend the current prefetch ---- (*tmp)->numoffset=numoffset; ---- (*tmp)->offset=offset; ---- return; ---- } ---- if (ooffset[i]offset[i]) { ---- //Place item before the current one ---- objnode = (objpile_t *) malloc(sizeof(objpile_t)); ---- objnode->offset = offset; ---- objnode->oid = oid; ---- objnode->numoffset = numoffset; ---- objnode->next = *tmp; ---- *tmp = objnode; ---- return; ---- } ---- } ---- //if we get to the end, we're already covered by this prefetch ---- return; - oidloop: ---oidloop: ---- ; ---- } ---- } - --- ---- -------} diff --cc Robust/src/Runtime/DSTM/interface/machinepile.h index 70fd47fb,8add41b7,8add41b7,c32a02a8,c32a02a8,c32a02a8,c32a02a8..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/machinepile.h +++ /dev/null @@@@@@@@ -1,11 -1,10 -1,10 -1,10 -1,10 -1,10 -1,10 +1,0 @@@@@@@@ -------#ifndef _MACHINEPILE_H_ -------#define _MACHINEPILE_H_ ------- -------#include "mcpileq.h" -------#include -------#include ------- - int insertPile(int, unsigned int, short, short *, prefetchpile_t *); - int deletePile(); -- prefetchpile_t *insertPile(int, unsigned int, short, short *, prefetchpile_t *); ----void insertPile(int, unsigned int, short, short *, prefetchpile_t **); ------- -------#endif diff --cc Robust/src/Runtime/DSTM/interface/main.c index 3a6f44f7,3a6f44f7,3a6f44f7,3a6f44f7,0f9e91f5,0f9e91f5,0f9e91f5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/main.c +++ /dev/null @@@@@@@@ -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 -1,25 +1,0 @@@@@@@@ ---- #include ---- #include ---- #include ---#include ---#include ---#include -------#include "dstm.h" ------- -------#define size 1000000 ---- --- ------- -------obj_addr_table_t mlut; ---- int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)}; ---int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)}; ------- ---- int main() { ---- int i; ---- ---- dstm_init(); ---- create_objstr(size); ---- createHash(&mlut, HASH_SIZE, 0.75); ---- ---- for(i=0; i< 4 ; i++) { ---- createObject(i); ---- } ---- ---- createObject(3); ---- return 0; ---int main() { --- int i; --- --- dstm_init(); --- create_objstr(size); --- createHash(&mlut, HASH_SIZE, 0.75); --- --- for(i=0; i< 4 ; i++) { --- createObject(i); --- } --- --- createObject(3); --- return 0; -------} diff --cc Robust/src/Runtime/DSTM/interface/mcpileq.c index 27081a08,fea54094,fea54094,bb58ecef,f8929907,f8929907,f8929907..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/mcpileq.c +++ /dev/null @@@@@@@@ -1,107 -1,84 -1,84 -1,71 -1,71 -1,71 -1,71 +1,0 @@@@@@@@ -------#include "mcpileq.h" ------- - mcpileq_t mcqueue; ------mcpileq_t mcqueue; //Global queue ------- -------void mcpileqInit(void) { --- /* Initialize machine queue that containing prefetch oids and offset values sorted by remote machineid */ --- mcqueue.front = mcqueue.rear = NULL; - pthread_mutex_init(&mcqueue.qlock, NULL); -- //Intiliaze and set machile pile queue's mutex attribute -- pthread_mutexattr_init(&mcqueue.qlockattr); -- pthread_mutexattr_settype(&mcqueue.qlockattr, PTHREAD_MUTEX_RECURSIVE_NP); -- //pthread_mutex_init(&mcqueue.qlock, NULL); -- pthread_mutex_init(&mcqueue.qlock,&mcqueue.qlockattr); --- pthread_cond_init(&mcqueue.qcond, NULL); - /* Initialize machine queue that containing prefetch oids and offset values sorted by remote machineid */ --- /* Initialize machine queue that containing prefetch oids and offset values sorted by remote machineid */ ---- mcqueue.front = mcqueue.rear = NULL; ---- //Intiliaze and set machile pile queue's mutex attribute ---- pthread_mutexattr_init(&mcqueue.qlockattr); ---- pthread_mutexattr_settype(&mcqueue.qlockattr, PTHREAD_MUTEX_RECURSIVE_NP); - pthread_mutex_init(&mcqueue.qlock,&mcqueue.qlockattr); - pthread_cond_init(&mcqueue.qcond, NULL); --- pthread_mutex_init(&mcqueue.qlock,&mcqueue.qlockattr); --- pthread_cond_init(&mcqueue.qcond, NULL); -------} ------- -------/* Insert to the rear of machine pile queue */ - /* - void mcpileenqueue(prefetchpile_t *node) { ------void mcpileenqueue(prefetchpile_t *node, prefetchpile_t *tail) { --- if(mcqueue.front == NULL && mcqueue.rear == NULL) { - mcqueue.front = mcqueue.rear = node; -- mcqueue.front = node; -- mcqueue.rear = tail; --- } else { - node->next = NULL; --- mcqueue.rear->next = node; - mcqueue.rear = node; - } - } - */ - - /* Insert to the rear of machine pile queue */ - void mcpileenqueue(prefetchpile_t *node) { - prefetchpile_t *tmp, *prev; - if(mcqueue.front == NULL && mcqueue.rear == NULL) { - tmp = mcqueue.front = node; - while(tmp != NULL) { - prev = tmp; - tmp = tmp->next; - } - mcqueue.rear = prev; - } else { - tmp = mcqueue.rear->next = node; - while(tmp != NULL) { - prev = tmp; - tmp = tmp->next; - } - mcqueue.rear = prev; -- mcqueue.rear = tail; --- } ---- if(mcqueue.front == NULL) { ---- mcqueue.front = node; ---- mcqueue.rear = tail; ---- } else { ---- mcqueue.rear->next = node; ---- mcqueue.rear = tail; ---- } -------} ------- -------/* Return the node pointed to by the front ptr of the queue */ -------prefetchpile_t *mcpiledequeue(void) { --- prefetchpile_t *retnode; --- if(mcqueue.front == NULL) { - printf("Machune pile queue empty: Underfloe %s %d\n", __FILE__, __LINE__); -- printf("Machine pile queue empty: Underflow %s %d\n", __FILE__, __LINE__); --- return NULL; --- } --- retnode = mcqueue.front; --- mcqueue.front = mcqueue.front->next; -- if (mcqueue.front == NULL) -- mcqueue.rear = NULL; --- retnode->next = NULL; --- --- return retnode; - } - - /* Delete the node pointed to by the front ptr of the queue */ - void delnode() { - prefetchpile_t *delnode; - if((mcqueue.front == NULL) && (mcqueue.rear == NULL)) { - printf("The queue is empty: UNDERFLOW %s, %d\n", __FILE__, __LINE__); - return; - } else if ((mcqueue.front == mcqueue.rear) && mcqueue.front != NULL && mcqueue.rear != NULL) { - printf("TEST1\n"); - free(mcqueue.front); - mcqueue.front = mcqueue.rear = NULL; - } else { - delnode = mcqueue.front; - mcqueue.front = mcqueue.front->next; - printf("TEST2\n"); - free(delnode); - } --- } --- --- void mcpiledelete(void) { --- /* Remove each element */ --- while(mcqueue.front != NULL) --- delqnode(); --- mcqueue.front = mcqueue.rear = NULL; ---- prefetchpile_t *retnode=mcqueue.front; ---- if(retnode == NULL) { ---- printf("Machine pile queue empty: Underflow %s %d\n", __FILE__, __LINE__); ---- return NULL; ---- } ---- mcqueue.front = retnode->next; ---- if (mcqueue.front == NULL) ---- mcqueue.rear = NULL; ---- retnode->next = NULL; - --- ---- return retnode; -------} --- ------- -------void mcpiledisplay() { --- int mid; --- --- prefetchpile_t *tmp = mcqueue.front; --- while(tmp != NULL) { --- printf("Remote machine id = %d\n", tmp->mid); --- tmp = tmp->next; --- } ---- int mid; - --- ---- prefetchpile_t *tmp = mcqueue.front; ---- while(tmp != NULL) { ---- printf("Remote machine id = %d\n", tmp->mid); ---- tmp = tmp->next; ---- } -------} ------- ------/* Delete prefetchpile_t and everything it points to */ -------void mcdealloc(prefetchpile_t *node) { - /* Remove the offset ptr and linked lists of objpile_t */ - objpile_t *delnode; - while(node->objpiles != NULL) { - node->objpiles->offset = NULL; - delnode = node->objpiles; - node->objpiles = node->objpiles->next; - free(delnode); - node->objpiles->next = NULL; -- prefetchpile_t *prefetchpile_ptr; -- prefetchpile_t *prefetchpile_next_ptr; -- objpile_t *objpile_ptr; -- objpile_t *objpile_next_ptr; -- -- prefetchpile_ptr = node; -- -- while (prefetchpile_ptr != NULL) -- { -- prefetchpile_next_ptr = prefetchpile_ptr; -- while(prefetchpile_ptr->objpiles != NULL) { -- if(prefetchpile_ptr->objpiles->numoffset > 0) { -- free(prefetchpile_ptr->objpiles->offset); -- } -- objpile_ptr = prefetchpile_ptr->objpiles; -- prefetchpile_ptr->objpiles = objpile_ptr->next; -- free(objpile_ptr); -- } -- prefetchpile_ptr = prefetchpile_next_ptr->next; -- free(prefetchpile_next_ptr); --- } - free(node); - node->next = NULL; ---- prefetchpile_t *prefetchpile_ptr; ---- prefetchpile_t *prefetchpile_next_ptr; ---- objpile_t *objpile_ptr; ---- objpile_t *objpile_next_ptr; - --- ---- prefetchpile_ptr = node; - --- ---- while (prefetchpile_ptr != NULL) { ---- prefetchpile_next_ptr = prefetchpile_ptr; ---- while(prefetchpile_ptr->objpiles != NULL) { ---- //offsets aren't owned by us, so we don't free them. ---- objpile_ptr = prefetchpile_ptr->objpiles; ---- prefetchpile_ptr->objpiles = objpile_ptr->next; ---- free(objpile_ptr); ---- } ---- prefetchpile_ptr = prefetchpile_next_ptr->next; ---- free(prefetchpile_next_ptr); ---- } -------} diff --cc Robust/src/Runtime/DSTM/interface/mcpileq.h index 93e20630,26a3de2c,26a3de2c,f32c7b69,5c0ab8ba,5c0ab8ba,5c0ab8ba..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/mcpileq.h +++ /dev/null @@@@@@@@ -1,38 -1,38 -1,38 -1,37 -1,37 -1,37 -1,37 +1,0 @@@@@@@@ -------#ifndef _MCPILEQ_H_ -------#define _MCPILEQ_H_ ------- ---- #include ---- #include ---- #include ---- #include ---#include ---#include ---#include ---#include ------- -------//Structure to make machine groups when prefetching ---- typedef struct objpile { --- unsigned int oid; --- short numoffset; --- short *offset; --- struct objpile *next; --- }objpile_t; ---typedef struct objpile { ---- unsigned int oid; ---- short numoffset; ---- short *offset; ---- struct objpile *next; ----} objpile_t; ------- -------//Structure for prefetching tuples generated by the compiler -------typedef struct prefetchpile { --- int mid; --- objpile_t *objpiles; --- struct prefetchpile *next; --- }prefetchpile_t; ---- unsigned int mid; ---- objpile_t *objpiles; ---- struct prefetchpile *next; ----} prefetchpile_t; ------- -------typedef struct mcpileq { --- prefetchpile_t *front, *rear; --- pthread_mutex_t qlock; -- pthread_mutexattr_t qlockattr; --- pthread_cond_t qcond; --- }mcpileq_t; ---- prefetchpile_t *front, *rear; ---- pthread_mutex_t qlock; ---- pthread_mutexattr_t qlockattr; ---- pthread_cond_t qcond; ----} mcpileq_t; ------- -------void mcpileqInit(void); - void mcpileenqueue(prefetchpile_t *); ------void mcpileenqueue(prefetchpile_t *, prefetchpile_t *); -------prefetchpile_t *mcpiledequeue(void); - void delnode(); --- void mcpiledelete(); -------void mcpiledisplay(); -------void mcdealloc(prefetchpile_t *); ------- -------#endif diff --cc Robust/src/Runtime/DSTM/interface/mlookup.c index 2c952638,0629adbe,0629adbe,9000b80e,a554d62f,4d5c6263,4d5c6263..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/mlookup.c +++ /dev/null @@@@@@@@ -1,221 -1,219 -1,219 -1,218 -1,215 -1,214 -1,214 +1,0 @@@@@@@@ -------#include "mlookup.h" ------- ---- mhashtable_t mlookup; //Global hash table ---mhashtable_t mlookup; //Global hash table ------- ---- // Creates a machine lookup table with size =" size" ---- unsigned int mhashCreate(unsigned int size, float loadfactor) { ---- mhashlistnode_t *nodes; - int i; ---// Creates a machine lookup table with size =" size" ---unsigned int mhashCreate(unsigned int size, float loadfactor) { --- mhashlistnode_t *nodes; --- // Allocate space for the hash table --- if((nodes = calloc(size, sizeof(mhashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } - --- ---- // Allocate space for the hash table ---- if((nodes = calloc(size, sizeof(mhashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } ---- ---- mlookup.table = nodes; ---- mlookup.size = size; ---- mlookup.numelements = 0; // Initial number of elements in the hash ---- mlookup.loadfactor = loadfactor; ---- //Initialize the pthread_mutex variable ---- pthread_mutex_init(&mlookup.locktable, NULL); ---- return 0; --- mlookup.table = nodes; --- mlookup.size = size; --- mlookup.numelements = 0; // Initial number of elements in the hash --- mlookup.loadfactor = loadfactor; --- //Initialize the pthread_mutex variable --- pthread_mutex_init(&mlookup.locktable, NULL); --- return 0; -------} ------- -------// Assign to keys to bins inside hash table -------unsigned int mhashFunction(unsigned int key) { ---- return( key % (mlookup.size)); --- return( key % (mlookup.size)); -------} ------- -------// Insert value and key mapping into the hash table -------unsigned int mhashInsert(unsigned int key, void *val) { ---- unsigned int newsize; ---- int index; ---- mhashlistnode_t *ptr, *node; ---- ---- if (mlookup.numelements > (mlookup.loadfactor * mlookup.size)) { ---- //Resize Table ---- newsize = 2 * mlookup.size + 1; ---- pthread_mutex_lock(&mlookup.locktable); ---- mhashResize(newsize); ---- pthread_mutex_unlock(&mlookup.locktable); ---- } ---- ptr = mlookup.table; ---- mlookup.numelements++; ---- --- index = mhashFunction(key); --- unsigned int newsize; --- int index; --- mhashlistnode_t *ptr, *node; --- --- if (mlookup.numelements > (mlookup.loadfactor * mlookup.size)) { --- //Resize Table --- newsize = 2 * mlookup.size + 1; --- pthread_mutex_lock(&mlookup.locktable); --- mhashResize(newsize); --- pthread_mutex_unlock(&mlookup.locktable); --- } --- ptr = mlookup.table; --- mlookup.numelements++; --- -------#ifdef DEBUG ---- printf("DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); --- printf("DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); -------#endif ---- pthread_mutex_lock(&mlookup.locktable); - index = mhashFunction(key); ---- if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable ---- ptr[index].key = key; ---- ptr[index].val = val; ---- } else { // Insert in the beginning of linked list ---- if ((node = calloc(1, sizeof(mhashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- pthread_mutex_unlock(&mlookup.locktable); ---- return 1; ---- } ---- node->key = key; - node->val = val ; --- node->val = val; ---- node->next = ptr[index].next; ---- ptr[index].next = node; ---- } ---- pthread_mutex_unlock(&mlookup.locktable); ---- return 0; --- pthread_mutex_lock(&mlookup.locktable); --- index = mhashFunction(key); --- if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable --- ptr[index].key = key; --- ptr[index].val = val; --- } else { // Insert in the beginning of linked list --- if ((node = calloc(1, sizeof(mhashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- pthread_mutex_unlock(&mlookup.locktable); --- return 1; --- } --- node->key = key; --- node->val = val; --- node->next = ptr[index].next; --- ptr[index].next = node; --- } --- pthread_mutex_unlock(&mlookup.locktable); --- return 0; -------} ------- -------// Return val for a given key in the hash table -------void *mhashSearch(unsigned int key) { ---- int index; ---- mhashlistnode_t *ptr, *node; --- int index; --- mhashlistnode_t *ptr, *node; ------- - pthread_mutex_lock(&mlookup.locktable); ---- ptr = mlookup.table; // Address of the beginning of hash table ---- index = mhashFunction(key); ---- node = &ptr[index]; --- pthread_mutex_lock(&mlookup.locktable); ---- while(node != NULL) { ---- if(node->key == key) { ---- pthread_mutex_unlock(&mlookup.locktable); ---- return node->val; ---- } ---- node = node->next; ---- } ---- pthread_mutex_unlock(&mlookup.locktable); ---- return NULL; --- pthread_mutex_lock(&mlookup.locktable); --- ptr = mlookup.table; // Address of the beginning of hash table --- index = mhashFunction(key); --- node = &ptr[index]; --- while(node != NULL) { --- if(node->key == key) { --- pthread_mutex_unlock(&mlookup.locktable); --- return node->val; --- } --- node = node->next; --- } --- pthread_mutex_unlock(&mlookup.locktable); --- return NULL; -------} ------- -------// Remove an entry from the hash table -------unsigned int mhashRemove(unsigned int key) { ---- int index; ---- mhashlistnode_t *curr, *prev; ---- mhashlistnode_t *ptr, *node; ---- - pthread_mutex_lock(&mlookup.locktable); ---- ptr = mlookup.table; ---- index = mhashFunction(key); ---- curr = &ptr[index]; --- int index; --- mhashlistnode_t *curr, *prev; --- mhashlistnode_t *ptr, *node; --- --- --- pthread_mutex_lock(&mlookup.locktable); ---- for (; curr != NULL; curr = curr->next) { ---- if (curr->key == key) { // Find a match in the hash table ---- mlookup.numelements--; // Decrement the number of elements in the global hashtable ---- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of mhashlistnode_t ---- curr->key = 0; ---- curr->val = NULL; ---- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of mhashlistnode_t connected ---- curr->key = curr->next->key; ---- curr->val = curr->next->val; ---- node = curr->next; ---- curr->next = curr->next->next; ---- free(node); ---- } else { // Regular delete from linked listed ---- prev->next = curr->next; ---- free(curr); ---- } ---- pthread_mutex_unlock(&mlookup.locktable); ---- return 0; ---- } ---- prev = curr; ---- } ---- pthread_mutex_unlock(&mlookup.locktable); ---- return 1; --- pthread_mutex_lock(&mlookup.locktable); --- ptr = mlookup.table; --- index = mhashFunction(key); --- curr = &ptr[index]; --- for (; curr != NULL; curr = curr->next) { --- if (curr->key == key) { // Find a match in the hash table --- mlookup.numelements--; // Decrement the number of elements in the global hashtable --- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of mhashlistnode_t --- curr->key = 0; --- curr->val = NULL; --- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of mhashlistnode_t connected --- curr->key = curr->next->key; --- curr->val = curr->next->val; --- node = curr->next; --- curr->next = curr->next->next; --- free(node); --- } else { // Regular delete from linked listed --- prev->next = curr->next; --- free(curr); --- } --- pthread_mutex_unlock(&mlookup.locktable); --- return 0; --- } --- prev = curr; --- } --- pthread_mutex_unlock(&mlookup.locktable); --- return 1; -------} ------- -------// Resize table -------unsigned int mhashResize(unsigned int newsize) { ---- mhashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next mhashlistnodes in a linked list ---- unsigned int oldsize; ---- int isfirst; // Keeps track of the first element in the mhashlistnode_t for each bin in hashtable ---- int i,index; ---- mhashlistnode_t *newnode; ---- ---- ptr = mlookup.table; ---- oldsize = mlookup.size; ---- ---- if((node = calloc(newsize, sizeof(mhashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } --- mhashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next mhashlistnodes in a linked list --- unsigned int oldsize; --- int isfirst; // Keeps track of the first element in the mhashlistnode_t for each bin in hashtable --- int i,index; --- mhashlistnode_t *newnode; ------- ---- mlookup.table = node; //Update the global hashtable upon resize() ---- mlookup.size = newsize; ---- mlookup.numelements = 0; --- ptr = mlookup.table; --- oldsize = mlookup.size; ------- ---- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table ---- curr = &ptr[i]; ---- isfirst = 1; ---- while (curr != NULL) { //Inner loop to go through linked lists ---- if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL ---- break; //key = val =0 for element if not present within the hash table ---- } ---- next = curr->next; --- if((node = calloc(newsize, sizeof(mhashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } ------- ---- index = mhashFunction(curr->key); --- mlookup.table = node; //Update the global hashtable upon resize() --- mlookup.size = newsize; --- mlookup.numelements = 0; --- --- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table --- curr = &ptr[i]; --- isfirst = 1; --- while (curr != NULL) { //Inner loop to go through linked lists --- if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL --- break; //key = val =0 for element if not present within the hash table --- } --- next = curr->next; --- --- index = mhashFunction(curr->key); -------#ifdef DEBUG ---- printf("DEBUG(resize) -> index = %d, key = %d, val = %x\n", index, curr->key, curr->val); --- printf("DEBUG(resize) -> index = %d, key = %d, val = %x\n", index, curr->key, curr->val); -------#endif ---- // Insert into the new table ---- if(mlookup.table[index].next == NULL && mlookup.table[index].key == 0) { ---- mlookup.table[index].key = curr->key; ---- mlookup.table[index].val = curr->val; ---- mlookup.numelements++; ---- }else { ---- if((newnode = calloc(1, sizeof(mhashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- return 1; ---- } ---- newnode->key = curr->key; ---- newnode->val = curr->val; ---- newnode->next = mlookup.table[index].next; ---- mlookup.table[index].next = newnode; ---- mlookup.numelements++; ---- } --- // Insert into the new table --- if(mlookup.table[index].next == NULL && mlookup.table[index].key == 0) { --- mlookup.table[index].key = curr->key; --- mlookup.table[index].val = curr->val; --- mlookup.numelements++; --- } else { --- if((newnode = calloc(1, sizeof(mhashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return 1; --- } --- newnode->key = curr->key; --- newnode->val = curr->val; --- newnode->next = mlookup.table[index].next; --- mlookup.table[index].next = newnode; --- mlookup.numelements++; --- } ------- ---- //free the linked list of mhashlistnode_t if not the first element in the hash table ---- if (isfirst != 1) { ---- free(curr); ---- } ---- ---- isfirst = 0; ---- curr = next; --- //free the linked list of mhashlistnode_t if not the first element in the hash table --- if (isfirst != 1) { --- free(curr); --- } ------- ---- } ---- } --- isfirst = 0; --- curr = next; ------- ---- free(ptr); //Free the memory of the old hash table ---- return 0; --- } --- } --- --- free(ptr); //Free the memory of the old hash table --- return 0; -------} ------- ---- unsigned int *mhashGetKeys(unsigned int *numKeys) ---- { ---- unsigned int *keys; ---- int i, keyindex; ---- mhashlistnode_t *curr; ---unsigned int *mhashGetKeys(unsigned int *numKeys) { --- unsigned int *keys; --- int i, keyindex; --- mhashlistnode_t *curr; ------- ---- pthread_mutex_lock(&mlookup.locktable); --- pthread_mutex_lock(&mlookup.locktable); ------- ---- *numKeys = mlookup.numelements; ---- keys = calloc(*numKeys, sizeof(unsigned int)); --- *numKeys = mlookup.numelements; --- keys = calloc(*numKeys, sizeof(unsigned int)); ------- ---- keyindex = 0; ---- for (i = 0; i < mlookup.size; i++) ---- { ---- if (mlookup.table[i].key != 0) ---- { ---- curr = &mlookup.table[i]; ---- while (curr != NULL) ---- { ---- keys[keyindex++] = curr->key; ---- curr = curr->next; ---- } ---- } ---- } --- keyindex = 0; - for (i = 0; i < mlookup.size; i++) - { - if (mlookup.table[i].key != 0){ -- for (i = 0; i < mlookup.size; i++) { -- if (mlookup.table[i].key != 0) { --- curr = &mlookup.table[i]; - while (curr != NULL){ -- while (curr != NULL) { --- keys[keyindex++] = curr->key; --- curr = curr->next; --- } --- } --- } ------- ---- if (keyindex != *numKeys) ---- printf("mhashGetKeys(): WARNING: incorrect mlookup.numelements value!\n"); --- if (keyindex != *numKeys) --- printf("mhashGetKeys(): WARNING: incorrect mlookup.numelements value!\n"); ------- ---- pthread_mutex_unlock(&mlookup.locktable); ---- return keys; --- pthread_mutex_unlock(&mlookup.locktable); --- return keys; -------} ------- diff --cc Robust/src/Runtime/DSTM/interface/mlookup.h index 85396c52,85396c52,85396c52,aec88798,f3360d4a,f3360d4a,f3360d4a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/mlookup.h +++ /dev/null @@@@@@@@ -1,35 -1,35 -1,35 -1,35 -1,35 -1,35 -1,35 +1,0 @@@@@@@@ -------#ifndef _MLOOKUP_H_ -------#define _MLOOKUP_H_ ------- -------#include -------#include -------#include ------- --- #define LOADFACTOR 0.75 ----#define LOADFACTOR 0.5 -------#define HASH_SIZE 100 ------- -------typedef struct mhashlistnode { ---- unsigned int key; ---- void *val; //this can be cast to another type or used to point to a larger structure ---- struct mhashlistnode *next; --- unsigned int key; --- void *val; //this can be cast to another type or used to point to a larger structure --- struct mhashlistnode *next; -------} mhashlistnode_t; ------- -------typedef struct mhashtable { ---- mhashlistnode_t *table; // points to beginning of hash table ---- unsigned int size; ---- unsigned int numelements; ---- float loadfactor; ---- pthread_mutex_t locktable; --- mhashlistnode_t *table; // points to beginning of hash table --- unsigned int size; --- unsigned int numelements; --- float loadfactor; --- pthread_mutex_t locktable; -------} mhashtable_t; ------- -------unsigned int mhashCreate(unsigned int size, float loadfactor); -------unsigned int mhashFunction(unsigned int key); -------unsigned mhashInsert(unsigned int key, void *val); -------void *mhashSearch(unsigned int key); //returns val, NULL if not found -------unsigned int mhashRemove(unsigned int key); //returns -1 if not found -------unsigned int mhashResize(unsigned int newsize); -------unsigned int *mhashGetKeys(unsigned int *numKeys); -------void mhashPrint(); ------- -------#endif ------- diff --cc Robust/src/Runtime/DSTM/interface/objstr.c index 4a66fa54,20004396,20004396,32bf38de,b3d2cbdd,b3d2cbdd,b3d2cbdd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/objstr.c +++ /dev/null @@@@@@@@ -1,57 -1,63 -1,63 -1,58 -1,58 -1,58 -1,58 +1,0 @@@@@@@@ -------#include "dstm.h" ------- --- objstr_t *objstrCreate(unsigned int size) --- { - objstr_t *tmp = malloc(sizeof(objstr_t) + size); -- objstr_t *tmp = calloc(1, (sizeof(objstr_t) + size)); --- tmp->size = size; -- tmp->next = NULL; --- tmp->top = tmp + 1; //points to end of objstr_t structure! --- return tmp; ----objstr_t *objstrCreate(unsigned int size) { ---- objstr_t *tmp; ---- if((tmp = calloc(1, (sizeof(objstr_t) + size))) == NULL) { ---- printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); ---- return NULL; ---- } ---- tmp->size = size; ---- tmp->next = NULL; ---- tmp->top = tmp + 1; //points to end of objstr_t structure! ---- return tmp; -------} ------- -------//free entire list, starting at store --- void objstrDelete(objstr_t *store) --- { --- objstr_t *tmp; --- while (store != NULL) --- { --- tmp = store->next; --- free(store); --- store = tmp; --- } --- return; ----void objstrDelete(objstr_t *store) { ---- objstr_t *tmp; ---- while (store != NULL) { ---- tmp = store->next; ---- free(store); ---- store = tmp; ---- } ---- return; -------} ------- --- void *objstrAlloc(objstr_t *store, unsigned int size) --- { --- void *tmp; --- while (1) --- { --- if (((unsigned int)store->top - (unsigned int)store - sizeof(objstr_t) + size) <= store->size) --- { //store not full --- tmp = store->top; --- store->top += size; --- return tmp; --- } --- //store full --- if (store->next == NULL) --- { //end of list, all full --- if (size > DEFAULT_OBJ_STORE_SIZE) //in case of large objects --- { - store->next = (objstr_t *)malloc(sizeof(objstr_t) + size); -- store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size)); -- if (store->next == NULL) -- return NULL; --- store = store->next; --- store->size = size; --- } --- else --- { - store->next = malloc(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE); -- store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE)); -- if (store->next == NULL) -- return NULL; --- store = store->next; -- store->next = NULL; --- store->size = DEFAULT_OBJ_STORE_SIZE; --- } --- store->top = (void *)((unsigned int)store + sizeof(objstr_t) + size); --- return (void *)((unsigned int)store + sizeof(objstr_t)); --- } --- else //try the next one --- store = store->next; --- } ----void *objstrAlloc(objstr_t *store, unsigned int size) { ---- void *tmp; ---- while (1) { ---- if (((unsigned int)store->top - (((unsigned int)store) + sizeof(objstr_t)) + size) <= store->size) { //store not full ---- tmp = store->top; ---- store->top += size; ---- return tmp; ---- } ---- //store full ---- if (store->next == NULL) { ---- //end of list, all full ---- if (size > DEFAULT_OBJ_STORE_SIZE) { - //in case of large objects - if((store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - store = store->next; - store->size = size; --- //in case of large objects --- if((store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size))) == NULL) { --- printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); --- return NULL; --- } --- store = store->next; --- store->size = size; ---- } else { - if((store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - store = store->next; - store->size = DEFAULT_OBJ_STORE_SIZE; --- if((store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE))) == NULL) { --- printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); --- return NULL; --- } --- store = store->next; --- store->size = DEFAULT_OBJ_STORE_SIZE; ---- } ---- store->top = (void *)(((unsigned int)store) + sizeof(objstr_t) + size); ---- return (void *)(((unsigned int)store) + sizeof(objstr_t)); ---- } else ---- store = store->next; ---- } -------} --- diff --cc Robust/src/Runtime/DSTM/interface/plookup.c index 7bf85693,1752c36c,7672ee0e,683f11d4,3eee2cbd,3eee2cbd,3eee2cbd..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/plookup.c +++ /dev/null @@@@@@@@ -1,119 -1,149 -1,149 -1,81 -1,81 -1,81 -1,81 +1,0 @@@@@@@@ -------#include "plookup.h" -------extern int classsize[]; ------ --- //NOTE: "pile" ptr points to the head of the linked list of the machine pile data structures ---//NOTE: "pile" ptr points to the head of the linked list of the machine pile data structures ------ ------/* This function creates a new pile data structure to hold ------ * obj ids of objects modified or read inside a transaction, ------ * no of objects read and no of objects modified ------ * that belong to a single machine */ ------- -------plistnode_t *pCreate(int objects) { ---- plistnode_t *pile; ---- ---- //Create main structure ---- if((pile = calloc(1, sizeof(plistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return NULL; ---- } - pile->next = NULL; ---- if ((pile->oidmod = calloc(objects, sizeof(unsigned int))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- free(pile); ---- return NULL; ---- } - if ((pile->oidread = calloc(objects, sizeof(unsigned int))) == NULL) { --- if ((pile->oidcreated = calloc(objects, sizeof(unsigned int))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- free(pile); --- free(pile->oidmod); ---- return NULL; ---- } - pile->nummod = pile->numread = pile->sum_bytes = 0; - if ((pile->objread = calloc(objects, sizeof(int) + sizeof(short))) == NULL) { --- if ((pile->objread = calloc(objects, sizeof(unsigned int) + sizeof(short))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- free(pile); --- free(pile->oidmod); --- free(pile->oidcreated); ---- return NULL; ---- } - pile->objmodified = NULL; - pile->nummod = pile->numread = pile->sum_bytes = 0; ---- - pile->nummod = pile->numread = pile->numcreated = pile->sum_bytes = 0; -- pile->nummod = pile->numread = pile->numcreated = pile->sum_bytes = pile->mid = 0; --- pile->next = NULL; --- return pile; --- } --- -- /* This function inserts necessary information into -- * a machine pile data structure */ --- plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mid, int num_objs) { --- plistnode_t *ptr, *tmp; -- int found = 0, offset; - int found = 0, offset = 0; --- --- tmp = pile; - //Add oid into a machine that is a part of the pile linked list structure -- //Add oid into a machine that is already present in the pile linked list structure --- while(tmp != NULL) { --- if (tmp->mid == mid) { - if ((headeraddr->status & DIRTY) == 1) { - tmp->oidmod[tmp->nummod] = headeraddr->oid; - tmp->nummod = tmp->nummod + 1; - tmp->sum_bytes += sizeof(objheader_t) + classsize[headeraddr->type]; - } else { - tmp->oidread[tmp->numread] = headeraddr->oid; - offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; - memcpy(tmp->objread + offset, &headeraddr->oid, sizeof(unsigned int)); - offset += sizeof(unsigned int); - memcpy(tmp->objread + offset, &headeraddr->version, sizeof(short)); - tmp->numread = tmp->numread + 1; - // printf("DEBUG->pInsert() No of obj read = %d\n", tmp->numread); - } - found = 1; - break; -- int tmpsize; -- -- if (STATUS(headeraddr) & NEW) { -- tmp->oidcreated[tmp->numcreated] = OID(headeraddr); -- tmp->numcreated = tmp->numcreated + 1; -- GETSIZE(tmpsize, headeraddr); -- tmp->sum_bytes += sizeof(objheader_t) + tmpsize; -- }else if (STATUS(headeraddr) & DIRTY) { -- tmp->oidmod[tmp->nummod] = OID(headeraddr); -- tmp->nummod = tmp->nummod + 1; -- GETSIZE(tmpsize, headeraddr); -- tmp->sum_bytes += sizeof(objheader_t) + tmpsize; -- } else { -- offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; - *((unsigned int *)(tmp->objread + offset))=OID(headeraddr); - *((unsigned int *)(((char *)tmp->objread) + offset))=OID(headeraddr); -- offset += sizeof(unsigned int); - memcpy(tmp->objread + offset, &headeraddr->version, sizeof(short)); - *((short *)(((char *)tmp->objread) + offset)) = headeraddr->version; -- tmp->numread = tmp->numread + 1; -- } -- found = 1; -- break; --- } --- tmp = tmp->next; --- } --- //Add oid for any new machine --- if (!found) { - if((ptr = pCreate(num_objs)) == NULL) { - return NULL; - } - ptr->mid = mid; - if ((headeraddr->status & DIRTY) == 1) { - ptr->oidmod[ptr->nummod] = headeraddr->oid; - ptr->nummod = ptr->nummod + 1; - ptr->sum_bytes += sizeof(objheader_t) + classsize[headeraddr->type]; - } else { - ptr->oidread[ptr->numread] = headeraddr->oid; - memcpy(ptr->objread, &headeraddr->oid, sizeof(unsigned int)); - memcpy(ptr->objread + sizeof(unsigned int), &headeraddr->version, sizeof(short)); - ptr->numread = ptr->numread + 1; - } - ptr->next = pile; - pile = ptr; -- int tmpsize; -- if((ptr = pCreate(num_objs)) == NULL) { -- return NULL; -- } -- ptr->mid = mid; -- if (STATUS(headeraddr) & NEW) { -- ptr->oidcreated[ptr->numcreated] = OID(headeraddr); -- ptr->numcreated = ptr->numcreated + 1; -- GETSIZE(tmpsize, headeraddr); -- ptr->sum_bytes += sizeof(objheader_t) + tmpsize; -- } else if (STATUS(headeraddr) & DIRTY) { -- ptr->oidmod[ptr->nummod] = OID(headeraddr); -- ptr->nummod = ptr->nummod + 1; -- GETSIZE(tmpsize, headeraddr); -- ptr->sum_bytes += sizeof(objheader_t) + tmpsize; -- } else { -- *((unsigned int *)ptr->objread)=OID(headeraddr); - memcpy(ptr->objread + sizeof(unsigned int), &headeraddr->version, sizeof(short)); - offset = sizeof(unsigned int); - *((short *)(((char *)ptr->objread) + offset)) = headeraddr->version; -- ptr->numread = ptr->numread + 1; -- } -- ptr->next = pile; -- pile = ptr; --- } - - /* Clear Flags */ --- plistnode_t *pile; -- --- - STATUS(headeraddr) &= ~(NEW); - STATUS(headeraddr) &= ~(DIRTY); - /* Clear Flags */ - STATUS(headeraddr) &= ~NEW; - STATUS(headeraddr) &= ~DIRTY; --- //Create main structure --- if((pile = calloc(1, sizeof(plistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return NULL; --- } --- if ((pile->oidmod = calloc(objects, sizeof(unsigned int))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- free(pile); --- return NULL; --- } --- if ((pile->oidcreated = calloc(objects, sizeof(unsigned int))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- free(pile); --- free(pile->oidmod); --- return NULL; --- } --- if ((pile->objread = calloc(objects, sizeof(unsigned int) + sizeof(short))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- free(pile); --- free(pile->oidmod); --- free(pile->oidcreated); --- return NULL; --- } --- --- ---- return pile; --- pile->nummod = pile->numread = pile->numcreated = pile->sum_bytes = pile->mid = 0; --- pile->next = NULL; --- return pile; -------} ------- - //Count the number of machine groups ------//Count the number of machine piles -------int pCount(plistnode_t *pile) { ---- plistnode_t *tmp; ---- int pcount = 0; ---- tmp = pile; ---- while(tmp != NULL) { ---- pcount++; ---- tmp = tmp->next; ---- } ---- return pcount; --- plistnode_t *tmp; --- int pcount = 0; --- tmp = pile; --- while(tmp != NULL) { --- pcount++; --- tmp = tmp->next; --- } --- return pcount; -------} ------- -------//Make a list of mid's for each machine group -------int pListMid(plistnode_t *pile, unsigned int *list) { ---- int i = 0; ---- plistnode_t *tmp; ---- tmp = pile; ---- while (tmp != NULL) { ---- list[i] = tmp->mid; ---- i++; ---- tmp = tmp->next; ---- } ---- return 0; --- int i = 0; --- plistnode_t *tmp; --- tmp = pile; --- while (tmp != NULL) { --- list[i] = tmp->mid; --- i++; --- tmp = tmp->next; --- } --- return 0; -------} ------- -------//Delete the entire pile -------void pDelete(plistnode_t *pile) { ---- plistnode_t *next, *tmp; ---- tmp = pile; ---- while(tmp != NULL) { ---- next = tmp->next; ---- free(tmp->oidmod); - free(tmp->oidread); --- free(tmp->oidcreated); ---- free(tmp->objread); ---- free(tmp); ---- tmp = next; ---- } ---- return; --- plistnode_t *next, *tmp; --- tmp = pile; --- while(tmp != NULL) { --- next = tmp->next; --- free(tmp->oidmod); --- free(tmp->oidcreated); --- free(tmp->objread); --- free(tmp); --- tmp = next; --- } --- return; -------} diff --cc Robust/src/Runtime/DSTM/interface/plookup.h index f4a84e29,777f0259,777f0259,4d15b4a7,d4137839,d4137839,d4137839..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/plookup.h +++ /dev/null @@@@@@@@ -1,29 -1,30 -1,30 -1,28 -1,28 -1,28 -1,28 +1,0 @@@@@@@@ -------#ifndef _PLOOKUP_H_ -------#define _PLOOKUP_H_ ------- -------#include -------#include --- #include "dstm.h" ------- ------/* This structure is created using a transaction record. --- * It is filled out with pile information necessary for --- * It is filled out with pile information necessary for ------ * participants involved in a transaction. */ -------typedef struct plistnode { ---- unsigned int mid; - int local; /*Variable that keeps track if this pile is for LOCAL machine */ - unsigned int *oidmod; - unsigned int *oidread; - int nummod; - int numread; - int sum_bytes; - char *objread; - char *objmodified; - int vote; -- short numread; /* no of objects modified */ -- short nummod; /* no of objects read */ -- short numcreated; /* no of objects created */ - unsigned int numread; /* no of objects modified */ - unsigned int nummod; /* no of objects read */ - unsigned int numcreated; /* no of objects created */ --- int sum_bytes; /* total bytes of objects modified */ --- char *objread; /* Pointer to array containing oids of objects read and their version numbers*/ --- unsigned int *oidmod; /* Pointer to array containing oids of modified objects */ --- unsigned int *oidcreated; /* Pointer to array containing oids of newly created objects */ ---- struct plistnode *next; --- unsigned int mid; --- unsigned int numread; /* no of objects modified */ --- unsigned int nummod; /* no of objects read */ --- unsigned int numcreated; /* no of objects created */ --- int sum_bytes; /* total bytes of objects modified */ --- char *objread; /* Pointer to array containing oids of objects read and their version numbers*/ --- unsigned int *oidmod; /* Pointer to array containing oids of modified objects */ --- unsigned int *oidcreated; /* Pointer to array containing oids of newly created objects */ --- struct plistnode *next; -------} plistnode_t; ------- -------plistnode_t *pCreate(int); --- plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mid, int num_objs); -------int pCount(plistnode_t *pile); -------int pListMid(plistnode_t *pile, unsigned int *list); -------void pDelete(plistnode_t *pile); ------- -------#endif ------- diff --cc Robust/src/Runtime/DSTM/interface/prelookup.c index 77733dfd,6eda49cf,6eda49cf,f003e0f1,79a616f4,79a616f4,79a616f4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/prelookup.c +++ /dev/null @@@@@@@@ -1,202 -1,210 -1,210 -1,226 -1,226 -1,226 -1,226 +1,0 @@@@@@@@ - #include "prelookup.h" ------/* LOCK THE ENTIRE HASH TABLE */ ------#include "prelookup.h" ----extern objstr_t *prefetchcache; ------- -------prehashtable_t pflookup; //Global prefetch cache table ------- -------unsigned int prehashCreate(unsigned int size, float loadfactor) { --- prehashlistnode_t *nodes; --- int i; --- --- // Allocate space for the hash table --- if((nodes = calloc(size, sizeof(prehashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } --- --- pflookup.table = nodes; --- pflookup.size = size; --- pflookup.numelements = 0; // Initial number of elements in the hash --- pflookup.loadfactor = loadfactor; -- -- //Intiliaze and set prefetch table mutex attribute -- pthread_mutexattr_init(&pflookup.prefetchmutexattr); -- //NOTE:PTHREAD_MUTEX_RECURSIVE is currently inside a #if_def UNIX98 in the pthread.h file -- //Therefore use PTHREAD_MUTEX_RECURSIVE_NP instead -- pthread_mutexattr_settype(&pflookup.prefetchmutexattr, PTHREAD_MUTEX_RECURSIVE_NP); --- prehashlistnode_t *nodes; --- int i; --- --- --- //Initialize mutex var - pthread_mutex_init(&pflookup.lock, NULL); - -- pthread_mutex_init(&pflookup.lock, &pflookup.prefetchmutexattr); -- //pthread_mutex_init(&pflookup.lock, NULL); -- pthread_cond_init(&pflookup.cond, NULL); --- return 0; - prehashlistnode_t *nodes; - int i; - - // Allocate space for the hash table - if((nodes = calloc(size, sizeof(prehashlistnode_t))) == NULL) { --- // Allocate space for the hash table --- if((nodes = calloc(size, sizeof(prehashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } ---- pflookup.hack=NULL; ---- pflookup.hack2=NULL; ---- pflookup.table = nodes; - pflookup.size = size; --- pflookup.size = size; ---- pflookup.numelements = 0; // Initial number of elements in the hash ---- pflookup.loadfactor = loadfactor; - --- ---- //Intiliaze and set prefetch table mutex attribute ---- pthread_mutexattr_init(&pflookup.prefetchmutexattr); ---- //NOTE:PTHREAD_MUTEX_RECURSIVE is currently inside a #if_def UNIX98 in the pthread.h file ---- //Therefore use PTHREAD_MUTEX_RECURSIVE_NP instead ---- pthread_mutexattr_settype(&pflookup.prefetchmutexattr, PTHREAD_MUTEX_RECURSIVE_NP); - --- ---- //Initialize mutex var ---- pthread_mutex_init(&pflookup.lock, &pflookup.prefetchmutexattr); ---- //pthread_mutex_init(&pflookup.lock, NULL); - pthread_cond_init(&pflookup.cond, NULL); --- pthread_cond_init(&pflookup.cond, NULL); ---- return 0; -------} ------- -------//Assign keys to bins inside hash table -------unsigned int prehashFunction(unsigned int key) { --- return ( key % (pflookup.size)); ---- return ( key % (pflookup.size)); -------} ------- -------//Store oids and their pointers into hash -------unsigned int prehashInsert(unsigned int key, void *val) { --- unsigned int newsize; --- int index; --- prehashlistnode_t *ptr, *node; --- --- if(pflookup.numelements > (pflookup.loadfactor * pflookup.size)) { --- //Resize --- newsize = 2 * pflookup.size + 1; --- pthread_mutex_lock(&pflookup.lock); --- prehashResize(newsize); --- pthread_mutex_unlock(&pflookup.lock); --- } --- --- ptr = pflookup.table; --- pflookup.numelements++; --- index = prehashFunction(key); --- --- pthread_mutex_lock(&pflookup.lock); --- if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable --- ptr[index].key = key; --- ptr[index].val = val; --- } else { // Insert in the beginning of linked list --- if ((node = calloc(1, sizeof(prehashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- pthread_mutex_unlock(&pflookup.lock); --- return 1; --- } --- node->key = key; --- node->val = val ; --- node->next = ptr[index].next; --- ptr[index].next = node; --- } --- pthread_mutex_unlock(&pflookup.lock); --- return 0; ---- unsigned int newsize; ---- int index; ---- prehashlistnode_t *ptr, *node; - --- ---- if(pflookup.numelements > (pflookup.loadfactor * pflookup.size)) { ---- //Resize ---- newsize = 2 * pflookup.size + 1; ---- pthread_mutex_lock(&pflookup.lock); ---- prehashResize(newsize); ---- pthread_mutex_unlock(&pflookup.lock); ---- } - --- ---- ptr = pflookup.table; ---- pflookup.numelements++; - --- ---- pthread_mutex_lock(&pflookup.lock); ---- index = prehashFunction(key); - if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable --- if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable ---- ptr[index].key = key; ---- ptr[index].val = val; - } else { // Insert in the beginning of linked list --- } else { // Insert in the beginning of linked list ---- if ((node = calloc(1, sizeof(prehashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- pthread_mutex_unlock(&pflookup.lock); ---- return 1; ---- } ---- node->key = key; ---- node->val = val ; ---- node->next = ptr[index].next; ---- ptr[index].next = node; ---- } ---- pthread_mutex_unlock(&pflookup.lock); ---- return 0; -------} ------- -------// Search for an address for a given oid -------void *prehashSearch(unsigned int key) { --- int index; --- prehashlistnode_t *ptr, *node; --- --- ptr = pflookup.table; --- index = prehashFunction(key); --- node = &ptr[index]; --- pthread_mutex_lock(&pflookup.lock); --- while(node != NULL) { --- if(node->key == key) { --- pthread_mutex_unlock(&pflookup.lock); --- return node->val; --- } --- node = node->next; --- } --- pthread_mutex_unlock(&pflookup.lock); --- return NULL; ---- int index; ---- prehashlistnode_t *ptr, *node; - --- ---- pthread_mutex_lock(&pflookup.lock); ---- ptr = pflookup.table; ---- index = prehashFunction(key); ---- node = &ptr[index]; ---- while(node != NULL) { ---- if(node->key == key) { ---- pthread_mutex_unlock(&pflookup.lock); ---- return node->val; ---- } ---- node = node->next; ---- } ---- pthread_mutex_unlock(&pflookup.lock); ---- return NULL; -------} ------- -------unsigned int prehashRemove(unsigned int key) { --- int index; --- prehashlistnode_t *curr, *prev; --- prehashlistnode_t *ptr, *node; --- --- ptr = pflookup.table; --- index = prehashFunction(key); --- curr = &ptr[index]; ---- int index; ---- prehashlistnode_t *curr, *prev; ---- prehashlistnode_t *ptr, *node; ------- --- pthread_mutex_lock(&pflookup.lock); --- for (; curr != NULL; curr = curr->next) { --- if (curr->key == key) { // Find a match in the hash table --- pflookup.numelements--; // Decrement the number of elements in the global hashtable --- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of prehashlistnode_t --- curr->key = 0; --- curr->val = NULL; --- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of prehashlistnode_t connected --- curr->key = curr->next->key; --- curr->val = curr->next->val; --- node = curr->next; --- curr->next = curr->next->next; --- free(node); --- } else { // Regular delete from linked listed --- prev->next = curr->next; --- free(curr); --- } --- pthread_mutex_unlock(&pflookup.lock); --- return 0; --- } --- prev = curr; --- } --- pthread_mutex_unlock(&pflookup.lock); --- return 1; ---- pthread_mutex_lock(&pflookup.lock); - ptr = pflookup.table; --- ptr = pflookup.table; ---- index = prehashFunction(key); ---- curr = &ptr[index]; - --- ---- for (; curr != NULL; curr = curr->next) { ---- if (curr->key == key) { // Find a match in the hash table ---- pflookup.numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of prehashlistnode_t --- if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of prehashlistnode_t ---- curr->key = 0; ---- curr->val = NULL; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of prehashlistnode_t connected --- } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of prehashlistnode_t connected ---- curr->key = curr->next->key; ---- curr->val = curr->next->val; ---- node = curr->next; ---- curr->next = curr->next->next; ---- free(node); - } else { // Regular delete from linked listed --- } else { // Regular delete from linked listed ---- prev->next = curr->next; ---- free(curr); ---- } ---- pthread_mutex_unlock(&pflookup.lock); ---- return 0; - } - prev = curr; --- } --- prev = curr; ---- } ---- pthread_mutex_unlock(&pflookup.lock); ---- return 1; -------} ------- -------unsigned int prehashResize(unsigned int newsize) { --- prehashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list --- unsigned int oldsize; --- int isfirst; // Keeps track of the first element in the prehashlistnode_t for each bin in hashtable --- int i,index; --- prehashlistnode_t *newnode; --- --- ptr = pflookup.table; --- oldsize = pflookup.size; --- --- if((node = calloc(newsize, sizeof(prehashlistnode_t))) == NULL) { --- printf("Calloc error %s %d\n", __FILE__, __LINE__); --- return 1; --- } --- --- pflookup.table = node; //Update the global hashtable upon resize() --- pflookup.size = newsize; --- pflookup.numelements = 0; --- --- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table --- curr = &ptr[i]; --- isfirst = 1; --- while (curr != NULL) { //Inner loop to go through linked lists --- if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL --- break; //key = val =0 for element if not present within the hash table --- } --- next = curr->next; --- index = prehashFunction(curr->key); --- // Insert into the new table --- if(pflookup.table[index].next == NULL && pflookup.table[index].key == 0) { --- pflookup.table[index].key = curr->key; --- pflookup.table[index].val = curr->val; --- pflookup.numelements++; --- }else { --- if((newnode = calloc(1, sizeof(prehashlistnode_t))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return 1; --- } --- newnode->key = curr->key; --- newnode->val = curr->val; --- newnode->next = pflookup.table[index].next; --- pflookup.table[index].next = newnode; --- pflookup.numelements++; --- } --- --- //free the linked list of prehashlistnode_t if not the first element in the hash table --- if (isfirst != 1) { --- free(curr); --- } --- --- isfirst = 0; --- curr = next; --- } --- } --- --- free(ptr); //Free the memory of the old hash table --- return 0; - prehashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list --- prehashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list ---- unsigned int oldsize; ---- int isfirst; // Keeps track of the first element in the prehashlistnode_t for each bin in hashtable - int i,index; - prehashlistnode_t *newnode; - --- int i,index; --- prehashlistnode_t *newnode; --- ---- ptr = pflookup.table; ---- oldsize = pflookup.size; - --- ---- if((node = calloc(newsize, sizeof(prehashlistnode_t))) == NULL) { ---- printf("Calloc error %s %d\n", __FILE__, __LINE__); ---- return 1; ---- } - - pflookup.table = node; //Update the global hashtable upon resize() --- --- pflookup.table = node; //Update the global hashtable upon resize() ---- pflookup.size = newsize; ---- pflookup.numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table --- --- for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table ---- curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //key = val =0 for element if not present within the hash table --- isfirst = 1; --- while (curr != NULL) { //Inner loop to go through linked lists --- if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL --- break; //key = val =0 for element if not present within the hash table ---- } ---- next = curr->next; ---- index = prehashFunction(curr->key); ---- // Insert into the new table - if(pflookup.table[index].next == NULL && pflookup.table[index].key == 0) { --- if(pflookup.table[index].next == NULL && pflookup.table[index].key == 0) { ---- pflookup.table[index].key = curr->key; ---- pflookup.table[index].val = curr->val; ---- pflookup.numelements++; - }else { - if((newnode = calloc(1, sizeof(prehashlistnode_t))) == NULL) { --- } else { --- if((newnode = calloc(1, sizeof(prehashlistnode_t))) == NULL) { ---- printf("Calloc error %s, %d\n", __FILE__, __LINE__); ---- return 1; - } --- } ---- newnode->key = curr->key; ---- newnode->val = curr->val; ---- newnode->next = pflookup.table[index].next; - pflookup.table[index].next = newnode; --- pflookup.table[index].next = newnode; ---- pflookup.numelements++; - } - --- } --- ---- //free the linked list of prehashlistnode_t if not the first element in the hash table ---- if (isfirst != 1) { ---- free(curr); - } - --- } --- ---- isfirst = 0; ---- curr = next; ---- } ---- } - - free(ptr); //Free the memory of the old hash table --- --- free(ptr); //Free the memory of the old hash table ---- return 0; -------} ------- --- /* Deletes the prefetch Cache */ --- void prehashDelete() { --- int i, isFirst; --- prehashlistnode_t *ptr, *curr, *next; --- ptr = pflookup.table; - //Note: This is based on the implementation of the inserting a key in the first position of the hashtable ---//Note: This is based on the implementation of the inserting a key in the first position of the hashtable ----void prehashClear() { ----#ifdef CACHE ---- int i, isFirstBin; ---- prehashlistnode_t *ptr, *prev, *curr; - --- ---- objstr_t *oldcache=prefetchcache; ---- prefetchcache=objstrCreate(prefetchcache->size); ------- --- for(i=0 ; inext; --- if(isFirst != 1) { --- free(curr); --- } --- isFirst = 0; --- curr = next; --- } --- } ---- pthread_mutex_lock(&pflookup.lock); - ptr = pflookup.table; --- ptr = pflookup.table; ---- for(i = 0; i < pflookup.size; i++) { ---- prev = &ptr[i]; ---- isFirstBin = 1; ---- while(prev->next != NULL) { ---- isFirstBin = 0; ---- curr = prev->next; ---- prev->next = curr->next; ---- free(curr); ---- } ---- if(isFirstBin == 1) { ---- prev->key = 0; ---- prev->next = NULL; ---- } ---- } ---- pthread_mutex_unlock(&pflookup.lock); ------- --- free(ptr); ---- if (pflookup.hack2!=NULL) { ---- objstrDelete(pflookup.hack2); ---- } ---- pflookup.hack2=pflookup.hack; ---- pflookup.hack=oldcache; ----#endif -------} ---- diff --cc Robust/src/Runtime/DSTM/interface/prelookup.h index e8bb204d,acb540d9,acb540d9,8b4c30be,023e53cc,023e53cc,023e53cc..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/prelookup.h +++ /dev/null @@@@@@@@ -1,36 -1,37 -1,37 -1,43 -1,43 -1,43 -1,43 +1,0 @@@@@@@@ -------#ifndef _PRELOOKUP_H_ -------#define _PRELOOKUP_H_ ------- -------#include -------#include -------#include ----#include "dstm.h" ------- --- #define LOADFACTOR 0.75 ----#define LOADFACTOR 0.5 -------#define HASH_SIZE 100 ------- -------typedef struct prehashlistnode { ---- unsigned int key; ---- void *val; //this can be cast to another type or used to point to a larger structure ---- struct prehashlistnode *next; --- unsigned int key; --- void *val; //this can be cast to another type or used to point to a larger structure --- struct prehashlistnode *next; -------} prehashlistnode_t; ---- ----struct objstr; ------- -------typedef struct prehashtable { --- prehashlistnode_t *table; // points to beginning of hash table --- unsigned int size; --- unsigned int numelements; --- float loadfactor; --- pthread_mutex_t lock; -- pthread_mutexattr_t prefetchmutexattr; --- pthread_cond_t cond; - prehashlistnode_t *table; // points to beginning of hash table --- prehashlistnode_t *table; // points to beginning of hash table ---- unsigned int size; ---- unsigned int numelements; ---- float loadfactor; ---- pthread_mutex_t lock; ---- pthread_mutexattr_t prefetchmutexattr; ---- pthread_cond_t cond; ---- struct objstr *hack2; ---- struct objstr *hack; -------} prehashtable_t; ------- -------/* Prototypes for hash*/ -------unsigned int prehashCreate(unsigned int size, float loadfactor); -------unsigned int prehashFunction(unsigned int key); -------unsigned int prehashInsert(unsigned int key, void *val); -------void *prehashSearch(unsigned int key); //returns val, NULL if not found -------unsigned int prehashRemove(unsigned int key); //returns -1 if not found -------unsigned int prehashResize(unsigned int newsize); ----void prehashClear(); -------/* end hash */ ------- -------#endif ------- diff --cc Robust/src/Runtime/DSTM/interface/queue.c index ce82aa7e,6837726b,c4b9e45c,2fb7e990,c892a030,c892a030,c892a030..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/queue.c +++ /dev/null @@@@@@@@ -1,108 -1,110 -1,109 -1,84 -1,84 -1,84 -1,84 +1,0 @@@@@@@@ -------#include "queue.h" ------- --- primarypfq_t pqueue; //Global queue ----volatile int headoffset, tailoffset; ----char * memory; ----pthread_mutex_t qlock; ----pthread_mutexattr_t qlockattr; ----pthread_cond_t qcond; ------- --- void queueInit(void) { --- /* Intitialize primary queue */ --- pqueue.front = pqueue.rear = NULL; - pthread_mutex_init(&pqueue.qlock, NULL); -- pthread_mutexattr_init(&pqueue.qlockattr); -- pthread_mutexattr_settype(&pqueue.qlockattr, PTHREAD_MUTEX_RECURSIVE_NP); -- pthread_mutex_init(&pqueue.qlock, &pqueue.qlockattr); - //pthread_mutex_init(&pqueue.qlock, NULL); --- pthread_cond_init(&pqueue.qcond, NULL); --- } ----#define QSIZE 2048 //2 KB ------- --- /* Delete the node pointed to by the front ptr of the queue */ --- void delqnode() { --- prefetchqelem_t *delnode; --- if((pqueue.front == NULL) && (pqueue.rear == NULL)) { --- printf("The queue is empty: UNDERFLOW %s, %d\n", __FILE__, __LINE__); --- return; --- } else if ((pqueue.front == pqueue.rear) && pqueue.front != NULL && pqueue.rear != NULL) { - printf("TEST1\n"); --- free(pqueue.front); --- pqueue.front = pqueue.rear = NULL; --- } else { --- delnode = pqueue.front; --- pqueue.front = pqueue.front->next; - printf("TEST2\n"); --- free(delnode); --- } ----void queueInit(void) { ---- /* Intitialize primary queue */ ---- headoffset=0; ---- tailoffset=0; - memory=malloc(QSIZE+sizeof(int));//leave space for -1 --- memory=malloc(QSIZE+sizeof(int)); //leave space for -1 ---- pthread_mutexattr_init(&qlockattr); ---- pthread_mutexattr_settype(&qlockattr, PTHREAD_MUTEX_RECURSIVE_NP); ---- pthread_mutex_init(&qlock, &qlockattr); ---- pthread_cond_init(&qcond, NULL); -------} ------- --- void queueDelete(void) { --- /* Remove each element */ --- while(pqueue.front != NULL) --- delqnode(); --- pqueue.front = pqueue.rear = NULL; ----void * getmemory(int size) { ---- int tmpoffset=headoffset+size+sizeof(int); ---- if (tmpoffset>QSIZE) { ---- //Wait for tail to go past end ---- tmpoffset=size+sizeof(int); ---- if (headoffsetnext = NULL; --- pqueue.rear->next = qnode; --- pqueue.rear = qnode; --- } ----void movehead(int size) { ---- int tmpoffset=headoffset+size+sizeof(int); ---- if (tmpoffset>QSIZE) { ---- headoffset=size+sizeof(int); ---- } else ---- headoffset=tmpoffset; - pthread_cond_signal(&qcond);//wake the other thread up --- pthread_cond_signal(&qcond); //wake the other thread up -------} --- --- /* Return the node pointed to by the front ptr of the queue */ - prefetchqelem_t *dequeue(void) { -- prefetchqelem_t *pre_dequeue(void) { --- prefetchqelem_t *retnode; --- if (pqueue.front == NULL) { --- printf("Queue empty: Underflow %s, %d\n", __FILE__, __LINE__); --- return NULL; --- } --- retnode = pqueue.front; --- pqueue.front = pqueue.front->next; -- if (pqueue.front == NULL) -- pqueue.rear = NULL; -- retnode->next = NULL; ------- --- return retnode; --- } ----void * gettail() { ---- while(tailoffset==headoffset) { ---- //Sleep ---- pthread_mutex_lock(&qlock); ---- if (tailoffset==headoffset) ---- pthread_cond_wait(&qcond, &qlock); ---- pthread_mutex_unlock(&qlock); ---- } ---- if (*((int *)(memory+tailoffset))==-1) { - tailoffset=0;//do loop --- tailoffset=0; //do loop ---- } ------- --- void queueDisplay() { --- int offset = sizeof(prefetchqelem_t); --- int *ptr; --- int ntuples; --- char *ptr1; --- prefetchqelem_t *tmp = pqueue.front; --- while(tmp != NULL) { --- ptr1 = (char *) tmp; --- ptr = (int *)(ptr1 + offset); --- ntuples = *ptr; - printf("Number of tuples = %d\n", ntuples); --- tmp = tmp->next; --- } ---- return memory+tailoffset+sizeof(int); -------} ------- --- void predealloc(prefetchqelem_t *node) { --- free(node); - node->next = NULL; ----void inctail() { ---- int tmpoffset=tailoffset+*((int *)(memory+tailoffset)); ---- if (tmpoffset>QSIZE) ---- tailoffset=0; ---- else ---- tailoffset=tmpoffset; -------} --- --- --- #if 0 --- main() { --- unsigned int oids[] = {11, 13}; --- short endoffsets[] = {2, 5}; --- short arrayfields[] = {2, 2, 1, 5, 6}; --- queueInit(); --- queueDisplay(); --- prefetch(2, oids, endoffsets, arrayfields); --- queueDisplay(); --- unsigned int oids1[] = {21, 23, 25, 27}; --- short endoffsets1[] = {1, 2, 3, 4}; --- short arrayfields1[] = {3, 2, 1, 3}; --- prefetch(4, oids1, endoffsets1, arrayfields1); --- queueDisplay(); --- delqnode(); --- queueDisplay(); --- delqnode(); --- queueDisplay(); --- delqnode(); --- queueDisplay(); --- delqnode(); ------- ----void predealloc() { ---- free(memory); -------} --- --- #endif --- ------- diff --cc Robust/src/Runtime/DSTM/interface/queue.h index ff614903,d315135b,d315135b,fffeed15,2e1aa9ec,2e1aa9ec,2e1aa9ec..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/DSTM/interface/queue.h +++ /dev/null @@@@@@@@ -1,28 -1,29 -1,29 -1,16 -1,16 -1,16 -1,16 +1,0 @@@@@@@@ -------#ifndef _QUEUE_H_ -------#define _QUEUE_H_ ---- ---- #include ---- #include ---- #include ---- #include --- --- // DS that contains information to be shared between threads. --- typedef struct prefetchqelem { --- struct prefetchqelem *next; --- } prefetchqelem_t; --- --- typedef struct primarypfq { --- prefetchqelem_t *front, *rear; --- pthread_mutex_t qlock; -- pthread_mutexattr_t qlockattr; --- pthread_cond_t qcond; --- } primarypfq_t; --- --- ---#include ---#include ---#include ---#include ----#include "dstm.h" ------- -------void queueInit(void); --- void delqnode(); --- void queueDelete(void); - void enqueue(prefetchqelem_t *); - prefetchqelem_t *dequeue(void); -- void pre_enqueue(prefetchqelem_t *); -- prefetchqelem_t *pre_dequeue(void); --- void queueDisplay(); --- void predealloc(prefetchqelem_t *); ----void * getmemory(int size); ----void movehead(int size); ----void * gettail(); ----void inctail(); ----void predealloc(); -------#endif diff --cc Robust/src/Runtime/GenericHashtable.c index ac50f964,763aa9ca,763aa9ca,7528b01e,aab1c63d,aab1c63d,aab1c63d..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Runtime/GenericHashtable.c +++ /dev/null @@@@@@@@ -1,228 -1,228 -1,228 -1,307 -1,307 -1,307 -1,307 +1,0 @@@@@@@@ ----#ifdef RAW ----#include ----#else -------#include ----#endif -------#include -------#include -------#include -------#include -------#include ------- -------#include "GenericHashtable.h" -------#include "mem.h" -------#ifdef DMALLOC -------#include "dmalloc.h" -------#endif ------- -------void * getfirstkey(struct genhashtable *ht) { - if(ht->list == NULL) { - return NULL; - } --- if(ht->list == NULL) { --- return NULL; --- } ------- return ht->list->src; -------} ------- -------int genputtable(struct genhashtable *ht, void * key, void * object) { ------- unsigned int bin=genhashfunction(ht,key); ------- struct genpointerlist * newptrlist=(struct genpointerlist *) RUNMALLOC(sizeof(struct genpointerlist)); ------- newptrlist->src=key; ------- newptrlist->object=object; ------- newptrlist->next=ht->bins[bin]; ------- newptrlist->inext=NULL; ------- /* maintain linked list of ht entries for iteration*/ ------- if (ht->last==NULL) { ------- ht->last=newptrlist; ------- ht->list=newptrlist; ------- newptrlist->iprev=NULL; ------- } else { ------- ht->last->inext=newptrlist; ------- newptrlist->iprev=ht->last; ------- ht->last=newptrlist; ------- } ------- ht->bins[bin]=newptrlist; ------- ht->counter++; ------- if(ht->counter>ht->currentsize&&ht->currentsize!=INT_MAX) { ------- /* Expand hashtable */ ---- long newcurrentsize=(ht->currentsize<(INT_MAX/2))?ht->currentsize*2:INT_MAX; --- long newcurrentsize=(ht->currentsize<(INT_MAX/2)) ? ht->currentsize*2 : INT_MAX; ------- long oldcurrentsize=ht->currentsize; ------- struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC(sizeof (struct genpointerlist *)*newcurrentsize); ---- struct genpointerlist **oldbins=ht->bins; ---- long j,i; - for(j=0;jcurrentsize=newcurrentsize; - for(i=0;isrc); - struct genpointerlist *nextptr=tmpptr->next; - tmpptr->next=newbins[hashcode]; - newbins[hashcode]=tmpptr; - tmpptr=nextptr; --- unsigned int hashcode=genhashfunction(ht, tmpptr->src); --- struct genpointerlist *nextptr=tmpptr->next; --- tmpptr->next=newbins[hashcode]; --- newbins[hashcode]=tmpptr; --- tmpptr=nextptr; ---- } ---- } ---- ht->bins=newbins; ---- RUNFREE(oldbins); ---- } ---- return 1; ----} ---- ----#ifdef RAW ----int genputtable_I(struct genhashtable *ht, void * key, void * object) { ---- unsigned int bin=genhashfunction(ht,key); ---- struct genpointerlist * newptrlist=(struct genpointerlist *) RUNMALLOC_I(sizeof(struct genpointerlist)); ---- newptrlist->src=key; ---- newptrlist->object=object; ---- newptrlist->next=ht->bins[bin]; ---- newptrlist->inext=NULL; ---- /* maintain linked list of ht entries for iteration*/ ---- if (ht->last==NULL) { ---- ht->last=newptrlist; ---- ht->list=newptrlist; ---- newptrlist->iprev=NULL; ---- } else { ---- ht->last->inext=newptrlist; ---- newptrlist->iprev=ht->last; ---- ht->last=newptrlist; ---- } ---- ht->bins[bin]=newptrlist; ---- ht->counter++; ---- if(ht->counter>ht->currentsize&&ht->currentsize!=INT_MAX) { ---- /* Expand hashtable */ - long newcurrentsize=(ht->currentsize<(INT_MAX/2))?ht->currentsize*2:INT_MAX; --- long newcurrentsize=(ht->currentsize<(INT_MAX/2)) ? ht->currentsize*2 : INT_MAX; ---- long oldcurrentsize=ht->currentsize; ---- struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC_I(sizeof (struct genpointerlist *)*newcurrentsize); ------- struct genpointerlist **oldbins=ht->bins; ------- long j,i; ---- for(j=0;jcurrentsize=newcurrentsize; ---- for(i=0;isrc); ---- struct genpointerlist *nextptr=tmpptr->next; ---- tmpptr->next=newbins[hashcode]; ---- newbins[hashcode]=tmpptr; ---- tmpptr=nextptr; --- unsigned int hashcode=genhashfunction(ht, tmpptr->src); --- struct genpointerlist *nextptr=tmpptr->next; --- tmpptr->next=newbins[hashcode]; --- newbins[hashcode]=tmpptr; --- tmpptr=nextptr; ------- } ------- } ------- ht->bins=newbins; ------- RUNFREE(oldbins); ------- } ------- return 1; -------} ----#endif ------- -------int hashsize(struct genhashtable *ht) { ------- return ht->counter; -------} ------- -------void genrehash(struct genhashtable * ht) { ------- struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC(sizeof (struct genpointerlist *)*ht->currentsize); ------- struct genpointerlist **oldbins=ht->bins; ------- long j,i; ------- ---- for(i=0;icurrentsize;i++) { --- for(i=0; icurrentsize; i++) { ------- struct genpointerlist * tmpptr=oldbins[i]; ------- while(tmpptr!=NULL) { ------- unsigned int hashcode=genhashfunction(ht, tmpptr->src); ------- struct genpointerlist *nextptr=tmpptr->next; ------- tmpptr->next=newbins[hashcode]; ------- newbins[hashcode]=tmpptr; ------- tmpptr=nextptr; ------- } ------- } ------- ht->bins=newbins; ------- RUNFREE(oldbins); -------} ------- -------void * gengettable(struct genhashtable *ht, void * key) { ------- struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; ------- while(ptr!=NULL) { ------- if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) ------- return ptr->object; ------- ptr=ptr->next; ------- } ----#ifndef RAW ------- printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key); ----#endif ------- return NULL; -------} ------- -------void * getnext(struct genhashtable *ht, void * key) { ------- struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; ------- while(ptr!=NULL) { ------- if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) ------- if (ptr->inext!=NULL) { ------- return ptr->inext->src; ------- } else ------- return NULL; ------- ptr=ptr->next; ------- } ----#ifndef RAW ------- printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p...\n Likely concurrent removal--bad user!!!\n",key); ----#endif ------- return NULL; -------} ------- -------int gencontains(struct genhashtable *ht, void * key) { ------- struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; ------- //printf("In gencontains2\n");fflush(NULL); ------- while(ptr!=NULL) { ------- if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) ------- return 1; ------- ptr=ptr->next; ------- } ------- return 0; -------} ------- ------- -------void genfreekey(struct genhashtable *ht, void * key) { ------- struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; - --- --- ------- if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) { ------- ht->bins[genhashfunction(ht,key)]=ptr->next; ------- ------- if (ptr==ht->last) ------- ht->last=ptr->iprev; ------- ------- if (ptr==ht->list) ------- ht->list=ptr->inext; ------- ------- if (ptr->iprev!=NULL) ------- ptr->iprev->inext=ptr->inext; ------- if (ptr->inext!=NULL) ------- ptr->inext->iprev=ptr->iprev; ---- --- ------- RUNFREE(ptr); ------- ht->counter--; ------- return; ------- } ------- while(ptr->next!=NULL) { ------- if (((ht->comp_function==NULL)&&(ptr->next->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->next->src,key))) { ------- struct genpointerlist *tmpptr=ptr->next; ------- ptr->next=tmpptr->next; ------- if (tmpptr==ht->list) ------- ht->list=tmpptr->inext; ------- if (tmpptr==ht->last) ------- ht->last=tmpptr->iprev; ------- if (tmpptr->iprev!=NULL) ------- tmpptr->iprev->inext=tmpptr->inext; ------- if (tmpptr->inext!=NULL) ------- tmpptr->inext->iprev=tmpptr->iprev; ------- RUNFREE(tmpptr); ------- ht->counter--; ------- return; ------- } ------- ptr=ptr->next; ------- } ----#ifndef RAW ------- printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key); ----#endif -------} ------- -------unsigned int genhashfunction(struct genhashtable *ht, void * key) { ------- if (ht->hash_function==NULL) ------- return ((long unsigned int)key) % ht->currentsize; ------- else ------- return ((*ht->hash_function)(key)) % ht->currentsize; -------} ------- -------struct genhashtable * genallocatehashtable(unsigned int (*hash_function)(void *),int (*comp_function)(void *, void *)) { --- struct genhashtable *ght=(struct genhashtable *) RUNMALLOC(sizeof(struct genhashtable)); --- struct genpointerlist **gpl=(struct genpointerlist **) RUNMALLOC(sizeof(struct genpointerlist *)*geninitialnumbins); ---- struct genhashtable *ght; ---- struct genpointerlist **gpl; ------- int i; --- for(i=0;ihash_function=hash_function; ------- ght->comp_function=comp_function; ------- ght->currentsize=geninitialnumbins; ------- ght->bins=gpl; ------- ght->counter=0; ------- ght->list=NULL; ------- ght->last=NULL; ----#ifdef RAWDEBUG ---- raw_test_pass(0xf004); ----#endif ------- return ght; -------} ------- -------void genfreehashtable(struct genhashtable * ht) { ------- int i; ---- for (i=0;icurrentsize;i++) { --- for (i=0; icurrentsize; i++) { ------- if (ht->bins[i]!=NULL) { ------- struct genpointerlist *genptr=ht->bins[i]; ------- while(genptr!=NULL) { ------- struct genpointerlist *tmpptr=genptr->next; ------- RUNFREE(genptr); ------- genptr=tmpptr; ------- } ------- } ------- } ------- RUNFREE(ht->bins); ------- RUNFREE(ht); -------} ------- -------struct geniterator * gengetiterator(struct genhashtable *ht) { ------- struct geniterator *gi=(struct geniterator*)RUNMALLOC(sizeof(struct geniterator)); ------- gi->ptr=ht->list; ------- return gi; -------} ------- -------void * gennext(struct geniterator *it) { ------- struct genpointerlist *curr=it->ptr; ------- if (curr==NULL) ------- return NULL; ------- if (it->finished&&(curr->inext==NULL)) ------- return NULL; ------- if (it->finished) { ------- it->ptr=curr->inext; ------- return it->ptr->src; ------- } ------- if(curr->inext!=NULL) ------- it->ptr=curr->inext; ------- else ------- it->finished=1; /* change offsetting scheme */ ------- return curr->src; -------} ------- -------void genfreeiterator(struct geniterator *it) { ------- RUNFREE(it); -------} diff --cc Robust/src/Runtime/GenericHashtable.h index 951f044c,951f044c,951f044c,832a8bd2,832a8bd2,832a8bd2,832a8bd2..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Runtime/GenericHashtable.h +++ /dev/null @@@@@@@@ -1,52 -1,52 -1,52 -1,55 -1,55 -1,55 -1,55 +1,0 @@@@@@@@ -------// implements a generic hash table ------- -------#ifndef GENHASHTABLE -------#define GENHASHTABLE -------#define geninitialnumbins 10 -------#define bool int ------- -------struct genhashtable { ------- unsigned int (*hash_function)(void *); ------- int (*comp_function)(void *,void *); ------- struct genpointerlist ** bins; ------- long counter; ------- int currentsize; ------- struct genpointerlist *list; ------- struct genpointerlist *last; -------}; ------- ------- -------struct genpointerlist { ------- void * src; ------- void * object; ------- struct genpointerlist * next; ------- ------- struct genpointerlist * inext; ------- struct genpointerlist * iprev; -------}; ------- ------- -------struct geniterator { ------- struct genpointerlist * ptr; ------- bool finished; -------}; ------- -------struct genhashtable * genallocatehashtable(unsigned int (*hash_function)(void *),int (*comp_function)(void *,void *)); -------void * getfirstkey(struct genhashtable *ht); -------void genfreehashtable(struct genhashtable * ht); -------void genrehash(struct genhashtable * ht); -------void * getnext(struct genhashtable *,void *); -------int genputtable(struct genhashtable *, void *, void *); ----#ifdef RAW ----int genputtable_I(struct genhashtable *, void *, void *); ----#endif -------void * gengettable(struct genhashtable *, void *); -------int gencontains(struct genhashtable *, void *); -------unsigned int genhashfunction(struct genhashtable *,void *); ------- -------int hashsize(struct genhashtable * ht); -------void genfreekey(struct genhashtable *ht, void *); -------struct geniterator * gengetiterator(struct genhashtable *ht); -------void * gennext(struct geniterator *it); -------void genfreeiterator(struct geniterator *it); -------#endif ------- ------- ------- diff --cc Robust/src/Runtime/Queue.c index 5a8da1fa,5a8da1fa,5a8da1fa,90743065,90743065,b00a7d78,33bfcc70..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/Queue.c +++ /dev/null @@@@@@@@ -1,64 -1,64 -1,64 -1,84 -1,84 -1,88 -1,88 +1,0 @@@@@@@@ -------#include "mem.h" -------#include "Queue.h" -------#ifdef DMALLOC -------#include "dmalloc.h" -------#endif ------- -------struct Queue * createQueue() { --- return RUNMALLOC(sizeof(struct Queue)); ---- struct Queue * queue = (struct Queue *)RUNMALLOC(sizeof(struct Queue)); ---- queue->head = NULL; ---- queue->tail = NULL; ---- return queue; -------} ------- -------void freeQueue(struct Queue * q) { ------- RUNFREE(q); ----- } ----- ----- int isEmpty(struct Queue *queue) { ----- return queue->head==NULL; -------} ------- -------struct QueueItem * addNewItem(struct Queue * queue, void * ptr) { ------- struct QueueItem * item=RUNMALLOC(sizeof(struct QueueItem)); ---- item->objectptr=ptr; ---- item->queue=queue; ---- if (queue->head==NULL) { ---- queue->head=item; ---- queue->tail=item; ---- } else { ---- item->next=queue->head; ---- queue->head->prev=item; ---- queue->head=item; ---- } ---- return item; ----} ---- ----#ifdef RAW ----struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr) { ---- struct QueueItem * item=RUNMALLOC_I(sizeof(struct QueueItem)); ------- item->objectptr=ptr; ------- item->queue=queue; ------- if (queue->head==NULL) { ------- queue->head=item; ------- queue->tail=item; ------- } else { ------- item->next=queue->head; ------- queue->head->prev=item; ------- queue->head=item; ------- } ------- return item; -------} ----#endif ------- -------struct QueueItem * findItem(struct Queue * queue, void *ptr) { ------- struct QueueItem * item=queue->head; ------- while(item!=NULL) { ------- if (item->objectptr==ptr) ------- return item; ------- item=item->next; ------- } ------- return NULL; -------} ------- -------void removeItem(struct Queue * queue, struct QueueItem * item) { ------- struct QueueItem * prev=item->prev; ------- struct QueueItem * next=item->next; ------- if (queue->head==item) ------- queue->head=next; ------- else ------- prev->next=next; ------- if (queue->tail==item) ------- queue->tail=prev; ------- else ------- next->prev=prev; ------- RUNFREE(item); -------} ------- -------struct QueueItem * getTail(struct Queue * queue) { ------- return queue->tail; -------} ------- ------ struct QueueItem * getNext(struct QueueItem * qi) { -struct QueueItem * getNextQueueItem(struct QueueItem * qi) { ------- return qi->next; --} -- --void * getItem(struct Queue * queue) { -- struct QueueItem * q=queue->head; -- void * ptr=q->objectptr; -- queue->head=q->next; -- RUNFREE(q); -- return ptr; -------} diff --cc Robust/src/Runtime/Queue.h index ef25820d,ef25820d,ef25820d,033478bf,033478bf,07260fb4,3f368f9a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/Queue.h +++ /dev/null @@@@@@@@ -1,25 -1,25 -1,25 -1,28 -1,28 -1,30 -1,30 +1,0 @@@@@@@@ -------#ifndef QUEUE_H -------#define QUEUE_H ------- -------struct Queue { ------- struct QueueItem * head; ------- struct QueueItem * tail; -------}; ------- -------struct QueueItem { ------- void * objectptr; ------- struct Queue * queue; ------- struct QueueItem * next; ------- struct QueueItem * prev; -------}; -- - #define isEmpty(x) (x->head==NULL) -#define isEmpty(x) ((x)->head==NULL) ------- --void * getItem(struct Queue * queue); -------void freeQueue(struct Queue * q); -------struct Queue * createQueue(); -------struct QueueItem * addNewItem(struct Queue * queue, void * ptr); ----#ifdef RAW ----struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr); ----#endif -------struct QueueItem * findItem(struct Queue * queue, void * ptr); -------void removeItem(struct Queue * queue, struct QueueItem * item); ----- int isEmpty(struct Queue *queue); -------struct QueueItem * getTail(struct Queue * queue); ------ -struct QueueItem * getNextQueueItem(struct QueueItem * qi); ------- -------#endif diff --cc Robust/src/Runtime/SimpleHash.c index 69055bb7,5e69d1d7,5e69d1d7,92fe695f,b43fb0ab,41e07508,41e07508..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Runtime/SimpleHash.c +++ /dev/null @@@@@@@@ -1,259 -1,290 -1,290 -1,365 -1,365 -1,365 -1,365 +1,0 @@@@@@@@ -------#include "SimpleHash.h" ----#ifdef RAW ----#include ----#else -------#include ----#endif -------#ifdef DMALLOC -------#include "dmalloc.h" -------#endif ------- -------/* SIMPLE HASH ********************************************************/ -------struct RuntimeIterator* RuntimeHashcreateiterator(struct RuntimeHash * thisvar) { ---- return allocateRuntimeIterator(thisvar->listhead); --- return allocateRuntimeIterator(thisvar->listhead); -------} ------- -------void RuntimeHashiterator(struct RuntimeHash *thisvar, struct RuntimeIterator * it) { ------- it->cur=thisvar->listhead; -------} ------- -------struct RuntimeHash * noargallocateRuntimeHash() { ---- return allocateRuntimeHash(100); --- return allocateRuntimeHash(100); -------} ------- -------struct RuntimeHash * allocateRuntimeHash(int size) { --- struct RuntimeHash *thisvar=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); - struct RuntimeHash *thisvar;//=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); ---- if (size <= 0) { --- struct RuntimeHash *thisvar; //=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); --- if (size <= 0) { ----#ifdef RAW - raw_test_done(0xb001); --- raw_test_done(0xb001); ----#else ---- printf("Negative Hashtable size Exception\n"); --- exit(-1); - exit(-1); --- printf("Negative Hashtable size Exception\n"); --- exit(-1); ----#endif ---- } - thisvar=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); ---- thisvar->size = size; ---- thisvar->bucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*size); ---- /* Set allocation blocks*/ ---- thisvar->listhead=NULL; ---- thisvar->listtail=NULL; ---- /*Set data counts*/ ---- thisvar->numelements = 0; ---- return thisvar; --- } --- thisvar=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); --- thisvar->size = size; --- thisvar->bucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*size); --- /* Set allocation blocks*/ --- thisvar->listhead=NULL; --- thisvar->listtail=NULL; --- /*Set data counts*/ --- thisvar->numelements = 0; --- return thisvar; -------} ------- -------void freeRuntimeHash(struct RuntimeHash *thisvar) { ---- struct RuntimeNode *ptr=thisvar->listhead; ---- RUNFREE(thisvar->bucket); ---- while(ptr) { ---- struct RuntimeNode *next=ptr->lnext; ---- RUNFREE(ptr); ---- ptr=next; ---- } ---- RUNFREE(thisvar); --- struct RuntimeNode *ptr=thisvar->listhead; --- RUNFREE(thisvar->bucket); --- while(ptr) { --- struct RuntimeNode *next=ptr->lnext; --- RUNFREE(ptr); --- ptr=next; --- } --- RUNFREE(thisvar); -------} ------- -------inline int RuntimeHashcountset(struct RuntimeHash * thisvar) { ---- return thisvar->numelements; --- return thisvar->numelements; -------} ------- -------int RuntimeHashfirstkey(struct RuntimeHash *thisvar) { ------- struct RuntimeNode *ptr=thisvar->listhead; ------- return ptr->key; ------} ------ ------int RuntimeHashremovekey(struct RuntimeHash *thisvar, int key) { --- unsigned int hashkey = (unsigned int)key % thisvar->size; --- unsigned int hashkey = (unsigned int)key % thisvar->size; ------ --- struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; --- int i; --- struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; --- int i; ------ --- while (*ptr) { --- if ((*ptr)->key == key) { --- struct RuntimeNode *toremove=*ptr; --- *ptr=(*ptr)->next; --- while (*ptr) { --- if ((*ptr)->key == key) { --- struct RuntimeNode *toremove=*ptr; --- *ptr=(*ptr)->next; ------ -- if (toremove->lprev!=NULL) - if (toremove->lprev!=NULL) { --- toremove->lprev->lnext=toremove->lnext; -- else - } else { --- thisvar->listhead=toremove->lnext; -- if (toremove->lnext!=NULL) - } - if (toremove->lnext!=NULL) { --- toremove->lnext->lprev=toremove->lprev; -- else - } else{ --- thisvar->listtail=toremove->lprev; - } --- RUNFREE(toremove); --- if (toremove->lprev!=NULL) { --- toremove->lprev->lnext=toremove->lnext; --- } else { --- thisvar->listhead=toremove->lnext; --- } --- if (toremove->lnext!=NULL) { --- toremove->lnext->lprev=toremove->lprev; - } else{ -- } else { --- thisvar->listtail=toremove->lprev; --- } --- RUNFREE(toremove); ------ --- thisvar->numelements--; --- return 1; --- } --- ptr = &((*ptr)->next); --- thisvar->numelements--; --- return 1; ------ } --- ptr = &((*ptr)->next); --- } ------ --- return 0; --- return 0; -------} ------- -------int RuntimeHashremove(struct RuntimeHash *thisvar, int key, int data) { ---- unsigned int hashkey = (unsigned int)key % thisvar->size; --- unsigned int hashkey = (unsigned int)key % thisvar->size; ------- ---- struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; ---- int i; --- struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; --- int i; ------- ---- while (*ptr) { ---- if ((*ptr)->key == key && (*ptr)->data == data) { ---- struct RuntimeNode *toremove=*ptr; ---- *ptr=(*ptr)->next; --- while (*ptr) { --- if ((*ptr)->key == key && (*ptr)->data == data) { --- struct RuntimeNode *toremove=*ptr; --- *ptr=(*ptr)->next; ------- --- if (toremove->lprev!=NULL) - if (toremove->lprev!=NULL) { ---- toremove->lprev->lnext=toremove->lnext; --- else - } else { ---- thisvar->listhead=toremove->lnext; --- if (toremove->lnext!=NULL) - } - if (toremove->lnext!=NULL) { ---- toremove->lnext->lprev=toremove->lprev; --- else - } else { ---- thisvar->listtail=toremove->lprev; - } ---- RUNFREE(toremove); --- if (toremove->lprev!=NULL) { --- toremove->lprev->lnext=toremove->lnext; --- } else { --- thisvar->listhead=toremove->lnext; --- } --- if (toremove->lnext!=NULL) { --- toremove->lnext->lprev=toremove->lprev; --- } else { --- thisvar->listtail=toremove->lprev; --- } --- RUNFREE(toremove); ------- ---- thisvar->numelements--; ---- return 1; ---- } ---- ptr = &((*ptr)->next); --- thisvar->numelements--; --- return 1; ------- } --- ptr = &((*ptr)->next); --- } ------- ---- return 0; --- return 0; -------} ------- -------void RuntimeHashrehash(struct RuntimeHash * thisvar) { ------- int newsize=thisvar->size; ------- struct RuntimeNode ** newbucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*newsize); ------- int i; ---- for(i=thisvar->size-1;i>=0;i--) { --- for(i=thisvar->size-1; i>=0; i--) { ------- struct RuntimeNode *ptr; ---- for(ptr=thisvar->bucket[i];ptr!=NULL;) { --- for(ptr=thisvar->bucket[i]; ptr!=NULL;) { ------- struct RuntimeNode * nextptr=ptr->next; ------- unsigned int newhashkey=(unsigned int)ptr->key % newsize; ------- ptr->next=newbucket[newhashkey]; ------- newbucket[newhashkey]=ptr; ------- ptr=nextptr; ------- } ------- } ------- thisvar->size=newsize; ------- RUNFREE(thisvar->bucket); ------- thisvar->bucket=newbucket; -------} ------- -------int RuntimeHashadd(struct RuntimeHash * thisvar,int key, int data) { ------- /* Rehash code */ ------- unsigned int hashkey; ------- struct RuntimeNode **ptr; ------- ------- if (thisvar->numelements>=thisvar->size) { ------- int newsize=2*thisvar->size+1; ------- struct RuntimeNode ** newbucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*newsize); ------- int i; ---- for(i=thisvar->size-1;i>=0;i--) { ---- struct RuntimeNode *ptr; ---- for(ptr=thisvar->bucket[i];ptr!=NULL;) { ---- struct RuntimeNode * nextptr=ptr->next; ---- unsigned int newhashkey=(unsigned int)ptr->key % newsize; ---- ptr->next=newbucket[newhashkey]; ---- newbucket[newhashkey]=ptr; ---- ptr=nextptr; ---- } --- for(i=thisvar->size-1; i>=0; i--) { --- struct RuntimeNode *ptr; --- for(ptr=thisvar->bucket[i]; ptr!=NULL;) { --- struct RuntimeNode * nextptr=ptr->next; --- unsigned int newhashkey=(unsigned int)ptr->key % newsize; --- ptr->next=newbucket[newhashkey]; --- newbucket[newhashkey]=ptr; --- ptr=nextptr; --- } ------- } ------- thisvar->size=newsize; ------- RUNFREE(thisvar->bucket); ------- thisvar->bucket=newbucket; ------- } ------- ------- hashkey = (unsigned int)key % thisvar->size; ------- ptr = &thisvar->bucket[hashkey]; ------- ------- /* check that thisvar key/object pair isn't already here */ ------- /* TBD can be optimized for set v. relation */ ------- ------- while (*ptr) { ------- if ((*ptr)->key == key && (*ptr)->data == data) { ------- return 0; ------- } ------- ptr = &((*ptr)->next); ------- } ------- ------- { ------- struct RuntimeNode *node=RUNMALLOC(sizeof(struct RuntimeNode)); ---- node->data=data; ---- node->key=key; ---- node->next=(*ptr); ---- *ptr=node; ---- if (thisvar->listhead==NULL) { ---- thisvar->listhead=node; ---- thisvar->listtail=node; ---- node->lnext=NULL; ---- node->lprev=NULL; ---- } else { ---- node->lprev=NULL; ---- node->lnext=thisvar->listhead; ---- thisvar->listhead->lprev=node; ---- thisvar->listhead=node; ---- } ---- } ---- ---- thisvar->numelements++; ---- return 1; ----} ---- ----#ifdef RAW ----int RuntimeHashadd_I(struct RuntimeHash * thisvar,int key, int data) { ---- /* Rehash code */ ---- unsigned int hashkey; ---- struct RuntimeNode **ptr; ---- ---- if (thisvar->numelements>=thisvar->size) { ---- int newsize=2*thisvar->size+1; ---- struct RuntimeNode ** newbucket = (struct RuntimeNode **) RUNMALLOC_I(sizeof(struct RuntimeNode *)*newsize); ---- int i; - for(i=thisvar->size-1;i>=0;i--) { - struct RuntimeNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct RuntimeNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } --- for(i=thisvar->size-1; i>=0; i--) { --- struct RuntimeNode *ptr; --- for(ptr=thisvar->bucket[i]; ptr!=NULL;) { --- struct RuntimeNode * nextptr=ptr->next; --- unsigned int newhashkey=(unsigned int)ptr->key % newsize; --- ptr->next=newbucket[newhashkey]; --- newbucket[newhashkey]=ptr; --- ptr=nextptr; --- } ---- } ---- thisvar->size=newsize; ---- RUNFREE(thisvar->bucket); ---- thisvar->bucket=newbucket; ---- } ---- ---- hashkey = (unsigned int)key % thisvar->size; ---- ptr = &thisvar->bucket[hashkey]; ---- ---- /* check that thisvar key/object pair isn't already here */ ---- /* TBD can be optimized for set v. relation */ ---- ---- while (*ptr) { ---- if ((*ptr)->key == key && (*ptr)->data == data) { ---- return 0; ---- } ---- ptr = &((*ptr)->next); ---- } ---- ---- { ---- struct RuntimeNode *node=RUNMALLOC_I(sizeof(struct RuntimeNode)); ------- node->data=data; ------- node->key=key; ------- node->next=(*ptr); ------- *ptr=node; ------- if (thisvar->listhead==NULL) { ------- thisvar->listhead=node; ------- thisvar->listtail=node; ------- node->lnext=NULL; ------- node->lprev=NULL; ------- } else { ------- node->lprev=NULL; ------- node->lnext=thisvar->listhead; ------- thisvar->listhead->lprev=node; ------- thisvar->listhead=node; ------- } ------- } ------- ------- thisvar->numelements++; ------- return 1; -------} ----#endif ------- -------bool RuntimeHashcontainskey(struct RuntimeHash *thisvar,int key) { ---- unsigned int hashkey = (unsigned int)key % thisvar->size; --- unsigned int hashkey = (unsigned int)key % thisvar->size; ------- ---- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; ---- while (ptr) { ---- if (ptr->key == key) { ---- /* we already have thisvar object ---- stored in the hash so just return */ ---- return true; ---- } ---- ptr = ptr->next; --- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; --- while (ptr) { --- if (ptr->key == key) { --- /* we already have thisvar object --- stored in the hash so just return */ --- return true; ------- } ---- return false; --- ptr = ptr->next; --- } --- return false; -------} ------- -------bool RuntimeHashcontainskeydata(struct RuntimeHash *thisvar, int key, int data) { ---- unsigned int hashkey = (unsigned int)key % thisvar->size; --- unsigned int hashkey = (unsigned int)key % thisvar->size; ------- ---- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; ---- while (ptr) { ---- if (ptr->key == key && ptr->data == data) { ---- /* we already have thisvar object ---- stored in the hash so just return*/ ---- return true; ---- } ---- ptr = ptr->next; --- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; --- while (ptr) { --- if (ptr->key == key && ptr->data == data) { --- /* we already have thisvar object --- stored in the hash so just return*/ --- return true; ------- } ---- return false; --- ptr = ptr->next; --- } --- return false; -------} ------- -------int RuntimeHashcount(struct RuntimeHash *thisvar,int key) { ---- unsigned int hashkey = (unsigned int)key % thisvar->size; ---- int count = 0; --- unsigned int hashkey = (unsigned int)key % thisvar->size; --- int count = 0; ------- ---- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; ---- while (ptr) { ---- if (ptr->key == key) { ---- count++; ---- } ---- ptr = ptr->next; --- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; --- while (ptr) { --- if (ptr->key == key) { --- count++; ------- } ---- return count; --- ptr = ptr->next; --- } --- return count; -------} ------- -------struct RuntimeHash * RuntimeHashimageSet(struct RuntimeHash *thisvar, int key) { ------- struct RuntimeHash * newset=allocateRuntimeHash(2*RuntimeHashcount(thisvar,key)+4); ------- unsigned int hashkey = (unsigned int)key % thisvar->size; ------- ------- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; ------- while (ptr) { ------- if (ptr->key == key) { ---- RuntimeHashadd(newset,ptr->data,ptr->data); --- RuntimeHashadd(newset,ptr->data,ptr->data); ------- } ------- ptr = ptr->next; ------- } ------- return newset; -------} ------- -------int RuntimeHashget(struct RuntimeHash *thisvar, int key, int *data) { ---- unsigned int hashkey = (unsigned int)key % thisvar->size; --- unsigned int hashkey = (unsigned int)key % thisvar->size; ------- ---- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; ---- while (ptr) { ---- if (ptr->key == key) { ---- *data = ptr->data; ---- return 1; /* success */ ---- } ---- ptr = ptr->next; --- struct RuntimeNode *ptr = thisvar->bucket[hashkey]; --- while (ptr) { --- if (ptr->key == key) { --- *data = ptr->data; --- return 1; /* success */ ------- } --- ptr = ptr->next; --- } ------- ---- return 0; /* failure */ --- return 0; /* failure */ -------} ------- -------inline struct RuntimeIterator * noargallocateRuntimeIterator() { ---- return (struct RuntimeIterator*)RUNMALLOC(sizeof(struct RuntimeIterator)); --- return (struct RuntimeIterator*)RUNMALLOC(sizeof(struct RuntimeIterator)); -------} ------- -------inline struct RuntimeIterator * allocateRuntimeIterator(struct RuntimeNode *start) { ---- struct RuntimeIterator *thisvar=(struct RuntimeIterator*)RUNMALLOC(sizeof(struct RuntimeIterator)); ---- thisvar->cur = start; ---- return thisvar; --- struct RuntimeIterator *thisvar=(struct RuntimeIterator*)RUNMALLOC(sizeof(struct RuntimeIterator)); --- thisvar->cur = start; --- return thisvar; -------} ------- -------inline int RunhasNext(struct RuntimeIterator *thisvar) { ------- return (thisvar->cur!=NULL); -------} ------- -------inline int Runnext(struct RuntimeIterator *thisvar) { ------- int curr=thisvar->cur->data; - thisvar->cur=thisvar->cur->next; ------ thisvar->cur=thisvar->cur->lnext; ------ return curr; -------} ------- -------inline int Runkey(struct RuntimeIterator *thisvar) { ------- return thisvar->cur->key; -------} diff --cc Robust/src/Runtime/SimpleHash.h index 2a25d6cc,7810120a,7810120a,e777d541,ec026904,ec026904,ec026904..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Runtime/SimpleHash.h +++ /dev/null @@@@@@@@ -1,76 -1,77 -1,77 -1,80 -1,80 -1,80 -1,80 +1,0 @@@@@@@@ -------#ifndef SIMPLEHASH_H -------#define SIMPLEHASH_H ------- -------#ifndef bool -------#define bool int -------#endif ------- -------#ifndef true -------#define true 1 -------#endif ------- -------#ifndef false -------#define false 0 -------#endif ------- -------#include "mem.h" ------- -------/* SimpleHash *********************************************************/ ------- -------struct RuntimeHash * noargallocateRuntimeHash(); -------struct RuntimeHash * allocateRuntimeHash(int size); -------void RuntimeHashaddChild(struct RuntimeHash *thisvar, struct RuntimeHash * child); -------void freeRuntimeHash(struct RuntimeHash *); ------- -------void RuntimeHashrehash(struct RuntimeHash * thisvar); -------int RuntimeHashadd(struct RuntimeHash *, int key, int data); ----#ifdef RAW ----int RuntimeHashadd_I(struct RuntimeHash *, int key, int data); ----#endif ------int RuntimeHashremovekey(struct RuntimeHash *,int key); -------int RuntimeHashremove(struct RuntimeHash *,int key, int data); -------bool RuntimeHashcontainskey(struct RuntimeHash *,int key); -------bool RuntimeHashcontainskeydata(struct RuntimeHash *,int key, int data); -------int RuntimeHashget(struct RuntimeHash *,int key, int* data); -------void RuntimeHashaddParent(struct RuntimeHash *,struct RuntimeHash* parent); -------int RuntimeHashfirstkey(struct RuntimeHash *); -------struct RuntimeIterator* RuntimeHashcreateiterator(struct RuntimeHash *); -------void RuntimeHashiterator(struct RuntimeHash *, struct RuntimeIterator * it); -------int RuntimeHashcount(struct RuntimeHash *, int key); -------struct RuntimeHash * RuntimeHashimageSet(struct RuntimeHash *, int key); ------- -------struct RuntimeHash { ---- int numelements; ---- int size; ---- struct RuntimeNode **bucket; ---- struct RuntimeNode *listhead; ---- struct RuntimeNode *listtail; --- int numelements; --- int size; --- struct RuntimeNode **bucket; --- struct RuntimeNode *listhead; --- struct RuntimeNode *listtail; -------}; ------- -------inline int RuntimeHashcountset(struct RuntimeHash * thisvar); ------- -------/* RuntimeHashException *************************************************/ ------- ------- -------/* RuntimeIterator *****************************************************/ -------#define ARRAYSIZE 100 ------- -------struct RuntimeNode { ------- struct RuntimeNode *next; ------- struct RuntimeNode *lnext; ------- struct RuntimeNode *lprev; ------- int data; ------- int key; -------}; ------- -------struct RuntimeIterator { ------- struct RuntimeNode *cur; -------}; ------- -------inline struct RuntimeIterator * noargallocateRuntimeIterator(); ------- -------inline struct RuntimeIterator * allocateRuntimeIterator(struct RuntimeNode *start); ------- -------inline int RunhasNext(struct RuntimeIterator *thisvar); ------- -------inline int Runnext(struct RuntimeIterator *thisvar); ------- -------inline int Runkey(struct RuntimeIterator *thisvar); ------- -------#endif diff --cc Robust/src/Runtime/checkpoint.c index f77a551d,16aee058,16aee058,dd3be84d,51b577a3,78d662d3,78d662d3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/checkpoint.c +++ /dev/null @@@@@@@@ -1,238 -1,332 -1,332 -1,352 -1,352 -1,356 -1,356 +1,0 @@@@@@@@ -------#include "checkpoint.h" -------#include "runtime.h" -------#include "structdefs.h" -------#include --#include "Queue.h" -------#ifdef DMALLOC -------#include "dmalloc.h" -------#endif ------extern void * curr_heapbase; ------extern void * curr_heapptr; ------extern void * curr_heapgcpoint; ------extern void * curr_heaptop; ------ ------extern void * to_heapbase; ------extern void * to_heapptr; ------extern void * to_heaptop; ------ ------- -------#define MALLOCSIZE 20*1024 ------- -------struct malloclist { ------- struct malloclist *next; ------- int size; ----#ifdef RAW ---- char * space; ----#else ------- char space[]; ----#endif -------}; ------- -------struct malloclist * top=NULL; -------int offset=0; ------- -------void * cpmalloc(int size) { ------- int endoffset=offset+size; ---- int tmpoffset=0; ------- if (top==NULL||endoffset>top->size) { ------- int basesize=MALLOCSIZE; ------- struct malloclist *tmp; ------- if (size>basesize) ------- basesize=size; ------- tmp=RUNMALLOC(sizeof(struct malloclist)+basesize); ------- tmp->next=top; ------- top=tmp; ------- top->size=basesize; ------- offset=0; ------- } --- int tmpoffset=offset; ---- tmpoffset=offset; ------- offset+=size; ------- return &top->space[tmpoffset]; -------} ------- -------void freemalloc() { ------- while(top!=NULL) { ------- struct malloclist *next=top->next; ------- RUNFREE(top); ------- top=next; ------ } ------} ------ ------void checkvalid(void * ptr) { ------ if (ptr>=curr_heapbase&&ptr<=curr_heaptop) { ----#ifndef RAW ------ printf("Valid\n"); ----#endif ------- } -------} ------ --- void validitycheck(struct RuntimeHash *forward, struct RuntimeHash *reverse) { --- struct RuntimeIterator rit; --- RuntimeHashiterator(forward, &rit); --- while(RunhasNext(&rit)) { --- struct ___Object___ * data=(struct ___Object___*) Runnext(&rit); --- int type=data->type; --- unsigned int * pointer=pointerarray[type]; --- int size; --- int i; --- if (pointer!=0&&((int)pointer)!=1) { --- size=pointer[0]; --- for(i=1;i<=size;i++) { --- int offset=pointer[i]; --- void * ptr=*(void **) (((int) data) + offset); --- if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { - void validitycheck(struct RuntimeHash *forward, struct RuntimeHash *reverse) { - struct RuntimeIterator rit; - RuntimeHashiterator(forward, &rit); - while(RunhasNext(&rit)) { --/* -- void validitycheck(struct ctable *forward, struct ctable *reverse) { -- struct RuntimeIterator rit; -- RuntimeHashiterator(forward, &rit); -- while(RunhasNext(&rit)) { --- struct ___Object___ * data=(struct ___Object___*) Runnext(&rit); --- int type=data->type; --- unsigned int * pointer=pointerarray[type]; --- int size; --- int i; --- if (pointer!=0&&((int)pointer)!=1) { --- size=pointer[0]; --- for(i=1; i<=size; i++) { - int offset=pointer[i]; - void * ptr=*(void **)(((int) data) + offset); - if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { -- #ifndef RAW --- printf("Bad\n"); - printf("Bad\n"); -- #endif --- } --- checkvalid(ptr); ---- } - checkvalid(ptr); -- int offset=pointer[i]; -- void * ptr=*(void **)(((int) data) + offset); -- if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { -- #ifndef RAW -- printf("Bad\n"); -- #endif -- } -- checkvalid(ptr); ------ } ------ } - } -- } ------ --- RuntimeHashiterator(reverse, &rit); --- while(RunhasNext(&rit)) { --- struct ___Object___ * data=(struct ___Object___*) Runkey(&rit); - int type=0; - unsigned int * pointer=NULL; - int size; - int i; --- Runnext(&rit); -- int type=data->type; -- unsigned int * pointer=pointerarray[type]; -- int size; -- int i; - type=data->type; - pointer=pointerarray[type]; --- if (pointer!=0&&((int)pointer)!=1) { --- size=pointer[0]; --- for(i=1;i<=size;i++) { --- int offset=pointer[i]; --- void * ptr=*(void **) (((int) data) + offset); --- if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { - RuntimeHashiterator(reverse, &rit); - while(RunhasNext(&rit)) { -- RuntimeHashiterator(reverse, &rit); -- while(RunhasNext(&rit)) { --- struct ___Object___ * data=(struct ___Object___*) Runkey(&rit); --- int type=0; --- unsigned int * pointer=NULL; --- int size; --- int i; --- Runnext(&rit); --- type=data->type; --- pointer=pointerarray[type]; --- if (pointer!=0&&((int)pointer)!=1) { --- size=pointer[0]; --- for(i=1; i<=size; i++) { - int offset=pointer[i]; - void * ptr=*(void **)(((int) data) + offset); - if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { -- #ifndef RAW --- printf("Bad2\n"); - printf("Bad2\n"); -- #endif --- } --- checkvalid(ptr); ---- } - checkvalid(ptr); -- int offset=pointer[i]; -- void * ptr=*(void **)(((int) data) + offset); -- if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { -- #ifndef RAW -- printf("Bad2\n"); -- #endif -- } -- checkvalid(ptr); ------ } ------ } ---- } - } ---- -- } -- } -- */ ------- ------- ----- void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * forward, struct RuntimeHash * reverse) { --void ** makecheckpoint(int numparams, void ** srcpointer, struct ctable * forward, struct ctable * reverse) { -------#ifdef PRECISE_GC ------- void **newarray=cpmalloc(sizeof(void *)*numparams); -------#else ------- void **newarray=RUNMALLOC(sizeof(void *)*numparams); -------#endif ----- struct RuntimeHash *todo=allocateRuntimeHash(100); -- struct Queue *todo=createQueue(); ------- int i; ------ ---- for(i=0;iflagptr; ------ if (objptr!=NULL) { ---- if (!RuntimeHashcontainskey(forward, (int) objptr)) { -- void *dst; -- if ((dst=cSearch(forward, (unsigned int)objptr))==NULL) { ------ void *copy=createcopy(objptr); ---- RuntimeHashadd(forward, (int) objptr, (int) copy); ---- RuntimeHashadd(reverse, (int) copy, (int) objptr); ---- RuntimeHashadd(todo, (int) objptr, (int) objptr); -- cInsert(forward, (int) objptr, copy); -- cInsert(reverse, (int) copy, objptr); -- addNewItem(todo, objptr); ------ ((struct ___TagDescriptor___*)cpy)->flagptr=copy; ------ } else { ---- RuntimeHashget(forward, (int) objptr, (int *) &(((struct ___TagDescriptor___*) cpy)->flagptr)); -- ((struct ___TagDescriptor___*) cpy)->flagptr=dst; ------ } ------ } ------ } else ------#endif ------- if (pointer==0) { ------- /* Array of primitives */ ------- /* Do nothing */ ------- } else if (((int)pointer)==1) { ------- /* Array of pointers */ ------- struct ArrayObject *ao=(struct ArrayObject *) ptr; ------- struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; ------- int length=ao->___length___; ------- int i; ---- for(i=0;i___length___)+sizeof(int)))[i]; --- for(i=0; i___length___)+sizeof(int)))[i]; ------- if (objptr==NULL) { - ((void **)(((char *)& ao->___length___)+sizeof(int)))[i]=NULL; --- ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=NULL; --- ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=NULL; ----- } else if (RuntimeHashcontainskey(forward, (int) objptr)) ---- RuntimeHashget(forward,(int) objptr,(int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); - RuntimeHashget(forward,(int) objptr,(int *) &((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]); -- } else if ((dst=cSearch(forward, (int)objptr))!=NULL) -- ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=dst; ------- else { ------- void * copy=createcopy(objptr); ----- RuntimeHashadd(forward, (int) objptr, (int)copy); ----- RuntimeHashadd(reverse, (int) copy, (int) objptr); ----- RuntimeHashadd(todo, (int) objptr, (int) objptr); ---- ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=copy; -- cInsert(forward, (int) objptr, copy); -- cInsert(reverse, (int) copy, objptr); -- addNewItem(todo, objptr); --- ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=copy; ------- } ------- } ------- } else { ------- int size=pointer[0]; ------- int i; ---- for(i=1;i<=size;i++) { --- for(i=1; i<=size; i++) { ------- int offset=pointer[i]; ------- void * objptr=*((void **)(((int)ptr)+offset)); -- void *dst; ------- if (objptr==NULL) { ---- *((void **) (((int)cpy)+offset))=NULL; --- *((void **)(((int)cpy)+offset))=NULL; ----- } else if (RuntimeHashcontainskey(forward, (int) objptr)) ----- RuntimeHashget(forward, (int) objptr, (int *) &(((char *)cpy)[offset])); -- } else if ((dst=cSearch(forward, (unsigned int)objptr))!=NULL) -- *((void **) &(((char *)cpy)[offset]))=dst; ------- else { ------- void * copy=createcopy(objptr); ----- RuntimeHashadd(forward, (int) objptr, (int) copy); ----- RuntimeHashadd(reverse, (int) copy, (int) objptr); ----- RuntimeHashadd(todo, (int) objptr, (int) objptr); ---- *((void **) (((int)cpy)+offset))=copy; -- cInsert(forward, (int) objptr, copy); -- cInsert(reverse, (int) copy, objptr); -- addNewItem(todo, objptr); --- *((void **)(((int)cpy)+offset))=copy; ------- } ------- } ------- } ------- } ------- } ----- freeRuntimeHash(todo); -- freeQueue(todo); ------- return newarray; -------} ------- -------void * createcopy(void * orig) { ------- if (orig==0) ------- return 0; ------- else { ------- int type=((int *)orig)[0]; ------- if (type___length___; ------- int size=sizeof(struct ArrayObject)+length*elementsize; -------#ifdef PRECISE_GC ------- void *newobj=cpmalloc(size); -------#else ------- void *newobj=RUNMALLOC(size); -------#endif ------- memcpy(newobj, orig, size); ------- return newobj; ------- } ------- } -------} ------- ----- void restorecheckpoint(int numparams, void ** original, void ** checkpoint, struct RuntimeHash *forward, struct RuntimeHash * reverse) { ----- struct RuntimeHash *todo=allocateRuntimeHash(100); ----- struct RuntimeHash *visited=allocateRuntimeHash(100); --void restorecheckpoint(int numparams, void ** original, void ** checkpoint, struct ctable *forward, struct ctable * reverse) { -- struct Queue *todo=createQueue(); -- struct ctable *visited=cCreate(256, 0.5); ------- int i; ------- ---- for(i=0;iflagptr; ------ memcpy(cpy, ptr, size); ------ if (objptr!=NULL) { ---- if (!RuntimeHashcontainskey(visited, (int) objptr)) { ---- RuntimeHashadd(visited, (int) objptr, (int) objptr); ---- RuntimeHashadd(todo, (int) objptr, (int) objptr); -- if (cSearch(visited, (unsigned int)objptr)==NULL) { -- cInsert(visited, (int) objptr, objptr); -- addNewItem(todo, objptr); ------ } --- RuntimeHashget(reverse, (int) objptr, (int *) & (((struct ___TagDescriptor___ *)cpy)->flagptr)); - RuntimeHashget(reverse, (int) objptr, (int *) &(((struct ___TagDescriptor___ *)cpy)->flagptr)); -- *((void **) &(((struct ___TagDescriptor___ *)cpy)->flagptr))=cSearch(reverse, (int) objptr); ------ } ------ } else ------#endif ------- if (pointer==0) { ------- /* Array of primitives */ ------- struct ArrayObject *ao=(struct ArrayObject *) ptr; ------- int length=ao->___length___; ------- int cpysize=sizeof(struct ArrayObject)+length*size; ------- memcpy(cpy, ptr, cpysize); - ------- } else if ((int)pointer==1) { ------- /* Array of pointers */ ------- struct ArrayObject *ao=(struct ArrayObject *) ptr; ------- struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; ------- int length=ao->___length___; ------- int i; ------- int cpysize=sizeof(struct ArrayObject)+length*size; ------- memcpy(ao_cpy, ao, cpysize); ------- ---- for(i=0;i___length___)+sizeof(int)))[i]; --- for(i=0; i___length___)+sizeof(int)))[i]; ------- if (objptr==NULL) ---- ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=NULL; --- ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=NULL; ------- else { ----- if (!RuntimeHashcontainskey(visited, (int) objptr)) { ----- RuntimeHashadd(visited, (int) objptr, (int) objptr); ----- RuntimeHashadd(todo, (int) objptr, (int) objptr); -- if (cSearch(visited, (int) objptr)==NULL) { -- cInsert(visited, (int) objptr, objptr); -- addNewItem(todo, objptr); ------- } ---- RuntimeHashget(reverse, (int) objptr, (int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); - RuntimeHashget(reverse, (int) objptr, (int *) &((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]); -- *((void **) &((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i])=cSearch(reverse, (int) objptr); ------- } ------- } ------- } else { ------- int numptr=pointer[0]; ------- int i; ------- void *flagptr; ------ int oldflag; ------ int currflag; ------- if (hasflags[type]) { ---- flagptr=(void *) (((int *)cpy)[2]); --- flagptr=(void *)(((int *)cpy)[2]); ------ oldflag=(((int *)cpy)[1]); ------ currflag=(((int *)ptr)[1]); ------- } ------- memcpy(cpy, ptr, size); ---- for(i=1;i<=numptr;i++) { --- for(i=1; i<=numptr; i++) { ------- int offset=pointer[i]; ------- void * objptr=*((void **)(((int)ptr)+offset)); ------- if (objptr==NULL) ---- *((void **) (((int)cpy)+offset))=NULL; --- *((void **)(((int)cpy)+offset))=NULL; ------- else { ----- if (!RuntimeHashcontainskey(visited, (int) objptr)) { ----- RuntimeHashadd(visited, (int) objptr, (int) objptr); ----- RuntimeHashadd(todo, (int) objptr, (int) objptr); -- if (cSearch(visited, (int)objptr)==NULL) { -- cInsert(visited, (int) objptr, objptr); -- addNewItem(todo, objptr); ------- } ----- RuntimeHashget(reverse, (int) objptr, (int *) &(((char *)cpy)[offset])); -- *((void **) &(((char *)cpy)[offset]))=cSearch(reverse, (int) objptr); ------- } ------- } ------- if (hasflags[type]) { ------- (((void **)cpy)[2])=flagptr; - flagorandinit(cpy, 0, 0xFFFFFFFF); -- if (currflag!=oldflag) ---- if (currflag!=oldflag) { ------ flagorandinit(cpy, 0, 0xFFFFFFFF); ----#ifdef MULTICORE ---- enqueueObject(cpy, NULL,0); //TODO ----#else - enqueueObject(cpy); --- enqueueObject(cpy); ----#endif ---- } ------- } ------- } ------- } ------- } ----- freeRuntimeHash(todo); ----- freeRuntimeHash(visited); -- freeQueue(todo); -- cDelete(visited); -------} diff --cc Robust/src/Runtime/checkpoint.h index 9f600953,9f600953,9f600953,9f600953,9f600953,62daeb95,62daeb95..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/checkpoint.h +++ /dev/null @@@@@@@@ -1,11 -1,11 -1,11 -1,11 -1,11 -1,11 -1,11 +1,0 @@@@@@@@ -------#ifndef CHECKPOINT_H -------#define CHECKPOINT_H ----- #include "SimpleHash.h" --#include "chash.h" ------- ----- void ** makecheckpoint(int numparams, void ** pointerarray, struct RuntimeHash * forward, struct RuntimeHash * reverse); --void ** makecheckpoint(int numparams, void ** pointerarray, struct ctable * forward, struct ctable * reverse); ------- ----- void restorecheckpoint(int numparams, void ** original, void ** checkpoint, struct RuntimeHash *forward, struct RuntimeHash * reverse); --void restorecheckpoint(int numparams, void ** original, void ** checkpoint, struct ctable *forward, struct ctable * reverse); ------- -------void * createcopy(void * orig); -------void freemalloc(); -------#endif diff --cc Robust/src/Runtime/file.c index 39cc3263,63f21bd5,63f21bd5,6a13701d,ae4366cf,ae4366cf,ae4366cf..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/file.c +++ /dev/null @@@@@@@@ -1,67 -1,66 -1,66 -1,71 -1,71 -1,71 -1,71 +1,0 @@@@@@@@ -------#include -------#include -------#include --- #include ----//#ifndef RAW ----//#include ----//#endif -------#include -------#include "structdefs.h" -------#include "mem.h" -------#include "runtime.h" ------- - void CALL12(___FileOutputStream______nativeWrite____I__AR_B, int fd, int fd, struct ArrayObject * ___array___) { - int length=VAR(___array___)->___length___; ------void CALL34(___FileOutputStream______nativeWrite____I__AR_B_I_I, int fd, int off, int len, int fd, struct ArrayObject * ___array___, int off, int len) { ---- char * string= (((char *)& VAR(___array___)->___length___)+sizeof(int)); - int status=write(fd, string, length); --- char * string= (((char *)&VAR(___array___)->___length___)+sizeof(int)); ------ int status=write(fd, &string[off], len); -------} ------- -------void CALL11(___FileOutputStream______nativeClose____I, int fd, int fd) { ------- close(fd); -------} ------- -------void CALL11(___FileOutputStream______nativeFlush____I, int fd, int fd) { - // not supported in RAW version --- // not supported in RAW version ----#ifndef RAW ------- fsync(fd); ----#endif -------} ------- -------int CALL01(___FileOutputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) { ------- int length=VAR(___filename___)->___length___; ---- char* filename= (((char *)& VAR(___filename___)->___length___)+sizeof(int)); --- char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int)); ------- int fd=open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU); ------- return fd; -------} ------- -------int CALL01(___FileOutputStream______nativeAppend_____AR_B, struct ArrayObject * ___filename___) { ------- int length=VAR(___filename___)->___length___; ---- char* filename= (((char *)& VAR(___filename___)->___length___)+sizeof(int)); --- char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int)); ------- int fd=open(filename, O_WRONLY|O_CREAT|O_APPEND, S_IRWXU); ------- return fd; -------} ------- -------int CALL01(___FileInputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) { ------- int length=VAR(___filename___)->___length___; ---- char* filename= (((char *)& VAR(___filename___)->___length___)+sizeof(int)); --- char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int)); ------- int fd=open(filename, O_RDONLY, 0); ------- return fd; -------} ------- -------void CALL11(___FileInputStream______nativeClose____I, int fd, int fd) { ------- close(fd); -------} ------- -------int CALL23(___FileInputStream______nativeRead____I__AR_B_I, int fd, int numBytes, int fd, struct ArrayObject * ___array___, int numBytes) { ------- int toread=VAR(___array___)->___length___; ---- char* string= (((char *)& VAR(___array___)->___length___)+sizeof(int)); --- char* string= (((char *)&VAR(___array___)->___length___)+sizeof(int)); ------- int status; ------- ------- if (numBytes___length___; ---- char* filename= (((char *)& VAR(___pathname___)->___length___)+sizeof(int)); --- char* filename= (((char *)&VAR(___pathname___)->___length___)+sizeof(int)); ------- struct stat st; ------- stat(filename, &st); ------- return st.st_size; -------} diff --cc Robust/src/Runtime/garbage.c index a0184390,16aca4c2,283e60b8,beb67c86,fb03fe5a,f608e4d6,5fab5b8a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/garbage.c +++ /dev/null @@@@@@@@ -1,571 -1,563 -1,562 -1,592 -1,593 -1,594 -1,598 +1,0 @@@@@@@@ -------#include "garbage.h" -------#include "runtime.h" -------#include "structdefs.h" -------#include "Queue.h" -------#include "SimpleHash.h" --#include "chash.h" -------#include "GenericHashtable.h" -------#include - #ifdef THREADS ------#if defined(THREADS) || defined(DSTM) -------#include "thread.h" -------#endif ------ -------#ifdef DMALLOC -------#include "dmalloc.h" -------#endif --- ----#ifdef DSTM ----#include "dstm.h" ----#endif ------- -------#define NUMPTRS 100 ------- ------ #define INITIALHEAPSIZE 10*1024 -#define INITIALHEAPSIZE 8192*1024 -------#define GCPOINT(x) ((int)((x)*0.9)) -------/* This define takes in how full the heap is initially and returns a new heap size to use */ -------#define HEAPSIZE(x,y) (((int)((x)/0.6))+y) ------- -------#ifdef TASK -------extern struct genhashtable * activetasks; ----#ifndef MULTICORE -------extern struct parameterwrapper * objectqueues[NUMCLASSES]; ----#endif -------extern struct genhashtable * failedtasks; -------extern struct taskparamdescriptor *currtpd; ----- extern struct RuntimeHash *forward; ----- extern struct RuntimeHash *reverse; --extern struct ctable *forward; --extern struct ctable *reverse; -------extern struct RuntimeHash *fdtoobject; -------#endif ------- - #ifdef THREADS ------#if defined(THREADS) || defined(DSTM) -------int needtocollect=0; -------struct listitem * list=NULL; -------int listcount=0; ------#endif ------ -----//Need to check if pointers are transaction pointers ------#ifdef DSTM ------#define ENQUEUE(orig, dst) \ --- if ((!(((unsigned int)orig)&0x1))) {\ - if (orig>to_heapbase&&origcurr_heapbase&&orig=curr_heapbase&&orig=curr_heapbase&&orignext=tmp; ------- head=tmp; ------- headindex=0; ------- } ------- head->ptrs[headindex++]=ptr; -------} ------- -------void * dequeue() { ------- if (tailindex==NUMPTRS) { ------- struct pointerblock *tmp=tail; ------- tail=tail->next; ------- tailindex=0; ------- if (spare!=NULL) ------- free(tmp); ------- else ------- spare=tmp; ------- } ------- return tail->ptrs[tailindex++]; -------} ------- -------int moreItems() { ------- if ((head==tail)&&(tailindex==headindex)) ------- return 0; ------- return 1; -------} ------- -------#ifdef TASK -------struct pointerblock *taghead=NULL; -------int tagindex=0; ------- -------void enqueuetag(struct ___TagDescriptor___ *ptr) { ------- if (tagindex==NUMPTRS) { ------- struct pointerblock * tmp=malloc(sizeof(struct pointerblock)); ------- tmp->next=taghead; ------- taghead=tmp; ------- tagindex=0; ------- } ------- taghead->ptrs[tagindex++]=ptr; -------} -------#endif ------- ------- -------void collect(struct garbagelist * stackptr) { - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- needtocollect=1; ------- pthread_mutex_lock(&gclistlock); ------- while(1) { ------- if ((listcount+1)==threadcount) { ------- break; /* Have all other threads stopped */ ------- } ------- pthread_cond_wait(&gccond, &gclistlock); ------- } -------#endif ------- ------- if (head==NULL) { ------- headindex=0; ------- tailindex=0; ------- head=tail=malloc(sizeof(struct pointerblock)); ------- } ------- -------#ifdef TASK ------- if (taghead==NULL) { ------- tagindex=0; ------- taghead=malloc(sizeof(struct pointerblock)); ------- taghead->next=NULL; ------- } -------#endif ------- ------- /* Check current stack */ - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ---- { ---- struct listitem *listptr=list; ---- while(1) { --- { --- struct listitem *listptr=list; --- while(1) { -------#endif ---- --- ------- while(stackptr!=NULL) { ------- int i; ---- for(i=0;isize;i++) { --- for(i=0; isize; i++) { ------- void * orig=stackptr->array[i]; - void * copy; - if (gc_createcopy(orig,©)) - enqueue(orig); - stackptr->array[i]=copy; ------ ENQUEUE(orig, stackptr->array[i]); ------- } ------- stackptr=stackptr->next; ------- } - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- /* Go to next thread */ ------- if (listptr!=NULL) { ------- void * orig=listptr->locklist; - void * copy; - if (gc_createcopy(orig,©)) - enqueue(orig); - listptr->locklist=copy; ------ ENQUEUE(orig, listptr->locklist); ------- stackptr=listptr->stackptr; ------- listptr=listptr->next; ------- } else ------- break; ---- } ---- } ---} ---} -------#endif ---- --- -------#ifdef TASK ------- { ------- /* Update objectsets */ ------- int i; ---- for(i=0;iobjectset; - struct RuntimeNode * ptr=set->listhead; ------ struct ObjectHash * set=p->objectset; ------ struct ObjectNode * ptr=set->listhead; ------- while(ptr!=NULL) { ------- void *orig=(void *)ptr->key; - void *copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - ptr->key=(int)copy; - ------ ENQUEUE(orig, *((void **)(&ptr->key))); ------- ptr=ptr->lnext; ------- } - RuntimeHashrehash(set); /* Rehash the table */ ------ ObjectHashrehash(set); /* Rehash the table */ ------- p=p->next; ------- } ----#endif ------- } ------- } ---- --- ------- if (forward!=NULL) { ----- struct RuntimeNode * ptr=forward->listhead; -- struct cnode * ptr=forward->listhead; ------- while(ptr!=NULL) { ------- void * orig=(void *)ptr->key; - void *copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - ptr->key=(int)copy; - ------ ENQUEUE(orig, *((void **)(&ptr->key))); ------- ptr=ptr->lnext; ------- } ----- RuntimeHashrehash(forward); /* Rehash the table */ -- crehash(forward); /* Rehash the table */ ------- } ------- ------- if (reverse!=NULL) { ----- struct RuntimeNode * ptr=reverse->listhead; -- struct cnode * ptr=reverse->listhead; ------- while(ptr!=NULL) { ----- void *orig=(void *)ptr->data; - void *copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - ptr->data=(int)copy; - ---- ENQUEUE(orig, *((void**)(&ptr->data))); -- void *orig=(void *)ptr->val; -- ENQUEUE(orig, *((void**)(&ptr->val))); ------- ptr=ptr->lnext; ------- } ------- } ------- ------- { ------- struct RuntimeNode * ptr=fdtoobject->listhead; ------- while(ptr!=NULL) { ------- void *orig=(void *)ptr->data; - void *copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - ptr->data=(int)copy; - ------ ENQUEUE(orig, *((void**)(&ptr->data))); ------- ptr=ptr->lnext; ------- } ------- } ------- ------- { ------- /* Update current task descriptor */ ------- int i; ---- for(i=0;inumParameters;i++) { --- for(i=0; inumParameters; i++) { ------- void *orig=currtpd->parameterArray[i]; - void *copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - currtpd->parameterArray[i]=copy; ------ ENQUEUE(orig, currtpd->parameterArray[i]); ------- } ------- ------- } ------- ---- /* Update active tasks */ --- /* Update active tasks */ ------- { ------- struct genpointerlist * ptr=activetasks->list; ------- while(ptr!=NULL) { ------- struct taskparamdescriptor *tpd=ptr->src; ------- int i; ---- for(i=0;inumParameters;i++) { --- for(i=0; inumParameters; i++) { ------- void * orig=tpd->parameterArray[i]; - void * copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - tpd->parameterArray[i]=copy; ------ ENQUEUE(orig, tpd->parameterArray[i]); ------- } ------- ptr=ptr->inext; ------- } ------- genrehash(activetasks); ------- } ------- ---- /* Update failed tasks */ --- /* Update failed tasks */ ------- { ------- struct genpointerlist * ptr=failedtasks->list; ------- while(ptr!=NULL) { ------- struct taskparamdescriptor *tpd=ptr->src; ------- int i; ---- for(i=0;inumParameters;i++) { --- for(i=0; inumParameters; i++) { ------- void * orig=tpd->parameterArray[i]; - void * copy; - if (gc_createcopy(orig, ©)) - enqueue(orig); - tpd->parameterArray[i]=copy; ------ ENQUEUE(orig, tpd->parameterArray[i]); ------- } ------- ptr=ptr->inext; ------- } ------- genrehash(failedtasks); ------- } -------#endif ------- ------- while(moreItems()) { ------- void * ptr=dequeue(); ------- void *cpy=((void **)ptr)[1]; ------- int type=((int *)cpy)[0]; - int * pointer; ------ unsigned int * pointer; -------#ifdef TASK ------- if(type==TAGTYPE) { ------- /* Enqueue Tag */ ------- /* Nothing is inside */ ------- enqueuetag(ptr); ------- continue; ------- } -------#endif ------- pointer=pointerarray[type]; ------- if (pointer==0) { ------- /* Array of primitives */ ------- /* Do nothing */ ----#ifdef DSTM ---- struct ArrayObject *ao=(struct ArrayObject *) ptr; ---- struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; ---- ENQUEUE((void *)ao->___nextobject___, *((void **)&ao_cpy->___nextobject___)); ---- ENQUEUE((void *)ao->___localcopy___, *((void **)&ao_cpy->___localcopy___)); ----#endif ------- } else if (((int)pointer)==1) { ------- /* Array of pointers */ ------- struct ArrayObject *ao=(struct ArrayObject *) ptr; ------- struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; ----#ifdef DSTM ---- ENQUEUE((void *)ao->___nextobject___, *((void **)&ao_cpy->___nextobject___)); ---- ENQUEUE((void *)ao->___localcopy___, *((void **)&ao_cpy->___localcopy___)); ----#endif ------- int length=ao->___length___; ------- int i; ---- for(i=0;i___length___)+sizeof(int)))[i]; - void * copy; - if (gc_createcopy(objptr, ©)) - enqueue(objptr); - ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=copy; --- ENQUEUE(objptr, ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); --- for(i=0; i___length___)+sizeof(int)))[i]; --- ENQUEUE(objptr, ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]); ------- } ------- } else { ------- int size=pointer[0]; ------- int i; ---- for(i=1;i<=size;i++) { - int offset=pointer[i]; --- for(i=1; i<=size; i++) { ------ unsigned int offset=pointer[i]; ------- void * objptr=*((void **)(((int)ptr)+offset)); - void * copy; - if (gc_createcopy(objptr, ©)) - enqueue(objptr); - *((void **) (((int)cpy)+offset))=copy; --- ENQUEUE(objptr, *((void **) (((int)cpy)+offset))); --- ENQUEUE(objptr, *((void **)(((int)cpy)+offset))); ------- } ------- } ------- } -------#ifdef TASK ------- fixtags(); -------#endif ------- - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- needtocollect=0; ------- pthread_mutex_unlock(&gclistlock); -------#endif -------} ------- -------#ifdef TASK ------ ------/* Fix up the references from tags. This can't be done earlier, ------ because we don't want tags to keep objects alive */ -------void fixtags() { ------- while(taghead!=NULL) { ------- int i; ------- struct pointerblock *tmp=taghead->next; ---- for(i=0;iptrs[i]; ------- struct ___Object___ *obj=tagd->flagptr; ------- struct ___TagDescriptor___ *copy=((struct ___TagDescriptor___**)tagd)[1]; - if (obj->type==-1) { ------ if (obj==NULL) { ------ /* Zero object case */ ------ } else if (obj->type==-1) { ------- /* Single object case */ ------- copy->flagptr=((struct ___Object___**)obj)[1]; ------- } else if (obj->type==OBJECTARRAYTYPE) { ------- /* Array case */ ------- struct ArrayObject *ao=(struct ArrayObject *) obj; ------- int livecount=0; ------- int j; ------- int k=0; ------- struct ArrayObject *aonew; ---- --- ------- /* Count live objects */ ---- for(j=0;j___cachedCode___;j++) { --- for(j=0; j___cachedCode___; j++) { ------- struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, j); ------- if (tobj->type==-1) ------- livecount++; ------- } ---- --- ------- livecount=((livecount-1)/OBJECTARRAYINTERVAL+1)*OBJECTARRAYINTERVAL; ------- aonew=(struct ArrayObject *) tomalloc(sizeof(struct ArrayObject)+sizeof(struct ___Object___*)*livecount); ------ memcpy(aonew, ao, sizeof(struct ArrayObject)); ------- aonew->type=OBJECTARRAYTYPE; ------- aonew->___length___=livecount; ------- copy->flagptr=aonew; ---- for(j=0;j___cachedCode___;j++) { --- for(j=0; j___cachedCode___; j++) { ------- struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, j); ------- if (tobj->type==-1) { ------- struct ___Object___ * tobjcpy=((struct ___Object___**)tobj)[1]; ------- ARRAYSET(aonew, struct ___Object___*, k++,tobjcpy); ------- } ------- } ------- aonew->___cachedCode___=k; - --- for(;kflagptr=NULL; ------- } ------- } ------- free(taghead); ------- taghead=tmp; ------- tagindex=NUMPTRS; ------- } -------} -------#endif - - void * curr_heapbase=0; - void * curr_heapptr=0; - void * curr_heapgcpoint=0; - void * curr_heaptop=0; - - void * to_heapbase=0; - void * to_heapptr=0; - void * to_heaptop=0; - long lastgcsize=0; ------- -------void * tomalloc(int size) { ------- void * ptr=to_heapptr; ------- if ((size%4)!=0) ------- size+=(4-(size%4)); ------- to_heapptr+=size; ------- return ptr; -------} ------- - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) --- -------void checkcollect(void * ptr) { ------- if (needtocollect) { ------- struct listitem * tmp=stopforgc((struct garbagelist *)ptr); ------- pthread_mutex_lock(&gclock); // Wait for GC ------- restartaftergc(tmp); ------- pthread_mutex_unlock(&gclock); ---- ---- } ----} ------- ----#ifdef DSTM ----void checkcollect2(void * ptr, transrecord_t *trans) { ---- if (needtocollect) { ---- int ptrarray[]={1, (int)ptr, (int) trans->revertlist}; ---- struct listitem * tmp=stopforgc((struct garbagelist *)ptrarray); ---- pthread_mutex_lock(&gclock); // Wait for GC ---- restartaftergc(tmp); ---- pthread_mutex_unlock(&gclock); ---- trans->revertlist=(struct ___Object___*)ptrarray[2]; ------- } -------} ----#endif ---- ------- -------struct listitem * stopforgc(struct garbagelist * ptr) { ------- struct listitem * litem=malloc(sizeof(struct listitem)); ------- litem->stackptr=ptr; ------- litem->locklist=pthread_getspecific(threadlocks); ------- litem->prev=NULL; ------- pthread_mutex_lock(&gclistlock); ------- litem->next=list; ------- if(list!=NULL) ------- list->prev=litem; ------- list=litem; ------- listcount++; ------- pthread_cond_signal(&gccond); ------- pthread_mutex_unlock(&gclistlock); ------- return litem; -------} ------- -------void restartaftergc(struct listitem * litem) { ------- pthread_mutex_lock(&gclistlock); ------- pthread_setspecific(threadlocks, litem->locklist); ------- if (litem->prev==NULL) { ------- list=litem->next; ------- } else { ------- litem->prev->next=litem->next; ------- } ------- if (litem->next!=NULL) { ------- litem->next->prev=litem->prev; ------- } ------- listcount--; ------- pthread_mutex_unlock(&gclistlock); ------- free(litem); -------} -------#endif ------- -------void * mygcmalloc(struct garbagelist * stackptr, int size) { ------- void *ptr; - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- if (pthread_mutex_trylock(&gclock)!=0) { ------- struct listitem *tmp=stopforgc(stackptr); ------- pthread_mutex_lock(&gclock); ------- restartaftergc(tmp); ------- } -------#endif ------- ptr=curr_heapptr; ------- if ((size%4)!=0) ------- size+=(4-(size%4)); ------- curr_heapptr+=size; ------- if (curr_heapptr>curr_heapgcpoint) { ------- if (curr_heapbase==0) { ------- /* Need to allocate base heap */ ------- curr_heapbase=malloc(INITIALHEAPSIZE); ------- bzero(curr_heapbase, INITIALHEAPSIZE); ------- curr_heaptop=curr_heapbase+INITIALHEAPSIZE; ------- curr_heapgcpoint=((char *) curr_heapbase)+GCPOINT(INITIALHEAPSIZE); ------- curr_heapptr=curr_heapbase+size; ------- ------- to_heapbase=malloc(INITIALHEAPSIZE); ------- to_heaptop=to_heapbase+INITIALHEAPSIZE; ------- to_heapptr=to_heapbase; ------- ptr=curr_heapbase; - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- pthread_mutex_unlock(&gclock); -------#endif ------- return ptr; ------- } ------- ------- /* Grow the to heap if necessary */ ------- { ------- int curr_heapsize=curr_heaptop-curr_heapbase; ------- int to_heapsize=to_heaptop-to_heapbase; ------- int last_heapsize=0; ------- if (lastgcsize>0) { ------- last_heapsize=HEAPSIZE(lastgcsize, size); ------- if ((last_heapsize%4)!=0) ------- last_heapsize+=(4-(last_heapsize%4)); ------- } ------- if (curr_heapsize>last_heapsize) ------- last_heapsize=curr_heapsize; ------- if (last_heapsize>to_heapsize) { ------- free(to_heapbase); ------- to_heapbase=malloc(last_heapsize); - if (to_heapbase==NULL) { - printf("Error Allocating enough memory\n"); - exit(-1); - } ------- to_heaptop=to_heapbase+last_heapsize; ------- to_heapptr=to_heapbase; ------- } ------- } ---- --- ------- /* Do our collection */ ------- collect(stackptr); ------- ------- /* Update stat on previous gc size */ ------- lastgcsize=(to_heapptr-to_heapbase)+size; ------- ------- /* Flip to/curr heaps */ ------- { ------- void * tmp=to_heapbase; ------- to_heapbase=curr_heapbase; ------- curr_heapbase=tmp; ------- ------- tmp=to_heaptop; ------- to_heaptop=curr_heaptop; ------- curr_heaptop=tmp; ---- --- ------- tmp=to_heapptr; ------- curr_heapptr=to_heapptr+size; ------- curr_heapgcpoint=((char *) curr_heapbase)+GCPOINT(curr_heaptop-curr_heapbase); ------- to_heapptr=to_heapbase; ---- --- ------- /* Not enough room :(, redo gc */ ------- if (curr_heapptr>curr_heapgcpoint) { - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- pthread_mutex_unlock(&gclock); -------#endif ------- return mygcmalloc(stackptr, size); ------- } ---- --- ------- bzero(tmp, curr_heaptop-tmp); - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- pthread_mutex_unlock(&gclock); -------#endif ------- return tmp; ------- } ------- } else { - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) ------- pthread_mutex_unlock(&gclock); -------#endif ------- return ptr; ------- } -------} ------- ------- -------int gc_createcopy(void * orig, void ** copy_ptr) { ------- if (orig==0) { ------- *copy_ptr=NULL; ------- return 0; ------- } else { ------- int type=((int *)orig)[0]; ------- if (type==-1) { ------- *copy_ptr=((void **)orig)[1]; ------- return 0; ---- } if (type___length___; ------- int size=sizeof(struct ArrayObject)+length*elementsize; ------- void *newobj=tomalloc(size); ------- memcpy(newobj, orig, size); ------- ((int *)orig)[0]=-1; ------- ((void **)orig)[1]=newobj; ------- *copy_ptr=newobj; ------- return 1; ------- } ------- } -------} diff --cc Robust/src/Runtime/garbage.h index c021ac64,5a65de65,5a65de65,5a65de65,5a65de65,5a65de65,5a65de65..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/garbage.h +++ /dev/null @@@@@@@@ -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 -1,29 +1,0 @@@@@@@@ -------#ifndef GARBAGE_H -------#define GARBAGE_H -------struct garbagelist { ------- int size; ------- struct garbagelist *next; ------- void * array[]; -------}; ------- -------struct listitem { ------- struct listitem * prev; ------- struct listitem * next; ------- struct garbagelist * stackptr; ------- struct ___Object___ * locklist; -------}; ------- -------#ifdef TASK -------void fixtags(); -------#endif ------- - #ifdef THREADS ------#if defined(THREADS)||defined(DSTM) -------void checkcollect(void * ptr); -------struct listitem * stopforgc(struct garbagelist * ptr); -------void restartaftergc(struct listitem * litem); -------#endif -------void * tomalloc(int size); -------void collect(struct garbagelist *stackptr); -------int gc_createcopy(void * orig, void **); -------void * mygcmalloc(struct garbagelist * ptr, int size); -------#endif diff --cc Robust/src/Runtime/mem.h index ed927099,ed927099,ed927099,fa82a2c3,18b64c25,18b64c25,18b64c25..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/mem.h +++ /dev/null @@@@@@@@ -1,22 -1,22 -1,22 -1,36 -1,36 -1,36 -1,36 +1,0 @@@@@@@@ -------#ifndef MEMH -------#define MEMH ---- #include ---#include ----#ifndef RAW ---- #include ---#include ----#endif ------- -------#ifdef BOEHM_GC -------#include "gc.h" -------#define FREEMALLOC(x) GC_malloc(x) -------#define RUNMALLOC(x) GC_malloc(x) -------#define RUNFREE(x) -------#else -------#ifdef PRECISE_GC -------#include "garbage.h" -------#define RUNMALLOC(x) calloc(1,x) -------#define RUNFREE(x) free(x) ----#else ----#ifdef RAW ----void * mycalloc(int m, int size); ----void * mycalloc_i(int m, int size); ----void myfree(void * ptr); ----#define FREEMALLOC(x) mycalloc(1,x) ----#define RUNMALLOC(x) mycalloc(1,x) // handle interruption inside ----#define RUNMALLOC_I(x) mycalloc_i(1,x) // with interruption blocked beforehand ----#define RUNFREE(x) myfree(x); ----//#define PTR(x) (32+(x-1)&~31) -------#else -------#define FREEMALLOC(x) calloc(1,x) -------#define RUNMALLOC(x) calloc(1,x) -------#define RUNFREE(x) free(x) ----//#define PTR(x) (x) ----#endif -------#endif -------#endif -------#endif diff --cc Robust/src/Runtime/object.c index ab986ecb,ab986ecb,ab986ecb,0bff6175,32547f61,32547f61,32547f61..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/object.c +++ /dev/null @@@@@@@@ -1,77 -1,77 -1,77 -1,85 -1,85 -1,85 -1,85 +1,0 @@@@@@@@ -------#include "object.h" ----#ifdef RAW ----#include ----#else -------#include "stdio.h" ----#endif -------#include "stdlib.h" ------- -------#ifdef THREADS -------#include "thread.h" -------#endif ------- -------int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) { ------- return (int) VAR(___this___); -------} ------- -------int CALL01(___Object______getType____, struct ___Object___ * ___this___) { ------- return ((int *)VAR(___this___))[0]; -------} ------- -------#ifdef THREADS -------int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { ------- pthread_t self=pthread_self(); ------- if (self==VAR(___this___)->tid) { ------- VAR(___this___)->lockcount++; ------- } else { -------#ifdef PRECISE_GC ------- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -------#endif ------- pthread_mutex_lock(&objlock); -------#ifdef PRECISE_GC ------- restartaftergc(tmp); -------#endif ------- while(1) { ------- if (VAR(___this___)->tid==0) { ------- VAR(___this___)->___prevlockobject___=NULL; ------- VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); ------- if (VAR(___this___)->___nextlockobject___!=NULL) ------- VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); ------- pthread_setspecific(threadlocks, VAR(___this___)); ------- VAR(___this___)->lockcount=1; ------- VAR(___this___)->tid=self; ------- pthread_mutex_unlock(&objlock); ------- break; ------- } ------- { -------#ifdef PRECISE_GC ------- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -------#endif ------- pthread_cond_wait(&objcond, &objlock); -------#ifdef PRECISE_GC ------- restartaftergc(tmp); -------#endif ------- } ------- } ------- } -------} ------- -------int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) { ------- pthread_t self=pthread_self(); ------- if (self==VAR(___this___)->tid) { ------- VAR(___this___)->lockcount--; ------- if (VAR(___this___)->lockcount==0) { ------- if (VAR(___this___)->___prevlockobject___==NULL) { ------- pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___); ------- } else ------- VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___; ------- if (VAR(___this___)->___nextlockobject___!=NULL) ------- VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___; ------- VAR(___this___)->lockentry=NULL; ------- VAR(___this___)->tid=0; ------- } ------- pthread_mutex_lock(&objlock); ------- pthread_cond_broadcast(&objcond); ------- pthread_mutex_unlock(&objlock); ------- } else { ----#ifdef RAW - raw_test_done(-1); --- raw_test_done(-1); ----#else ------- printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n"); ------- exit(-1); ----#endif ------- } -------} -------#endif diff --cc Robust/src/Runtime/object.h index f0d95d57,f0d95d57,f0d95d57,f0d95d57,7f4cdb15,7f4cdb15,7f4cdb15..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/object.h +++ /dev/null @@@@@@@@ -1,11 -1,11 -1,11 -1,11 -1,11 -1,11 -1,11 +1,0 @@@@@@@@ -------#ifndef OBJECT_H -------#define OBJECT_H -------#include "runtime.h" -------#include "structdefs.h" ------- ---- int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___);int CALL01(___Object______getType____, struct ___Object___ * ___this___); ---int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___); int CALL01(___Object______getType____, struct ___Object___ * ___this___); -------#ifdef THREADS -------int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___); -------int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___); -------#endif -------#endif diff --cc Robust/src/Runtime/option.c index acb5079c,acb5079c,acb5079c,acb5079c,1d673874,1d673874,6b93254f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/option.c +++ /dev/null @@@@@@@@ -1,80 -1,80 -1,80 -1,80 -1,80 -1,80 -1,86 +1,0 @@@@@@@@ -------#include "option.h" -------#include -------#include -------#include -------#include "runtime.h" -------#include ------- -------extern char *options; -------extern int injectfailures; -------extern float failurechance; -------extern int debugtask; -extern int errors; -------extern int injectinstructionfailures; -------extern int failurecount; -------extern float instfailurechance; -------extern int numfailures; -------extern int instaccum; -------extern char ** environ; ------- -------void processOptions() { ------- int i; ------- options=NULL; ---- for(i=0;environ[i]!=0;i++) { --- for(i=0; environ[i]!=0; i++) { ------- if (strncmp(environ[i],"BRISTLECONE=",12)==0) { ------- options=environ[i]+12; ------- break; ------- } ------- } ---- --- ------- while(options!=NULL) { ------- if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) { ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- if (options==NULL) ------- break; ------- sscanf(options, "%f", &failurechance); ------- injectfailures=1; ------- printf("Injecting errors with chance=%f\n",failurechance); ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- } else if (strncmp(options,"-injectinstructionfailures",sizeof("-injectinstructionfailures")-1)==0) { ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- if (options==NULL) ------- break; ------- sscanf(options, "%d", &failurecount); ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- if (options==NULL) ------- break; ------- ------- sscanf(options, "%f", &instfailurechance); ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- if (options==NULL) ------- break; ------- ------- sscanf(options, "%d", &numfailures); ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- ------- instaccum=failurecount; ------- instructioncount=failurecount; ------- injectinstructionfailures=1; ------- printf("Number of failures=%d\n",numfailures); ------- printf("Injecting errors with count=%d\n",failurecount); ------- printf("Injecting errors with chance=%f\n",instfailurechance); ------- } else if (strncmp(options, "-debugtask",sizeof("-debugtask")-1)==0) { ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- debugtask=1; ------- printf("Debug task option on.\n"); - } else if (strncmp(options, "-errors",sizeof("-errors")-1)==0) { - options=strchr(options,' '); - if (options!=NULL) options++; - errors=1; - printf("Errors on.\n"); ------- } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) { ------- options=strchr(options,' '); ------- if (options!=NULL) options++; ------- printf("Initializing random number generator.\n"); ------- srandom(time(NULL)); ------- } else ------- break; ------- } -------} diff --cc Robust/src/Runtime/option.h index f9cd7ac7,f9cd7ac7,f9cd7ac7,f9cd7ac7,f9cd7ac7,f9cd7ac7,f9cd7ac7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/option.h +++ /dev/null @@@@@@@@ -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 +1,0 @@@@@@@@ -------#ifdef OPTION_H -------#define OPTION_H -------void processOptions(); -------#endif diff --cc Robust/src/Runtime/runtime.c index de7b1a49,197b9fb2,197b9fb2,0f84c36a,ead07d04,ead07d04,836856cc..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/runtime.c +++ /dev/null @@@@@@@@ -1,185 -1,242 -1,242 -1,252 -1,253 -1,253 -1,254 +1,0 @@@@@@@@ -------#include "runtime.h" -------#include "structdefs.h" -------#include -------#include "mem.h" ---- #include ---- #include --- #include ---- #include ---#include ---#include ---#include -------#include "option.h" ------#ifdef DSTM ------#include "dstm.h" ----#include "prelookup.h" ------#endif ------- -------extern int classsize[]; -------jmp_buf error_handler; -------int instructioncount; ------- -------char *options; -------int injectfailures=0; -------float failurechance=0; -int errors=0; -------int debugtask=0; -------int injectinstructionfailures; -------int failurecount; -------float instfailurechance=0; -------int numfailures; -------int instaccum=0; -------#ifdef DMALLOC -------#include "dmalloc.h" -------#endif - - - ------- -------void exithandler(int sig, siginfo_t *info, void * uap) { ------- exit(0); -------} ------- -------void initializeexithandler() { ------- struct sigaction sig; ------- sig.sa_sigaction=&exithandler; ------- sig.sa_flags=SA_SIGINFO; ------- sigemptyset(&sig.sa_mask); ------- sigaction(SIGUSR2, &sig, 0); -------} ------- ------- -------/* This function inject failures */ ------- -------void injectinstructionfailure() { -------#ifdef TASK ------- if (injectinstructionfailures) { ------- if (numfailures==0) ------- return; ---- instructioncount=failurecount; --- instructioncount=failurecount; ------- instaccum+=failurecount; ------- if ((((double)random())/RAND_MAX)0) ------- numfailures--; ------- printf("FAILURE!!! %d\n",numfailures); ------- longjmp(error_handler,11); ------- } ------- } -------#else -------#ifdef THREADS ------- if (injectinstructionfailures) { ------- if (numfailures==0) ------- return; ------- instaccum+=failurecount; ------- if ((((double)random())/RAND_MAX)0) ------- numfailures--; ------- printf("FAILURE!!! %d\n",numfailures); ------- threadexit(); ------- } ------- } -------#endif -------#endif ------} ------ ------void CALL11(___System______exit____I,int ___status___, int ___status___) { ------ exit(___status___); ----} ---- ----void CALL11(___System______printI____I,int ___status___, int ___status___) { ---- printf("%d\n",___status___); ------} ------ ------long CALL00(___System______currentTimeMillis____) { ------ struct timeval tv; long long retval; ------ gettimeofday(&tv, NULL); ------ retval = tv.tv_sec; /* seconds */ ------ retval*=1000; /* milliseconds */ ------ retval+= (tv.tv_usec/1000); /* adjust milliseconds & add them in */ ------ return retval; -------} ------- -------void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) { ---- struct ArrayObject * chararray=VAR(___s___)->___value___; ---- int i; ---- int offset=VAR(___s___)->___offset___; ---- for(i=0;i___count___;i++) { ---- short sc=((short *)(((char *)& chararray->___length___)+sizeof(int)))[i+offset]; ---- putchar(sc); ---- } --- struct ArrayObject * chararray=VAR(___s___)->___value___; --- int i; --- int offset=VAR(___s___)->___offset___; --- for(i=0; i___count___; i++) { --- short sc=((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset]; --- putchar(sc); --- } ----} ---- ----#ifdef DSTM ----void CALL00(___System______clearPrefetchCache____) { ---- prehashClear(); -------} ----#endif ------- -------/* Object allocation function */ ------ ------#ifdef DSTM ------void * allocate_newglobal(transrecord_t *trans, int type) { ------ struct ___Object___ * v=(struct ___Object___ *) transCreateObj(trans, classsize[type]); ------ v->type=type; ------#ifdef THREADS ------ v->tid=0; ------ v->lockentry=0; ------ v->lockcount=0; ------#endif ------ return v; ------} ------ ------/* Array allocation function */ ------ ------struct ArrayObject * allocate_newarrayglobal(transrecord_t *trans, int type, int length) { ------ struct ArrayObject * v=(struct ArrayObject *)transCreateObj(trans, sizeof(struct ArrayObject)+length*classsize[type]); ------ if (length<0) { ------ printf("ERROR: negative array\n"); ------ return NULL; ------ } ------ v->type=type; ------ v->___length___=length; ------#ifdef THREADS ------ v->tid=0; ------ v->lockentry=0; ------ v->lockcount=0; ------#endif ------ return v; ------} ------#endif ------ ------- -------#ifdef PRECISE_GC -------void * allocate_new(void * ptr, int type) { ------- struct ___Object___ * v=(struct ___Object___ *) mygcmalloc((struct garbagelist *) ptr, classsize[type]); ------- v->type=type; -------#ifdef THREADS ------- v->tid=0; ------- v->lockentry=0; ------- v->lockcount=0; ------#endif ------#ifdef OPTIONAL ------ v->fses=0; -------#endif ------- return v; -------} ------- -------/* Array allocation function */ ------- -------struct ArrayObject * allocate_newarray(void * ptr, int type, int length) { ------- struct ArrayObject * v=mygcmalloc((struct garbagelist *) ptr, sizeof(struct ArrayObject)+length*classsize[type]); ------- v->type=type; ------- if (length<0) { ------- printf("ERROR: negative array\n"); ------- return NULL; ------- } ------- v->___length___=length; -------#ifdef THREADS ------- v->tid=0; ------- v->lockentry=0; ------- v->lockcount=0; ------#endif ------#ifdef OPTIONAL ------ v->fses=0; -------#endif ------- return v; -------} ------- -------#else -------void * allocate_new(int type) { - void * v=FREEMALLOC(classsize[type]); - *((int *)v)=type; ------ struct ___Object___ * v=FREEMALLOC(classsize[type]); ------ v->type=type; ------#ifdef OPTIONAL ------ v->fses=0; ------#endif ------- return v; -------} ------- -------/* Array allocation function */ ------- -------struct ArrayObject * allocate_newarray(int type, int length) { ------- struct ArrayObject * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); ------- v->type=type; ------- v->___length___=length; ------#ifdef OPTIONAL ------ v->fses=0; ------#endif ------- return v; -------} -------#endif ------- ------- -------/* Converts C character arrays into Java strings */ -------#ifdef PRECISE_GC -------struct ___String___ * NewString(void * ptr, const char *str,int length) { -------#else -------struct ___String___ * NewString(const char *str,int length) { -------#endif ------- int i; -------#ifdef PRECISE_GC ------- struct ArrayObject * chararray=allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length); ------- int ptrarray[]={1, (int) ptr, (int) chararray}; ------- struct ___String___ * strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE); ------- chararray=(struct ArrayObject *) ptrarray[2]; -------#else ------- struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length); ------- struct ___String___ * strobj=allocate_new(STRINGTYPE); -------#endif ------- strobj->___value___=chararray; ------- strobj->___count___=length; ------- strobj->___offset___=0; ------- ---- for(i=0;i___length___)+sizeof(int)))[i]=(short)str[i]; } --- for(i=0; i___length___)+sizeof(int)))[i]=(short)str[i]; --- } ------- return strobj; -------} ------- -------/* Generated code calls this if we fail a bounds check */ ------- -------void failedboundschk() { -------#ifndef TASK ------- printf("Array out of bounds\n"); -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#else ------- longjmp(error_handler,2); -------#endif -------} ------- -------/* Abort task call */ -------void abort_task() { -------#ifdef TASK ------- longjmp(error_handler,4); -------#else ------- printf("Aborting\n"); ------- exit(-1); -------#endif -------} diff --cc Robust/src/Runtime/runtime.h index b0500def,7158c14f,7158c14f,fdad772e,fcc62a61,f80a4ab7,27e83f2d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/runtime.h +++ /dev/null @@@@@@@@ -1,114 -1,152 -1,152 -1,189 -1,189 -1,190 -1,191 +1,0 @@@@@@@@ -------#ifndef RUNTIME -------#define RUNTIME -------#include -------extern jmp_buf error_handler; -------extern int instructioncount; -------extern int failurecount; ------#ifdef DSTM ------#include "dstm.h" ------#endif ---- ----extern void * curr_heapbase; ----extern void * curr_heaptop; ------- -------#define TAGARRAYINTERVAL 10 -------#define OBJECTARRAYINTERVAL 10 ------- -------#define ARRAYSET(array, type, index, value) \ ---- ((type *)(&(& array->___length___)[1]))[index]=value --- ((type *)(& (& array->___length___)[1]))[index]=value ------- -------#define ARRAYGET(array, type, index) \ ---- ((type *)(&(& array->___length___)[1]))[index] --- ((type *)(& (& array->___length___)[1]))[index] ------ ------#ifdef OPTIONAL ------#define OPTARG(x) , x ------#else ------#define OPTARG(x) ------#endif ------ ------#ifdef DSTM ------void * allocate_newglobal(transrecord_t *, int type); ------struct ArrayObject * allocate_newarrayglobal(transrecord_t *, int type, int length); ------#endif ------- -------#ifdef PRECISE_GC -------#include "garbage.h" -------void * allocate_new(void *, int type); -------struct ArrayObject * allocate_newarray(void *, int type, int length); -------struct ___String___ * NewString(void *, const char *str,int length); -------struct ___TagDescriptor___ * allocate_tag(void *ptr, int index); -------#else -------void * allocate_new(int type); -------struct ArrayObject * allocate_newarray(int type, int length); -------struct ___String___ * NewString(const char *str,int length); -------struct ___TagDescriptor___ * allocate_tag(int index); -------#endif ------- ------- ------- -------void initializeexithandler(); -------void failedboundschk(); -------void failednullptr(); -------void abort_task(); -------void injectinstructionfailure(); -------void createstartupobject(); ------- -------#ifdef PRECISE_GC -------#define VAR(name) ___params___->name -------#define CALL00(name) name(struct name ## _params * ___params___) -------#define CALL01(name, alt) name(struct name ## _params * ___params___) -------#define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___) -------#define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest) -------#define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest) ------#define CALL22(name, rest, rest2, alt1, alt2) name(struct name ## _params * ___params___, rest, rest2) -------#define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2) -------#define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2) ------#define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2, rest3) -------#else -------#define VAR(name) name -------#define CALL00(name) name() -------#define CALL01(name, alt) name(alt) -------#define CALL02(name, alt1, alt2) name(alt1, alt2) -------#define CALL11(name,rest, alt) name(alt) -------#define CALL12(name,rest, alt1, alt2) name(alt1, alt2) ------#define CALL22(name, rest, rest2, alt1, alt2) name(alt1, alt2) -------#define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3) -------#define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4) ------#define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4) -------#endif ------- -------#ifdef TASK -------#include "SimpleHash.h" --#include "chash.h" ----#ifndef MULTICORE ------#include "ObjectHash.h" --- #include "task.h" -------#include "structdefs.h" ----#endif ----#include "task.h" ------#ifdef OPTIONAL ------#include "optionalstruct.h" ------#endif ------ ------#ifdef OPTIONAL ------struct failedtasklist { ------ struct taskdescriptor *task; ------ int index; ------ int numflags; ------ int *flags; ------ struct failedtasklist *next; ----}; ----#endif ---- ----#ifdef MULTICORE ----struct transObjInfo { - void * objptr; - int targetcore; - int * queues; - int length; --- void * objptr; --- int targetcore; --- int * queues; --- int length; ------}; --- #endif --- --- #ifdef RAW --- //struct RuntimeHash * ptbl = NULL; ------#endif ------- ----#ifdef MULTICORE ----void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length); ----void flagorandinit(void * ptr, int ormask, int andmask); ----void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length); ----#ifdef RAW ----void enqueueObject_I(void * ptr, struct parameterwrapper ** queues, int length); -#ifdef RAWPROFILE -inline void setTaskExitIndex(int index); -inline void addNewObjInfo(void * nobj); -#endif ----#endif -void addAliasLock(void * ptr, int lock); ----#else -------void flagorand(void * ptr, int ormask, int andmask); -------void flagorandinit(void * ptr, int ormask, int andmask); ----void enqueueObject(void * ptr); ----#endif -------void executetasks(); -------void processtasks(); ---- ----#ifdef MULTICORE ----void transferObject(struct transObjInfo * transObj); ----#endif ------- ----#ifndef MULTICORE -------struct tagobjectiterator { ------- int istag; /* 0 if object iterator, 1 if tag iterator */ - struct RuntimeIterator it; /* Object iterator */ - struct RuntimeHash * objectset; ------ struct ObjectIterator it; /* Object iterator */ ------ struct ObjectHash * objectset; ------#ifdef OPTIONAL ------ int failedstate; ------#endif ------- int slot; ------- int tagobjindex; /* Index for tag or object depending on use */ ------- /*if tag we have an object binding */ ------- int tagid; ------- int tagobjectslot; ------- /*if object, we may have one or more tag bindings */ ------- int numtags; ------- int tagbindings[MAXTASKPARAMS-1]; /* list slots */ -------}; ------- -------struct parameterwrapper { ------- struct parameterwrapper *next; - struct RuntimeHash * objectset; ------ struct ObjectHash * objectset; ------- int numberofterms; ------- int * intarray; ------- int numbertags; ------- int * tagarray; ------- struct taskdescriptor * task; ------- int slot; ------- struct tagobjectiterator iterators[MAXTASKPARAMS-1]; -------}; ----#endif ------- -------struct taskparamdescriptor { ------- struct taskdescriptor * task; ------- int numParameters; ------- void ** parameterArray; ------#ifdef OPTIONAL ------ int * failed; ------#endif -------}; ------- -------int hashCodetpd(struct taskparamdescriptor *); -------int comparetpd(struct taskparamdescriptor *, struct taskparamdescriptor *); ------- -------void toiReset(struct tagobjectiterator * it); - int toiHasNext(struct tagobjectiterator *it, void ** objectarray); - void toiNext(struct tagobjectiterator *it , void ** objectarray); ------int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)); --- void toiNext(struct tagobjectiterator *it , void ** objectarray OPTARG(int * failed)); ---void toiNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)); -------void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams); -------void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams); -------void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter); - void enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr); ------int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags); ----#ifdef RAW ----int enqueuetasks_I(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags); ----#endif ------- -------#endif ------- -------#endif diff --cc Robust/src/Runtime/socket.c index d1ddf28a,60709cd2,60709cd2,bb84411d,66f788de,66f788de,66f788de..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/socket.c +++ /dev/null @@@@@@@@ -1,356 -1,374 -1,374 -1,430 -1,430 -1,430 -1,430 +1,0 @@@@@@@@ -------#include "runtime.h" -------#include "structdefs.h" --- #include -------#include ----#ifndef RAW ----#include -------#include -------#include --- #include -------#include ----#endif ----#include -------#include "SimpleHash.h" -------#include "GenericHashtable.h" ------- --- extern struct RuntimeHash *fdtoobject; ----struct RuntimeHash *fdtoobject; ------- ---- int CALL24(___Socket______nativeConnect____I__AR_B_I, int ___fd___, int ___port___, struct ___Socket___ * ___this___, int ___fd___, struct ArrayObject * ___address___ ,int ___port___) { ---int CALL24(___Socket______nativeConnect____I__AR_B_I, int ___fd___, int ___port___, struct ___Socket___ * ___this___, int ___fd___, struct ArrayObject * ___address___,int ___port___) { ----#ifdef RAW - // not supported in RAW version - return -1; --- // not supported in RAW version --- return -1; ----#else ------- struct sockaddr_in sin; ------- int rc; ---- --- ------- bzero(&sin, sizeof(sin)); ------- sin.sin_family= AF_INET; ------- sin.sin_port=htons(___port___); ------- sin.sin_addr.s_addr=htonl(*(int *)(((char *)&VAR(___address___)->___length___)+sizeof(int))); --- #ifdef THREADS ----#if defined(THREADS)||defined(DSTM) -------#ifdef PRECISE_GC ------- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -------#endif -------#endif ------- do { ------- rc = connect(___fd___, (struct sockaddr *) &sin, sizeof(sin)); ------- } while (rc<0 && errno==EINTR); /* repeat if interrupted */ --- #ifdef THREADS ----#if defined(THREADS)||defined(DSTM) -------#ifdef PRECISE_GC ------- restartaftergc(tmp); -------#endif -------#endif ------- ---- --- ------- if (rc<0) goto error; ------- -------#ifdef TASK ------- //Make non-blocking ------- fcntl(___fd___, F_SETFD, 1); ------- fcntl(___fd___, F_SETFL, fcntl(___fd___, F_GETFL)|O_NONBLOCK); ------- RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___)); ------- addreadfd(___fd___); -------#endif ------- ------- return 0; ---- ---- error: --- ---error: ------- close(___fd___); ------- return -1; ----#endif ------} ------ ------#ifdef TASK ------int CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ * ___this___, int ___fd___) { ------ if (RuntimeHashcontainskey(fdtoobject, ___fd___)) --- RuntimeHashremovekey(fdtoobject, ___fd___); --- RuntimeHashremovekey(fdtoobject, ___fd___); ------ RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___)); ------ addreadfd(___fd___); -------} ------#endif ------- ------- -------int CALL12(___Socket______nativeBind_____AR_B_I, int ___port___, struct ArrayObject * ___address___, int ___port___) { ----#ifdef RAW - // not supported in RAW version - return -1; --- // not supported in RAW version --- return -1; ----#else ------- int fd; ------- int rc; ------- socklen_t sa_size; ------- struct sockaddr_in sin; ------- bzero(&sin, sizeof(sin)); ------- sin.sin_family= AF_INET; ------- sin.sin_port=0; ------- sin.sin_addr.s_addr=INADDR_ANY; ---- --- ------- fd=socket(AF_INET, SOCK_STREAM, 0); ------- if (fd<0) { -------#ifdef DEBUG ------- perror(NULL); ------- printf("createSocket error in nativeBind\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,12); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#endif ------- } ---- --- ------- rc = bind(fd, (struct sockaddr *) &sin, sizeof(sin)); ------- if (rc<0) goto error; ------- ------- sa_size = sizeof(sin); ------- rc = getsockname(fd, (struct sockaddr *) &sin, &sa_size); ------- if (rc<0) goto error; ------- ------- return fd; ------- ---- error: ---error: ------- close(fd); -------#ifdef DEBUG ------- perror(NULL); ------- printf("createSocket error #2 in nativeBind\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,13); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); ----#endif -------#endif -------#endif -------} ------- --- struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ___ArrayObject___ * ___hostname___) { ----struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ArrayObject * ___hostname___) { ----#ifdef RAW - // not supported in RAW version - return NULL; --- // not supported in RAW version --- return NULL; ----#else ----//struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ___ArrayObject___ * ___hostname___) { ------- int length=VAR(___hostname___)->___length___; ------- int i,j,n; ------- char * str=malloc(length+1); ------- struct hostent *h; ------- struct ArrayObject * arraybytearray; ------- ---- for(i=0;i___length___)+sizeof(int))[i]; ------- } ------- str[length]=0; ------- h=gethostbyname(str); ------- free(str); ---- --- ------- for (n=0; h->h_addr_list[n]; n++) /* do nothing */ ; ---- --- -------#ifdef PRECISE_GC ------- arraybytearray=allocate_newarray(___params___,BYTEARRAYARRAYTYPE,n); -------#else ------- arraybytearray=allocate_newarray(BYTEARRAYARRAYTYPE,n); -------#endif ---- for(i=0;ih_length); ------- arraybytearray=(struct ArrayObject *) ptrarray[2]; ------- } -------#else ------- bytearray=allocate_newarray(BYTEARRAYTYPE,h->h_length); -------#endif ------- ((void **)&((&arraybytearray->___length___)[1]))[i]=bytearray; ------- { ------- int ha=ntohl(*(int *)h->h_addr_list[i]); ------- (&bytearray->___length___)[1]=ha; ------- } ------- } ---- --- ------- return arraybytearray; ----#endif -------} ------- ------- -------int CALL12(___ServerSocket______createSocket____I, int port, struct ___ServerSocket___ * ___this___, int port) { ----#ifdef RAW - // not supported in RAW version - return -1; --- // not supported in RAW version --- return -1; ----#else ------- int fd; ------- ------- int n=1; ------- struct sockaddr_in sin; ------- ------- bzero(&sin, sizeof(sin)); ------- sin.sin_family = AF_INET; ---- sin.sin_port = htons (port); ---- sin.sin_addr.s_addr = htonl (INADDR_ANY); --- sin.sin_port = htons(port); --- sin.sin_addr.s_addr = htonl(INADDR_ANY); ------- fd=socket(AF_INET, SOCK_STREAM, 0); ------- if (fd<0) { -------#ifdef DEBUG ------- perror(NULL); ------- printf("createSocket error #1\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,5); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#endif ------- } ------- ---- if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (char *)&n, sizeof (n)) < 0) { --- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&n, sizeof (n)) < 0) { ------- close(fd); -------#ifdef DEBUG ------- perror(""); ------- printf("createSocket error #2\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,6); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#endif ------- } ------ ------#ifdef MAC --- if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &n, sizeof (n)) < 0) { --- perror("socket"); --- exit(-1); --- } --- if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &n, sizeof (n)) < 0) { --- perror("socket"); --- exit(-1); --- } ------#endif ------- -------#ifdef TASK ------- fcntl(fd, F_SETFD, 1); ------- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK); -------#endif ------- ------- /* bind to port */ ---- if (bind(fd, (struct sockaddr *) &sin, sizeof(sin))<0) { --- if (bind(fd, (struct sockaddr *) &sin, sizeof(sin))<0) { ------- close(fd); -------#ifdef DEBUG ------- perror(""); ------- printf("createSocket error #3\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,7); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#endif ------- } ------- ------- /* listen */ ---- if (listen(fd, 5)<0) { ---- close (fd); --- if (listen(fd, 5)<0) { --- close(fd); -------#ifdef DEBUG ------- perror(""); ------- printf("createSocket error #4\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,8); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#endif ------- } ------- ------- /* Store the fd/socket object mapping */ -------#ifdef TASK ------- RuntimeHashadd(fdtoobject, fd, (int) VAR(___this___)); ------- addreadfd(fd); -------#endif ------- return fd; ----#endif -------} ------- -------int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSocket___ * ___this___, struct ___Socket___ * ___s___) { ----#ifdef RAW - // not supported in RAW version - return -1; --- // not supported in RAW version --- return -1; ----#else ------- struct sockaddr_in sin; ------- unsigned int sinlen=sizeof(sin); ------- int fd=VAR(___this___)->___fd___; ------- int newfd; --- #ifdef THREADS ----#if defined(THREADS)||defined(DSTM) -------#ifdef PRECISE_GC ------- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -------#endif -------#endif ------- newfd=accept(fd, (struct sockaddr *)&sin, &sinlen); --- #ifdef THREADS ----#if defined(THREADS)||defined(DSTM) -------#ifdef PRECISE_GC ------- restartaftergc(tmp); -------#endif -------#endif ---- if (newfd<0) { --- if (newfd<0) { -------#ifdef DEBUG ------- perror(NULL); ------- printf("acceptSocket error #1\n"); -------#endif -------#ifdef TASK ------- longjmp(error_handler,9); -------#else -------#ifdef THREADS ------- threadexit(); -------#else ------- exit(-1); -------#endif -------#endif ------- } -------#ifdef TASK ------- fcntl(newfd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK); ------- RuntimeHashadd(fdtoobject, newfd, (int) VAR(___s___)); ------- addreadfd(newfd); ----#ifdef MULTICORE ---- flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); ---- enqueueObject(VAR(___this___), NULL, 0); ---- //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); ---- //enqueueObject(VAR(___this___), objq4socketobj[corenum], numqueues4socketobj[corenum]); ----#else ------- flagorand(VAR(___this___),0,0xFFFFFFFE); ---- enqueueObject(VAR(___this___)); ----#endif -------#endif ------- return newfd; ----#endif -------} ------- - void CALL02(___Socket______nativeWrite_____AR_B, struct ___Socket___ * ___this___, struct ArrayObject * ___b___) { ------void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, struct ___Socket___ * ___this___, struct ArrayObject * ___b___, int offset, int length) { ------- int fd=VAR(___this___)->___fd___; - int length=VAR(___b___)->___length___; - char * charstr=((char *)& VAR(___b___)->___length___)+sizeof(int); --- char * charstr=((char *)& VAR(___b___)->___length___)+sizeof(int)+offset; --- char * charstr=((char *)&VAR(___b___)->___length___)+sizeof(int)+offset; ------- while(1) { - int bytewritten=write(fd, charstr, length); - if (bytewritten==-1&&errno==EAGAIN) - continue; ------ int offset=0; ------ int bytewritten; ------ while(length>0) { ------ bytewritten=write(fd, &charstr[offset], length); ------ if (bytewritten==-1&&errno!=EAGAIN) ------ break; ------ length-=bytewritten; ------ offset+=bytewritten; --- } --- } ------- - if (bytewritten!=length) { ------ if (length!=0) { ----#ifndef RAW ------- perror("ERROR IN NATIVEWRITE"); - printf("Supposed to write %d, wrote %d\n", length, bytewritten); --- printf("error=%d remaining bytes %d\n",errno, length); --- printf("error=%d remaining bytes %d\n",errno, length); ----#endif ------- } ------- break; ------- } -------} ------- -------int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___, struct ArrayObject * ___b___) { ------- int fd=VAR(___this___)->___fd___; ------- int length=VAR(___b___)->___length___; ------- ------- char * charstr=malloc(length); ---- --- #ifdef THREADS --- ----#if defined(THREADS)||defined(DSTM) -------#ifdef PRECISE_GC ------- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -------#endif -------#endif - int byteread; ------ int byteread=-1; ------- ------- // printf("Doing read on %d\n",fd); - while(1) { ------ do { ------- byteread=read(fd, charstr, length); - - break; - } ------ } while(byteread==-1&&errno==EINTR); --- #ifdef THREADS ----#if defined(THREADS)||defined(DSTM) -------#ifdef PRECISE_GC ------- restartaftergc(tmp); -------#endif -------#endif ---- --- ------- { ------- int i; ---- for(i=0;i___length___)+sizeof(int))[i]=charstr[i]; --- for(i=0; i___length___)+sizeof(int))[i]=charstr[i]; ------- } ------- free(charstr); ------- } ------- ------- ------- if (byteread<0) { ----#ifndef RAW ------- printf("ERROR IN NATIVEREAD\n"); ------- perror(""); - byteread=0; ----#endif ------- } -------#ifdef TASK ----#ifdef MULTICORE ---- flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); ---- enqueueObject(VAR(___this___), NULL, 0); ---- //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); ---- //enqueueObject(VAR(___this___),objq4socketobj[corenum],numqueues4socketobj[corenum]); ----#else ------- flagorand(VAR(___this___),0,0xFFFFFFFE); ---- enqueueObject(VAR(___this___)); ----#endif -------#endif ------- return byteread; -------} ------- -------void CALL01(___Socket______nativeClose____, struct ___Socket___ * ___this___) { ------- int fd=VAR(___this___)->___fd___; ------- int data; -------#ifdef TASK ------- RuntimeHashget(fdtoobject, fd, &data); ------- RuntimeHashremove(fdtoobject, fd, data); ------- removereadfd(fd); ----#ifdef MULTICORE ---- flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); ---- enqueueObject(VAR(___this___), NULL, 0); ---- //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); ---- //enqueueObject(VAR(___this___),objq4socketobj[corenum],numqueues4socketobj[corenum]); ----#else ------- flagorand(VAR(___this___),0,0xFFFFFFFE); ---- enqueueObject(VAR(___this___)); ----#endif -------#endif ------- close(fd); -------} diff --cc Robust/src/Runtime/task.c index 5e7848c8,61416da0,61416da0,57bcbf07,e1430679,52f8bcb0,229e66f7..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/task.c +++ /dev/null @@@@@@@@ -1,916 -1,1654 -1,1654 -1,1667 -1,1663 -1,1663 -1,1666 +1,0 @@@@@@@@ -------#ifdef TASK -------#include "runtime.h" -------#include "structdefs.h" -------#include "mem.h" -------#include "checkpoint.h" -------#include "Queue.h" -------#include "SimpleHash.h" -------#include "GenericHashtable.h" - #include "optionalstruct.h" -------#include -------#include -------#include -------#include -------#include ------- -------extern int injectfailures; -------extern float failurechance; -------extern int debugtask; -------extern int instaccum; -extern int errors; ------- -------#ifdef CONSCHECK -------#include "instrument.h" -------#endif ------- -------struct genhashtable * activetasks; -------struct parameterwrapper * objectqueues[NUMCLASSES]; -------struct genhashtable * failedtasks; -------struct taskparamdescriptor * currtpd; ----- struct RuntimeHash * forward; ----- struct RuntimeHash * reverse; - --struct ctable * forward; --struct ctable * reverse; ------- -------int main(int argc, char **argv) { -------#ifdef BOEHM_GC ------- GC_init(); // Initialize the garbage collector -------#endif -------#ifdef CONSCHECK ------- initializemmap(); -------#endif ------- processOptions(); ------- initializeexithandler(); ------- /* Create table for failed tasks */ ---- failedtasks=genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd, ---- (int (*)(void *,void *)) &comparetpd); --- failedtasks=genallocatehashtable((unsigned int(*) (void *)) &hashCodetpd, --- (int(*) (void *,void *)) &comparetpd); ------- /* Create queue of active tasks */ ---- activetasks=genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd, ---- (int (*)(void *,void *)) &comparetpd); - --- activetasks=genallocatehashtable((unsigned int(*) (void *)) &hashCodetpd, --- (int(*) (void *,void *)) &comparetpd); - --- --- ------- /* Process task information */ ------- processtasks(); ------- ------- /* Create startup object */ ------- createstartupobject(argc, argv); ------- ------- /* Start executing the tasks */ ------- executetasks(); -------} ------- -------void createstartupobject(int argc, char ** argv) { ------- int i; ---- --- ------- /* Allocate startup object */ -------#ifdef PRECISE_GC ------- struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(NULL, STARTUPTYPE); ---- struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-1); --- struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-1); -------#else ------- struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(STARTUPTYPE); ---- struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-1); --- struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-1); -------#endif ------- /* Build array of strings */ ------- startupobject->___parameters___=stringarray; ---- for(i=1;i___length___)+sizeof(int)))[i-1]=newstring; --- ((void **)(((char *)&stringarray->___length___)+sizeof(int)))[i-1]=newstring; ------- } ---- --- --- --- /* Set initialized flag for startup object */ - /* Set initialized flag for startup object */ ------- flagorand(startupobject,1,0xFFFFFFFF); ---- enqueueObject(startupobject); -------} ------- -------int hashCodetpd(struct taskparamdescriptor *ftd) { ------- int hash=(int)ftd->task; ------- int i; - for(i=0;inumParameters;i++) { --- for(i=0;inumParameters;i++){ - for(i=0; inumParameters; i++){ -- for(i=0; inumParameters; i++) { ------- hash^=(int)ftd->parameterArray[i]; ------- } ------- return hash; -------} ------- -------int comparetpd(struct taskparamdescriptor *ftd1, struct taskparamdescriptor *ftd2) { ------- int i; ------- if (ftd1->task!=ftd2->task) ------- return 0; ---- for(i=0;inumParameters;i++) - if (ftd1->parameterArray[i]!=ftd2->parameterArray[i]) --- for(i=0; inumParameters; i++) ------ if(ftd1->parameterArray[i]!=ftd2->parameterArray[i]) ------ return 0; ------#ifdef OPTIONAL --- for(i=0;inumParameters;i++) { --- for(i=0; inumParameters; i++) { ------ if(ftd1->failed[i]!=ftd2->failed[i]) ------- return 0; ------ } ------#endif ------- return 1; -------} - ------- -------/* This function sets a tag. */ -------#ifdef PRECISE_GC -------void tagset(void *ptr, struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -------#else -------void tagset(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -------#endif ------- struct ___Object___ * tagptr=obj->___tags___; ------- if (tagptr==NULL) { ------- obj->___tags___=(struct ___Object___ *)tagd; ------- } else { ------- /* Have to check if it is already set */ ------- if (tagptr->type==TAGTYPE) { ------- struct ___TagDescriptor___ * td=(struct ___TagDescriptor___ *) tagptr; ------- if (td==tagd) ------- return; -------#ifdef PRECISE_GC ------- int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; ------- struct ArrayObject * ao=allocate_newarray(&ptrarray,TAGARRAYTYPE,TAGARRAYINTERVAL); ------- obj=(struct ___Object___ *)ptrarray[2]; ------- tagd=(struct ___TagDescriptor___ *)ptrarray[3]; ------- td=(struct ___TagDescriptor___ *) obj->___tags___; -------#else ------- struct ArrayObject * ao=allocate_newarray(TAGARRAYTYPE,TAGARRAYINTERVAL); -------#endif ------- ARRAYSET(ao, struct ___TagDescriptor___ *, 0, td); ------- ARRAYSET(ao, struct ___TagDescriptor___ *, 1, tagd); ------- obj->___tags___=(struct ___Object___ *) ao; ------- ao->___cachedCode___=2; ------- } else { ------- /* Array Case */ ------- int i; ------- struct ArrayObject *ao=(struct ArrayObject *) tagptr; ---- for(i=0;i___cachedCode___;i++) { --- for(i=0; i___cachedCode___; i++) { ------- struct ___TagDescriptor___ * td=ARRAYGET(ao, struct ___TagDescriptor___*, i); ------- if (td==tagd) ------- return; ------- } ------- if (ao->___cachedCode______length___) { ------- ARRAYSET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___, tagd); ------- ao->___cachedCode___++; ------- } else { -------#ifdef PRECISE_GC ------- int ptrarray[]={2,(int) ptr, (int) obj, (int) tagd}; ------- struct ArrayObject * aonew=allocate_newarray(&ptrarray,TAGARRAYTYPE,TAGARRAYINTERVAL+ao->___length___); ------- obj=(struct ___Object___ *)ptrarray[2]; ------- tagd=(struct ___TagDescriptor___ *) ptrarray[3]; ------- ao=(struct ArrayObject *)obj->___tags___; -------#else ------- struct ArrayObject * aonew=allocate_newarray(TAGARRAYTYPE,TAGARRAYINTERVAL+ao->___length___); -------#endif ------- aonew->___cachedCode___=ao->___length___+1; ---- for(i=0;i___length___;i++) { --- for(i=0; i___length___; i++) { ------- ARRAYSET(aonew, struct ___TagDescriptor___*, i, ARRAYGET(ao, struct ___TagDescriptor___*, i)); ------- } ------- ARRAYSET(aonew, struct ___TagDescriptor___ *, ao->___length___, tagd); ------- } ------- } ------- } ------- ------- { ------- struct ___Object___ * tagset=tagd->flagptr; - ------- if(tagset==NULL) { ------- tagd->flagptr=obj; ------- } else if (tagset->type!=OBJECTARRAYTYPE) { -------#ifdef PRECISE_GC ------- int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; ------- struct ArrayObject * ao=allocate_newarray(&ptrarray,OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); ------- obj=(struct ___Object___ *)ptrarray[2]; ------- tagd=(struct ___TagDescriptor___ *)ptrarray[3]; -------#else ------- struct ArrayObject * ao=allocate_newarray(OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); -------#endif ------- ARRAYSET(ao, struct ___Object___ *, 0, tagd->flagptr); ------- ARRAYSET(ao, struct ___Object___ *, 1, obj); ------- ao->___cachedCode___=2; ------- tagd->flagptr=(struct ___Object___ *)ao; ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) tagset; ------- if (ao->___cachedCode______length___) { ------- ARRAYSET(ao, struct ___Object___*, ao->___cachedCode___++, obj); ------- } else { ------- int i; -------#ifdef PRECISE_GC ------- int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; ------- struct ArrayObject * aonew=allocate_newarray(&ptrarray,OBJECTARRAYTYPE,OBJECTARRAYINTERVAL+ao->___length___); ------- obj=(struct ___Object___ *)ptrarray[2]; ------- tagd=(struct ___TagDescriptor___ *)ptrarray[3]; ------- ao=(struct ArrayObject *)tagd->flagptr; -------#else ------- struct ArrayObject * aonew=allocate_newarray(OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); -------#endif ------- aonew->___cachedCode___=ao->___cachedCode___+1; ---- for(i=0;i___length___;i++) { --- for(i=0; i___length___; i++) { ------- ARRAYSET(aonew, struct ___Object___*, i, ARRAYGET(ao, struct ___Object___*, i)); ------- } ------- ARRAYSET(aonew, struct ___Object___ *, ao->___cachedCode___, obj); - tagd->flagptr=(struct ___Object___ *) ao; ------ tagd->flagptr=(struct ___Object___ *) aonew; ------- } ------- } ------- } -------} ------- -------/* This function clears a tag. */ -------#ifdef PRECISE_GC -------void tagclear(void *ptr, struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -------#else -------void tagclear(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -------#endif ------- /* We'll assume that tag is alway there. ------- Need to statically check for this of course. */ ------- struct ___Object___ * tagptr=obj->___tags___; ------- ------- if (tagptr->type==TAGTYPE) { ------- if ((struct ___TagDescriptor___ *)tagptr==tagd) ------- obj->___tags___=NULL; ------- else ------- printf("ERROR 1 in tagclear\n"); ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) tagptr; ------- int i; ---- for(i=0;i___cachedCode___;i++) { --- for(i=0; i___cachedCode___; i++) { ------- struct ___TagDescriptor___ * td=ARRAYGET(ao, struct ___TagDescriptor___ *, i); ------- if (td==tagd) { ------- ao->___cachedCode___--; ------- if (i___cachedCode___) ------- ARRAYSET(ao, struct ___TagDescriptor___ *, i, ARRAYGET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___)); ------- ARRAYSET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___, NULL); ------- if (ao->___cachedCode___==0) ------- obj->___tags___=NULL; ------- goto PROCESSCLEAR; ------- } ------- } ------- printf("ERROR 2 in tagclear\n"); ------- } ---- PROCESSCLEAR: ---PROCESSCLEAR: ------- { ------- struct ___Object___ *tagset=tagd->flagptr; ------- if (tagset->type!=OBJECTARRAYTYPE) { ------- if (tagset==obj) ------- tagd->flagptr=NULL; ------- else ------- printf("ERROR 3 in tagclear\n"); ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) tagset; ------- int i; ---- for(i=0;i___cachedCode___;i++) { --- for(i=0; i___cachedCode___; i++) { ------- struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, i); ------- if (tobj==obj) { ------- ao->___cachedCode___--; ------- if (i___cachedCode___) ------- ARRAYSET(ao, struct ___Object___ *, i, ARRAYGET(ao, struct ___Object___ *, ao->___cachedCode___)); ------- ARRAYSET(ao, struct ___Object___ *, ao->___cachedCode___, NULL); ------- if (ao->___cachedCode___==0) ------- tagd->flagptr=NULL; ------- goto ENDCLEAR; ------- } ------- } ------- printf("ERROR 4 in tagclear\n"); ------- } ------- } ---- ENDCLEAR: ---ENDCLEAR: ------- return; - -------} ---- --- -------/* This function allocates a new tag. */ -------#ifdef PRECISE_GC -------struct ___TagDescriptor___ * allocate_tag(void *ptr, int index) { ------- struct ___TagDescriptor___ * v=(struct ___TagDescriptor___ *) mygcmalloc((struct garbagelist *) ptr, classsize[TAGTYPE]); -------#else -------struct ___TagDescriptor___ * allocate_tag(int index) { ------- struct ___TagDescriptor___ * v=FREEMALLOC(classsize[TAGTYPE]); -------#endif ------- v->type=TAGTYPE; ------- v->flag=index; ------- return v; ---- } ---} ------- ------- ------- -------/* This function updates the flag for object ptr. It or's the flag ------- with the or mask and and's it with the andmask. */ ------- -------void flagbody(struct ___Object___ *ptr, int flag); ------#ifdef OPTIONAL ------void enqueueoptional(struct ___Object___ * currobj, int numfailedfses, int * failedfses, struct taskdescriptor * task, int index); ------#endif --- --- int flagcomp(const int *val1, const int *val2) { --- return (*val1)-(*val2); --- } --- ---int flagcomp(const int *val1, const int *val2) { --- return (*val1)-(*val2); ---} ------- -------void flagorand(void * ptr, int ormask, int andmask) { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; - // Not sure why this was necessary - // if (flag==oldflag) /* Don't do anything */ - // return; - //else - flagbody(ptr, flag); ------#ifdef OPTIONAL ------ struct ___Object___ * obj = (struct ___Object___ *)ptr; --- if(obj->numfses){/*store the information about fses*/ - if(obj->numfses){ /*store the information about fses*/ -- if(obj->numfses) { /*store the information about fses*/ ------ int flag, i, j,counter, offset=0; --- for(i=0;inumfses;i++) { --- for(i=0; inumfses; i++) { ------ int oldoffset; ------ counter=obj->fses[offset++]; ------ oldoffset=offset; --- for(j=0;jfses[offset]; ------ obj->fses[offset++]=(flag|ormask)&andmask; ------ } --- qsort(&obj->fses[oldoffset], sizeof(int), counter, (int (*)(const void *, const void *)) &flagcomp); --- qsort(&obj->fses[oldoffset], sizeof(int), counter, (int(*) (const void *, const void *)) &flagcomp); ------ } ------ enqueueoptional(obj, 0, NULL, NULL, 0); --- } --- else --- } else ------#endif --- { --- int oldflag=((int *)ptr)[1]; --- int flag=ormask|oldflag; --- flag&=andmask; --- flagbody(ptr, flag); --- } --- { --- int oldflag=((int *)ptr)[1]; --- int flag=ormask|oldflag; --- flag&=andmask; --- flagbody(ptr, flag); --- } -------} - --- --- --- void intflagorand(void * ptr, int ormask, int andmask) { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; - if (flag==oldflag) /* Don't do anything */ - return; - else flagbody(ptr, flag); ----bool intflagorand(void * ptr, int ormask, int andmask) { ------#ifdef OPTIONAL ------ struct ___Object___ * obj = (struct ___Object___ *)ptr; --- if(obj->numfses) {/*store the information about fses*/ --- if(obj->numfses) { /*store the information about fses*/ ------ int flag, i, j,counter, offset=0; --- for(i=0;inumfses;i++) { --- for(i=0; inumfses; i++) { ------ int oldoffset; ------ counter=obj->fses[offset++]; ------ oldoffset=offset; --- for(j=0;jfses[offset]; ------ obj->fses[offset++]=(flag|ormask)&andmask; ------ } --- qsort(&obj->fses[oldoffset], sizeof(int), counter, (int (*)(const void *, const void *)) &flagcomp); --- qsort(&obj->fses[oldoffset], sizeof(int), counter, (int(*) (const void *, const void *)) &flagcomp); ------ } ------ enqueueoptional(obj, 0, NULL, NULL, 0); --- } --- else --- } else ------#endif --- { --- int oldflag=((int *)ptr)[1]; --- int flag=ormask|oldflag; --- flag&=andmask; --- if (flag==oldflag) /* Don't do anything */ -- return; -- else flagbody(ptr, flag); - return false; - else { - flagbody(ptr, flag); - return true; - } --- { --- int oldflag=((int *)ptr)[1]; --- int flag=ormask|oldflag; --- flag&=andmask; --- if (flag==oldflag) /* Don't do anything */ --- return false; --- else { --- flagbody(ptr, flag); --- return true; ------ } --- } -------} ------- -------void flagorandinit(void * ptr, int ormask, int andmask) { ------- int oldflag=((int *)ptr)[1]; ------- int flag=ormask|oldflag; ------- flag&=andmask; ------- flagbody(ptr,flag); -------} ------- -------void flagbody(struct ___Object___ *ptr, int flag) { ------- struct parameterwrapper *flagptr=(struct parameterwrapper *)ptr->flagptr; ------- ptr->flag=flag; ---- --- ------- /*Remove object from all queues */ ------- while(flagptr!=NULL) { ------- struct parameterwrapper *next; - struct ___Object___ * tag=ptr->___tags___; - RuntimeHashget(flagptr->objectset, (int) ptr, (int *) &next); - RuntimeHashremove(flagptr->objectset, (int)ptr, (int) next); ------ int UNUSED, UNUSED2; ------ int * enterflags; ------ ObjectHashget(flagptr->objectset, (int) ptr, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); ------ ObjectHashremove(flagptr->objectset, (int)ptr); ------ if (enterflags!=NULL) ------ free(enterflags); ------- flagptr=next; ------- } - } ---} ---- - void enqueueObject(void *vptr) { - struct ___Object___ *ptr = (struct ___Object___ *)vptr; ---- ---void enqueueObject(void *vptr) { --- struct ___Object___ *ptr = (struct ___Object___ *)vptr; --- ------- { ------- struct QueueItem *tmpptr; ------- struct parameterwrapper * parameter=objectqueues[ptr->type]; ------- int i; ------- struct parameterwrapper * prevptr=NULL; ------- struct ___Object___ *tagptr=ptr->___tags___; - --- --- ------- /* Outer loop iterates through all parameter queues an object of ------- this type could be in. */ - --- --- ------- while(parameter!=NULL) { ------- /* Check tags */ ------- if (parameter->numbertags>0) { ------- if (tagptr==NULL) ---- goto nextloop;//that means the object has no tag but that param needs tag ---- else if(tagptr->type==TAGTYPE) {//one tag --- goto nextloop; //that means the object has no tag but that param needs tag --- else if(tagptr->type==TAGTYPE) { //one tag ------- struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; ---- for(i=0;inumbertags;i++) { --- for(i=0; inumbertags; i++) { ------- //slotid is parameter->tagarray[2*i]; ------- int tagid=parameter->tagarray[2*i+1]; ------- if (tagid!=tagptr->flag) ---- goto nextloop; /*We don't have this tag */ --- goto nextloop; /*We don't have this tag */ - --- } --- } ---- } else {//multiple tags --- } else { //multiple tags ------- struct ArrayObject * ao=(struct ArrayObject *) tagptr; ---- for(i=0;inumbertags;i++) { --- for(i=0; inumbertags; i++) { ------- //slotid is parameter->tagarray[2*i]; ------- int tagid=parameter->tagarray[2*i+1]; ------- int j; ---- for(j=0;j___cachedCode___;j++) { - if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, i)->flag) --- for(j=0; j___cachedCode___; j++) { ------ if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, j)->flag) ------- goto foundtag; ------- } ------- goto nextloop; ---- foundtag: ---foundtag: ------- ; ------- } ------- } ------- } - --- --- ------- /* Check flags */ ---- for(i=0;inumberofterms;i++) { --- for(i=0; inumberofterms; i++) { ------- int andmask=parameter->intarray[i*2]; ------- int checkmask=parameter->intarray[i*2+1]; --- if ((flag&andmask)==checkmask) { - enqueuetasks(parameter, prevptr, ptr); ---- if ((ptr->flag&andmask)==checkmask) { ------ enqueuetasks(parameter, prevptr, ptr, NULL, 0); ------- prevptr=parameter; ------- break; ------- } ------- } ---- nextloop: ---nextloop: ------- parameter=parameter->next; ------- } ------- ptr->flagptr=prevptr; ------ } ------} -- ---- ------#ifdef OPTIONAL ------ ------int checktags(struct ___Object___ * currobj, struct fsanalysiswrapper * fswrapper) { ------ /* Check Tags */ ------ struct ___Object___ * tagptr = currobj->___tags___; ---- if(fswrapper->numtags>0){ -- if(fswrapper->numtags>0) { ------ if (tagptr==NULL) ------ return 0; //that means the object has no tag but that param ------ //needs tag --- else if(tagptr->type==TAGTYPE) {//one tag --- if(fswrapper->numtags!=1) --- else if(tagptr->type==TAGTYPE) { //one tag --- if(fswrapper->numtags!=1) ------ return 0; //we don't have the right number of tags ------ struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; ------ if (fswrapper->tags[0]!=tagptr->flag) ------ return 0; ------ } else { //multiple tags ------ struct ArrayObject * ao=(struct ArrayObject *) tagptr; ------ int tag_counter=0; ------ int foundtag=0; --- --- if(ao->___length___!=fswrapper->numtags) --- return 0;//we don't have the right number of tags --- for(tag_counter=0;tag_counternumtags;tag_counter++) { --- --- if(ao->___length___!=fswrapper->numtags) --- return 0; //we don't have the right number of tags --- for(tag_counter=0; tag_counternumtags; tag_counter++) { ------ int tagid=fswrapper->tags[tag_counter]; ------ int j; --- for(j=0;j___cachedCode___;j++) { --- for(j=0; j___cachedCode___; j++) { ------ if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, tag_counter)->flag) ------ return 1; ------ } ------ return 0; ------ } ------ } ------ } ------ return 1; ------} ------ ------int getlength(int *flist, int len) { ------ int count=0; ------ int i; --- for(i=0;inumflags;i++) { --- for(i=0; inumflags; i++) { ------ int len=ftl->flags[offset++]; ------ int offsetmerge=0; --- for(j=0;jnumflags;j++) { --- for(j=0; jnumflags; j++) { ------ int lenmerge=ftlmerge->flags[offsetmerge++]; ------ length+=1+domerge(&ftl->flags[offset],len,&ftlmerge->flags[offsetmerge],lenmerge, NULL); ------ offsetmerge+=lenmerge; ------ } ------ offset+=len; ------ } ------ mergedlist=RUNMALLOC(sizeof(int)*length); ---- - void enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr) { --- ------ offset=0; ------ length=0; --- for(i=0;inumflags;i++) { --- for(i=0; inumflags; i++) { ------ int len=ftl->flags[offset++]; ------ int offsetmerge=0; --- for(j=0;jnumflags;j++) { --- for(j=0; jnumflags; j++) { ------ int lenmerge=ftlmerge->flags[offsetmerge++]; ------ int size=domerge(&ftl->flags[offset],len,&ftlmerge->flags[offsetmerge],lenmerge,&mergedlist[length+1]); ------ mergedlist[length]=size; ------ length+=size+1; ------ } ------ } ------ RUNFREE(ftl->flags); ------ ftl->flags=mergedlist; ------ ftl->numflags*=ftlmerge->numflags; ------} ------ ------void mergefailedlists(struct failedtasklist **andlist, struct failedtasklist *list) { ------ struct failedtasklist *tmpptr; ------ while((*andlist)!=NULL) { ------ struct failedtasklist *searchftl=list; ------ while(searchftl!=NULL) { ------ if ((*andlist)->task==searchftl->task&& --- (*andlist)->index==searchftl->index) { --- (*andlist)->index==searchftl->index) { ------ mergeitems(*andlist, searchftl); ------ break; ------ } ------ searchftl=searchftl->next; ------ } ------ if (searchftl==NULL) { ------ //didn't find andlist ------ tmpptr=*andlist; --- *andlist=(*andlist)->next;//splice item out of list --- *andlist=(*andlist)->next; //splice item out of list ------ RUNFREE(tmpptr->flags); //free the item ------ RUNFREE(tmpptr); ------ } else { ------ andlist=&((*andlist)->next); //iterate to next item ------ } ------ } ------ //free the list we're searching ------ while(list!=NULL) { ------ tmpptr=list->next; ------ RUNFREE(list->flags); ------ RUNFREE(list); ------ list=tmpptr; ------ } ------} ------ ------struct failedtasklist * processfailstate(struct classanalysiswrapper * classwrapper, struct taskdescriptor *task, int index, struct ___Object___ * currobj, int flagstate) { ------ struct failedtasklist *list=NULL; ------ int i,h; ------ struct fsanalysiswrapper *fswrapper=NULL; --- for(h=0;hnumfsanalysiswrappers;h++) { --- for(h=0; hnumfsanalysiswrappers; h++) { ------ struct fsanalysiswrapper * tmp=classwrapper->fsanalysiswrapperarray[h]; ------ if (tmp->flags==flagstate&&checktags(currobj, tmp)) { ------ //we only match exactly here ------ fswrapper=tmp; ------ break; ------ } ------ } ------ if (fswrapper==NULL) ------ return list; --- for(i=0;inumtaskfailures;i++) { --- for(i=0; inumtaskfailures; i++) { ------ int j; ------ struct taskfailure * taskfail=fswrapper->taskfailurearray[i]; ------ if (taskfail->task==task&&taskfail->index==index) { ------ int start=0; ------ while(startnumoptionaltaskdescriptors) { ------ struct taskdescriptor *currtask=NULL; ------ struct failedtasklist *tmpftl; ------ int currindex; ------ int totallength=0; ------ int *enterflags; ------ int numenterflags, offset; ------ struct parameterwrapper *pw; --- for(j=start;jnumoptionaltaskdescriptors;j++) { --- for(j=start; jnumoptionaltaskdescriptors; j++) { ------ struct optionaltaskdescriptor *otd=taskfail->optionaltaskdescriptorarray[j]; ------ if(currtask==NULL) { ------ currtask=otd->task; ------ currindex=otd->index; ------ } else if (currtask!=otd->task||currindex!=otd->index) ------ break; ------ totallength+=otd->numenterflags; ------ } ------ pw=currtask->descriptorarray[currindex]->queue; ------ enterflags=RUNMALLOC(totallength*sizeof(int)); ------ numenterflags=j-start; ------ offset=0; --- for(start;startoptionaltaskdescriptorarray[start]; ------ enterflags[offset++]=otd->numenterflags; ------ memcpy(&enterflags[offset], otd->enterflags, otd->numenterflags*sizeof(int)); ------ offset+=otd->numenterflags; ------ } ------ tmpftl=RUNMALLOC(sizeof(struct failedtasklist)); ------ tmpftl->next=list; ------ tmpftl->task=currtask; ------ tmpftl->numflags=numenterflags; ------ tmpftl->flags=enterflags; ------ list=tmpftl; ------ } ------ } ------ } ------ return list; ------} ------ ------struct failedtasklist * processnormfailstate(struct classanalysiswrapper * classwrapper, struct ___Object___ * currobj, int flagstate) { ------ struct failedtasklist *list=NULL; ------ int i,h; ------ int start=0; ------ struct fsanalysiswrapper *fswrapper=NULL; --- for(h=0;hnumfsanalysiswrappers;h++) { --- for(h=0; hnumfsanalysiswrappers; h++) { ------ struct fsanalysiswrapper * tmp=classwrapper->fsanalysiswrapperarray[h]; ------ if (tmp->flags==flagstate&&checktags(currobj, tmp)) { ------ //we only match exactly here ------ fswrapper=tmp; ------ break; ------ } ------ } ------ if(fswrapper==NULL) ------ return NULL; ------ ------ while(startnumoptionaltaskdescriptors) { ------ struct taskdescriptor *currtask=NULL; ------ struct failedtasklist *tmpftl; ------ int j; ------ int currindex; ------ int totallength=0; ------ int *enterflags; ------ int numenterflags, offset; ------ struct parameterwrapper *pw; --- for(j=start;jnumoptionaltaskdescriptors;j++) { --- for(j=start; jnumoptionaltaskdescriptors; j++) { ------ struct optionaltaskdescriptor *otd=fswrapper->optionaltaskdescriptorarray[j]; ------ if(currtask==NULL) { ------ currtask=otd->task; ------ currindex=otd->index; ------ } else if (currtask!=otd->task||currindex!=otd->index) ------ break; ------ totallength+=otd->numenterflags; ------ } ------ pw=currtask->descriptorarray[currindex]->queue; ------ enterflags=RUNMALLOC(totallength*sizeof(int)); ------ numenterflags=j-start; ------ offset=0; --- for(start;startoptionaltaskdescriptorarray[start]; ------ enterflags[offset++]=otd->numenterflags; ------ memcpy(&enterflags[offset], otd->enterflags, otd->numenterflags*sizeof(int)); ------ offset+=otd->numenterflags; ------ } ------ tmpftl=RUNMALLOC(sizeof(struct failedtasklist)); ------ tmpftl->next=list; ------ tmpftl->task=currtask; ------ tmpftl->numflags=numenterflags; ------ tmpftl->flags=enterflags; ------ list=tmpftl; ------ } ------ return list; ------} ------ ------ ------ ------void enqueuelist(struct ___Object___ * currobj, struct failedtasklist * andlist) { ------ while(andlist!=NULL) { ------ struct failedtasklist *tmp=andlist; ------ struct parameterwrapper *pw=andlist->task->descriptorarray[andlist->index]->queue; ------ struct parmaeterwrapper *next; ------ int * flags; ------ int numflags; ------ int isnonfailed; --- --- ------ if (enqueuetasks(pw, currobj->flagptr, currobj, tmp->flags, tmp->numflags)) ------ currobj->flagptr=pw; --- --- ------ andlist=andlist->next; ------ RUNFREE(tmp); ------ } ------} ------ ------void enqueueoptional(struct ___Object___ * currobj, int numfailedfses, int * failedfses, struct taskdescriptor * task, int index) { --- struct classanalysiswrapper * classwrapper=NULL; --- --- struct classanalysiswrapper * classwrapper=NULL; --- ------ /*test what optionaltaskdescriptors are available, find the class --- corresponding*/ --- corresponding*/ ------ if (classanalysiswrapperarray[currobj->type]!=NULL) { ------ classwrapper = classanalysiswrapperarray[currobj->type]; ------ } else ------ return; --- --- if(task!=NULL) { --- --- if(task!=NULL) { ------ /* We have a failure */ ------ if (failedfses==NULL) { ------ /* Failed in normal state */ ------ /*first time the method is invoked*/ ------ int i,h; ------ struct fsanalysiswrapper *fswrapper=NULL; ------ --- for(h=0;hnumfsanalysiswrappers;h++) { --- for(h=0; hnumfsanalysiswrappers; h++) { ------ struct fsanalysiswrapper * tmp=classwrapper->fsanalysiswrapperarray[h]; ------ if (tmp->flags==currobj->flag&&checktags(currobj, tmp)) { ------ //we only match exactly here ------ fswrapper=tmp; ------ break; ------ } ------ } ------ if(fswrapper==NULL) //nothing to do in this state ------ return; --- for(i=0;inumtaskfailures;i++) { --- for(i=0; inumtaskfailures; i++) { ------ int j; ------ struct taskfailure * taskfail=fswrapper->taskfailurearray[i]; ------ if (taskfail->task==task&&taskfail->index==index) { ------ int start=0; ------ while(startnumoptionaltaskdescriptors) { ------ struct taskdescriptor *currtask=NULL; ------ int currindex; ------ int totallength=0; ------ int *enterflags; ------ int numenterflags, offset; ------ struct parameterwrapper *pw; --- for(j=start;jnumoptionaltaskdescriptors;j++) { --- for(j=start; jnumoptionaltaskdescriptors; j++) { ------ struct optionaltaskdescriptor *otd=taskfail->optionaltaskdescriptorarray[j]; ------ if(currtask==NULL) { ------ currtask=otd->task; ------ currindex=otd->index; ------ } else if (currtask!=otd->task||currindex!=otd->index) ------ break; --- totallength+=otd->numenterflags;//1 is to store the lengths --- totallength+=otd->numenterflags; //1 is to store the lengths ------ } ------ pw=currtask->descriptorarray[currindex]->queue; ---- enterflags=RUNMALLOC((totallength+numenterflags)*sizeof(int)); ------ numenterflags=j-start; -- enterflags=RUNMALLOC((totallength+numenterflags)*sizeof(int)); ------ ------ offset=0; --- for(start;startoptionaltaskdescriptorarray[start]; ------ enterflags[offset++]=otd->numenterflags; ------ memcpy(&enterflags[offset], otd->enterflags, otd->numenterflags*sizeof(int)); ------ offset+=otd->numenterflags; ------ } ------ //Enqueue this one ------ if (enqueuetasks(pw, currobj->flagptr, currobj, enterflags, numenterflags)) ------ currobj->flagptr=pw; ------ } ------ } ------ } ------ } else { ------ /* Failed in failed state */ ------ int i; ------ int offset=0; --- for(i=0;iflagptr; ------ ------ /*Remove object from all queues */ ------ while(flagptr!=NULL) { ------ struct parameterwrapper *next; ------ int UNUSED, UNUSED2; ------ int * enterflags; ------ ObjectHashget(flagptr->objectset, (int) currobj, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); ------ ObjectHashremove(flagptr->objectset, (int)currobj); ------ if (enterflags!=NULL) ------ free(enterflags); ------ flagptr=next; ------ } ------ ------ /* Failed in failed state */ ------ int i; ------ int offset=0; --- for(i=0;inumfses;i++) { --- for(i=0; inumfses; i++) { ------ int numfses=currobj->fses[offset++]; ------ int j; ------ struct failedtasklist *andlist=NULL; --- for(j=0;jfses[offset++]; ------ struct failedtasklist *currlist=processnormfailstate(classwrapper, currobj, flagstate); ------ if (andlist==NULL) ------ andlist=currlist; ------ else ------ mergefailedlists(&andlist, currlist); ------ } ------ enqueuelist(currobj, andlist); ------ } ------ } --- } --- --- ---} --- --- ------#endif --- --- ------int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags) { ------- void * taskpointerarray[MAXTASKPARAMS]; ------#ifdef OPTIONAL ------ int failed[MAXTASKPARAMS]; ------#endif ------- int j; ------- int numparams=parameter->task->numParameters; ------- int numiterators=parameter->task->numTotal-1; ------ int retval=1; ------ int addnormal=1; ------ int adderror=1; ------- ------- struct taskdescriptor * task=parameter->task; - - RuntimeHashadd(parameter->objectset, (int) ptr, (int) prevptr);//this add the object to parameterwrapper - ------ --- #ifdef OPTIONAL ---#ifdef OPTIONAL ------ if (ObjectHashcontainskey(parameter->objectset, (int) ptr)) { ------ /* The object is already here...or it with the existing item */ ------ int * oldflags; ------ int oldnumflags; ------ int oldptr; ------ int oldstatus; ------ int *mergedflags; --- ObjectHashget(parameter->objectset, (int) ptr, & oldptr, (int *) &oldflags, &oldnumflags, &oldstatus); --- ObjectHashget(parameter->objectset, (int) ptr, &oldptr, (int *) &oldflags, &oldnumflags, &oldstatus); ------ mergedflags=domergeor(oldflags, oldnumflags, enterflags, numenterflags); ------ ObjectHashupdate(parameter->objectset, (int) ptr, oldptr, mergedflags, oldnumflags+numenterflags, oldstatus||(enterflags==NULL)); ------ ------ RUNFREE(oldflags); ------ RUNFREE(enterflags); ------ ------ //only add if truly needed ------ if (oldstatus) ------ addnormal=0; ------ if (oldnumflags>0) ------ adderror=0; ------ ------ retval=0; ------ } else { ------#endif --- ObjectHashadd(parameter->objectset, (int) ptr, (int) prevptr, (int) enterflags, numenterflags, enterflags==NULL);//this add the object to parameterwrapper --- ObjectHashadd(parameter->objectset, (int) ptr, (int) prevptr, (int) enterflags, numenterflags, enterflags==NULL); //this add the object to parameterwrapper ------#ifdef OPTIONAL --- } ---} ------#endif --- --- ------- /* Add enqueued object to parameter vector */ ------- taskpointerarray[parameter->slot]=ptr; ------#ifdef OPTIONAL ------ failed[parameter->slot]=(enterflags!=NULL); ------#endif ------- ------- /* Reset iterators */ ---- for(j=0;jiterators[j]); ------- } ------- ------- /* Find initial state */ ---- for(j=0;jiterators[j], taskpointerarray)) - toiNext(¶meter->iterators[j], taskpointerarray); -- if(toiHasNext(¶meter->iterators[j], taskpointerarray OPTARG(failed))) --- for(j=0; jiterators[j], taskpointerarray OPTARG(failed))){ -- if(toiHasNext(¶meter->iterators[j], taskpointerarray OPTARG(failed))) { ------ toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - } ---- else if (j>0) { - } else if (j>0) { -- } else if (j>0) { ------- /* Need to backtrack */ ------- toiReset(¶meter->iterators[j]); ------- j--; ------- goto backtrackinit; ------- } else { ------- /* Nothing to enqueue */ - return; ------ return retval; ------- } ------- } ------- ---- --- ------- while(1) { ------- /* Enqueue current state */ ------ int launch = 0; ------- struct taskparamdescriptor *tpd=RUNMALLOC(sizeof(struct taskparamdescriptor)); ------- tpd->task=task; ------- tpd->numParameters=numiterators+1; ------- tpd->parameterArray=RUNMALLOC(sizeof(void *)*(numiterators+1)); - for(j=0;j<=numiterators;j++) ------#ifdef OPTIONAL ------ tpd->failed=RUNMALLOC(sizeof(int)*(numiterators+1)); ------#endif --- for(j=0;j<=numiterators;j++){ ---- tpd->parameterArray[j]=taskpointerarray[j];//store the actual parameters - - for(j=0; j<=numiterators; j++){ -- for(j=0; j<=numiterators; j++) { --- tpd->parameterArray[j]=taskpointerarray[j]; //store the actual parameters ------#ifdef OPTIONAL ------ tpd->failed[j]=failed[j]; ------ if (failed[j]!=0&&failed[j]!=1) { ------ printf("BAD\n"); ------ } ------#endif ------ } ------- /* Enqueue task */ - if (!gencontains(failedtasks, tpd)&&!gencontains(activetasks,tpd)) { ------ if ((!gencontains(failedtasks, tpd)&&!gencontains(activetasks,tpd))) { ------- genputtable(activetasks, tpd, tpd); ------- } else { ------- RUNFREE(tpd->parameterArray); ------#ifdef OPTIONAL ------ RUNFREE(tpd->failed); ------#endif ------- RUNFREE(tpd); ------- } --- ---- ------- /* This loop iterates to the next parameter combination */ ------- if (numiterators==0) - return; ------ return retval; ------- ---- for(j=numiterators-1; jiterators[j], taskpointerarray)) - toiNext(¶meter->iterators[j], taskpointerarray); -- if(toiHasNext(¶meter->iterators[j], taskpointerarray OPTARG(failed))) --- for(j=numiterators-1; jiterators[j], taskpointerarray OPTARG(failed))){ -- if(toiHasNext(¶meter->iterators[j], taskpointerarray OPTARG(failed))) { ------ toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - } ---- else if (j>0) { - } else if (j>0) { -- } else if (j>0) { ------- /* Need to backtrack */ ------- toiReset(¶meter->iterators[j]); ------- j--; ------- goto backtrackinc; ------- } else { ------- /* Nothing more to enqueue */ - return; ------ return retval; ------- } ------- } ------- } ------ return retval; -------} ---- --- -------/* Handler for signals. The signals catch null pointer errors and ------- arithmatic errors. */ ------- -------void myhandler(int sig, siginfo_t *info, void *uap) { ------ sigset_t toclear; -------#ifdef DEBUG ------- printf("sig=%d\n",sig); ------- printf("signal\n"); -------#endif ------ sigemptyset(&toclear); ------ sigaddset(&toclear, sig); --- sigprocmask(SIG_UNBLOCK, &toclear,NULL); --- sigprocmask(SIG_UNBLOCK, &toclear,NULL); ------- longjmp(error_handler,1); -------} ------- -------fd_set readfds; -------int maxreadfd; -------struct RuntimeHash *fdtoobject; ------- -------void addreadfd(int fd) { ------- if (fd>=maxreadfd) ------- maxreadfd=fd+1; ------- FD_SET(fd, &readfds); -------} ------- -------void removereadfd(int fd) { ------- FD_CLR(fd, &readfds); ------- if (maxreadfd==(fd+1)) { ------- maxreadfd--; ------- while(maxreadfd>0&&!FD_ISSET(maxreadfd-1, &readfds)) ------- maxreadfd--; ------- } -------} ------- -------#ifdef PRECISE_GC -------#define OFFSET 2 -------#else -------#define OFFSET 0 ------#endif ------ ------#ifdef OPTIONAL --- int * fsescopy(int *src, int len) { --- int *dst; --- if (src==NULL) --- return NULL; --- dst=RUNMALLOC(len*sizeof(int)); --- memcpy(dst, src, len*sizeof(int)); --- return dst; --- } ---int * fsescopy(int *src, int len) { --- int *dst; --- if (src==NULL) --- return NULL; --- dst=RUNMALLOC(len*sizeof(int)); --- memcpy(dst, src, len*sizeof(int)); --- return dst; ---} -------#endif ------- -------void executetasks() { ------- void * taskpointerarray[MAXTASKPARAMS+OFFSET]; ------#ifdef OPTIONAL ------ int * fsesarray[MAXTASKPARAMS]; ------ int * oldfsesarray[MAXTASKPARAMS]; ------ int numfsesarray[MAXTASKPARAMS]; --- #endif ---#endif ------- ------- /* Set up signal handlers */ ------- struct sigaction sig; ------- sig.sa_sigaction=&myhandler; ------- sig.sa_flags=SA_SIGINFO; ------- sigemptyset(&sig.sa_mask); ------- ------- /* Catch bus errors, segmentation faults, and floating point exceptions*/ ------ sigaction(SIGBUS,&sig,0); ------ sigaction(SIGSEGV,&sig,0); ------ sigaction(SIGFPE,&sig,0); ------ sigaction(SIGPIPE,&sig,0); - if (!errors) { - sigaction(SIGBUS,&sig,0); - sigaction(SIGSEGV,&sig,0); - sigaction(SIGFPE,&sig,0); - sigaction(SIGPIPE,&sig,0); - } ------- ------- /* Zero fd set */ ------- FD_ZERO(&readfds); ------- maxreadfd=0; ------- fdtoobject=allocateRuntimeHash(100); ------- ------- /* Map first block of memory to protected, anonymous page */ ------- mmap(0, 0x1000, 0, MAP_SHARED|MAP_FIXED|MAP_ANON, -1, 0); ------- ---- newtask: ---newtask: ------- while((hashsize(activetasks)>0)||(maxreadfd>0)) { ------- ------- /* Check if any filedescriptors have IO pending */ ------- if (maxreadfd>0) { ------- int i; ------- struct timeval timeout={0,0}; ------- fd_set tmpreadfds; ------- int numselect; ------- tmpreadfds=readfds; ------- numselect=select(maxreadfd, &tmpreadfds, NULL, NULL, &timeout); ------- if (numselect>0) { ------- /* Process ready fd's */ ------- int fd; ---- for(fd=0;fd0) { ------- int i; ------- currtpd=(struct taskparamdescriptor *) getfirstkey(activetasks); ------- genfreekey(activetasks, currtpd); - --- - /* Check if this task has failed */ --- ------ /* Check if this task has failed, allow a task that contains optional objects to fire */ ------- if (gencontains(failedtasks, currtpd)) { ------- // Free up task parameter descriptor ------- RUNFREE(currtpd->parameterArray); ------#ifdef OPTIONAL ------ RUNFREE(currtpd->failed); ------#endif ------- RUNFREE(currtpd); ------- goto newtask; ------- } ------- int numparams=currtpd->task->numParameters; ------- int numtotal=currtpd->task->numTotal; - --- --- ------- /* Make sure that the parameters are still in the queues */ ---- for(i=0;iparameterArray[i]; ------- struct parameterdescriptor * pd=currtpd->task->descriptorarray[i]; ------- struct parameterwrapper *pw=(struct parameterwrapper *) pd->queue; ------- int j; ------- /* Check that object is still in queue */ - if (!RuntimeHashcontainskey(pw->objectset, (int) parameter)) { - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; ------#ifdef OPTIONAL ------ { ------ int UNUSED, UNUSED2; ------ int *flags; ------ int numflags, isnonfailed; ------ int failed=currtpd->failed[i]; ------ if (!ObjectHashget(pw->objectset, (int) parameter, &UNUSED, (int *) &flags, &numflags, &isnonfailed)) { ------ RUNFREE(currtpd->parameterArray); ------ RUNFREE(currtpd->failed); ------ RUNFREE(currtpd); ------ goto newtask; ------ } else { ------ if (failed&&(flags!=NULL)) { ------ //Failed parameter ------ fsesarray[i]=flags; ------ numfsesarray[i]=numflags; ------ } else if (!failed && isnonfailed) { ------ //Non-failed parameter ------ fsesarray[i]=NULL; ------ numfsesarray[i]=0; ------ } else { ------ RUNFREE(currtpd->parameterArray); ------ RUNFREE(currtpd->failed); ------ RUNFREE(currtpd); ------ goto newtask; ------ } ------ } ------ } ------#else ------ { ------ if (!ObjectHashcontainskey(pw->objectset, (int) parameter)) { ------ RUNFREE(currtpd->parameterArray); ------ RUNFREE(currtpd); ------ goto newtask; ------ } ------- } ------#endif --- parameterpresent: ---parameterpresent: ------ ; ------- /* Check that object still has necessary tags */ ---- for(j=0;jnumbertags;j++) { --- for(j=0; jnumbertags; j++) { ------- int slotid=pd->tagarray[2*j]+numparams; ------- struct ___TagDescriptor___ *tagd=currtpd->parameterArray[slotid]; ------- if (!containstag(parameter, tagd)) { ------- RUNFREE(currtpd->parameterArray); ------#ifdef OPTIONAL ------ RUNFREE(currtpd->failed); ------#endif ------- RUNFREE(currtpd); ------- goto newtask; ------- } ------- } ---- --- ------- taskpointerarray[i+OFFSET]=parameter; ------- } ------- /* Copy the tags */ ---- for(;iparameterArray[i]; ------- } ------- ------- { ------- /* Checkpoint the state */ ----- forward=allocateRuntimeHash(100); ----- reverse=allocateRuntimeHash(100); -- forward=cCreate(256, 0.4); -- reverse=cCreate(256, 0.4); ------- void ** checkpoint=makecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, forward, reverse); ------- int x; ------- if (x=setjmp(error_handler)) { ------ int counter; ------- /* Recover */ - int h; -------#ifdef DEBUG ------- printf("Fatal Error=%d, Recovering!\n",x); -------#endif ------- genputtable(failedtasks,currtpd,currtpd); ------- restorecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, checkpoint, forward, reverse); - /*where we have to insert the code for optional tasks - all the pointers I need are in currtpd->parameterArray */ ------ ------#ifdef OPTIONAL ---- for(counter=0; countertask->numParameters; counter++){ -- for(counter=0; countertask->numParameters; counter++) { ------ //enqueue as failed ------ enqueueoptional(currtpd->parameterArray[counter], numfsesarray[counter], fsesarray[counter], currtpd->task, counter); ------ ------ //free fses copies ------ if (fsesarray[counter]!=NULL) ------ RUNFREE(fsesarray[counter]); ------ } ------#endif ----- freeRuntimeHash(forward); ----- freeRuntimeHash(reverse); -- cDelete(forward); -- cDelete(reverse); ------- freemalloc(); ------- forward=NULL; ------- reverse=NULL; ------- } else { ------- if (injectfailures) { ------- if ((((double)random())/RAND_MAX)task->name); ------- longjmp(error_handler,10); ------- } ------- } ------- /* Actually call task */ -------#ifdef PRECISE_GC - ((int *)taskpointerarray)[0]=currtpd->task->numParameters; --- ((int *)taskpointerarray)[0]=currtpd->numParameters; - ((int *)taskpointerarray)[0]=currtpd->numParameters; - ((int *)taskpointerarray)[0]=currtpd->numParameters; - ((int *)taskpointerarray)[0]=currtpd->numParameters; ------- taskpointerarray[1]=NULL; -------#endif - - if (debugtask) { ------#ifdef OPTIONAL ------ //get the task flags set --- for(i=0;ifses; ------ fsesarray[i]=fsescopy(fsesarray[i], numfsesarray[i]); --- ((struct ___Object___ *)taskpointerarray[i+OFFSET])->fses=fsesarray[i]; --- ((struct ___Object___ *)taskpointerarray[i+OFFSET])->fses=fsesarray[i]; ------ } ------#endif ---- if(debugtask){ -- if(debugtask) { ------- printf("ENTER %s count=%d\n",currtpd->task->name, (instaccum-instructioncount)); ---- ((void (*) (void **)) currtpd->task->taskptr)(taskpointerarray); --- ((void(*) (void **))currtpd->task->taskptr)(taskpointerarray); ------- printf("EXIT %s count=%d\n",currtpd->task->name, (instaccum-instructioncount)); ------- } else ---- ((void (*) (void **)) currtpd->task->taskptr)(taskpointerarray); --- ((void(*) (void **))currtpd->task->taskptr)(taskpointerarray); ------ ------#ifdef OPTIONAL --- for(i=0;iparameterArray); ------#ifdef OPTIONAL ------ RUNFREE(currtpd->failed); ------#endif ------- RUNFREE(currtpd); ------- forward=NULL; ------- reverse=NULL; ------- } ------- } ------- } ------- } -------} - --- --- -------/* This function processes an objects tags */ -------void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams) { ------- int i; - --- --- ---- for(i=0;inumbertags;i++) { --- for(i=0; inumbertags; i++) { ------- int slotid=pd->tagarray[2*i]; ------- int tagid=pd->tagarray[2*i+1]; ---- --- ------- if (statusarray[slotid+numparams]==0) { ------- parameter->iterators[*iteratorcount].istag=1; ------- parameter->iterators[*iteratorcount].tagid=tagid; ------- parameter->iterators[*iteratorcount].slot=slotid+numparams; ------- parameter->iterators[*iteratorcount].tagobjectslot=index; ------- statusarray[slotid+numparams]=1; ------- (*iteratorcount)++; ------- } ------- } -------} ------- ------- -------void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams) { ------- int i; ------- int tagcount=0; - struct RuntimeHash * objectset=((struct parameterwrapper *)pd->queue)->objectset; ------ struct ObjectHash * objectset=((struct parameterwrapper *)pd->queue)->objectset; ------- ------- parameter->iterators[*iteratorcount].istag=0; ------- parameter->iterators[*iteratorcount].slot=index; ------- parameter->iterators[*iteratorcount].objectset=objectset; ------- statusarray[index]=1; ------- ---- for(i=0;inumbertags;i++) { --- for(i=0; inumbertags; i++) { ------- int slotid=pd->tagarray[2*i]; ------- int tagid=pd->tagarray[2*i+1]; ------- if (statusarray[slotid+numparams]!=0) { ------- /* This tag has already been enqueued, use it to narrow search */ ------- parameter->iterators[*iteratorcount].tagbindings[tagcount]=slotid+numparams; ------- tagcount++; ------- } ------- } ------- parameter->iterators[*iteratorcount].numtags=tagcount; ------- ------- (*iteratorcount)++; -------} ------- -------/* This function builds the iterators for a task & parameter */ ------- -------void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter) { ------- int statusarray[MAXTASKPARAMS]; ------- int i; ------- int numparams=task->numParameters; ------- int iteratorcount=0; ---- for(i=0;idescriptorarray[index], index, parameter, & iteratorcount, statusarray, numparams); ---- --- --- processtags(task->descriptorarray[index], index, parameter, &iteratorcount, statusarray, numparams); --- ------- while(1) { ---- loopstart: ---loopstart: ------- /* Check for objects with existing tags */ ---- for(i=0;idescriptorarray[i]; ------- int j; ---- for(j=0;jnumbertags;j++) { --- for(j=0; jnumbertags; j++) { ------- int slotid=pd->tagarray[2*j]; ------- if(statusarray[slotid+numparams]!=0) { ------- processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); ------- processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); ------- goto loopstart; ------- } ------- } ------- } ------- } ------- ------- /* Next do objects w/ unbound tags*/ ------- ---- for(i=0;idescriptorarray[i]; ------- if (pd->numbertags>0) { ------- processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); ------- processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); ------- goto loopstart; ------- } ------- } ------- } ------- ------- /* Nothing with a tag enqueued */ ------- ---- for(i=0;idescriptorarray[i]; ------- processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); ------- processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); ------- goto loopstart; ------- } ------- } ------- ------- /* Nothing left */ ------- return; ------- } -------} - ------- --- void printdebug() { --- int i; --- int j; --- for(i=0;iname); --- for(j=0;jnumParameters;j++) { --- struct parameterdescriptor *param=task->descriptorarray[j]; --- struct parameterwrapper *parameter=param->queue; --- struct ObjectHash * set=parameter->objectset; --- struct ObjectIterator objit; --- printf(" Parameter %d\n", j); --- ObjectHashiterator(set, &objit); --- while(ObjhasNext(&objit)) { --- struct ___Object___ * obj=(struct ___Object___ *)Objkey(&objit); --- struct ___Object___ * tagptr=obj->___tags___; --- int nonfailed=Objdata4(&objit); --- int numflags=Objdata3(&objit); --- int flags=Objdata2(&objit); --- Objnext(&objit); --- printf(" Contains %lx\n", obj); --- printf(" flag=%d\n", obj->flag); ---void printdebug() { --- int i; --- int j; --- for(i=0; iname); --- for(j=0; jnumParameters; j++) { --- struct parameterdescriptor *param=task->descriptorarray[j]; --- struct parameterwrapper *parameter=param->queue; --- struct ObjectHash * set=parameter->objectset; --- struct ObjectIterator objit; --- printf(" Parameter %d\n", j); --- ObjectHashiterator(set, &objit); --- while(ObjhasNext(&objit)) { --- struct ___Object___ * obj=(struct ___Object___ *)Objkey(&objit); --- struct ___Object___ * tagptr=obj->___tags___; --- int nonfailed=Objdata4(&objit); --- int numflags=Objdata3(&objit); --- int flags=Objdata2(&objit); --- Objnext(&objit); --- printf(" Contains %lx\n", obj); --- printf(" flag=%d\n", obj->flag); ------#ifdef OPTIONAL --- printf(" flagsstored=%x\n",flags); --- printf(" numflags=%d\n", numflags); --- printf(" nonfailed=%d\n",nonfailed); --- printf(" flagsstored=%x\n",flags); --- printf(" numflags=%d\n", numflags); --- printf(" nonfailed=%d\n",nonfailed); ------#endif --- if (tagptr==NULL) { --- } else if (tagptr->type==TAGTYPE) { --- printf(" tag=%lx\n",tagptr); --- } else { --- int tagindex=0; --- struct ArrayObject *ao=(struct ArrayObject *)tagptr; --- for(;tagindex___cachedCode___;tagindex++) { --- printf(" tag=%lx\n",ARRAYGET(ao, struct ___TagDescriptor___*, tagindex)); --- } --- } --- } --- } --- } --- } ---- --- if (tagptr==NULL) { --- } else if (tagptr->type==TAGTYPE) { --- printf(" tag=%lx\n",tagptr); --- } else { --- int tagindex=0; --- struct ArrayObject *ao=(struct ArrayObject *)tagptr; --- for(; tagindex___cachedCode___; tagindex++) { --- printf(" tag=%lx\n",ARRAYGET(ao, struct ___TagDescriptor___*, tagindex)); --- } --- } --- } --- } --- } ---} --- ------- -------/* This function processes the task information to create queues for ------- each parameter type. */ ------- -------void processtasks() { ------- int i; ---- for(i=0;inumParameters;j++) { --- for(j=0; jnumParameters; j++) { ------- struct parameterdescriptor *param=task->descriptorarray[j]; ------- struct parameterwrapper * parameter=RUNMALLOC(sizeof(struct parameterwrapper)); ------- struct parameterwrapper ** ptr=&objectqueues[param->type]; ------- ------- param->queue=parameter; - parameter->objectset=allocateRuntimeHash(10); ------ parameter->objectset=allocateObjectHash(10); ------- parameter->numberofterms=param->numberterms; ------- parameter->intarray=param->intarray; ------- parameter->numbertags=param->numbertags; ------- parameter->tagarray=param->tagarray; ------- parameter->task=task; - parameter->slot=j; --- parameter->slot=j; ------- /* Link new queue in */ ------- while((*ptr)!=NULL) ------- ptr=&((*ptr)->next); ------- (*ptr)=parameter; ------- } ------- ------- /* Build iterators for parameters */ ---- for(j=0;jnumParameters;j++) { --- for(j=0; jnumParameters; j++) { ------- struct parameterdescriptor *param=task->descriptorarray[j]; --- struct parameterwrapper *parameter=param->queue; --- parameter->slot=j; ---- struct parameterwrapper *parameter=param->queue; ------- builditerators(task, j, parameter); ------- } ------- } -------} ------- -------void toiReset(struct tagobjectiterator * it) { ------- if (it->istag) { ------- it->tagobjindex=0; ------- } else if (it->numtags>0) { ------- it->tagobjindex=0; ------#ifdef OPTIONAL ------ it->failedstate=0; ------#endif ------- } else { - RuntimeHashiterator(it->objectset, &it->it); ------ ObjectHashiterator(it->objectset, &it->it); ------#ifdef OPTIONAL ------ it->failedstate=0; ------#endif ------- } -------} ------- - int toiHasNext(struct tagobjectiterator *it, void ** objectarray) { ------int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)) { ------- if (it->istag) { ------- /* Iterate tag */ ------- /* Get object with tags */ ------- struct ___Object___ *obj=objectarray[it->tagobjectslot]; ------- struct ___Object___ *tagptr=obj->___tags___; ------- if (tagptr->type==TAGTYPE) { ------- if ((it->tagobjindex==0)&& /* First object */ ---- (it->tagid==((struct ___TagDescriptor___ *)tagptr)->flag)) /* Right tag type */ --- (it->tagid==((struct ___TagDescriptor___ *)tagptr)->flag)) /* Right tag type */ ------- return 1; ------- else ------- return 0; ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) tagptr; ------- int tagindex=it->tagobjindex; ---- for(;tagindex___cachedCode___;tagindex++) { --- for(; tagindex___cachedCode___; tagindex++) { ------- struct ___TagDescriptor___ *td=ARRAYGET(ao, struct ___TagDescriptor___ *, tagindex); ------- if (td->flag==it->tagid) { ------- it->tagobjindex=tagindex; /* Found right type of tag */ ------- return 1; ------- } ------- } ------- return 0; ------- } ------- } else if (it->numtags>0) { ------- /* Use tags to locate appropriate objects */ ------- struct ___TagDescriptor___ *tag=objectarray[it->tagbindings[0]]; ------- struct ___Object___ *objptr=tag->flagptr; ------- int i; ------- if (objptr->type!=OBJECTARRAYTYPE) { ------- if (it->tagobjindex>0) ------- return 0; - if (!RuntimeHashcontainskey(it->objectset, (int) objptr)) ------ if (!ObjectHashcontainskey(it->objectset, (int) objptr)) ------- return 0; ---- for(i=1;inumtags;i++) { --- for(i=1; inumtags; i++) { ------- struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]]; ------- if (!containstag(objptr,tag2)) ------ return 0; ------ } ------#ifdef OPTIONAL ------ if (it->failedstate==1) { ------ int UNUSED, UNUSED2; ------ int * flags; ------ int isnonfailed; ------ ObjectHashget(it->objectset, (int) objptr, &UNUSED, (int *) &flags, &UNUSED2, &isnonfailed); ------ if (flags!=NULL) { ------ return 1; ------ } else { ------ it->tagobjindex++; ------ it->failedstate=0; ------- return 0; ------ } ------ } else { ------ int UNUSED, UNUSED2; ------ int * flags; ------ int isnonfailed; ------ ObjectHashget(it->objectset, (int) objptr, &UNUSED, (int *) &flags, &UNUSED2, &isnonfailed); ------ if (!isnonfailed) { ------ it->failedstate=1; ------ } ------ return 1; ------- } --- #endif ---#endif ------- return 1; ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) objptr; ------- int tagindex; ------- int i; ------#ifdef OPTIONAL ------ if (it->failedstate==1) { ------ int UNUSED, UNUSED2; ------ int * flags; ------ int isnonfailed; ------ struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, it->tagobjindex); ------ ObjectHashget(it->objectset, (int) objptr, &UNUSED, (int *) &flags, &UNUSED2, &isnonfailed); ------ if (flags!=NULL) { ------ return 1; ------ } else { ------ it->failedstate=0; ------ it->tagobjindex++; ------ } ------ } ------#endif ---- for(tagindex=it->tagobjindex;tagindex___cachedCode___;tagindex++) { --- for(tagindex=it->tagobjindex; tagindex___cachedCode___; tagindex++) { ------- struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, tagindex); - if (!RuntimeHashcontainskey(it->objectset, (int) objptr)) ------ if (!ObjectHashcontainskey(it->objectset, (int) objptr)) ------- continue; ---- for(i=1;inumtags;i++) { --- for(i=1; inumtags; i++) { ------- struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]]; ------- if (!containstag(objptr,tag2)) ------- goto nexttag; ------ } ------#ifdef OPTIONAL ------ { ------ int UNUSED, UNUSED2; ------ int flags, isnonfailed; ------ struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, tagindex); ------ ObjectHashget(it->objectset, (int) objptr, &UNUSED, &flags, &UNUSED2, &isnonfailed); ------ if (!isnonfailed) { ------ it->failedstate=1; ------ } ------- } ------#endif ------ it->tagobjindex=tagindex; ------- return 1; ---- nexttag: ---nexttag: ------- ; ------- } ------- it->tagobjindex=tagindex; ------- return 0; ------- } ------- } else { - return RunhasNext(&it->it); ------#ifdef OPTIONAL ------ if (it->failedstate==1) { ------ if (Objdata2(&it->it)) ------ return 1; ------ else { ------ it->failedstate=0; ------ Objnext(&it->it); ------ } ------ } ------ if (ObjhasNext(&it->it)) { ------ if (!Objdata4(&it->it)) { ------ //failed state only ------ it->failedstate=1; ------ } ------ return 1; ------ } else ------ return 0; ------#else ------ return ObjhasNext(&it->it); ------#endif ------- } -------} ------- -------int containstag(struct ___Object___ *ptr, struct ___TagDescriptor___ *tag) { ------- int j; ------- struct ___Object___ * objptr=tag->flagptr; ------- if (objptr->type==OBJECTARRAYTYPE) { ------- struct ArrayObject *ao=(struct ArrayObject *)objptr; ---- for(j=0;j___cachedCode___;j++) { --- for(j=0; j___cachedCode___; j++) { ------- if (ptr==ARRAYGET(ao, struct ___Object___*, j)) ------- return 1; ------- } ------- return 0; ------- } else ------- return objptr==ptr; -------} ------- - void toiNext(struct tagobjectiterator *it , void ** objectarray) { --- void toiNext(struct tagobjectiterator *it , void ** objectarray OPTARG(int * failed)) { ---void toiNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)) { ------- /* hasNext has all of the intelligence */ ------- if(it->istag) { ------- /* Iterate tag */ ------- /* Get object with tags */ ------- struct ___Object___ *obj=objectarray[it->tagobjectslot]; ------- struct ___Object___ *tagptr=obj->___tags___; ------#ifdef OPTIONAL ------ failed[it->slot]=0; //have to set it to something ------#endif ------- if (tagptr->type==TAGTYPE) { ------- it->tagobjindex++; ------- objectarray[it->slot]=tagptr; ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) tagptr; ------- objectarray[it->slot]=ARRAYGET(ao, struct ___TagDescriptor___ *, it->tagobjindex++); ------- } ------- } else if (it->numtags>0) { ------- /* Use tags to locate appropriate objects */ ------- struct ___TagDescriptor___ *tag=objectarray[it->tagbindings[0]]; ------- struct ___Object___ *objptr=tag->flagptr; ------- if (objptr->type!=OBJECTARRAYTYPE) { ------#ifdef OPTIONAL --- failed[it->slot]=it->failedstate; --- objectarray[it->slot]=objptr; --- if (it->failedstate==0) { --- it->failedstate=1; --- } else { --- it->failedstate=0; --- it->tagobjindex++; --- } --- failed[it->slot]=it->failedstate; --- objectarray[it->slot]=objptr; --- if (it->failedstate==0) { --- it->failedstate=1; --- } else { --- it->failedstate=0; --- it->tagobjindex++; --- } ------#else ------- it->tagobjindex++; ------- objectarray[it->slot]=objptr; ------#endif ------- } else { ------- struct ArrayObject *ao=(struct ArrayObject *) objptr; ------#ifdef OPTIONAL --- failed[it->slot]=it->failedstate; --- objectarray[it->slot]=ARRAYGET(ao, struct ___Object___ *, it->tagobjindex); --- if (it->failedstate==0) { --- it->failedstate=1; --- } else { --- it->failedstate=0; --- it->tagobjindex++; --- } --- failed[it->slot]=it->failedstate; --- objectarray[it->slot]=ARRAYGET(ao, struct ___Object___ *, it->tagobjindex); --- if (it->failedstate==0) { --- it->failedstate=1; --- } else { --- it->failedstate=0; --- it->tagobjindex++; --- } ------#else ------- objectarray[it->slot]=ARRAYGET(ao, struct ___Object___ *, it->tagobjindex++); ------#endif ------- } ------- } else { ------- /* Iterate object */ - objectarray[it->slot]=(void *)Runkey(&it->it); - Runnext(&it->it); -- objectarray[it->slot]=(void *)Objkey(&it->it); - void * tmpp = (void *) Objkey(&it->it); --- void * tmpp = (void *) Objkey(&it->it); ---- objectarray[it->slot]=tmpp; ------#ifdef OPTIONAL ------ failed[it->slot]=it->failedstate; ------ if (it->failedstate==0) { ------ it->failedstate=1; ------ } else { ------ it->failedstate=0; ------ Objnext(&it->it); ------ } ------#else ------ Objnext(&it->it); ------#endif ------- } -------} - - -------#endif diff --cc Robust/src/Runtime/thread.c index a8b19c02,5523426a,4dc88de3,f7855d71,83b0746e,83b0746e,83b0746e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/thread.c +++ /dev/null @@@@@@@@ -1,114 -1,259 -1,268 -1,302 -1,302 -1,302 -1,302 +1,0 @@@@@@@@ -------#include "runtime.h" -------#include -------#include -------#include -------#include -------#include "thread.h" -------#include "option.h" -------#include ------#include ------#include ------- ----#ifndef RAW -------#include ----#endif -------int threadcount; -------pthread_mutex_t gclock; -------pthread_mutex_t gclistlock; -------pthread_cond_t gccond; -------pthread_mutex_t objlock; -------pthread_cond_t objcond; ---- ----pthread_mutex_t joinlock; ----pthread_cond_t joincond; -------pthread_key_t threadlocks; ------pthread_mutex_t threadnotifylock; ------pthread_cond_t threadnotifycond; - transrecord_t * trans; - pthread_key_t oid; -----pthread_key_t oidval; ------- -------void threadexit() { ------ objheader_t* ptr; ------ void *value; ----- transrecord_t * trans; ------ unsigned int oidvalue; ------ ------#ifdef THREADS ------- struct ___Object___ *ll=pthread_getspecific(threadlocks); ------- while(ll!=NULL) { ---- struct ___Object___ *llnext=ll->___nextlockobject___; --- struct ___Object___ *llnext=ll->___nextlockobject___; ------- ll->___nextlockobject___=NULL; ------- ll->___prevlockobject___=NULL; ------- ll->lockcount=0; ------- ll->tid=0; //unlock it ------- ll=llnext; ------- } ---- pthread_mutex_lock(&objlock);//wake everyone up --- pthread_mutex_lock(&objlock); //wake everyone up ------- pthread_cond_broadcast(&objcond); ------- pthread_mutex_unlock(&objlock); ------#endif ------- pthread_mutex_lock(&gclistlock); ------- threadcount--; ------- pthread_cond_signal(&gccond); ------- pthread_mutex_unlock(&gclistlock); ------#ifdef DSTM ------ /* Add transaction to check if thread finished for join operation */ - value = pthread_getspecific(oid); ----- value = pthread_getspecific(oidval); ------ oidvalue = *((unsigned int *)value); ------ goto transstart; ------transstart: - trans = transStart(); - ptr = transRead(trans, oidvalue); - struct ___Thread___ *p = (struct ___Thread___ *) ptr; - p->___threadDone___ = 1; - if(transCommit(trans) != 0) { - transAbort(trans); - goto transstart; ----- { ----- transrecord_t * trans = transStart(); ----- ptr = transRead(trans, oidvalue); ----- struct ___Thread___ *p = (struct ___Thread___ *) ptr; ----- p->___threadDone___ = 1; ----- *((unsigned int *)&((struct ___Object___ *) p)->___localcopy___) |=DIRTY; ----- if(transCommit(trans) != 0) { ----- goto transstart; ----- } ------ } --- #endif ---#endif ------- pthread_exit(NULL); -------} ------- -------void threadhandler(int sig, siginfo_t *info, void *uap) { -------#ifdef DEBUG ------- printf("sig=%d\n",sig); ------- printf("signal\n"); -------#endif ------- threadexit(); -------} ------- -------void initializethreads() { ------- struct sigaction sig; ------- threadcount=1; ------- pthread_mutex_init(&gclock, NULL); ------- pthread_mutex_init(&gclistlock, NULL); ------- pthread_cond_init(&gccond, NULL); ------- pthread_mutex_init(&objlock,NULL); ------- pthread_cond_init(&objcond,NULL); ---- pthread_mutex_init(&joinlock,NULL); ---- pthread_cond_init(&joincond,NULL); ------- pthread_key_create(&threadlocks, NULL); ------- processOptions(); ------- initializeexithandler(); ------- ------- sig.sa_sigaction=&threadhandler; ------- sig.sa_flags=SA_SIGINFO; ------- sigemptyset(&sig.sa_mask); ------- ------- /* Catch bus errors, segmentation faults, and floating point exceptions*/ ------- sigaction(SIGBUS,&sig,0); ------- sigaction(SIGSEGV,&sig,0); ------- sigaction(SIGFPE,&sig,0); ------ signal(SIGPIPE, SIG_IGN); -------} ------- ------#ifdef THREADS -------void initthread(struct ___Thread___ * ___this___) { -------#ifdef PRECISE_GC --- struct ___Thread______staticStart____L___Thread____params p={1, NULL, ___this___}; --- ___Thread______staticStart____L___Thread___(&p); ---- int p[]={1, (int) NULL, (int) ___this___}; ---- ___Thread______staticStart____L___Thread___((struct ___Thread______staticStart____L___Thread____params *)p); ---- ___this___=(struct ___Thread___ *) p[2]; -------#else ------- ___Thread______staticStart____L___Thread___(___this___); -------#endif ---- ___this___->___finished___=1; ---- pthread_mutex_lock(&joinlock); ---- pthread_cond_signal(&joincond); ---- pthread_mutex_unlock(&joinlock); ---- ------- pthread_mutex_lock(&gclistlock); ------- threadcount--; ------- pthread_cond_signal(&gccond); ------- pthread_mutex_unlock(&gclistlock); -------} ------#endif ------- -------void CALL11(___Thread______sleep____J, long long ___millis___, long long ___millis___) { -------#ifdef THREADS -------#ifdef PRECISE_GC ------- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -------#endif -------#endif ---- usleep(___millis___); --- usleep(___millis___); -------#ifdef THREADS -------#ifdef PRECISE_GC ------- restartaftergc(tmp); ------#endif -------#endif ----} ---- ----#if defined(DSTM)|| defined(THREADS) ----void CALL00(___Thread______yield____) { ---- pthread_yield(); ------} ----#endif ------ -----#ifdef DSTM ------/* Add thread join capability */ ------void CALL01(___Thread______join____, struct ___Thread___ * ___this___) { - printf("DEBUG -> Inside thread join\n"); - #ifdef DSTM - pthread_t thread; ------ unsigned int *oidarray; ------ unsigned short *versionarray, version; ------ transrecord_t *trans; ------ objheader_t *ptr; ------ /* Add transaction to check if thread finished for join operation */ ----- goto transstart; ------transstart: ------ trans = transStart(); ------ ptr = transRead(trans, (unsigned int) VAR(___this___)); ------ struct ___Thread___ *p = (struct ___Thread___ *) ptr; ----#ifdef THREADJOINDEBUG ---- printf("Start join process for Oid = %x\n", (unsigned int) VAR(___this___)); ----#endif ------ if(p->___threadDone___ == 1) { ----#ifdef THREADJOINDEBUG ---- printf("Thread oid = %x is done\n", (unsigned int) VAR(___this___)); ----#endif --- transAbort(trans); --- return; --- transAbort(trans); --- return; ------ } else { ---- --- version = (ptr-1)->version; --- if((oidarray = calloc(1, sizeof(unsigned int))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return; --- } --- version = (ptr-1)->version; --- if((oidarray = calloc(1, sizeof(unsigned int))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- return; --- } ------ --- oidarray[0] = (unsigned int) VAR(___this___); --- oidarray[0] = (unsigned int) VAR(___this___); ------ --- if((versionarray = calloc(1, sizeof(unsigned short))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- free(oidarray); --- return; --- } --- versionarray[0] = version; --- /* Request Notification */ --- if((versionarray = calloc(1, sizeof(unsigned short))) == NULL) { --- printf("Calloc error %s, %d\n", __FILE__, __LINE__); --- free(oidarray); --- return; --- } --- versionarray[0] = version; --- /* Request Notification */ -----#ifdef PRECISE_GC -- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); --- struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -----#endif --- reqNotify(oidarray, versionarray, 1); --- reqNotify(oidarray, versionarray, 1); -----#ifdef PRECISE_GC -- restartaftergc(tmp); --- restartaftergc(tmp); -----#endif --- free(oidarray); --- free(versionarray); --- transAbort(trans); --- goto transstart; --- free(oidarray); --- free(versionarray); --- transAbort(trans); --- goto transstart; ------ } ------ return; -- #endif -------} -----#endif ------- ------#ifdef THREADS ----void CALL01(___Thread______nativeJoin____, struct ___Thread___ * ___this___) { ---- pthread_mutex_lock(&joinlock); ---- while(!VAR(___this___)->___finished___) ---- pthread_cond_wait(&joincond, &joinlock); - pthread_mutex_unlock(&joinlock); --- pthread_mutex_unlock(&joinlock); ----} ---- -------void CALL01(___Thread______nativeCreate____, struct ___Thread___ * ___this___) { ------- pthread_t thread; ------- int retval; ------- pthread_attr_t nattr; ------- ------- pthread_mutex_lock(&gclistlock); ------- threadcount++; ------- pthread_mutex_unlock(&gclistlock); ------- pthread_attr_init(&nattr); ------- pthread_attr_setdetachstate(&nattr, PTHREAD_CREATE_DETACHED); ---- --- ------- do { ------- retval=pthread_create(&thread, &nattr, (void * (*)(void *)) &initthread, VAR(___this___)); ------ if (retval!=0) ------ usleep(1); ------ } while(retval!=0); ---- /* This next statement will likely not work on many machines */ ------ ------ pthread_attr_destroy(&nattr); ------} ------#endif ------ ------#ifdef DSTM ------void CALL12(___Thread______start____I, int ___mid___, struct ___Thread___ * ___this___, int ___mid___) { ------ startRemoteThread((unsigned int)VAR(___this___), ___mid___); ------} ------#endif ------ ------#ifdef DSTM ------void globalDestructor(void *value) { --- free(value); - pthread_setspecific(oid, NULL); -- pthread_setspecific(oidval, NULL); --- free(value); --- pthread_setspecific(oidval, NULL); ------} ------ ------void initDSMthread(int *ptr) { --- objheader_t *tmp; --- objheader_t *tmp; ----- transrecord_t * trans; ------ void *threadData; ------ int oid=ptr[0]; ------ int type=ptr[1]; ------ free(ptr); ------#ifdef PRECISE_GC ------ int p[]={1, 0 /* NULL */, oid}; --- ((void (*)(void *))virtualtable[type*MAXCOUNT+RUNMETHOD])(p); --- ((void(*) (void *))virtualtable[type*MAXCOUNT+RUNMETHOD])(p); ------#else --- ((void (*)(void *))virtualtable[type*MAXCOUNT+RUNMETHOD])(oid); --- ((void(*) (void *))virtualtable[type*MAXCOUNT+RUNMETHOD])(oid); ------#endif ------ threadData = calloc(1, sizeof(unsigned int)); ------ *((unsigned int *) threadData) = oid; - pthread_setspecific(oid, threadData); ----- pthread_setspecific(oidval, threadData); ------ pthread_mutex_lock(&gclistlock); ------ threadcount--; ------ pthread_cond_signal(&gccond); ------ pthread_mutex_unlock(&gclistlock); ------ /* Add transaction to check if thread finished for join operation */ ------ goto transstart; ------transstart: - trans = transStart(); - tmp = transRead(trans, (unsigned int) oid); - struct ___Thread___ *t = (struct ___Thread___ *) tmp; - t->___threadDone___ = 1; - if(transCommit(trans)!= 0) { - transAbort(trans); - goto transstart; ----- { ----- transrecord_t * trans = transStart(); ----- tmp = transRead(trans, (unsigned int) oid); ----- ((struct ___Thread___ *)tmp)->___threadDone___ = 1; ----- *((unsigned int *)&((struct ___Object___ *) tmp)->___localcopy___) |=DIRTY; ----- if(transCommit(trans)!= 0) { ----- goto transstart; ----- } ------ } ------ pthread_exit(NULL); ------} ------ ------void startDSMthread(int oid, int objType) { - --- pthread_t thread; - --- int retval; - --- pthread_attr_t nattr; -- pthread_t thread; -- int retval; -- pthread_attr_t nattr; ------ - --- pthread_mutex_lock(&gclistlock); - --- threadcount++; - --- pthread_mutex_unlock(&gclistlock); -- pthread_mutex_lock(&gclistlock); -- threadcount++; -- pthread_mutex_unlock(&gclistlock); ------ pthread_attr_init(&nattr); ------ pthread_attr_setdetachstate(&nattr, PTHREAD_CREATE_DETACHED); ------ int * ptr=malloc(sizeof(int)*2); ------ ptr[0]=oid; ------ ptr[1]=objType; - pthread_key_create(&oid, globalDestructor); ----- pthread_key_create(&oidval, globalDestructor); ------ do { ------ retval=pthread_create(&thread, &nattr, (void * (*)(void *)) &initDSMthread, ptr); ------- if (retval!=0) ------- usleep(1); ------- } while(retval!=0); ------- ------- pthread_attr_destroy(&nattr); -------} ------ ------#endif diff --cc Robust/src/Runtime/thread.h index 5bb5d19c,e5388ab5,e5388ab5,e5388ab5,e5388ab5,e5388ab5,e5388ab5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Runtime/thread.h +++ /dev/null @@@@@@@@ -1,20 -1,27 -1,27 -1,27 -1,27 -1,27 -1,27 +1,0 @@@@@@@@ -------#ifndef THREAD_H -------#define THREAD_H -------#include "methodheaders.h" -------#include ------- -------extern int threadcount; -------extern pthread_mutex_t gclock; -------extern pthread_mutex_t gclistlock; -------extern pthread_cond_t gccond; -------extern pthread_mutex_t objlock; -------extern pthread_cond_t objcond; -------extern pthread_key_t threadlocks; ------#ifdef THREADS -------void initthread(struct ___Thread___ * ___this___); ------#endif ------#ifdef DSTM ------void initDSMthread(int *ptr); ------void startDSMthread(int oid, int objType); ------extern void * virtualtable[]; ------#endif ------- -------struct locklist { ------- struct locklist * next; ------- struct locklist * prev; ------- struct ___Object___ * object; -------}; -------#endif diff --cc Robust/src/Tests/Array.java index 28b32f3e,28b32f3e,28b32f3e,28b32f3e,28b32f3e,28b32f3e,28b32f3e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/Array.java +++ /dev/null @@@@@@@@ -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 -1,12 +1,0 @@@@@@@@ -------public class Array { ------- int a; ------- public static void main(String[] st) { ------- int a[]=new int[10]; ------- int i=2; ------- a[i]=4; ------- System.printInt(a[2]); ------- System.printString("\n"); ------- System.printInt(a.length); ------- System.printString("\n"); ------- } -------} diff --cc Robust/src/Tests/Array2.java index f7b69d47,f7b69d47,f7b69d47,f7b69d47,f7b69d47,f7b69d47,f7b69d47..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/Array2.java +++ /dev/null @@@@@@@@ -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 -1,19 +1,0 @@@@@@@@ -------public class Array2 { ------- int a; ------- public static void main(String str[]) { ------- int a[][]=new int[10][20]; ------- for(int i=0;i<10;i++) { ------- for(int j=0;j<20;j++) { ------- a[i][j]=i*100+j; ------- } ------- } ------- ------- for(int i=0;i<10;i++) { ------- for(int j=0;j<20;j++) { ------- System.printInt(a[i][j]); ------- System.printString(" "); ------- } ------- System.printString("\n"); ------- } ------- } -------} diff --cc Robust/src/Tests/BoundsFail.java index 6aff4f2a,6aff4f2a,6aff4f2a,6aff4f2a,6aff4f2a,6aff4f2a,6aff4f2a..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/BoundsFail.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------public class BoundsFail { ------- int a; ------- public static void main(String str[]) { ------- int a[]=new int[10]; ------- a[-1]=2; ------- } -------} diff --cc Robust/src/Tests/BoundsFail2.java index abe327ca,abe327ca,abe327ca,abe327ca,abe327ca,abe327ca,abe327ca..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/BoundsFail2.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------public class BoundsFail2 { ------- int a; ------- public static void main(String str[]) { ------- int a[]=new int[10]; ------- a[10]=2; ------- } -------} diff --cc Robust/src/Tests/BoundsFail3.java index c6949e2f,c6949e2f,c6949e2f,c6949e2f,c6949e2f,c6949e2f,c6949e2f..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/BoundsFail3.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------public class BoundsFail3 { ------- int a; ------- public static void main(String str[]) { ------- int a[]=new int[10]; ------- int b=a[-1]; ------- } -------} diff --cc Robust/src/Tests/BoundsFail4.java index 3eae8e26,3eae8e26,3eae8e26,3eae8e26,3eae8e26,3eae8e26,3eae8e26..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/BoundsFail4.java +++ /dev/null @@@@@@@@ -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 -1,7 +1,0 @@@@@@@@ -------public class BoundsFail4 { ------- int a; ------- public static void main(String str[]) { ------- int a[]=new int[10]; ------- int b=a[10]; ------- } -------} diff --cc Robust/src/Tests/CommandLineTest.java index b828b76e,b828b76e,b828b76e,b828b76e,b828b76e,b828b76e,b828b76e..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/CommandLineTest.java +++ /dev/null @@@@@@@@ -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 -1,8 +1,0 @@@@@@@@ -------class CommandLineTest { ------- public static void main(String str[]) { ------- for(int i=0;i/dev/null -../buildscript -robustroot ${dir}/../ -mainclass $ARG1 $ARG2 -o $ARG1 &>/dev/null -------$ARG1.bin $@ &> output/$ARG1.output -------diff output/$ARG1.output output/$ARG1.output.goal -------rm $ARG1.bin diff --cc Robust/src/Tests/output/Array.output.goal index e2a306d0,e2a306d0,e2a306d0,e2a306d0,e2a306d0,e2a306d0,e2a306d0..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/Array.output.goal +++ /dev/null @@@@@@@@ -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 +1,0 @@@@@@@@ -------4 -------10 diff --cc Robust/src/Tests/output/Array2.output.goal index 3ddbfa74,3ddbfa74,3ddbfa74,3ddbfa74,3ddbfa74,3ddbfa74,3ddbfa74..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/Array2.output.goal +++ /dev/null @@@@@@@@ -1,10 -1,10 -1,10 -1,10 -1,10 -1,10 -1,10 +1,0 @@@@@@@@ -------0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -------100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 -------200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 -------300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 -------400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 -------500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 -------600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 -------700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 -------800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 -------900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 diff --cc Robust/src/Tests/output/BoundsFail.output.goal index 693b0912,693b0912,693b0912,693b0912,693b0912,693b0912,693b0912..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/BoundsFail.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------Array out of bounds diff --cc Robust/src/Tests/output/BoundsFail2.output.goal index 693b0912,693b0912,693b0912,693b0912,693b0912,693b0912,693b0912..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/BoundsFail2.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------Array out of bounds diff --cc Robust/src/Tests/output/BoundsFail3.output.goal index 693b0912,693b0912,693b0912,693b0912,693b0912,693b0912,693b0912..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/BoundsFail3.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------Array out of bounds diff --cc Robust/src/Tests/output/BoundsFail4.output.goal index 693b0912,693b0912,693b0912,693b0912,693b0912,693b0912,693b0912..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/BoundsFail4.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------Array out of bounds diff --cc Robust/src/Tests/output/CommandLineTest.output.goal index d0e08a8d,d0e08a8d,d0e08a8d,d0e08a8d,d0e08a8d,d0e08a8d,d0e08a8d..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/CommandLineTest.output.goal +++ /dev/null @@@@@@@@ -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 +1,0 @@@@@@@@ -------hello -------hi diff --cc Robust/src/Tests/output/FileLength.output.goal index f11c82a4,f11c82a4,f11c82a4,f11c82a4,f11c82a4,f11c82a4,f11c82a4..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/FileLength.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------9 diff --cc Robust/src/Tests/output/IncTest.output.goal index 22769ee9,22769ee9,22769ee9,22769ee9,22769ee9,22769ee9,22769ee9..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/IncTest.output.goal +++ /dev/null @@@@@@@@ -1,41 -1,41 -1,41 -1,41 -1,41 -1,41 -1,41 +1,0 @@@@@@@@ -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------0 -------0 -------0 -------0 -------0 -------0 -------0 -------0 -------0 -------0 ----------------------- -------0 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------1 -------0 -------0 -------0 -------0 -------0 -------0 -------0 -------0 -------0 diff --cc Robust/src/Tests/output/IntegerTest.output.goal index 101e0aec,101e0aec,101e0aec,101e0aec,101e0aec,101e0aec,101e0aec..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/IntegerTest.output.goal +++ /dev/null @@@@@@@@ -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 -1,2 +1,0 @@@@@@@@ -------312 --------34 diff --cc Robust/src/Tests/output/ReadFile.output.goal index 107d5f91,107d5f91,107d5f91,107d5f91,107d5f91,107d5f91,107d5f91..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/ReadFile.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------adsasdasd diff --cc Robust/src/Tests/output/StringBufferTest.output.goal index 2df7ebc3,2df7ebc3,2df7ebc3,2df7ebc3,2df7ebc3,2df7ebc3,2df7ebc3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/StringBufferTest.output.goal +++ /dev/null @@@@@@@@ -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 -1,1 +1,0 @@@@@@@@ -------hello worldhello world diff --cc Robust/src/Tests/output/StringTest.output.goal index 39ff83e3,39ff83e3,39ff83e3,39ff83e3,39ff83e3,39ff83e3,39ff83e3..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/StringTest.output.goal +++ /dev/null @@@@@@@@ -1,5 -1,5 -1,5 -1,5 -1,5 -1,5 -1,5 +1,0 @@@@@@@@ -------hello world -------1 -------6 -------lo world -------lo diff --cc Robust/src/Tests/output/Test.output.goal index 22e99001,22e99001,22e99001,22e99001,22e99001,22e99001,22e99001..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/Test.output.goal +++ /dev/null @@@@@@@@ -1,1228 -1,1228 -1,1228 -1,1228 -1,1228 -1,1228 -1,1228 +1,0 @@@@@@@@ -------3 -------5 -------7 -------11 -------13 -------17 -------19 -------23 -------29 -------31 -------37 -------41 -------43 -------47 -------53 -------59 -------61 -------67 -------71 -------73 -------79 -------83 -------89 -------97 -------101 -------103 -------107 -------109 -------113 -------127 -------131 -------137 -------139 -------149 -------151 -------157 -------163 -------167 -------173 -------179 -------181 -------191 -------193 -------197 -------199 -------211 -------223 -------227 -------229 -------233 -------239 -------241 -------251 -------257 -------263 -------269 -------271 -------277 -------281 -------283 -------293 -------307 -------311 -------313 -------317 -------331 -------337 -------347 -------349 -------353 -------359 -------367 -------373 -------379 -------383 -------389 -------397 -------401 -------409 -------419 -------421 -------431 -------433 -------439 -------443 -------449 -------457 -------461 -------463 -------467 -------479 -------487 -------491 -------499 -------503 -------509 -------521 -------523 -------541 -------547 -------557 -------563 -------569 -------571 -------577 -------587 -------593 -------599 -------601 -------607 -------613 -------617 -------619 -------631 -------641 -------643 -------647 -------653 -------659 -------661 -------673 -------677 -------683 -------691 -------701 -------709 -------719 -------727 -------733 -------739 -------743 -------751 -------757 -------761 -------769 -------773 -------787 -------797 -------809 -------811 -------821 -------823 -------827 -------829 -------839 -------853 -------857 -------859 -------863 -------877 -------881 -------883 -------887 -------907 -------911 -------919 -------929 -------937 -------941 -------947 -------953 -------967 -------971 -------977 -------983 -------991 -------997 -------1009 -------1013 -------1019 -------1021 -------1031 -------1033 -------1039 -------1049 -------1051 -------1061 -------1063 -------1069 -------1087 -------1091 -------1093 -------1097 -------1103 -------1109 -------1117 -------1123 -------1129 -------1151 -------1153 -------1163 -------1171 -------1181 -------1187 -------1193 -------1201 -------1213 -------1217 -------1223 -------1229 -------1231 -------1237 -------1249 -------1259 -------1277 -------1279 -------1283 -------1289 -------1291 -------1297 -------1301 -------1303 -------1307 -------1319 -------1321 -------1327 -------1361 -------1367 -------1373 -------1381 -------1399 -------1409 -------1423 -------1427 -------1429 -------1433 -------1439 -------1447 -------1451 -------1453 -------1459 -------1471 -------1481 -------1483 -------1487 -------1489 -------1493 -------1499 -------1511 -------1523 -------1531 -------1543 -------1549 -------1553 -------1559 -------1567 -------1571 -------1579 -------1583 -------1597 -------1601 -------1607 -------1609 -------1613 -------1619 -------1621 -------1627 -------1637 -------1657 -------1663 -------1667 -------1669 -------1693 -------1697 -------1699 -------1709 -------1721 -------1723 -------1733 -------1741 -------1747 -------1753 -------1759 -------1777 -------1783 -------1787 -------1789 -------1801 -------1811 -------1823 -------1831 -------1847 -------1861 -------1867 -------1871 -------1873 -------1877 -------1879 -------1889 -------1901 -------1907 -------1913 -------1931 -------1933 -------1949 -------1951 -------1973 -------1979 -------1987 -------1993 -------1997 -------1999 -------2003 -------2011 -------2017 -------2027 -------2029 -------2039 -------2053 -------2063 -------2069 -------2081 -------2083 -------2087 -------2089 -------2099 -------2111 -------2113 -------2129 -------2131 -------2137 -------2141 -------2143 -------2153 -------2161 -------2179 -------2203 -------2207 -------2213 -------2221 -------2237 -------2239 -------2243 -------2251 -------2267 -------2269 -------2273 -------2281 -------2287 -------2293 -------2297 -------2309 -------2311 -------2333 -------2339 -------2341 -------2347 -------2351 -------2357 -------2371 -------2377 -------2381 -------2383 -------2389 -------2393 -------2399 -------2411 -------2417 -------2423 -------2437 -------2441 -------2447 -------2459 -------2467 -------2473 -------2477 -------2503 -------2521 -------2531 -------2539 -------2543 -------2549 -------2551 -------2557 -------2579 -------2591 -------2593 -------2609 -------2617 -------2621 -------2633 -------2647 -------2657 -------2659 -------2663 -------2671 -------2677 -------2683 -------2687 -------2689 -------2693 -------2699 -------2707 -------2711 -------2713 -------2719 -------2729 -------2731 -------2741 -------2749 -------2753 -------2767 -------2777 -------2789 -------2791 -------2797 -------2801 -------2803 -------2819 -------2833 -------2837 -------2843 -------2851 -------2857 -------2861 -------2879 -------2887 -------2897 -------2903 -------2909 -------2917 -------2927 -------2939 -------2953 -------2957 -------2963 -------2969 -------2971 -------2999 -------3001 -------3011 -------3019 -------3023 -------3037 -------3041 -------3049 -------3061 -------3067 -------3079 -------3083 -------3089 -------3109 -------3119 -------3121 -------3137 -------3163 -------3167 -------3169 -------3181 -------3187 -------3191 -------3203 -------3209 -------3217 -------3221 -------3229 -------3251 -------3253 -------3257 -------3259 -------3271 -------3299 -------3301 -------3307 -------3313 -------3319 -------3323 -------3329 -------3331 -------3343 -------3347 -------3359 -------3361 -------3371 -------3373 -------3389 -------3391 -------3407 -------3413 -------3433 -------3449 -------3457 -------3461 -------3463 -------3467 -------3469 -------3491 -------3499 -------3511 -------3517 -------3527 -------3529 -------3533 -------3539 -------3541 -------3547 -------3557 -------3559 -------3571 -------3581 -------3583 -------3593 -------3607 -------3613 -------3617 -------3623 -------3631 -------3637 -------3643 -------3659 -------3671 -------3673 -------3677 -------3691 -------3697 -------3701 -------3709 -------3719 -------3727 -------3733 -------3739 -------3761 -------3767 -------3769 -------3779 -------3793 -------3797 -------3803 -------3821 -------3823 -------3833 -------3847 -------3851 -------3853 -------3863 -------3877 -------3881 -------3889 -------3907 -------3911 -------3917 -------3919 -------3923 -------3929 -------3931 -------3943 -------3947 -------3967 -------3989 -------4001 -------4003 -------4007 -------4013 -------4019 -------4021 -------4027 -------4049 -------4051 -------4057 -------4073 -------4079 -------4091 -------4093 -------4099 -------4111 -------4127 -------4129 -------4133 -------4139 -------4153 -------4157 -------4159 -------4177 -------4201 -------4211 -------4217 -------4219 -------4229 -------4231 -------4241 -------4243 -------4253 -------4259 -------4261 -------4271 -------4273 -------4283 -------4289 -------4297 -------4327 -------4337 -------4339 -------4349 -------4357 -------4363 -------4373 -------4391 -------4397 -------4409 -------4421 -------4423 -------4441 -------4447 -------4451 -------4457 -------4463 -------4481 -------4483 -------4493 -------4507 -------4513 -------4517 -------4519 -------4523 -------4547 -------4549 -------4561 -------4567 -------4583 -------4591 -------4597 -------4603 -------4621 -------4637 -------4639 -------4643 -------4649 -------4651 -------4657 -------4663 -------4673 -------4679 -------4691 -------4703 -------4721 -------4723 -------4729 -------4733 -------4751 -------4759 -------4783 -------4787 -------4789 -------4793 -------4799 -------4801 -------4813 -------4817 -------4831 -------4861 -------4871 -------4877 -------4889 -------4903 -------4909 -------4919 -------4931 -------4933 -------4937 -------4943 -------4951 -------4957 -------4967 -------4969 -------4973 -------4987 -------4993 -------4999 -------5003 -------5009 -------5011 -------5021 -------5023 -------5039 -------5051 -------5059 -------5077 -------5081 -------5087 -------5099 -------5101 -------5107 -------5113 -------5119 -------5147 -------5153 -------5167 -------5171 -------5179 -------5189 -------5197 -------5209 -------5227 -------5231 -------5233 -------5237 -------5261 -------5273 -------5279 -------5281 -------5297 -------5303 -------5309 -------5323 -------5333 -------5347 -------5351 -------5381 -------5387 -------5393 -------5399 -------5407 -------5413 -------5417 -------5419 -------5431 -------5437 -------5441 -------5443 -------5449 -------5471 -------5477 -------5479 -------5483 -------5501 -------5503 -------5507 -------5519 -------5521 -------5527 -------5531 -------5557 -------5563 -------5569 -------5573 -------5581 -------5591 -------5623 -------5639 -------5641 -------5647 -------5651 -------5653 -------5657 -------5659 -------5669 -------5683 -------5689 -------5693 -------5701 -------5711 -------5717 -------5737 -------5741 -------5743 -------5749 -------5779 -------5783 -------5791 -------5801 -------5807 -------5813 -------5821 -------5827 -------5839 -------5843 -------5849 -------5851 -------5857 -------5861 -------5867 -------5869 -------5879 -------5881 -------5897 -------5903 -------5923 -------5927 -------5939 -------5953 -------5981 -------5987 -------6007 -------6011 -------6029 -------6037 -------6043 -------6047 -------6053 -------6067 -------6073 -------6079 -------6089 -------6091 -------6101 -------6113 -------6121 -------6131 -------6133 -------6143 -------6151 -------6163 -------6173 -------6197 -------6199 -------6203 -------6211 -------6217 -------6221 -------6229 -------6247 -------6257 -------6263 -------6269 -------6271 -------6277 -------6287 -------6299 -------6301 -------6311 -------6317 -------6323 -------6329 -------6337 -------6343 -------6353 -------6359 -------6361 -------6367 -------6373 -------6379 -------6389 -------6397 -------6421 -------6427 -------6449 -------6451 -------6469 -------6473 -------6481 -------6491 -------6521 -------6529 -------6547 -------6551 -------6553 -------6563 -------6569 -------6571 -------6577 -------6581 -------6599 -------6607 -------6619 -------6637 -------6653 -------6659 -------6661 -------6673 -------6679 -------6689 -------6691 -------6701 -------6703 -------6709 -------6719 -------6733 -------6737 -------6761 -------6763 -------6779 -------6781 -------6791 -------6793 -------6803 -------6823 -------6827 -------6829 -------6833 -------6841 -------6857 -------6863 -------6869 -------6871 -------6883 -------6899 -------6907 -------6911 -------6917 -------6947 -------6949 -------6959 -------6961 -------6967 -------6971 -------6977 -------6983 -------6991 -------6997 -------7001 -------7013 -------7019 -------7027 -------7039 -------7043 -------7057 -------7069 -------7079 -------7103 -------7109 -------7121 -------7127 -------7129 -------7151 -------7159 -------7177 -------7187 -------7193 -------7207 -------7211 -------7213 -------7219 -------7229 -------7237 -------7243 -------7247 -------7253 -------7283 -------7297 -------7307 -------7309 -------7321 -------7331 -------7333 -------7349 -------7351 -------7369 -------7393 -------7411 -------7417 -------7433 -------7451 -------7457 -------7459 -------7477 -------7481 -------7487 -------7489 -------7499 -------7507 -------7517 -------7523 -------7529 -------7537 -------7541 -------7547 -------7549 -------7559 -------7561 -------7573 -------7577 -------7583 -------7589 -------7591 -------7603 -------7607 -------7621 -------7639 -------7643 -------7649 -------7669 -------7673 -------7681 -------7687 -------7691 -------7699 -------7703 -------7717 -------7723 -------7727 -------7741 -------7753 -------7757 -------7759 -------7789 -------7793 -------7817 -------7823 -------7829 -------7841 -------7853 -------7867 -------7873 -------7877 -------7879 -------7883 -------7901 -------7907 -------7919 -------7927 -------7933 -------7937 -------7949 -------7951 -------7963 -------7993 -------8009 -------8011 -------8017 -------8039 -------8053 -------8059 -------8069 -------8081 -------8087 -------8089 -------8093 -------8101 -------8111 -------8117 -------8123 -------8147 -------8161 -------8167 -------8171 -------8179 -------8191 -------8209 -------8219 -------8221 -------8231 -------8233 -------8237 -------8243 -------8263 -------8269 -------8273 -------8287 -------8291 -------8293 -------8297 -------8311 -------8317 -------8329 -------8353 -------8363 -------8369 -------8377 -------8387 -------8389 -------8419 -------8423 -------8429 -------8431 -------8443 -------8447 -------8461 -------8467 -------8501 -------8513 -------8521 -------8527 -------8537 -------8539 -------8543 -------8563 -------8573 -------8581 -------8597 -------8599 -------8609 -------8623 -------8627 -------8629 -------8641 -------8647 -------8663 -------8669 -------8677 -------8681 -------8689 -------8693 -------8699 -------8707 -------8713 -------8719 -------8731 -------8737 -------8741 -------8747 -------8753 -------8761 -------8779 -------8783 -------8803 -------8807 -------8819 -------8821 -------8831 -------8837 -------8839 -------8849 -------8861 -------8863 -------8867 -------8887 -------8893 -------8923 -------8929 -------8933 -------8941 -------8951 -------8963 -------8969 -------8971 -------8999 -------9001 -------9007 -------9011 -------9013 -------9029 -------9041 -------9043 -------9049 -------9059 -------9067 -------9091 -------9103 -------9109 -------9127 -------9133 -------9137 -------9151 -------9157 -------9161 -------9173 -------9181 -------9187 -------9199 -------9203 -------9209 -------9221 -------9227 -------9239 -------9241 -------9257 -------9277 -------9281 -------9283 -------9293 -------9311 -------9319 -------9323 -------9337 -------9341 -------9343 -------9349 -------9371 -------9377 -------9391 -------9397 -------9403 -------9413 -------9419 -------9421 -------9431 -------9433 -------9437 -------9439 -------9461 -------9463 -------9467 -------9473 -------9479 -------9491 -------9497 -------9511 -------9521 -------9533 -------9539 -------9547 -------9551 -------9587 -------9601 -------9613 -------9619 -------9623 -------9629 -------9631 -------9643 -------9649 -------9661 -------9677 -------9679 -------9689 -------9697 -------9719 -------9721 -------9733 -------9739 -------9743 -------9749 -------9767 -------9769 -------9781 -------9787 -------9791 -------9803 -------9811 -------9817 -------9829 -------9833 -------9839 -------9851 -------9857 -------9859 -------9871 -------9883 -------9887 -------9901 -------9907 -------9923 -------9929 -------9931 -------9941 -------9949 -------9967 -------9973 diff --cc Robust/src/Tests/output/WriteFile.output.goal index e69de29b,e69de29b,e69de29b,e69de29b,e69de29b,e69de29b,e69de29b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/WriteFile.output.goal +++ /dev/null diff --cc Robust/src/Tests/output/virtualcalltest.output.goal index e69de29b,e69de29b,e69de29b,e69de29b,e69de29b,e69de29b,e69de29b..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/output/virtualcalltest.output.goal +++ /dev/null diff --cc Robust/src/Tests/virtualcalltest.java index 1b034ad2,1b034ad2,1b034ad2,1b034ad2,1b034ad2,1b034ad2,1b034ad2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Tests/virtualcalltest.java +++ /dev/null @@@@@@@@ -1,47 -1,47 -1,47 -1,47 -1,47 -1,47 -1,47 +1,0 @@@@@@@@ -------class A { ------- A() { ------- ; ------- } ------- ------- void foo(int x) { ------- System.printInt(x); ------- System.printString("\n"); ------- } -------} ------- ------- -------class B extends A { ------- B() { ------- ; ------- } ------- ------- void foo(int x) { ------- } -------} ------- ------- -------class C extends A { ------- C() { ------- ; ------- } ------- ------- void foo(int x) { ------- } -------} ------- -------public class virtualcalltest { ------- public static void main(String str[]) { ------- ------- A a=null; ------- B b=new B(); ------- C c=new C(); ------- for(int i=0;i<1000000;i++) { ------- if (i%2==0) ------- a=b; ------- else ------- a=c; ------- ------- a.foo(20); ------- } ------- } -------} diff --cc Robust/src/Util/Edge.java index 2d95adbb,8b13b03d,8b13b03d,8b13b03d,598572d5,598572d5,598572d5..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Util/Edge.java +++ /dev/null @@@@@@@@ -1,51 -1,72 -1,72 -1,72 -1,76 -1,76 -1,76 +1,0 @@@@@@@@ -------package Util; ------- -------/* Edge *****************/ ------- -------public class Edge { ---- protected GraphNode target; ---- protected GraphNode source; - protected boolean processed = false; - --- protected GraphNode target; --- protected GraphNode source; ------- ---- protected String dotnodeparams = new String(); ---- ---- public Edge(GraphNode target) { ---- this.target = target; ---- } ---- ---- public String getLabel() { ---- return ""; ---- } ---- ---- public void setSource(GraphNode s) { ---- this.source=s; ---- } ---- ---- public GraphNode getSource() { ---- return source; ---- } ---- ---- public GraphNode getTarget() { ---- return target; ---- } --- protected String dotnodeparams = new String(); ------- - public void setProcessed() { - processed = true; - } - - public boolean isProcessed(){ - return processed; - } - ---- public void setDotNodeParameters(String param) { ---- if (param == null) { ---- throw new NullPointerException(); ---- } ---- if (dotnodeparams.length() > 0) { ---- dotnodeparams += "," + param; ---- } else { ---- dotnodeparams = param; ---- } --- public Edge(GraphNode target) { --- this.target = target; --- } --- --- public String getLabel() { --- return ""; --- } --- --- public void setSource(GraphNode s) { --- this.source=s; --- } --- --- public GraphNode getSource() { --- return source; --- } --- --- public GraphNode getTarget() { --- return target; --- } --- --- public void setDotNodeParameters(String param) { --- if (param == null) { --- throw new NullPointerException(); ------ } --- --- public static final EdgeStatus UNVISITED = new EdgeStatus("UNVISITED"); --- public static final EdgeStatus PROCESSING = new EdgeStatus("PROCESSING"); --- public static final EdgeStatus FINISHED = new EdgeStatus("FINISHED"); --- --- public static class EdgeStatus { --- private static String name; --- private EdgeStatus(String name) { this.name = name; } --- public String toString() { return name; } --- if (dotnodeparams.length() > 0) { --- dotnodeparams += "," + param; --- } else { --- dotnodeparams = param; ------ } --- --- int discoverytime = -1; --- int finishingtime = -1; /* used for searches */ --- EdgeStatus status = UNVISITED; --- --- void reset() { --- discoverytime = -1; --- finishingtime = -1; --- status = UNVISITED; --- } --- --- public static final EdgeStatus UNVISITED = new EdgeStatus("UNVISITED"); --- public static final EdgeStatus PROCESSING = new EdgeStatus("PROCESSING"); --- public static final EdgeStatus FINISHED = new EdgeStatus("FINISHED"); --- --- public static class EdgeStatus { --- private static String name; --- private EdgeStatus(String name) { --- this.name = name; ------ } --- --- void discover(int time) { --- discoverytime = time; --- status = PROCESSING; --- public String toString() { --- return name; ------ } --- } ------ --- void finish(int time) { --- assert status == PROCESSING; --- finishingtime = time; --- status = FINISHED; ---- } --- int discoverytime = -1; --- int finishingtime = -1; /* used for searches */ --- EdgeStatus status = UNVISITED; --- --- void reset() { --- discoverytime = -1; --- finishingtime = -1; --- status = UNVISITED; --- } --- --- void discover(int time) { --- discoverytime = time; --- status = PROCESSING; --- } --- --- void finish(int time) { --- assert status == PROCESSING; --- finishingtime = time; --- status = FINISHED; --- } -------} diff --cc Robust/src/Util/GraphNode.java index c352aaa4,0028af76,0028af76,0028af76,ebc31d0e,ebc31d0e,d765b2f2..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/Util/GraphNode.java +++ /dev/null @@@@@@@@ -1,503 -1,541 -1,541 -1,541 -1,545 -1,545 -1,545 +1,0 @@@@@@@@ -------package Util; ------- -------import java.util.*; -------import java.io.*; ------- -------public class GraphNode { ---- /* NodeStatus enumeration pattern ***********/ --- /* NodeStatus enumeration pattern ***********/ ------- ---- public static final NodeStatus UNVISITED = new NodeStatus("UNVISITED"); ---- public static final NodeStatus PROCESSING = new NodeStatus("PROCESSING"); ---- public static final NodeStatus FINISHED = new NodeStatus("FINISHED"); ---- ---- public static class NodeStatus { ---- private static String name; ---- private NodeStatus(String name) { this.name = name; } ---- public String toString() { return name; } --- public static final NodeStatus UNVISITED = new NodeStatus("UNVISITED"); --- public static final NodeStatus PROCESSING = new NodeStatus("PROCESSING"); --- public static final NodeStatus FINISHED = new NodeStatus("FINISHED"); --- --- public static class NodeStatus { --- private static String name; --- private NodeStatus(String name) { --- this.name = name; --- } --- public String toString() { --- return name; ------- } --- } ------- ---- int discoverytime = -1; ---- int finishingtime = -1; /* used for searches */ --- int discoverytime = -1; --- int finishingtime = -1; /* used for searches */ ------- ---- protected Vector edges = new Vector(); ---- protected Vector inedges = new Vector(); --- protected Vector edges = new Vector(); --- protected Vector inedges = new Vector(); ------- ---- NodeStatus status = UNVISITED; ---- String dotnodeparams = new String(); ---- public boolean merge=false; --- NodeStatus status = UNVISITED; --- String dotnodeparams = new String(); --- public boolean merge=false; ------- ---- public void setMerge() { ---- merge=true; ---- } --- public void setMerge() { --- merge=true; --- } ------- ---- public static void computeclosure(Collection nodes, Collection removed) { ---- Stack tovisit=new Stack(); ---- tovisit.addAll(nodes); ---- while(!tovisit.isEmpty()) { ---- GraphNode gn=(GraphNode)tovisit.pop(); ---- for(Iterator it=gn.edges();it.hasNext();) { ---- Edge edge=(Edge)it.next(); ---- GraphNode target=edge.getTarget(); ---- if (!nodes.contains(target)) { ---- if ((removed==null)|| ---- (!removed.contains(target))) { ---- nodes.add(target); ---- tovisit.push(target); ---- } ---- } ---- } --- public static void computeclosure(Collection nodes, Collection removed) { --- Stack tovisit=new Stack(); --- tovisit.addAll(nodes); --- while(!tovisit.isEmpty()) { --- GraphNode gn=(GraphNode)tovisit.pop(); --- for(Iterator it=gn.edges(); it.hasNext();) { --- Edge edge=(Edge)it.next(); --- GraphNode target=edge.getTarget(); --- if (!nodes.contains(target)) { --- if ((removed==null)|| --- (!removed.contains(target))) { --- nodes.add(target); --- tovisit.push(target); --- } ------- } --- } ------- } --- } ------- ---- public static void boundedcomputeclosure(Collection nodes, Collection removed,int depth) { ---- Stack tovisit=new Stack(); ---- Stack newvisit=new Stack(); ---- tovisit.addAll(nodes); ---- for(int i=0;i 0) { ---- dotnodeparams += "," + param; ---- } else { ---- dotnodeparams = param; ---- } --- } --- tovisit=newvisit; --- newvisit=new Stack(); ------- } --- } ------- ---- public void setStatus(NodeStatus status) { ---- if (status == null) { ---- throw new NullPointerException(); ---- } ---- this.status = status; --- public void setDotNodeParameters(String param) { --- if (param == null) { --- throw new NullPointerException(); ------- } ---- ---- public String getLabel() { ---- return ""; --- if (dotnodeparams.length() > 0) { --- dotnodeparams += "," + param; --- } else { --- dotnodeparams = param; ------- } --- } ------- ---- public String getTextLabel() { ---- return ""; ---- } ---- - public String getName(){ - return ""; - } --- public String getName(){ --- return ""; --- public void setStatus(NodeStatus status) { --- if (status == null) { --- throw new NullPointerException(); ------ } --- this.status = status; --- } ------- ---- public NodeStatus getStatus() { ---- return this.status; ---- } --- public String getLabel() { --- return ""; --- } ------- ---- public int numedges() { ---- return edges.size(); ---- } --- public String getTextLabel() { --- return ""; --- } ------- ---- public int numinedges() { ---- return inedges.size(); ---- } --- public String getName() { --- return ""; --- } ------- ---- public Edge getedge(int i) { ---- return (Edge) edges.get(i); ---- } --- public NodeStatus getStatus() { --- return this.status; --- } ------- ---- public Edge getinedge(int i) { ---- return (Edge) inedges.get(i); ---- } --- public int numedges() { --- return edges.size(); --- } ------- ---- public Vector getEdgeVector() { ---- return edges; ---- } --- public int numinedges() { --- return inedges.size(); --- } ------- ---- public Vector getInedgeVector() { ---- return inedges; ---- } --- public Edge getedge(int i) { --- return (Edge) edges.get(i); --- } ------- ---- public Iterator edges() { ---- return edges.iterator(); ---- } --- public Edge getinedge(int i) { --- return (Edge) inedges.get(i); --- } ------- ---- public Iterator inedges() { ---- return inedges.iterator(); ---- } ---- ---- public void addEdge(Edge newedge) { ---- newedge.setSource(this); ---- edges.addElement(newedge); ---- GraphNode tonode=newedge.getTarget(); ---- tonode.inedges.addElement(newedge); --- } --- public Vector getEdgeVector() { --- return edges; --- } ------ --- public boolean containsEdge(Edge e) { --- return edges.contains(e); ---- } --- public Vector getInedgeVector() { --- return inedges; --- } ------- ---- public void addEdge(Vector v) { ---- for (Iterator it = v.iterator(); it.hasNext();) ---- addEdge((Edge)it.next()); ---- } --- public Iterator edges() { --- return edges.iterator(); --- } ------- ---- public void removeEdge(Edge edge) { ---- edges.remove(edge); ---- } --- public Iterator inedges() { --- return inedges.iterator(); --- } ------- ---- public void removeInedge(Edge edge) { ---- inedges.remove(edge); ---- } --- public void addEdge(Edge newedge) { --- newedge.setSource(this); --- edges.addElement(newedge); --- GraphNode tonode=newedge.getTarget(); --- tonode.inedges.addElement(newedge); --- } ------- ---- public void removeAllEdges() { ---- edges.removeAllElements(); ---- } --- public boolean containsEdge(Edge e) { --- return edges.contains(e); --- } ------- ---- public void removeAllInedges() { ---- inedges.removeAllElements(); ---- } ---- void reset() { ---- discoverytime = -1; ---- finishingtime = -1; ---- status = UNVISITED; ---- } --- public void addEdge(Vector v) { --- for (Iterator it = v.iterator(); it.hasNext();) --- addEdge((Edge)it.next()); --- } ------- ---- void resetscc() { ---- status = UNVISITED; ---- } --- public void removeEdge(Edge edge) { --- edges.remove(edge); --- } ------- ---- void discover(int time) { ---- discoverytime = time; ---- status = PROCESSING; ---- } --- public void removeInedge(Edge edge) { --- inedges.remove(edge); --- } ------- ---- void finish(int time) { ---- assert status == PROCESSING; ---- finishingtime = time; ---- status = FINISHED; ---- } --- public void removeAllEdges() { --- edges.removeAllElements(); --- } ------- ---- /** Returns finishing time for dfs */ --- public void removeAllInedges() { --- inedges.removeAllElements(); --- } --- void reset() { --- discoverytime = -1; --- finishingtime = -1; --- status = UNVISITED; --- } ------- ---- public int getFinishingTime() { ---- return finishingtime; ---- } --- void resetscc() { --- status = UNVISITED; --- } ------- --- void discover(int time) { --- discoverytime = time; --- status = PROCESSING; --- } ------- ---- public static class DOTVisitor { --- void finish(int time) { --- assert status == PROCESSING; --- finishingtime = time; --- status = FINISHED; --- } ------- ---- java.io.PrintWriter output; ---- int tokennumber; ---- int color; ---- Vector namers; --- /** Returns finishing time for dfs */ ------- ---- private DOTVisitor(java.io.OutputStream output, Vector namers) { ---- tokennumber = 0; ---- color = 0; ---- this.output = new java.io.PrintWriter(output, true); ---- this.namers=namers; ---- } --- public int getFinishingTime() { --- return finishingtime; --- } ------- ---- private String getNewID(String name) { ---- tokennumber = tokennumber + 1; ---- return new String (name+tokennumber); ---- } ------- ---- Collection nodes; --- public static class DOTVisitor { ------- --- java.io.PrintWriter output; --- int tokennumber; --- int color; --- Vector namers; ------- ---- public static void visit(java.io.OutputStream output, Collection nodes, Vector namers) { ---- DOTVisitor visitor = new DOTVisitor(output, namers); ---- visitor.nodes = nodes; ---- visitor.make(); ---- } --- private DOTVisitor(java.io.OutputStream output, Vector namers) { --- tokennumber = 0; --- color = 0; --- this.output = new java.io.PrintWriter(output, true); --- this.namers=namers; --- } ------- ---- public static void visit(java.io.OutputStream output, Collection nodes) { ---- Vector v=new Vector(); ---- v.add(new Namer()); ---- DOTVisitor visitor = new DOTVisitor(output, v); ---- visitor.nodes = nodes; ---- visitor.make(); ---- } --- private String getNewID(String name) { --- tokennumber = tokennumber + 1; --- return new String(name+tokennumber); --- } ------- ---- private void make() { ---- output.println("digraph dotvisitor {"); ---- /* output.println("\tpage=\"8.5,11\";"); ---- output.println("\tnslimit=1000.0;"); ---- output.println("\tnslimit1=1000.0;"); ---- output.println("\tmclimit=1000.0;"); ---- output.println("\tremincross=true;");*/ ---- output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];"); ---- output.println("\tedge [fontsize=6];"); ---- traverse(); ---- output.println("}\n"); ---- } --- Collection nodes; ------- ------- --- public static void visit(java.io.OutputStream output, Collection nodes, Vector namers) { --- DOTVisitor visitor = new DOTVisitor(output, namers); --- visitor.nodes = nodes; --- visitor.make(); --- } ------- ---- private void traverse() { ---- Set cycleset=GraphNode.findcycles(nodes); --- public static void visit(java.io.OutputStream output, Collection nodes) { --- Vector v=new Vector(); --- v.add(new Namer()); --- DOTVisitor visitor = new DOTVisitor(output, v); --- visitor.nodes = nodes; --- visitor.make(); --- } ------- ---- Iterator it = nodes.iterator(); ---- while (it.hasNext()) { ---- GraphNode gn = (GraphNode) it.next(); ---- Iterator edges = gn.edges(); ---- String label = ""; ---- String dotnodeparams=""; --- private void make() { --- output.println("digraph dotvisitor {"); --- /* output.println("\tpage=\"8.5,11\";"); --- output.println("\tnslimit=1000.0;"); --- output.println("\tnslimit1=1000.0;"); --- output.println("\tmclimit=1000.0;"); --- output.println("\tremincross=true;");*/ --- output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];"); --- output.println("\tedge [fontsize=6];"); --- traverse(); --- output.println("}\n"); --- } ------- ---- for(int i=0;i " + node2.getLabel() + " [" + "label=\"" + edgelabel + "\"" + edgedotnodeparams + "];"); ---- } ---- } ---- } ---- } ---- } --- for(int i=0; i " + node2.getLabel() + " [" + "label=\"" + edgelabel + "\"" + edgedotnodeparams + "];"); --- } --- } --- } --- } ------- } ------- ---- /** This function returns the set of nodes involved in cycles. ---- * It only considers cycles containing nodes in the set 'nodes'. ---- */ ---- public static Set findcycles(Collection nodes) { ---- HashSet cycleset=new HashSet(); ---- SCC scc=DFS.computeSCC(nodes); ---- if (!scc.hasCycles()) ---- return cycleset; ---- for(int i=0;i1) ---- return true; ---- Object [] array=s.toArray(); ---- GraphNode gn=(GraphNode)array[0]; ---- for(Iterator it=gn.edges();it.hasNext();) { ---- Edge e=(Edge)it.next(); ---- if (e.getTarget()==gn) ---- return true; /* Self Cycle */ ---- } ---- return false; ---- } --- /** Returns the strongly connected component number for the GraphNode gn*/ --- public int getComponent(GraphNode gn) { --- return ((Integer)revmap.get(gn)).intValue(); ------- } ------- ---- /** ---- * DFS encapsulates the depth first search algorithm ---- */ ---- public static class DFS { --- /** Returns the set of nodes in the strongly connected component i*/ --- public Set getSCC(int i) { --- Integer scc=new Integer(i); --- return (Set)map.get(scc); --- } ------- ---- int time = 0; ---- int sccindex = 0; ---- Collection nodes; ---- Vector finishingorder=null; --- Vector finishingorder_edge = null; --- int edgetime = 0; ---- HashMap sccmap; ---- HashMap sccmaprev; --- /** Returns whether the strongly connected component i contains a cycle */ -- boolean hasCycle(int i) { - public boolean hasCycle(int i) { --- Integer scc=new Integer(i); --- Set s=(Set)map.get(scc); --- if (s.size()>1) --- return true; --- Object [] array=s.toArray(); --- GraphNode gn=(GraphNode)array[0]; --- for(Iterator it=gn.edges(); it.hasNext();) { --- Edge e=(Edge)it.next(); --- if (e.getTarget()==gn) --- return true; /* Self Cycle */ --- } --- return false; --- } --- } ------- ---- private DFS(Collection nodes) { ---- this.nodes = nodes; ---- } ---- /** Calculates the strong connected components for the graph composed ---- * of the set of nodes 'nodes'*/ ---- public static SCC computeSCC(Collection nodes) { ---- if (nodes==null) { ---- throw new NullPointerException(); ---- } ---- DFS dfs=new DFS(nodes); ---- dfs.sccmap=new HashMap(); ---- dfs.sccmaprev=new HashMap(); ---- dfs.finishingorder=new Vector(); ---- boolean acyclic=dfs.go(); ---- for (Iterator it = nodes.iterator();it.hasNext();) { ---- GraphNode gn = (GraphNode) it.next(); ---- gn.resetscc(); ---- } ---- for(int i=dfs.finishingorder.size()-1;i>=0;i--) { ---- GraphNode gn=(GraphNode)dfs.finishingorder.get(i); ---- if (gn.getStatus() == UNVISITED) { ---- dfs.dfsprev(gn); ---- dfs.sccindex++; /* Increment scc index */ ---- } ---- } ---- return new SCC(acyclic,dfs.sccmap,dfs.sccmaprev,dfs.sccindex); ---- } --- /** --- * DFS encapsulates the depth first search algorithm --- */ --- public static class DFS { ------- ---- void dfsprev(GraphNode gn) { ---- if (gn.getStatus()==FINISHED||!nodes.contains(gn)) ---- return; ---- gn.setStatus(FINISHED); ---- Integer i=new Integer(sccindex); ---- if (!sccmap.containsKey(i)) ---- sccmap.put(i,new HashSet()); ---- ((Set)sccmap.get(i)).add(gn); ---- sccmaprev.put(gn,i); ---- for(Iterator edgeit=gn.inedges();edgeit.hasNext();) { ---- Edge e=(Edge)edgeit.next(); ---- GraphNode gn2=e.getSource(); ---- dfsprev(gn2); ---- } --- int time = 0; --- int sccindex = 0; --- Collection nodes; --- Vector finishingorder=null; --- Vector finishingorder_edge = null; --- int edgetime = 0; --- HashMap sccmap; --- HashMap sccmaprev; --- --- private DFS(Collection nodes) { --- this.nodes = nodes; --- } --- /** Calculates the strong connected components for the graph composed --- * of the set of nodes 'nodes'*/ --- public static SCC computeSCC(Collection nodes) { --- if (nodes==null) { --- throw new NullPointerException(); --- } --- DFS dfs=new DFS(nodes); --- dfs.sccmap=new HashMap(); --- dfs.sccmaprev=new HashMap(); --- dfs.finishingorder=new Vector(); --- boolean acyclic=dfs.go(); --- for (Iterator it = nodes.iterator(); it.hasNext();) { --- GraphNode gn = (GraphNode) it.next(); --- gn.resetscc(); --- } --- for(int i=dfs.finishingorder.size()-1; i>=0; i--) { --- GraphNode gn=(GraphNode)dfs.finishingorder.get(i); --- if (gn.getStatus() == UNVISITED) { --- dfs.dfsprev(gn); --- dfs.sccindex++; /* Increment scc index */ ------- } --- } --- return new SCC(acyclic,dfs.sccmap,dfs.sccmaprev,dfs.sccindex); --- } ------- ---- public static boolean depthFirstSearch(Collection nodes) { ---- if (nodes == null) { ---- throw new NullPointerException(); ---- } --- void dfsprev(GraphNode gn) { --- if (gn.getStatus()==FINISHED||!nodes.contains(gn)) --- return; --- gn.setStatus(FINISHED); --- Integer i=new Integer(sccindex); --- if (!sccmap.containsKey(i)) --- sccmap.put(i,new HashSet()); --- ((Set)sccmap.get(i)).add(gn); --- sccmaprev.put(gn,i); --- for(Iterator edgeit=gn.inedges(); edgeit.hasNext();) { --- Edge e=(Edge)edgeit.next(); --- GraphNode gn2=e.getSource(); --- dfsprev(gn2); --- } --- } ------- ---- DFS dfs = new DFS(nodes); ---- return dfs.go(); ---- } --- public static boolean depthFirstSearch(Collection nodes) { --- if (nodes == null) { --- throw new NullPointerException(); --- } ------- ---- private boolean go() { ---- Iterator i; ---- time = 0; --- edgetime = 0; ---- boolean acyclic=true; ---- i = nodes.iterator(); ---- while (i.hasNext()) { ---- GraphNode gn = (GraphNode) i.next(); ---- gn.reset(); ---- } --- DFS dfs = new DFS(nodes); --- return dfs.go(); --- } ------- ---- i = nodes.iterator(); ---- while (i.hasNext()) { ---- GraphNode gn = (GraphNode) i.next(); ---- assert gn.getStatus() != PROCESSING; ---- if (gn.getStatus() == UNVISITED) { ---- if (!dfs(gn)) ---- acyclic=false; ---- } ---- } ---- return acyclic; ---- } --- private boolean go() { --- Iterator i; --- time = 0; --- edgetime = 0; --- boolean acyclic=true; --- i = nodes.iterator(); --- while (i.hasNext()) { --- GraphNode gn = (GraphNode) i.next(); --- gn.reset(); --- } ------- ---- private boolean dfs(GraphNode gn) { - boolean acyclic=true; --- boolean acyclic=true; ---- gn.discover(time++); ---- Iterator edges = gn.edges(); --- i = nodes.iterator(); --- while (i.hasNext()) { --- GraphNode gn = (GraphNode) i.next(); --- assert gn.getStatus() != PROCESSING; --- if (gn.getStatus() == UNVISITED) { --- if (!dfs(gn)) --- acyclic=false; --- } --- } --- return acyclic; --- } ------- ---- while (edges.hasNext()) { ---- Edge edge = (Edge) edges.next(); --- edge.discover(edgetime++); ---- GraphNode node = edge.getTarget(); - if (!nodes.contains(node)) /* Skip nodes which aren't in the set */ - continue; --- if (!nodes.contains(node)) /* Skip nodes which aren't in the set */ { --- if(finishingorder_edge != null) --- finishingorder_edge.add(edge); --- edge.finish(edgetime++); --- continue; --- } ---- if (node.getStatus() == UNVISITED) { ---- if (!dfs(node)) - acyclic=false; --- acyclic=false; ---- } else if (node.getStatus()==PROCESSING) { - acyclic=false; - } --- acyclic=false; --- } --- if(finishingorder_edge != null) --- finishingorder_edge.add(edge); --- edge.finish(edgetime++); ---- } - if (finishingorder!=null) - finishingorder.add(gn); - gn.finish(time++); - return acyclic; --- if (finishingorder!=null) --- finishingorder.add(gn); --- gn.finish(time++); --- return acyclic; ---- } --- private boolean dfs(GraphNode gn) { --- boolean acyclic=true; --- gn.discover(time++); --- Iterator edges = gn.edges(); ------- --- public static Vector topology(Collection nodes, Vector finishingorder_edge) { --- if (nodes==null) { --- throw new NullPointerException(); --- } --- DFS dfs=new DFS(nodes); --- dfs.finishingorder=new Vector(); --- if(finishingorder_edge != null) { --- dfs.finishingorder_edge = new Vector(); --- } --- boolean acyclic=dfs.go(); --- Vector topology = new Vector(); --- for(int i=dfs.finishingorder.size()-1;i>=0;i--) { --- GraphNode gn=(GraphNode)dfs.finishingorder.get(i); --- topology.add(gn); --- } --- if(finishingorder_edge != null) { --- for(int i=dfs.finishingorder_edge.size()-1;i>=0;i--) { --- Edge gn=(Edge)dfs.finishingorder_edge.get(i); --- finishingorder_edge.add(gn); --- } --- } --- return topology; --- } ---- } /* end DFS */ --- while (edges.hasNext()) { --- Edge edge = (Edge) edges.next(); --- edge.discover(edgetime++); --- GraphNode node = edge.getTarget(); --- if (!nodes.contains(node)) { /* Skip nodes which aren't in the set */ --- if(finishingorder_edge != null) --- finishingorder_edge.add(edge); --- edge.finish(edgetime++); --- continue; --- } --- if (node.getStatus() == UNVISITED) { --- if (!dfs(node)) --- acyclic=false; --- } else if (node.getStatus()==PROCESSING) { --- acyclic=false; --- } --- if(finishingorder_edge != null) --- finishingorder_edge.add(edge); --- edge.finish(edgetime++); --- } --- if (finishingorder!=null) --- finishingorder.add(gn); --- gn.finish(time++); --- return acyclic; --- } --- --- public static Vector topology(Collection nodes, Vector finishingorder_edge) { --- if (nodes==null) { --- throw new NullPointerException(); --- } --- DFS dfs=new DFS(nodes); --- dfs.finishingorder=new Vector(); --- if(finishingorder_edge != null) { --- dfs.finishingorder_edge = new Vector(); --- } --- boolean acyclic=dfs.go(); --- Vector topology = new Vector(); --- for(int i=dfs.finishingorder.size()-1; i>=0; i--) { --- GraphNode gn=(GraphNode)dfs.finishingorder.get(i); --- topology.add(gn); --- } --- if(finishingorder_edge != null) { --- for(int i=dfs.finishingorder_edge.size()-1; i>=0; i--) { --- Edge gn=(Edge)dfs.finishingorder_edge.get(i); --- finishingorder_edge.add(gn); --- } --- } --- return topology; --- } --- } /* end DFS */ ------- -------} diff --cc Robust/src/Util/Namer.java index 1e8d3c38,1e8d3c38,1e8d3c38,1e8d3c38,9616e730,9616e730,9616e730..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Util/Namer.java +++ /dev/null @@@@@@@@ -1,21 -1,21 -1,21 -1,21 -1,22 -1,22 -1,22 +1,0 @@@@@@@@ -------package Util; ------- -------public class Namer { ---- public Namer() {} --- public Namer() { --- } ------- ---- public String nodeLabel(GraphNode gn) { ---- return gn.getTextLabel(); ---- } ---- ---- public String nodeOption(GraphNode gn) { ---- return gn.dotnodeparams; ---- } --- public String nodeLabel(GraphNode gn) { --- return gn.getTextLabel(); --- } ------- ---- public String edgeLabel(Edge e) { ---- return e.getLabel(); ---- } --- public String nodeOption(GraphNode gn) { --- return gn.dotnodeparams; --- } ------- ---- public String edgeOption(Edge e) { ---- return e.dotnodeparams; ---- } --- public String edgeLabel(Edge e) { --- return e.getLabel(); --- } --- --- public String edgeOption(Edge e) { --- return e.dotnodeparams; --- } -------} diff --cc Robust/src/Util/Relation.java index eea6f68a,eea6f68a,eea6f68a,eea6f68a,00446b5c,00446b5c,00446b5c..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/Util/Relation.java +++ /dev/null @@@@@@@@ -1,45 -1,45 -1,45 -1,45 -1,45 -1,45 -1,45 +1,0 @@@@@@@@ -------package Util; -------import java.util.*; ------- ------- -------public class Relation { ---- private Hashtable table; ---- int size; --- private Hashtable table; --- int size; ------- ---- public Relation() { ---- table=new Hashtable(); ---- size=0; ---- } --- public Relation() { --- table=new Hashtable(); --- size=0; --- } ------- ---- public int size() { ---- return size; ---- } --- public int size() { --- return size; --- } ------- ---- public boolean containsKey(Object o) { ---- return table.containsKey(o); ---- } --- public boolean containsKey(Object o) { --- return table.containsKey(o); --- } ------- ---- public Set keySet() { ---- return table.keySet(); ---- } --- public Set keySet() { --- return table.keySet(); --- } ------- ---- public synchronized boolean put(Object key, Object value) { ---- HashSet s; ---- if (table.containsKey(key)) { ---- s=(HashSet) table.get(key); ---- } else { ---- s=new HashSet(); ---- table.put(key,s); ---- } ---- if (!s.contains(value)) { ---- size++; ---- s.add(value); ---- return true; ---- } else ---- return false; ---- } ---- ---- public Set get(Object key) { ---- return (Set)table.get(key); --- public synchronized boolean put(Object key, Object value) { --- HashSet s; --- if (table.containsKey(key)) { --- s=(HashSet) table.get(key); --- } else { --- s=new HashSet(); --- table.put(key,s); ------- } --- if (!s.contains(value)) { --- size++; --- s.add(value); --- return true; --- } else --- return false; --- } --- --- public Set get(Object key) { --- return (Set)table.get(key); --- } -------} diff --cc Robust/src/buildscripttask index fb2b4065,fb2b4065,fb2b4065,fb2b4065,fb2b4065,fb2b4065,fb2b4065..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/buildscripttask +++ /dev/null @@@@@@@@ -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 -1,4 +1,0 @@@@@@@@ -------#!/bin/bash -------echo THIS FILE IS DEPRECATED. DO NOT USE IT. -------./buildscript -recover -o $@ ------- diff --cc Robust/src/buildscripttaskerror index a4f0459e,a4f0459e,a4f0459e,a4f0459e,a4f0459e,a4f0459e,a4f0459e..00000000 deleted file mode 100755,100755,100755,100755,100755,100755,100755 --- a/Robust/src/buildscripttaskerror +++ /dev/null @@@@@@@@ -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 -1,3 +1,0 @@@@@@@@ -------#!/bin/bash -------echo THIS FILE IS DEPRECATED. DO NOT USE IT. -------./buildscript -recover -debug -instructionfailures -o $@ diff --cc Robust/src/designnotes index 404809f2,404809f2,404809f2,404809f2,404809f2,404809f2,404809f2..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/designnotes +++ /dev/null @@@@@@@@ -1,118 -1,118 -1,118 -1,118 -1,118 -1,118 -1,118 +1,0 @@@@@@@@ -------Objects have: -------Collection of Flags ------- Flags have type/name associated with them ------- Are either present or not present ------- -------Assumptions: -------Task parameters can't be modified ------- -------How do we handle new object allocation? -------Idea #1: Set flags at allocation ------- Only allow flag setting at exit for parameters ------- -------Non parameter variables: -------1) Type must contain flags -------2) Apply flag additions to all states ------- -------Tags operations: -------create_tag operation(type) ------- -------tag name=new tag(type); ------- -------associate_with_tag operation(object, tag) ------- -------Dispatch: -------after flag status, allow tag status... -------each tag state is of the form: Type(name) ------- -------Other approach: -------Tag sets: {x, y, z, ... in R ------- -------Allow additions/removals of tuples in taskexit: -------remove from R -------add to R ------- -------Allow addition of new tuples in object allocation -------add to R ------------------------------------------------------------------------------------- ------- ------- ------- ------- -------Collection of Tags ------- Tags have type/name associated with them ------- Also have UID associated with them ------- Two basic types: ------- Ordered: Initial/Next / Preserves Sequencing ------- Non-ordered: New / Groups items together ------- ----------------------------------------------------------------------------- -------Tasks: -------Have list of parameters w/ flag/tag specifications -------Flag/Tag transitions at task exit ------------------------------------------------------------------------------ -------Problems: -------How do we efficiently do task dispatch? ------- -------Idea: -------Flags - efficiently -------Build static state transition diagram : explore full space for now -------Then for each state transition we consider: -------1) What task activations have we added -------2) What task activations have we removed -------Collapse state transition diagram to ------- ------- -------Tags - search once we match a flag ------- ------- ------- -------Input: -------trigger role specification for tasks: -------role mutator operation: -------role definition: ------- -------Generate: -------Role transition diagram ------- ------- -------Initial features: -------methods -------structs -------type system ------- -------Language features: -------Single Inheritance -------Virtual methods -------Objects ------- -------object metastate: -------1. flags: flag role1 -------2. tags: tag tag1 ------- -------tag operations: -------tag tag1=new tag; -------tag tag2=incrementtag(tag tag1); -------tag tag3=no tag; ------- -------metastate operations: ------- -------task foo(type1 o1{role1||role2}, type2 o2{role3}) { ------- ------- exit(o1{role1'=false},o2{role3'=false},onew{role4=true}); -------} ----------------------------------------------------------------------- ----------------------------------------------------------------------- ------- -------Initial design: ----------------------------------------------------------------------- ------- -------Provide runtime with: -------1) List of tasks ------- a) Task names ------- b) Parameter types ------- c) Flag settings ------- -------2) List of flags for each type ------- -------3) Flag transition calls diff --cc Robust/src/docs/schedulerdesign index deed8f48,deed8f48,deed8f48,deed8f48,deed8f48,deed8f48,deed8f48..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/docs/schedulerdesign +++ /dev/null @@@@@@@@ -1,32 -1,32 -1,32 -1,32 -1,32 -1,32 -1,32 +1,0 @@@@@@@@ -------Basic design of scheduler: ------- -------activetask: Queue of active tasks -------failedtasks: Hashtable of failed task/parameter combinations -------objectqueues: For each class we have a list of parameterwrapper objects ------- -------1. ObjectQueues ------- -------Each parameterwrapper object is a set of objects that can serve as a -------specific parameter for a specific task. This set is stored in the -------hashtable referenced by the objectset field. A reference to the -------relevant taskdescriptor is stored in the task field. ------- -------Each parameterwrapper object has an array of ints: intarray This array -------contains numberofterms pairs of integere: i*2 and i*2+1. The first -------integer in a pair contains an "and" mask of the flags that the task -------cares about. The second integer in the pair contains the flag -------settings. If the flag of an object matches any of these masks, then -------the object should be placed in the object set. ------- -------1.1 Objectsets ------- -------Each objectset is implemented using a hashtable. If an object is in -------the objectset, the objectset hashtable maps that object to either NULL -------or the next objectset the object is a member of. ------- -------1.2 ------- -------Each object with a flag contains a flagptr field ((struct RuntimeHash -------*) ptr)[2]. This field points to the first objectset hashtable that -------the object is a member of. ------- diff --cc Robust/src/docs/tagimplementation index 3b15ab45,3b15ab45,3b15ab45,3b15ab45,3b15ab45,3b15ab45,3b15ab45..00000000 deleted file mode 100644,100644,100644,100644,100644,100644,100644 --- a/Robust/src/docs/tagimplementation +++ /dev/null @@@@@@@@ -1,20 -1,20 -1,20 -1,20 -1,20 -1,20 -1,20 +1,0 @@@@@@@@ -------Example: -------task test(Baz a {}{tag Foo x}, Bar b {}{tag Foo x, Tag Far y}) { -------} ------- -------Idea: Each parameter with a tag has its own queue and a hashtable that -------is indexed by the tag ------- -------When adding the object to the queue, the runtime: ------- -------1) cycles through each tag of the appropriate type in that object and -------index into the other queues for that tag ------- -------2) if multiple objects have that tag, have to search each possible -------one... ------- -------3) if the parameter is specified to have a second tag, search through -------each possible second tag ------- -------Each flag object has tag pointer - it can either point to a tag object -------or a list of tags...