MAWK-CODE(7) | Miscellaneous | MAWK-CODE(7) |
mawk-code - dumping mawk's byte-code
At startup, mawk compiles the script into byte-code. After that, it interprets the compiled byte-code. Use the -Wdump option to show the byte-code.
As mawk executes the program, it maintains a reference to the command to execute in cdp. After that there may be data and/or references in cdp[0], cdp[1], etc.
When an operation requires operands, mawk pushes the values (or array/string references) onto the stack, which updates the stack pointer sp. When the operation completes, mawk consumes those entries on the stack, pushing the result (if any) onto the stack.
While executing user-defined functions, mawk maintains a frame pointer fp to address the function's local variables.
Concatenate array-indices.
Usage:
Parameters:
Delete an array item.
Usage:
Parameters:
Find the length of an array.
Usage:
Parameters:
Returns the length of the array in sp[0].
Push array address onto stack.
Usage:
Parameters:
Returns the array in sp[0].
Test if an expression is present in an array.
Usage:
Parameters:
Returns 1 in sp[0] if the expression is found, 0 otherwise.
Add two numbers.
Usage:
Parameters:
Returns the sum in sp[0].
Combined addition/assignment.
Usage:
Parameters:
Stores the sum in the target, leaving sp[0] pointing to the target.
Push reference to array cell, given expression for its index.
Usage:
Parameters:
Returns a reference to the addressed cell in sp[0].
Push contents of array cell, given expression for its index.
Usage:
Parameters:
Returns contents of the addressed cell in sp[0].
Update reference to next cell for array loop.
Usage:
Parameters:
Mawk maintains a stack of array-loop state. It updates the array/cell references in the current loop's state.
Assigns a value.
Usage:
Parameters:
Compute arc-tangent of two values.
Usage:
Parameters:
Returns the result in sp[0].
Call a function.
Usage:
Parameters:
Returns function value in sp[0].
Concatenate two strings.
Usage:
Parameters:
Returns the result in sp[0].
Close the file or pipe associated with an expression.
Usage:
Parameters:
Returns the status from closing the file, 0 on success or -1 on failure.
Compute the cosine of a value in radians.
Usage:
Parameters:
Returns the result in sp[0].
Delete an array.
Usage:
Parameters:
Divide one number by another.
Usage:
Parameters:
Returns the quotient in sp[0].
Combined division/assignment.
Usage:
Parameters:
Stores the quotient in the target, leaving sp[0] pointing to the target.
Compare two values.
Usage:
Parameters:
Returns 1 in sp[0] if the values are equal, otherwise 0.
Exits mawk with a specific exit-code.
Usage:
Parameters:
Exits mawk with success
Usage:
Parameters:
Compute base-e exponential function of a value.
Usage:
Parameters:
Returns the result in sp[0].
Combination addition/assignment to NF.
Usage:
Parameters:
Assign an expression to NF.
Usage:
Parameters:
Combination division/assignment to NF.
Usage:
Parameters:
Combination modulus/assignment to NF.
Usage:
Parameters:
Combination multiplication/assignment to NF.
Usage:
Parameters:
Post-decrement using NF.
Usage:
Parameters:
Post-increment using NF.
Usage:
Parameters:
Exponentiation using NF.
Usage:
Parameters:
Predecrement using NF.
Usage:
Parameters:
Preincrement using NF.
Usage:
Parameters:
Push array reference to data split-up as fields..
Usage:
Parameters:
Returns the resulting array reference in sp[0].
Push contents of numbered field.
Usage:
Parameters:
Returns the field's value in sp[0].
Combination subtraction/assignment to NF.
Usage:
Parameters:
Push reference to numbered field.
Usage:
Parameters:
Returns a reference to the field in sp[0].
Push content of numbered field.
Usage:
Parameters:
Returns the field's content in sp[0].
Flush the output file or pipe associated with an expression.
Usage:
Parameters:
Returns the result in sp[0].
Test if first value is greater than the second.
Usage:
Parameters:
Returns 1 in sp[0] if the first value is greater than, otherwise 0.
Test if first value is greater than or equal to the second.
Usage:
Parameters:
Returns 1 in sp[0] if the first value is greater than or equal, otherwise 0.
Find the position of the second string in the first.
Usage:
Parameters:
Returns the position in sp[0] starting at 1 if found, 0 if not found.
Returns a value truncated towards zero..
Usage:
Parameters:
Returns the result in sp[0].
Go from BEGIN code to MAIN code.
Usage:
Parameters:
Jump to a new byte-code position, by a given number of bytes.
Usage:
Parameters:
Jump to a new byte-code position if sp[0] is nonzero, by a given number of bytes.
Usage:
Parameters:
Jump to a new byte-code position if sp[0] is zero, by a given number of bytes.
Usage:
Parameters:
Push a local address onto the evaluation stack.
Usage:
Parameters:
Returns the address in sp[0].
Push contents of a local variable onto the evaluation stack.
Usage:
Parameters:
Returns the contents of the local variable in sp[0].
Pushes a reference to an array onto the evaluation stack.
Usage:
Parameters:
Returns a reference to the array in sp[0].
Pushes a reference to a given array cell onto the evaluation stack.
Usage:
Parameters:
Returns a reference to the specified array cell in sp[0].
Pushes the contents of a given array cell onto the evaluation stack.
Usage:
Parameters:
Returns the contents of the specified array cell in sp[0].
Returns the length of a string or array value.
Usage:
Parameters:
Returns the length in sp[0].
Special jump for logical-OR, always preceded by test.
Usage:
Parameters:
Special jump for logical-OR, always preceded by test.
Usage:
Parameters:
Compute the natural logarithm of a value.
Usage:
Parameters:
Returns the result in sp[0].
Test if first value is less than the second.
Usage:
Parameters:
Returns 1 in sp[0] if the first value is less than, otherwise 0.
Test if first value is less than or equal to the second.
Usage:
Parameters:
Returns 1 in sp[0] if the first value is less than or equal, otherwise 0.
Test if $0 matches a given regular expression.
Usage:
Parameters:
Returns 1 in sp[0] if $0 matches the regular expression, 0 otherwise.
Test if a given expression matches a given regular expression.
Usage:
Parameters:
Returns 1 in sp[0] if the expression matches the regular expression, 0 otherwise.
Test if an expression in sp[-1] matches the regular expression in sp[0].
Usage:
Parameters:
Returns 1 in sp[0] if the expression matches the regular expression, 0 otherwise.
Converts a date specification in systime format to a timestamp.
Usage:
Parameters:
Returns the result in sp[0].
Compute modulus/remainder with two operands.
Usage:
Parameters:
Returns the remainder in sp[0].
Assign modulus/remainder with two operands.
Usage:
Parameters:
Returns the remainder in sp[0] as well as replacing the first value.
Compute product with two operands.
Usage:
Parameters:
Returns the product in sp[0].
Assign product with two operands.
Usage:
Parameters:
Returns the product in sp[0] as well as replacing the first value.
Compare two values.
Usage:
Parameters:
Returns 1 in sp[0] if the values are not equal, otherwise 0.
Read the next record, restart pattern testing.
Usage:
Parameters:
Begin processing the next file listed on the command line.
Usage:
Parameters:
Push the number of fields (NF) onto the evaluation stack.
Usage:
Parameters:
Compute a logical negation.
Usage:
Parameters:
Returns the result on the evaluation stack, i.e., 0 if the value is nonzero and 1 otherwise.
Read into $0 using getline.
Usage:
Parameters:
Read into $0 using getline, updating NR and FNR.
Usage:
Parameters:
Start executing the main section of the script (between BEGIN and END).
Usage:
Parameters:
Pop the evaluation stack, discarding the value.
Usage:
Parameters:
Finish an array “in” loop, deallocating the state information.
Usage:
Parameters:
Post-decrement a value.
Usage:
Parameters:
Returns the updated value in sp[0].
Post-increment a value.
Usage:
Parameters:
Returns the updated value in sp[0].
Compute the first value raised to the power of the second value.
Usage:
Parameters:
Returns the result in sp[0].
Assign the first value raised to the power of the second value.
Usage:
Parameters:
Pre-decrement a value.
Usage:
Parameters:
Returns the updated value in sp[0];.
Pre-increment a value.
Usage:
Parameters:
Returns the updated value in sp[0];.
Push array address onto stack.
Usage:
Parameters:
Returns the array in sp[0].
Push a data cell onto the evaluation stack.
Usage:
Parameters:
Returns a reference to the result in sp[0].
Push a double floating value onto the evaluation stack.
Usage:
Parameters:
Returns a reference to the result in sp[0].
Push contents of next referenced variable onto the evaluation stack.
Usage:
Parameters:
Returns a reference to the result in sp[0].
Reserve the next slot on the evaluation stack, setting its type.
Usage:
Parameters:
Returns a reference to the result in sp[0].
Push a reference to a string value onto the evaluation stack.
Usage:
Parameters:
Returns a reference to the result in sp[0].
Returns a random number between zero and one..
Usage:
Parameters:
Returns the result in sp[0].
Test a range pattern: pat1, pat2 { action }.
Usage:
Parameters:
Return a function value.
Usage:
Parameters:
When calling a function, mawk saves the current stack, creating a new one. On return, mawk restores the previous stack and returns the function value in sp[0].
Return from a function without providing a return-value.
Usage:
Parameters:
As in the ret operation, mawk restores the previous stack. After the return, sp[0] is an uninitialized value.
Begin an array “in” loop.
Usage:
Parameters:
Mawk pushes a new entry onto the array loop stack, and updates cdp to point to the statement to execute.
Compute the sine of a value in radians.
Usage:
Parameters:
Returns the result in sp[0].
Returns a string constructed from expression-list according to format.
Usage:
Parameters:
Returns the square root of a value.
Usage:
Parameters:
Returns the result in sp[0].
Seeds the random number generator.
Usage:
Parameters:
Returns the previous seed value in sp[0].
Finish a range pattern.
Usage:
Parameters:
Formats the given timestamp using the given format.
Usage:
Parameters:
Zero to three parameters may be on the stack. If all three are used, they are as follows:
Returns the result in sp[0].
Subtract the second value from the first.
Usage:
Parameters:
Assign the difference of two values to a variable.
Usage:
Parameters:
Stores the difference in the target, leaving sp[0] pointing to the target.
eturns the substring of string s, starting at index i, of length n.
Usage:
Parameters:
Executes a command, returning the wait-status.
Usage:
Parameters:
Returns the wait-status in sp[0].
Returns the current time of day as the number of seconds since the Epoch.
Usage:
Parameters:
Returns the result in sp[0].
Test a logical expression.
Usage:
Parameters:
Returns the result on the evaluation stack, i.e., 1 if the value is nonzero and 0 otherwise.
Copy a string, converting to lowercase.
Usage:
Parameters:
Returns the result in sp[0].
Copy a string, converting to uppercase.
Usage:
Parameters:
Returns the result in sp[0].
Unitary minus.
Usage:
Parameters:
Returns the result in sp[0].
Unitary plus.
Usage:
Parameters:
Returns the result in sp[0].
mandatory jump
optional (undesirable) jump
optional (desirable) jump
pop pos'n, optional jump if advanced
end of match
arbitrary character (.)
character class
end of string ($)
push position onto stack
start of string (^)
matching a literal string
arbitrary string (.*)
2024-01-23 | Version 1.3.4 |