View Javadoc
1   package org.sentrysoftware.jawk.jrt;
2   
3   /*-
4    * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5    * Jawk
6    * ჻჻჻჻჻჻
7    * Copyright (C) 2006 - 2023 Sentry Software
8    * ჻჻჻჻჻჻
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
23   */
24  
25  /**
26   * The AWK Variable Manager.
27   * It provides getter/setter methods for global AWK variables.
28   * Its purpose is to expose a variable management interface to
29   * the JRT, even though the implementation is provided by
30   * the AWK script at script compile-time.
31   * <p>
32   * The getters/setters here do not access <strong>all</strong>
33   * special AWK variables, such as <code>RSTART</code>
34   * and <code>ENVIRON</code>. That's because these variables
35   * are not referred to within the JRT.
36   *
37   * @see JRT
38   * @author Danny Daglas
39   */
40  public interface VariableManager {
41  
42  	/**
43  	 * <p>getARGC.</p>
44  	 *
45  	 * @return the contents of the ARGC variable.
46  	 */
47  	Object getARGC();
48  
49  	/**
50  	 * <p>getARGV.</p>
51  	 *
52  	 * @return the contents of the ARGV variable.
53  	 */
54  	Object getARGV();
55  
56  	/**
57  	 * <p>getCONVFMT.</p>
58  	 *
59  	 * @return the contents of the CONVFMT variable.
60  	 */
61  	Object getCONVFMT();
62  
63  	/**
64  	 * <p>getFS.</p>
65  	 * 
66  	 * @return the contents of the FS variable.
67  	 */
68  	Object getFS();
69  
70  	/**
71  	 * <p>getRS.</p>
72  	 *
73  	 * @return the contents of the RS variable.
74  	 */
75  	Object getRS();
76  
77  	/**
78  	 * <p>getOFS.</p>
79  	 *
80  	 * @return the contents of the OFS variable.
81  	 */
82  	Object getOFS();
83  
84  	/**
85  	 * <p>getORS.</p>
86  	 *
87  	 * @return the contents of the ORS variable.
88  	 */
89  	Object getORS();
90  
91  	/**
92  	 * <p>getSUBSEP.</p>
93  	 *
94  	 * @return the contents of the SUBSEP variable.
95  	 */
96  	Object getSUBSEP();
97  
98  	/**
99  	 * Set the contents of the FILENAME variable.
100 	 *
101 	 * @param fileName File name
102 	 */
103 	void setFILENAME(String fileName);
104 
105 	/**
106 	 * Set the contents of the NF variable.
107 	 *
108 	 * @param newNf Value for NF
109 	 */
110 	void setNF(Integer newNf);
111 
112 	/**
113 	 * Increases the NR variable by 1.
114 	 */
115 	void incNR();
116 
117 	/**
118 	 * Increases the FNR variable by 1.
119 	 */
120 	void incFNR();
121 
122 	/**
123 	 * Resets the FNR variable to 0.
124 	 */
125 	void resetFNR();
126 
127 	/**
128 	 * Set the contents of a user-defined AWK
129 	 * variable. Used when processing
130 	 * <em>name=value</em> command-line arguments
131 	 * (either via -v or via ARGV).
132 	 *
133 	 * @param name The AWK variable name.
134 	 * @param value The new contents of the variable.
135 	 */
136 	void assignVariable(String name, Object value);
137 
138 }