Can you exit out of a .RAV file early? i.e. If some shape is NOT found we currently report that error (and add a DRC in the center) but then we do NOT want to continue the rest of the file. This is usually because the rest of the file will add more erroneous DRC markers and we just want to quit and tell the designer to fix the shape first.
The Ravel programming language is built around a different paradigm than procedural programming languages. You will therefore not find explicit control flow operators such as 'if' in it. This is by design, and there are other ways of achieving the same result.
If you have a relational expression, and you feed it an empty relation, the result will be an empty relation. All relational operators have the property that if they are given empty relations as input (relations of size zero), they perform no work and an empty relation comes out. This means that if the result of a selection is empty, any other code that that result is fed into will not produce a result -- on the other hand, the inverse of the selection will. To take a concrete example, let us say that we have a constraint value that if greater than zero indicates to include something additional in the check:
(constraint CHECK_FOO 1)(define step_x (select (...) R (and ... (greaterp (value CHECK_FOO) 0) ...)))(define step_y ... step_x ...)
In the above, step_y will only be performed if the result of step_x is a non-empty relation, and step_x requires the constraint value CHECK_FOO to be positive in order to select anything. If something else should happen when CHECK_FOO is zero, one can either select for it, or take the difference if it fits better:
(define step_z ... (difference R step_x) ...)
The condition on which to branch need not be a constraint value, of course, but can be the value of a parameter or design property, or based on the presence of a design object, etc.
In your case you already have an empty relation that may or may not hold a shape, and conditional on its presence you want to evaluate some other code. An easy way to propagate the "emptiness" of this relation, in case the shape is absent, is to combine this relation with another one. The result of a combination where one of the inputs is empty is always empty, so the combination will only be non-empty if the shape is present:
;; This relation is empty if the shape is not present.(define myshape ...)(define R_if_shape_present (PAIR_1 (combine R myshape)))
Instead of the PAIR_1 macro from Ravel Standard Library, you can use a transform to remove the tuple constituent added by the combination.
Note that if the rest of the code naturally depends on the relation holding the shape, it will automatically reduce to a no-op if the shape is not present. Only if the code does not depend on the shape itself would you have to introduce the dependency as I outline above.