Home   News   Product   Order   Forum   Feedback   Partner   Profile © Neatware 2000
Neatware Syntax
Search
Command, Substitution, Grouping
Home : Last Update: Thu Jul 06 16:04:09 2000
  1. Variable

    The syntax of Media Control Language (MCL) is similar to the Tcl. A variable is represented as a case sensitive string. It can be used anywhere without declaring its type. It can also be assigned a value. Furthermore a variable value can be accessed by substitution.

  2. Command

    A MCL command syntax is

    	command argument1 argument2 ... 
    where command is a buildin or a defined procedure in the MCL. Spaces separate a command name and its arguments in a line. Newline and semicolons are command terminators. Each command has a return value. To evaluate a command, interprter substitutes command arguments from left to right, which makes a single passing substitution, and then executes the command.

    Commands are catalogied as regular and block.

    • Regular Command

      Regular command has a typical command syntax. Its number of argument is unlimited. There are no implict relatioship between two regular commands. It is possible to define a new command and its arguments with proc. For example, the regular command set assigns a value to a variable.

      	set var value 

    • Block Command

      Block command may specify a scope of the commands. The start command is the beginning of a block command. MCL represents the satrt command name with the underscore prefix as _command argument. A start command has only one argument. The end command is the end of a block command. The command name has the underscore postfix as command_. An end command has no arguments. A start command may have no corresponding end command. Commands in between the start and end commands are called content.

      An argument is a list of attributes. Attribute is a key/value pairs separated by whitespace. A pair has the format key=value where key must be a character string (includes letters, digits, hypen, period, and underscore). The value may be any of strings or variables (except the = character). So a value can be a string with spaces. A key that a start command can not recognize will be ignored. And a key will be assigned to its default value when it is not be assigned in the start command.

      Start and end block commands provide the context of a defined object such as video. After the execution of the _video command, the video is supposed to be opened until video_ command closes it. In the following example, the code opens a neat.mpg video, play and close it.

      	_video "name=neat.mpg"
      	  _play
      	video_
      

    • Query Command

      Query command has a form ?command argument. It has only one argument. Usually the command name is an object. The argument specifies the info key of the object. For example, "?window width" command returns the value of the window's width.

      	?window width 

    • Execute Command

      Execute command has a form !command argument. It has only one argument. Typically the command name is an object. The argument specifies the object attributes that will be changed. Following code changes window's title and orginal point.

      	!window {title=New Title Name orgx=100 orgy=200} 

  3. Substitution

    Dollar sign $ enables variable substitution. It replaces the variable with its value. ${variable} will be useful to distinguish from other special characters.

    	set x $variable 
    Square brackets [ ] enable command substitution. A command must be inside the brackets. After evaluation of the command, the return value will replace the square bracket string. The brackets maybe nested. Following command returns the title of a window.
    	[?window title] 
    Backslash \ enables next character substitution. The next character or group after the backslash will be replaced by a new representation of the character. Usually backslash \ is widely used to quote a specific character. For example, the " inside a pair of "" should be substituted by \".
    	"inside double quote \" "
    	"newline \n and tab \t "

  4. Grouping

    Double quote " " enable inside string substitution. The " character inside the double quote must be disabled with the backslash \" quoting. The grouping value of double quotes is the string inside after substitution.

    	"dobule quote enable variable substitution {$variable} 
    	 and command substitution [clock seconds]" 
    Curly braces { } disable substitution inside. All the characters include whitespace, double quotes, even nested curly braces (exclude outmost curly braces) are value of the group. When curly braces are inside the double quote, they will not work as grouping.
    	{curly braces disable variable substitution {$variable} 
    	 and command substitution [clock seconds]} 

    << Introduction         Control >>

Home : Last Update: Thu Jul 06 16:04:09 2000
Search
Command, Substitution, Grouping
Neatware Syntax
Home   News   Product   Order   Forum   Feedback   Partner   Profile © Neatware 2000