home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- // This script sets up the initial standard options for Microsoft's Java
- // development kit.
-
- var helpers = getMapFile("ApplicationHelpers");
- var gOptions = getMapFile("MSJToolsStandardOptions");
-
- function DoCommand()
- {
- alert("The msjOptions script only contains funtions\nthat can be used by other scripts");
- }
-
- function GetRunOptions()
- {
- var options;
- var runInWindow = gOptions.lookup("runInWindow", true);
- if (runInWindow)
- {
- options = gOptions.lookup("msj-wjview", "");
- }
- else
- {
- options = gOptions.lookup("msj-jview", "");
- }
- return options;
- }
-
- function ChooseRunOptions()
- {
- var standardOptions;
- var runInWindow = gOptions.lookup("runInWindow", true);
- if (runInWindow)
- {
- standardOptions = gOptions.lookup("msj-wjview", "");
- }
- else
- {
- standardOptions = gOptions.lookup("msj-jview", "");
- }
-
- var editedOptions = RunOptions(standardOptions);
-
- if (editedOptions != null)
- {
- // Get the value again because RunOptions may have changed it
- runInWindow = gOptions.lookup("runInWindow", true);
- if (runInWindow)
- {
- gOptions.setValue("msj-wjview", editedOptions);
- }
- else
- {
- gOptions.setValue("msj-jview", editedOptions);
- }
- }
- }
-
- function CompileOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- value = AddOption(
- list,
- checked,
- "Disable Microsoft Java extensions ( /x )",
- "/x",
- value,
- action, null);
-
- // debugging tables
- value = AddOption(
- list,
- checked,
- "Generate all debugging information. ( /g )",
- "/g",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Generate line number debugging information. ( /g:l )",
- "/g:l",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Generate debug tables. ( /g:t )",
- "/g:l",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Do not generate class file ( /nowrite )",
- "/nowrite",
- value,
- action, null);
-
- // optimiation
- value = AddOption(
- list,
- checked,
- "Optimize run time ( /O )",
- "/O",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Optimize by inlining methods ( /O:I )",
- "/O:I",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Optimize byte codes - default ( /O:J )",
- "/O:J",
- value,
- action, null);
-
- // verbose
- value = AddOption(
- list,
- checked,
- "Output additional information ( /verbose )",
- "/verbose",
- value,
- action, null);
-
- // Warning levels
- value = AddOption(
- list,
- checked,
- "Set warning level 0 ( /w0 )",
- "/w0",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Set warning level 1 ( /w1 )",
- "/w1",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Set warning level 2 - default ( /w2 )",
- "/w2",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Set warning level 3 ( /w3 )",
- "/w3",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Set warning level 4 ( /w4 )",
- "/w4",
- value,
- action, null);
-
-
- var result = chooseOptions("Choose Options",
- "Choose compile options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
-
- function RunOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- AddSpecialOption(
- list,
- checked,
- "Show command line",
- "",
- gOptions.lookup("showCommandLine", false),
- action, null);
-
- AddSpecialOption(
- list,
- checked,
- "Run in window ( use wjview )",
- "",
- gOptions.lookup("runInWindow", true),
- action, null);
-
- AddSpecialOption(
- list,
- checked,
- "Show console window",
- "",
- gOptions.lookup("showConsoleWindow", false),
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Pause before terminated if an error occurs ( /p )",
- "/p",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Verify all invoked methods ( /v )",
- "/v",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java runtime options", list, checked,
- null, true, "Classpaths...", EditClasspaths);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
-
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
- gOptions.setValue("showCommandLine", selected);
-
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
- gOptions.setValue("runInWindow", selected);
-
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
- gOptions.setValue("showConsoleWindow", selected);
-
- while (resultPosition.valid && listPosition.valid)
- {
- selected = result.getNext(resultPosition);
- item = list.getNext(listPosition);
-
- if (selected )
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- function EditClasspaths()
- {
- var classpaths = gOptions.lookup("customClasspaths", "");
- var classpathUtilities = getScriptObject("\\Library\\classpathUtilities");
-
- var newclasspaths = classpathUtilities.EditClasspaths(
- "Edit MSJ custom classpaths (do not add a path for classes.zip)",
- classpaths);
- gOptions.setValue("customClasspaths", newclasspaths);
- }
-
- function JViewOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- value = AddOption(
- list,
- checked,
- "Pause before terminated if an error occurs ( /p )",
- "/p",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Verify all invoked methods ( /v )",
- "/v",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java runtime options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- function WJViewOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- value = AddOption(
- list,
- checked,
- "Verify all invoked methods ( /v )",
- "/v",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java runtime options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- function ClassViewOptions(value)
- {
- // Input value should be a string containing
- // existing options
-
- if (typeof(value) != "string")
- {
- return value;
- }
-
- // Function must return a string of selected options.
- // Any options not included are appended to the
- // the end of the returned string.
-
- var list = newList();
- var checked = newList();
- var action = newList();
-
- value = AddOption(
- list,
- checked,
- "Display minimum infomation (D1, /min )",
- "/min",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Display minimum infomation (D1, D2 and D3, /ltd )",
- "/ltd",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Verbose display of information ( /v )",
- "/v",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Suppress display of constant pooling ( /cpno )",
- "/cpno",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Display many items in table form ( /tables )",
- "/tables",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Generate informal Virtual Machine Assembly Language ( /ivmal )",
- "/ivmal",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Send output to a file named by the package and class with the extension .cvue ( /CVue )",
- "/CVue",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Quiet mode, suppresses copyright banner ( /q )",
- "/q",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Display the list of available options ( /? )",
- "/?",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Display list of information levels. ( /D? )",
- "/D?",
- value,
- action, null);
-
- value = AddOption(
- list,
- checked,
- "Output information to help in reading the output ( /README )",
- "/README",
- value,
- action, null);
-
- var result = chooseOptions("Choose Options",
- "Choose java runtime options", list, checked);
-
- // result is a list of booleans
- if (result)
- {
- var listPosition = list.getHeadPosition();
- var resultPosition = result.getHeadPosition();
- var returnValue = "";
- while (resultPosition.valid && listPosition.valid)
- {
- var selected = result.getNext(resultPosition);
- var item = list.getNext(listPosition);
-
- if (selected)
- {
- // Separate from the previous using a space
- if (returnValue.length > 0)
- {
- returnValue += " ";
- }
- returnValue += item.value;
- }
- }
-
- // Add what's left over if there is any non-space data in value
- // Note: the expression "[^ ]" matches the first non-space
- // character in value
-
- if (value.length > 0)
- {
- // Don't add extra spaces
- var nonspace = searchInString(value, "[^ ]");
- if (nonspace)
- {
- returnValue += " " +
- value.substring(nonspace.value, value.length);
- }
- }
- return returnValue;
- }
- return null;
- }
-
- // Use this function to add a command line option
- // when preparing to use the editProperties dialog
- function AddOption(optionsList, checkedList,
- option, optionValue,
- optionString,
- actionList, action)
- {
- if (typeof(optionString) == "string")
- {
- optionsList.addTail(newAssociation(option, optionValue));
- var index1 = optionString.indexOf(optionValue + " ");
- var index2 = optionString.indexOf(optionValue);
- if (index1 != -1)
- {
- checkedList.addTail(true);
-
- // Remove this option from the list
- optionString = replaceInString(optionString, index1,
- optionValue.length, "");
- }
- else if (index2 != -1 && index2 + optionValue.length == optionString.length)
- {
- checkedList.addTail(true);
-
- // Remove this option from the list
- optionString = replaceInString(optionString, index2,
- optionValue.length, "");
- }
- else
- {
- checkedList.addTail(false);
- }
- }
-
- if (actionList)
- {
- actionList.addTail(action);
- }
-
- return optionString;
- }
-
- // Use this function to add a special command line option
- // when preparing to use the editProperties dialog
- function AddSpecialOption(optionsList, checkedList,
- option, optionValue,
- checkOn,
- actionList, action)
- {
- optionsList.addTail(newAssociation(option, optionValue));
- checkedList.addTail(checkOn);
-
- if (actionList)
- {
- actionList.addTail(action);
- }
- }
-
- function UpdateOptions()
- {
- var buildmode = gOptions.lookup("msj-buildmode", "release");
-
- if (buildmode == "release")
- {
- // Change tool options
- var compileOptions = gOptions.lookup("msj-jvc_release", "");
- gOptions.setValue("msj-jvc",compileOptions);
- }
-
- if (buildmode == "debug")
- {
- // Change tool options
- var compileOptions = gOptions.lookup("msj-jvc_debug", "/g");
- gOptions.setValue("msj-jvc",compileOptions);
- }
- }
-
-
- !!/Script
-