/*************************************************************************** FILE: "LineCountWithGlobals.java" AUTHOR: Aaron Chappelle, revised by Charlie McDowell ASSIGNMENT: ASSIGNEMT #1 "Basic Non-OOP Java Syntax" DESCRIPTION: This program will count the number of physical and logical lines in an input file. Each semi-colon that does not appear inside a comment or string will count as a logical line, and physical lines consist of the total number of lines in the file. ****************************************************************************/ import tio.*; /** This version of this program uses no globals. To do so, a buffer class is created that contains the char array, and the current buffer index. **/ public class LineCountWithGlobals { static char[] buffer; static int bufferIndex; /**************************** STRIP STRING ************************ Advance the input buffer position past the end of a string, or print an error message if the string does not end on the current line. @param buffer - the input buffer, assumed to contain a non-null array of characters @param bufferIndex - initially pointing to the opening quote of the string. On return, bufferIndex will indicate the first character following the string, or if the string is not properly terminated, the last character in the buffer. @param physLines - the number of physical lines read - used when printing unterminated string error messsages. *******************************************************************/ public static int stripString(char[] buffer, int bufferIndex, int physLines){ if (buffer[bufferIndex] == '\"'){ bufferIndex++; while(bufferIndex