

                            MSC v1.0 User's Guide

                                     ---


Code by Frdric Cheveau. Copyright (C)1998 Frdric Cheveau.
Coded for MOS (Master Operating System v3.0).
First release: 13.02.1998
Last update  : 13.02.1998

This program is CARDWARE. If you find it usefull, please send me a postcard
from your country. Thanks!

   Frdric CHEVEAU
   8 passage des grillons
   66000 Perpignan
   FRANCE.




------------------------------------------------------------------------------

                              Table of Contents


1  - What is MSC ?
2  - Requirements
3  - How to use MSC ?
4  - Commands and Switches
5  - Structure of a Command file
6  - Commands List
7  - Commands Syntax
8  - Commands Description
9  - Errors description list
10 - News for the next version


------------------------------------------------------------------------------

1 - What is MSC ?
------------------
MSC means MOS Source Converter.
It's a program coded for the MOS Graphic Interface which was primary developped
for convert the MOS TP7 sources from the 2.8 version to the 3.0 version.

But by extention, you can convert or modify any text file as you want using
a Batch sequence of instructions.

Just take a look...
You can replace strings or words items, set strings to upper or lower,
insert or delete line using conditions, insert or delete a parameter in
functions in programs sources files as C or C++ code...etc.

The only limit that you have is your imagination!

The MSC package contain a set of command files (just for example):

MSC_D2W.CMD     Convert the DOS texts files to Windows texts files
MSC_W2D.CMD     Convert the Windows texts files to DOS texts files

------------------------------------------------------------------------------

2 - Requirements
-----------------
You must have a PC with DOS 4.0 or highter.
MSC run on a 386 or highter, plus on new processors (of course!).
No special memory configuration required.

------------------------------------------------------------------------------

3 - How to use MSC ?
---------------------
MSC is a DOS program file. You can use it directly on prompt or in a Batch file.
MSC use a DOS syntax with commands and switches.

MSC use a special command file called "MSC.CMD".
This file must be in the current directory to be used by MSC.EXE.
This file contain the commands that will be interpreted by MSC.
MSC work like a compiler. When you run MSC, the MSC.CMD file is opened and
commands are analysed. If an error is found, the MSC process is stopped,
and the error is displayed.

You must have none errors in your command script file to run MSC and convert
your files.
You are able to select a special command file with the optional switch
"/C=<Command File>". This switch select a user command file.
Delault is MSC.CMD.

------------------------------------------------------------------------------

4 - Commands and Switches
--------------------------

Synopsis: MSC <File> /Commands /Switches

Inputfile <File>        : File(s) to be processed
Commands: /?            : Help on MSC commands and switches
          /Author       : More information about the author
Switches: /Nm           : No display messages
          /S            : Recurse subdirectories
          /B            : Create backup file
          /I            : Detailled convertion per file
          /C=<File>     : Use specified command file
Example : MSC *.PAS /I

Note    : Please note that aliases and jockers are supported.
          Commands and switches are not case sensitives.
          Redirection to a file possible with > and >>.
          Support long filenames (Windows and NT OS).

------------------------------------------------------------------------------

5 - Structure of a Command file
--------------------------------
As you see beelow, the command file must begin by the string
"MSC v1.0 Command File". Please note that the case sensitive is important!
Then, you found the tag "[Commands]" that define the real begining of commands.
After this word, you have to put your commands. The end of command is the end
of file. So you have nothing to add to tag the end of commands.

Note: Blank lines are not importants. You can add them as you want without bugs.
Note: You can put comments between the first tag of the file and the
"[Commands]" word.

Example
-------

<----- Begin of the Command file ----->
MSC v1.0 Command File

*****************************************
*** File to test the MSC program v1.0 ***
*****************************************

[Commands]
<Define>  [CaseSensitive] Is [No]
<Skip>    [BlankLines]    Is [Yes]

<Upper>           [Msc]
<ReplaceItem>     [Win] by [Windows]
<DeleteOccurence> [Position] After [1]
<DeleteLines>     [Windows] Size [3]
<InsertBlock>     [   ] pos [1]
Rem <InsertBlock>     [XXX] pos [3]

<Exit>
<----- End of the Command file ----->

------------------------------------------------------------------------------

6 - Commands List
------------------

<Define> [CaseSensitive]
<Skip>   [BlankLines]
<ReplaceString>
<DeleteString>
<ReplaceItem>
<DeleteItem>
<DeleteOccurence> After
<InsertLine> Before
<InsertLine> After
<DeleteLine>
<DeleteLines> Size
<InsertBlock>
<DeleteBlock>
<Upper>
<Lower>
<Midder>
<InsertParam>
<DeleteParam>
<Exit>
<Cls>
<Write>

------------------------------------------------------------------------------

7 - Commands Syntax
--------------------

First: Some of the MSC commands use a source and target string in their
syntax. All the ASCII caracters are authorised to be used in sources or
targets strings except those: '[' ']'. There's no way to use them.

Two: Commands are not case sensitive, but your source or target strings
could be case sensitive is you have the followed command line in your script:
<Define>  [CaseSensitive] Is [Yes]

Three: MSC works like a compiler. So spaces between command's words are
without effects.

Four: You can use the command word 'Rem' to put a command in remark.
The MSC compiler will skip it when the analysis will be made.

Five: A typical command line is builded wity this shape:
<Command> [Source String] Keyword [Target String]
Some of the commands uses only source strings and no keyword.
So the syntax is really variable!

Six: Commands are between '<' and '>'
     Source and target strings are between '[' and ']'
     Keywords are without any additional caracters

------------------------------------------------------------------------------

8 - Commands Description
-------------------------

<Define> [CaseSensitive] is [Yes]
   All the commands after this line will be processed case sensitively.
   Values: Yes(Boolean) or No(Boolean)

<Skip>   [BlankLines] is [Yes]
   All the blank lines encountered in processed files will be skipped.
   Values: Yes(Boolean) or No(Boolean)

<ReplaceString> [Source] by [Target]
   Replace the source string by the target string in processed files.
   Values: Source(String) Target(String)

<DeleteString> [Source]
   Delete all the source strings in processed files.
   Values: Source(String)

<DeleteOccurence> [Source] After [Quantity]
   Delete all the source strings in processed files only if the source
   string has been found more than 'Quantity' times.
   Values: Source(String) and Quantity(Integer)

<DeleteItem> [Source]
   Delete all the source strings in processed files only if the string
   match exactly the source and if it's not a substring or a part of a
   more big string.
   Values: Source(String)

<ReplaceItem> [Source] by [Target]
   Replace all the source strings by target strings in processed files
   only if the string match exactly the source and if it's not a substring
   or a part of a more big string.
   Values: Source(String) and Target(String)

<InsertLine> [InsertString] Before [LocalisationString]
   Insert the 'InsertString' as new line before the 'LocalisationString'
   Values: InsertString(String) and LocalisationString(String)

<InsertLine> [InsertString] After [LocalisationString]
   Insert the 'InsertString' as new line after the 'LocalisationString'
   Values: InsertString(String) and LocalisationString(String)

<DeleteLine> [LocalisationString]
   Delete the line who contain the 'LocalisationString'.
   Values: LocalisationString(String)

<DeleteLines> [LocalisationString] Size [Quantity]
   Search for the line who contain the 'LocalisationString', and delete
   'Quantity' line(s) after this line (including this line).
   Values: LocalisationString(String) and Quatity(Integer)

<InsertBlock> [String] Pos [Position]
   Insert the 'String' in each line of processed's files at the 'Position'.
   Usefull to Indent a Textfile.
   Values: String(String) and Position(Integer)

<DeleteBlock> [Position] Size [Quantity]
   Delete a part of string in each line of processed's files begining
   at the 'Position' with the size 'Quantity'.
   Values: Position(Integer) and Quantity(Integer)

<Upper> [String]
   Set to upper the string 'String'.
   Values: String(String)

<Lower>
   Set to lower the string 'String'.
   Values: String(String)

<Midder>
   Set to lower the string 'String', and set to upper the first character
   of the phrase.
   Values: String(String)

<InsertParam> [Parameter] in [Function] at [Position]
   Insert a new 'Parameter' in the 'Function' at the 'Position'.
   Target: Usefull only for source textfiles (C,C++,PAS).
   Values: Parameter(String), Function(String) and Position(Integer)

<DeleteParam> [Number] in [Function]
   Delete the parameter 'Number' in the 'Function'.
   Target: Usefull only for source textfiles (C,C++,PAS).
   Values: Number(Integer) and Function(String)

<Exit>
   Exit the command file and stop compilation.
   All the following commands before this line will not be compiled.
   Values: None

<Cls>
   Clear screen before to convert a file.
   Values: None

<Write> [String]
   Display a 'String' on screen during the textfile convertion.
   Values: String

------------------------------------------------------------------------------

9 - Errors description list
----------------------------
Here is a list of errors that you could encounter during MSC compilation.

   Error  2:  Command not found:
   Error  3:  Unknown command: <Dekete> [Windows]
   Error  4:  Missing "]" in source string: <Upper> [Msc
   Error  5:  Missing "[" in source string: <Upper> Msc]
   Error  6:  Missing "]" in target string: <ReplaceString> [] by [Msc
   Error  7:  Missing "[" in target string: <ReplaceString> [] by Msc]
   Error  8:  Empty command: <>
   Error  9:  Missing "<" in command: Delete
   Error 10:  Missing ">" in command: Delete
   Error 11:  Swapped markers in command: >   <
   Error 12:  Swapped markers in source string: <Replace> ]Win[ by [Windows]
   Error 13:  Swapped markers in target string: <Replace> [Win] by ]Windows[
   Error 14:  Missing reserved word "is": <Define> [CaseSensitive] [Yes]
   Error 15:  Empty source string
   Error 16:  Empty target string
   Error 17:  Missing reserved word "by": <Replace> [Win] [Window]
   Error 18:  Missing reserved word "in": <InsertParam> [Msc] [Win] at [3]
   Error 19:  Missing reserved word "at": <InsertParam> [Msc] in [Win] [3]
   Error 20:  Negative parameters not allowed: <Insertparam> [L] in [U] at [-1]
   Error 21:  Strings not allowed: <Insertparam> [Msc] in [Win] at [String]
   Error 22:  Missing reserved word "before" or "after": <Insertline> [MSC] [Win]
   Error 23:  Choose "before" or "after" reserved word: <Insertline> [MSC] Before After [Win]
   Error 24:  Missing reserved word "pos": <Insertblock> [{!}] pros [3]
   Error 25:  Missing reserved word "size": <Deleteblock> [3] sizde [10]
   Error 26:  Too many commands loaded
   Error 27:  Missing parameter position
   Error 28:  Missing reserved word "after"
   Error 29:  Defined string too long (Max=64)

------------------------------------------------------------------------------

10 - News for the next version
-------------------------------

* Add the possibility to put '[' and ']' caracters in source and targets strings.

* Add some new commands:
  <ReplaceHexa> [6B97C2008] by [9C00]
  <Define> [KeepJustify] is [Yes]
  <Define> [ParametersSeparator] is [,]
  <SetRem> [{] at [60]
