home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
SOUR
/
MXMNU239.EXE
/
NOVTRANS.MNU
< prev
next >
Wrap
Text File
|
1992-06-22
|
14KB
|
415 lines
Comment
========================================================================
Novell menu to MarxMenu Translator:
Copyright 1989-92 by Marc Perkel * All rights reserved.
Usage: MARXMENU NOVTRANS <novell menu>
This program was written to translate Novell menus to MarxMenus. It is
not an exact translation, but does the bulk of the work. It is up to you
to edit the output file and tune the menu the way you want.
I have made no attempt to copy color information. I am not presenting
selections in sorted order, but in the order in which they are defined.
The program creates a MarxMenu file names <menu>.TMP where <menu> is the
name of your Novell menu file. Then it compiles <menu>.TMP into
<menu>.MRX file that should be ready to run. if the menu needs to be
altered, you will have to rename the <menu>.TMP file to a MNU file and
then you can work with it like any other MarxMenu source file.
========================================================================
EndComment
Var
Menus MenuPtr CommandPtr LinePtr ThisMenu ThisChoice
BoxDim VarNum PromptLine Out Cap InputAVar NovellFileName
MarxMenuFileName NovellTempFileName Greek Titles NovLines
;----- Translator Messages
Const
TopMessage = "Joe Blow's Master Menu"
BottomMessage = "*-<< Acme Manufacturing Company >>-*"
;----- If you want the Greek Column effect, set to true
Greek = False
Qualifier MenuName MenuTitle YPos XPos MenuColor MenuChoices
Qualifier ChoiceName ChoiceCmd
Comment
========================================================================
This is the main body of the NovTrans Program.
========================================================================
EndComment
if not NetWorkVersion
ClearScreen
Writeln
Writeln 'This translator requires the network version of MarxMenu to Run!'
endif
PreAmble
PrepareFiles
Header
Parse
WriteOutMenus
Footer
ClearScreenFirst Off
Writeln
Execute 'MARXCOMP.EXE ' + MarxMenuFileName
Writeln
Writeln 'To test your menu type MARX ' NovellFileName '. When you are satisfied with'
Writeln 'the translation, replace the Novell ' NovellFileName '.MNU file'
Writeln 'with the ' MarxMenuFileName ' file that NovTrans just created.'
Comment
=====================================
Subroutine area.
=====================================
EndComment
;----- Initilize Variables and Environment
Procedure PreAmble
ClearScreenOnExit Off
StandardIO
Writeln
NovellFileName = UpperCase(ParamStr(2))
Usage
EndProc
;----- Proper Usage Procedure
Procedure Usage
if NovellFileName = ''
Writeln('Usage: MarxMenu NovTrans <menu>')
Writeln('Converts Novell menus to MarxMenus.')
Writeln('Be sure to backup your original menus before running!!')
ExitMenu
endif
EndProc
;----- Create FileNames and open Files
Procedure PrepareFiles
if pos('.',NovellFileName) > 0
NovellFileName = left(NovellFileName,pred(pos('.',NovellFileName)))
endif
NovellTempFileName = NovellFileName + '.MNU'
MarxMenuFileName = ForceExtension(NovellTempFileName,'TMP')
ReadTextFile(NovellTempFileName,NovLines)
Writeln 'Creating ' MarxMenuFileName
FileAssign(Out,MarxMenuFileName)
FileCreate(Out)
EndProc
Procedure BlankLine
FileWriteln(Out,'')
EndProc
;----- Write out the MarxMenu Source Header
Procedure Header
BlankLine
FileWriteln(Out,'Comment')
FileWriteln(Out,'==========================================================')
BlankLine
FileWriteln(Out,'This File was converted from Novell Menu: ',NovellTempFileName)
BlankLine
FileWriteln(Out,'It should behave in a similar way to the original menu but')
FileWriteln(Out,'not necessarilly exactly the same. It will be close enough')
FileWriteln(Out,'for you to fine tune it the way you want.')
BlankLine
FileWriteln(Out,'To add a choice to a menu simply use the AddChoice command')
FileWriteln(Out,'then add the appropiate Onkey statement.')
FileWriteln(Out,'The menu will make the size adjustments accordinaly.')
BlankLine
FileWriteln(Out,' Example:')
FileWriteln(Out,' AddChoice("Print Console",10)')
FileWriteln(Out,' ... ')
FileWriteln(Out,' ... ')
FileWriteln(Out,' OnKey Task(10)')
FileWriteln(Out,' cd \public')
FileWriteln(Out,' PConsole')
FileWriteln(Out,' ...')
BlankLine
FileWriteln(Out,"If you want to change the menu's center, pass the XY")
FileWriteln(Out,"coordinates to menu's CenterStretchBox procedure.")
BlankLine
FileWriteln(Out,' Example:')
FileWriteln(Out,' CenterStretchBox("Menu Header",40,12)')
BlankLine
FileWriteln(Out,'This will cause the menu to center at Col 40, Row 12')
BlankLine
FileWriteln(Out,'Instead of defining the center of the box, there is a command')
FileWriteln(Out,'CornerStretchBox where the box grows down and right.')
BlankLine
FileWriteln(Out,' Example:')
FileWriteln(Out,' CornerStretchBox("Menu Header",8,6)')
BlankLine
FileWriteln(Out,'Once you are satisfied with the translation you can copy the TMP file')
FileWriteln(Out,'over the old Novell MNU file and just work with the MarxMenu version.')
BlankLine
FileWriteln(Out,'To control custom features, edit CUSTOM.INC and other INCLUDE Files.')
BlankLine
FileWriteln(Out,'=========================================================')
FileWriteln(Out,'EndComment')
BlankLine
FileWriteln(Out,';----- Create Variables')
BlankLine
FileWriteln(Out,'var')
FileWriteln(Out,' %NovVar1')
FileWriteln(Out,' %NovVar2')
FileWriteln(Out,' %NovVar3')
FileWriteln(Out,' %NovVar4')
FileWriteln(Out,' %NovVar5')
FileWriteln(Out,' %NovVar6')
FileWriteln(Out,' %NovVar7')
FileWriteln(Out,' %NovVar8')
FileWriteln(Out,' %NovVar9')
FileWriteln(Out,' %NovVar10')
FileWriteln(Out,' KeepUsersInMenu')
BlankLine
BlankLine
FileWriteln(Out,';----- Here is where you add you own menu title and status line message')
BlankLine
FileWriteln(Out,'MenuTitle = "',TopMessage,'"')
FileWriteln(Out,'StatusLineText = "',BottomMessage,'"')
BlankLine
FileWriteln(Out,';----- Load Novell look and feel routines')
BlankLine
FileWriteln(Out,'Include "CUSTOM.INC"')
if Greek then FileWriteln(Out,'Greek = True')
BlankLine
FileWriteln(Out,'KeepUsersInMenu Off ;Change to On to keep users in menu.')
BlankLine
FileWriteln(Out,'Comment')
FileWriteln(Out,'=================================')
BlankLine
FileWriteln(Out,'MarxMenu is capable of software metering. This means that it can')
FileWriteln(Out,'limit the number of users of an application to a fixed amount.')
BlankLine
FileWriteln(Out,' OnKey Task (2)')
FileWriteln(Out," |if Limit('LOTUS',6) then Return ;limit Lotus to 6 Users")
FileWriteln(Out,' CD \PUBLIC\LOTUS')
FileWriteln(Out,' 123')
BlankLine
FileWriteln(Out,'Read the METER.INC file for more details.')
BlankLine
FileWriteln(Out,'=================================')
FileWriteln(Out,'EndComment')
BlankLine
FileWriteln(Out,"Include 'METER.INC' ;Software Metering")
BlankLine
FileWriteln(Out,'Comment')
FileWriteln(Out,'=================================')
BlankLine
FileWriteln(Out,'In order to add menu choices conditionally you would append the')
FileWriteln(Out,'choices to the end of the array after all the default choices')
FileWriteln(Out,'are set. For Example:')
BlankLine
FileWriteln(Out,' if InGroup("ACCOUNTING")')
FileWriteln(Out,' AddChoice("Payroll Menu",10)')
FileWriteln(Out,' endif')
BlankLine
FileWriteln(Out,'Here is where menus are created.')
BlankLine
FileWriteln(Out,'=================================')
FileWriteln(Out,'EndComment')
BlankLine
FileFlush(Out);
EndProc
;----- Write out the MarxMenu Source Footer
Procedure Footer
BlankLine
FileWriteln(Out,';----- End of Menu')
FileClose(Out)
EndProc
;----- Preprocess Lines
Procedure Parse
Var ChoicePtr TotalLines X St St2
TotalLines = NumberOfElements(NovLines)
Writeln('Parsing Novell Menu source code ...')
MenuPtr = 0
loop(TotalLines)
if (LoopIndex Mod 10 = 0) or (LoopIndex = TotalLines)
Write Cr
Write('Processing Line # ',LoopIndex,' of ',TotalLines)
endif
if left(NovLines[LoopIndex],1) = '%'
ChoicePtr = 0
CommandPtr = 0
MenuPtr = MenuPtr + 1
Actual ThisMenu = Loc Menus[MenuPtr]
St = mid(NovLines[LoopIndex],2,255)
X = pos(',',St)
if X = 0 then X = succ(Length(St))
ThisMenu.MenuTitle = left(St,X - 1)
Trim(ThisMenu.MenuTitle)
AppendArray(Titles,UpperCase(ThisMenu.MenuTitle))
delete(St,1,X)
St2 = ' '
if MenuPtr < 10 then St2 = St2 + ' '
ThisMenu.MenuName = 'Menu' + Str(MenuPtr) + St2 + '{' + ThisMenu.MenuTitle + '}'
ThisMenu.YPos = value(NextWord(St))
ThisMenu.XPos = value(NextWord(St))
ThisMenu.MenuColor = value(NextWord(St))
else
if left(NovLines[LoopIndex],1) > ' '
CommandPtr = 0
ChoicePtr = ChoicePtr + 1
Trim(NovLines[LoopIndex])
if Mid(NovLines[LoopIndex], 2, 1) = '.'
Delete(NovLines[LoopIndex],1,2)
Trim(NovLines[LoopIndex])
endif
;----- Get rid of multiple spaces
while pos(' ',NovLines[LoopIndex]) > 0
delete(NovLines[LoopIndex],pos(' ',NovLines[LoopIndex]),1)
endwhile
;----- Get rid of double quotes
while pos('"',NovLines[LoopIndex]) > 0
delete(NovLines[LoopIndex],pos('"',NovLines[LoopIndex]),1)
endwhile
ThisMenu.MenuChoices[ChoicePtr].ChoiceName = NovLines[LoopIndex]
else
if NovLines[LoopIndex] > ''
if ChoicePtr = 0
Writeln
Writeln 'Error in menu line: ' LoopIndex
ExitMenu
endif
CommandPtr = CommandPtr + 1
ThisMenu.MenuChoices[ChoicePtr].ChoiceCmd[CommandPtr] = NovLines[LoopIndex]
endif
endif
endif
endloop
EndProc
;----- Create the Menu Choices Array
Procedure WriteOutMenuChoices
Writeln
Write('Translating: ' + ThisMenu.MenuName + ' ... ')
BlankLine
FileWriteln(Out,';----- Translating: ' + ThisMenu.MenuTitle)
BlankLine
if MenuPtr > 1
FileWriteln(Out,':',ThisMenu.MenuName)
BlankLine
endif
loop ThisMenu.MenuChoices
FileWriteln(Out,' AddChoice("' + ThisMenu.MenuChoices[LoopIndex].ChoiceName + '",' + Str(LoopIndex) + ')')
endloop
BlankLine
FileWriteln(Out,'CenterStretchBox("' + ThisMenu.MenuTitle + '",' + Str(ThisMenu.XPos) + ',' + Str(ThisMenu.YPos) + ')')
BlankLine
EndProc
;----- Create the Onkey Statements
Procedure WriteOutOnkeyChoices
var Tmp St X Y Z
loop ThisMenu.MenuChoices
Actual ThisChoice = Loc ThisMenu.MenuChoices[LoopIndex]
Tmp = ThisChoice.ChoiceName
FileWriteln(Out,'OnKey Task(' + Str(LoopIndex) + ')')
loop ThisChoice.ChoiceCmd
CommandPtr = LoopIndex
Tmp = ThisChoice.ChoiceCmd[CommandPtr]
Trim(Tmp)
if UpperCase(Tmp) = '!LOGOUT' then Tmp = '|Logoff'
if Left(Tmp,1) = '%'
delete(Tmp,1,1)
X = PosInList(UpperCase(Tmp),Titles)
if X = 0
Writeln
Writeln 'Error: Menu ' Tmp ' not Found!'
ExitMenu
endif
Tmp = '^' + Menus[X].MenuName
endif
if (pos('@',Tmp) > 0) And (Pos('@ECHO',UpperCase(Tmp)) = 0)
X = 1
while X <= length(Tmp)
while (X <= length(Tmp)) and (mid(Tmp,X,1) <> '@')
X = X + 1
endwhile
Z[1] = mid(Tmp,X,1)
Z[2] = mid(Tmp,X + 1,1)
if (Z[1] = '@') and (((Z[2] > '0') and (Z[3] <= '9')) or (Z[2] = '"'))
if Z[2] = '"'
insert(' ',Tmp,X + 1)
VarNum = 10
else
VarNum = ord(Z[2]) - 48
endif
InputAVar = mid(Tmp,X + 2,1) = '"'
if InputAVar
Y = X + 3
while (mid(Tmp,Y,1) <> '"') and (Y <= length(Tmp))
Y = Y + 1
endwhile
PromptLine = mid(Tmp,X + 3,Y - (X + 3))
else
Y = X + 1
endif
delete(Tmp,X,Y - X + 1)
insert('%NovVar' + Str(VarNum) ,Tmp,X)
if InputAVar
FileWriteln(Out,' |%NovVar',Str(VarNum), ' = ReadTextLine("' + PromptLine + '","",0,21)')
endif
endif
endwhile
endif
FileWriteln(Out,' ' + Tmp)
endloop
BlankLine
endloop
EndProc
;----- Create the Menus
Procedure WriteOutMenus
Writeln
Loop Menus
MenuPtr = LoopIndex
Actual ThisMenu = Loc Menus[MenuPtr]
WriteOutMenuChoices
WriteOutOnkeyChoices
if MenuPtr = 1
FileWriteln(Out,'OnKey ESC')
FileWriteln(Out,' |if not KeepUsersInMenu or NovConsoleOperator')
FileWriteln(Out,' | LeaveMenu')
FileWriteln(Out,' |endif')
BlankLine
endif
EndLoop
EndProc