ICMAKE Part 2

In part 1, Brokken and Kubat explained where the ideas for icmake came from, the basics of the program and where you can get a copy. In Part 2 we cover the grammar of icmake source files. The final part of this article will appear next month and will show examples of the use of icmake.
4.4.4. Expressions and operators

Icmake allows a large number of operators to form or combine expressions. Binary operators may be used with the following operand-types:

operand-types

  1. Each binary operator must be used with two variables or constants of the same type, e.g., the addition of an int and a string is not allowed; icmake performs no default type casting.

  2. Some operators may not be used with some types, e.g., string subtraction is not allowed, but string addition is.

  3. The operators have a certain priority; some operators are evaluated before others. The priority of operators is identical to the priority used by C.

The binary operators recognized by icmake are summarized in the following table:

binary operators

All binary operators with the exception of the assignment operators are left-associative. The assignment operators are right-associative. The operators at the top of the table have the lowest priority; those at the bottom have the highest priority. Operators with different priority are separated by lines.

The unary operators are summarized in the following table. The unary operators have higher priority than binary operators and are right-associative. The exception is the expression-nesting operator, which surrounds an expression and does not associate.

unary operators

4.4.4.1. Logical operators

Icmake recognizes three logical operators: the logical and (&&), the logical or (||) and the logical not (!). These operators can be used to combine or reverse logical expressions.

The logical not operator reverses the logical outcome of an expression. The logical and operator and the logical or operator group conditions. Icmake evaluates a combined condition using these operators until the outcome of the condition is determined, in analogy to C:

  1. In the condition (c1 && c2), c2 is not evaluated if c1 yields zero, since when c1 yields zero the combined condition can only fail. Therefore, c2 is evaluated only if c1 yields not zero.

  2. In the condition (c1 || c2), c2 is not evaluated if c1 yields not zero, since when c1 yields not zero the combined condition can only succeed. Therefore, c2 is only evaluated if c1 yields zero.

Logical operators may be used with any type of expression. An int constant or variable yields its integer representation. A string constant or variable yields not zero when the length of the string is non-zero; e.g., string “a” yields not zero.

A list or variable yields not zero when the number of strings in the list is not zero, e.g., in the following code fragment the making process is stopped when no files with extension “.c” are found:

list

to be continued...

Look for part 3 of 4 of the IC Make Article in the next issue of Linux Journal.

______________________

Webcast
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers

Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.

Learn More

Sponsored by AMD

White Paper
Red Hat White Paper: Using an Open Source Framework to Catch the Bad Guy

Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6

Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.

Learn more about catching the bad guy in this free white paper.

Learn More

Sponsored by DLT Solutions