Package net.sf.smc
Class Smc
- java.lang.Object
-
- net.sf.smc.Smc
-
public final class Smc extends Object
Main class for the state machine compiler application. This class is responsible for processing the command line arguments, configuring the parser, model and generator packages according to the command line and outputing the results to the user. The actual work is performed by the parser, model and generator packages.- Author:
- Charles Rapp
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSmc.LanguageThis class explicitly stores each target language's properties: the start of the command line option, the language's full name, the language'sSmcCodeGeneratorsubclass, and whether the language also generates a header file and the header fillSmcCodeGeneratorsubclass.
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Smc.LanguagefindTargetLanguage(String name)Returns the language record associated with the given name.static StringgetFileName(String fullName)Returnsnameportion frompath/name.sm.static booleanisValidAccessLevel(String s, Smc.Language targetLanguage)Returnstrueif the given string is a valid access level for target language.static booleanisValidCast(String castType)ReturnstrueifcastTypeis a valid C++ cast.static booleanisValidDirectory(String path, boolean readable, boolean writable)Returnstrueifpathis a valid directory.static booleanisValidGraphLevel(int glevel)Returnstrueifglevelis a valid graph detail level.static voidmain(String[] args)The state machine compiler main method.static voidoutputMessages(String srcFileName, PrintStream stream, List<SmcMessage> messages)Writes SMC output messages to the provided stream.static booleansupportsOption(String option, Smc.Language language)Returnstrueif the target language supports the specified option.
-
-
-
Field Detail
-
APP_NAME
public static final String APP_NAME
- See Also:
- Constant Field Values
-
VERSION
public static final String VERSION
- See Also:
- Constant Field Values
-
SM_SUFFIX
public static final String SM_SUFFIX
SMC target files must end with ".sm".- See Also:
- Constant Field Values
-
ACCESS_FLAG
public static final String ACCESS_FLAG
- See Also:
- Constant Field Values
-
CAST_FLAG
public static final String CAST_FLAG
- See Also:
- Constant Field Values
-
DIRECTORY_FLAG
public static final String DIRECTORY_FLAG
- See Also:
- Constant Field Values
-
DEBUG_FLAG
public static final String DEBUG_FLAG
- See Also:
- Constant Field Values
-
DEBUG_LEVEL0_FLAG
public static final String DEBUG_LEVEL0_FLAG
- See Also:
- Constant Field Values
-
DEBUG_LEVEL1_FLAG
public static final String DEBUG_LEVEL1_FLAG
- See Also:
- Constant Field Values
-
GENERIC_FLAG
public static final String GENERIC_FLAG
- See Also:
- Constant Field Values
-
GENERIC7_FLAG
public static final String GENERIC7_FLAG
- See Also:
- Constant Field Values
-
GLEVEL_FLAG
public static final String GLEVEL_FLAG
- See Also:
- Constant Field Values
-
HEADER_FLAG
public static final String HEADER_FLAG
- See Also:
- Constant Field Values
-
HEADER_SUFFIX_FLAG
public static final String HEADER_SUFFIX_FLAG
- See Also:
- Constant Field Values
-
HELP_FLAG
public static final String HELP_FLAG
- See Also:
- Constant Field Values
-
NO_CATCH_FLAG
public static final String NO_CATCH_FLAG
- See Also:
- Constant Field Values
-
NO_EXCEPTIONS_FLAG
public static final String NO_EXCEPTIONS_FLAG
- See Also:
- Constant Field Values
-
NO_STREAMS_FLAG
public static final String NO_STREAMS_FLAG
- See Also:
- Constant Field Values
-
CRTP_FLAG
public static final String CRTP_FLAG
- See Also:
- Constant Field Values
-
STACK_FLAG
public static final String STACK_FLAG
- See Also:
- Constant Field Values
-
REFLECT_FLAG
public static final String REFLECT_FLAG
- See Also:
- Constant Field Values
-
RETURN_FLAG
public static final String RETURN_FLAG
- See Also:
- Constant Field Values
-
SERIAL_FLAG
public static final String SERIAL_FLAG
- See Also:
- Constant Field Values
-
SILENT_FLAG
public static final String SILENT_FLAG
- See Also:
- Constant Field Values
-
SUFFIX_FLAG
public static final String SUFFIX_FLAG
- See Also:
- Constant Field Values
-
SYNC_FLAG
public static final String SYNC_FLAG
- See Also:
- Constant Field Values
-
VERBOSE_FLAG
public static final String VERBOSE_FLAG
- See Also:
- Constant Field Values
-
VERSION_FLAG
public static final String VERSION_FLAG
- See Also:
- Constant Field Values
-
VVERBOSE_FLAG
public static final String VVERBOSE_FLAG
- See Also:
- Constant Field Values
-
USE_PROTOCOL_FLAG
public static final String USE_PROTOCOL_FLAG
- See Also:
- Constant Field Values
-
PACKAGE_LEVEL
public static final String PACKAGE_LEVEL
Java package level access is "package".- See Also:
- Constant Field Values
-
PACKAGE_ACCESS
public static final String PACKAGE_ACCESS
Since "package" is a Java restricted keyword and cannot be used to specify an access level, then use "/* package */" instead.- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(String[] args)
The state machine compiler main method.- Parameters:
args- command line arguments.
-
findTargetLanguage
public static final Smc.Language findTargetLanguage(String name)
Returns the language record associated with the given name. Returnsnullifnameis not associated with any supported target language.- Parameters:
name- target language name.- Returns:
- language record.
-
supportsOption
public static boolean supportsOption(String option, Smc.Language language)
Returnstrueif the target language supports the specified option.- Parameters:
option- command line option.language- check if this language supportsoption.- Returns:
trueif the command line option is valid forlanguage.
-
isValidDirectory
public static boolean isValidDirectory(String path, boolean readable, boolean writable)
Returnstrueifpathis a valid directory. Valid means that the direct exists and is either readable or writable.- Parameters:
path- used to createFileinstance.readable- expectedFile.canRead()result.writable- expectedFile.canWrite()result.- Returns:
trueif specified directory meets expected results.
-
isValidAccessLevel
public static boolean isValidAccessLevel(String s, Smc.Language targetLanguage)
Returnstrueif the given string is a valid access level for target language.- Parameters:
s- access level string.targetLanguage- target language.- Returns:
trueifsis a validtargetLanguageaccess level.
-
isValidCast
public static boolean isValidCast(String castType)
ReturnstrueifcastTypeis a valid C++ cast.- Parameters:
castType- C++ cast type.- Returns:
trueif cast type is valid.
-
isValidGraphLevel
public static boolean isValidGraphLevel(int glevel)
Returnstrueifglevelis a valid graph detail level.- Parameters:
glevel- validate this graph detail level.- Returns:
trueifglevelis valid.
-
getFileName
public static String getFileName(String fullName)
Returnsnameportion frompath/name.sm.- Parameters:
fullName- full qualified file name.- Returns:
- base file name.
-
outputMessages
public static void outputMessages(String srcFileName, PrintStream stream, List<SmcMessage> messages)
Writes SMC output messages to the provided stream.- Parameters:
srcFileName- SMC target file name.stream- write messages to this print stream.messages- output these messages.
-
-