Converting Events to Low-Level Syntax

[This is preliminary documentation and subject to change.]

You can write stream compiler language statements in either high-level syntax or low-level syntax. Writing the stream in high-level syntax enables you to compactly specify multiaction events. This makes the stream easier to create and read. If, however, you use ipsend to transmit the events ipsend transmits the events as low-level events. Because of this, you should convert the stream to low-level syntax before you transmit it.

Converting a stream to low-level syntax breaks each compound event into its constituent events. For example, the following stream uses high-level syntax to indicate that two files and their dependencies should be broadcast and that the second file, Second.htm, should be broadcast repeatedly for the first thirty minutes of the show.

before 00:00:20.00 "First.htm"; 
00:00:21.00 "Second.htm repeat 300 until 1800;
 

When this statement is converted to low-level syntax, it is broken into the following set of events, assuming that the red.gif, green.gif, and yellow.gif files are dependencies of the First.htm file:

00:00:04.98 "yellow.gif" only Group "7865584";
00:00:09.98 "green.gif" only Group "7865584";
00:00:14.99 "red.gif" only Group "7865584";
before 00:00:20.00 "First.htm" only depends("red.gif" "green.gif" "yellow.gif") Group "7865584,head";
00:00:21.00 "Second.htm" only Group "7865712,head";
before 00:05:21.00 "Second.htm" only Group "7865712";
before 00:10:21.00 "Second.htm" only Group "7865712";
before 00:15:21.00 "Second.htm" only Group "7865712";
before 00:20:21.00 "Second.htm" only Group "7865712";
before 00:25:21.00 "Second.htm" only Group "7865712";
 

Note  The Group and depend microevents in the low-level version of the stream are added by the stream compiler objects when the stream is converted to low-level syntax. These microevents store information that enables the stream compiler objects to reassemble the stream into high-level format.

To convert an enhancement stream from high-level syntax to low-level syntax, your application can call EnhEvents.Flatten. The EnhEvents.UnFlatten method reverses the process, converting a previously-flattened stream back into its original high-level syntax.

Note that UnFlatten uses the Group values when rebuilding the events. If your application alters or changes these values, the UnFlatten method may fail or produce unexpected results.

For example, the following loads an enhancement stream from the file EnhStr.txt, converts the stream to low-level syntax, and then saves the low-level stream to the file EnhStrFlat.txt.

Dim evs As IEnhEvents
Set evs = New EnhEvents
evs.Load("C:\EnhTools\EnhStr.txt")
evs.Flatten
evs.Store("C:\EnhTools\EnhStrFlat.txt")
 

Note  The Group information that the stream compiler objects use to re-assemble flattened streams is based on handle values and is not guaranteed to be unique if the stream is stored and then reloaded. Because of this, you should avoid unflattening streams loaded from a file.

In addition to converting the entire stream to low-level syntax you can convert a single event in the stream. To do this use the EnhEvent.Flatten method. Use this method instead of EnhEvents.Flatten when you only need to convert a single event. For example, if you wanted the stream compiler objects to generate a dependency list for a single event in the stream, you could use EnhEvent.Flatten and save the processing overhead of converting the entire stream.

To convert a single event back into high-level syntax, use EnhEvent.UnFlatten. This causes all events that were part of the original, high-level, event to be recombined into a single event. In other words, all events that have the same Group number as the event on which you called UnFlatten are converted back into a single high-level event.

Because EnhEvent.UnFlatten uses the Group information to rebuild the event, your application should not alter this information. If it does, UnFlatten may fail or produce unexpected results.

You can only call EnhEvent.Flatten and EnhEvent.UnFlatten for events that are part of an enhancement stream. Calling these methods on events that are not part of the enhancement stream causes the methods to return an error.