public Workspace(string workspaceName, string rootDirectory, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength, ColumnsLayout columnsLayout, TypeCobolOptions compilationOptions) { compilationProject = new CompilationProject(workspaceName, rootDirectory, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength, columnsLayout, compilationOptions); OpenedFileCompilers = new Dictionary <string, FileCompiler>(3); }
public Workspace(string workspaceName, string rootDirectory, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength, ColumnsLayout columnsLayout, TypeCobolOptions compilationOptions) { compilationProject = new CompilationProject(workspaceName, rootDirectory, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength, columnsLayout, compilationOptions); OpenedFileCompilers = new Dictionary<string, FileCompiler>(3); }
/// <summary> /// Initializes a Cobol text library from files contained in a root directory /// </summary> /// <param name="libraryName">Name of the Cobol library, as specified in a Cobol program (COPY textName OF libraryName)</param> /// <param name="rootPath">Local directory containing all the Cobol files of this library</param> /// <param name="includeSubdirectories">Does this library also includes the files contained in all the subdirectories found below the root path ?</param> /// <param name="fileExtensions">File extensions which should be optionnaly appended to the text name to find corresponding Cobol files (for example : { ".cbl",".cpy" })</param> /// <param name="encoding">Character encoding used to read and write all the files contained in this library (use IBMCodePages.GetDotNetEncodingFromIBMCCSID if necessary)</param> /// <param name="endOfLineDelimiter">Type of line delimiter which is used in the files of this library</param> /// <param name="fixedLineLength">If the files of this library all have a fixed line length : number of chars found on each line (for example : 80)</param> /// <exception cref="ArgumentException"></exception> public LocalDirectoryLibrary(string libraryName, string rootPath, bool includeSubdirectories, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { Name = libraryName; this._rootPath = rootPath; rootDirectory = new DirectoryInfo(rootPath); if (!rootDirectory.Exists) { throw new ArgumentException(String.Format("Root path for local directory libray is invalid : {0}", rootPath)); } this.includeSubdirectories = includeSubdirectories; if (fileExtensions != null) { foreach (var fileExtension in fileExtensions) { if (fileExtension[0] != '.') { throw new ArgumentException(string.Format("File extension must start with a '.' : {0}", fileExtension)); } } } this.fileExtensions = fileExtensions; this.encoding = encoding; this.endOfLineDelimiter = endOfLineDelimiter; this.fixedLineLength = fixedLineLength; }
/// <summary> /// This version of the constructor is called by LocalDirectoryLibrary only /// </summary> internal LocalCobolFile(LocalDirectoryLibrary parentCobolLibrary, string name, string fullPath, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) : base(name, encoding, endOfLineDelimiter, fixedLineLength) { localFileInfo = new FileInfo(fullPath); if(!localFileInfo.Exists) { throw new ArgumentException(String.Format("Full path for local Cobol file is invalid : {0}"), fullPath); } FullPath = localFileInfo.FullName; this.parentCobolLibrary = parentCobolLibrary; }
internal CobolFile(string name, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { Name = name; Encoding = encoding; EndOfLineDelimiter = endOfLineDelimiter; if (endOfLineDelimiter == EndOfLineDelimiter.FixedLengthLines) { FixedLineLength = fixedLineLength; } // Some characters from the source encoding may not support roundtrip Unicode decoding & encoding InitUnsupportedSourceCharCodes(); }
/// <summary> /// Initializes a Cobol text library from files contained in a root directory /// </summary> /// <param name="name">Name of the Cobol library, as specified in a Cobol program (COPY textName OF libraryName)</param> /// <param name="rootPath">Local directory containing all the Cobol files of this library</param> /// <param name="includeSubdirectories">Does this library also includes the files contained in all the subdirectories found below the root path ?</param> /// <param name="fileExtensions">File extensions which should be optionnaly appended to the text name to find corresponding Cobol files (for example : { ".cbl",".cpy" })</param> /// <param name="encoding">Character encoding used to read and write all the files contained in this library (use IBMCodePages.GetDotNetEncodingFromIBMCCSID if necessary)</param> /// <param name="endOfLineDelimiter">Type of line delimiter which is used in the files of this library</param> /// <param name="fixedLineLength">If the files of this library all have a fixed line length : number of chars found on each line (for example : 80)</param> public LocalDirectoryLibrary(string libraryName, string rootPath, bool includeSubdirectories, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { Name = libraryName; rootDirectory = new DirectoryInfo(rootPath); if(!rootDirectory.Exists) { throw new ArgumentException(String.Format("Root path for local directory libray is invalid : {0}", rootPath)); } this.includeSubdirectories = includeSubdirectories; this.fileExtensions = fileExtensions; this.encoding = encoding; this.endOfLineDelimiter = endOfLineDelimiter; this.fixedLineLength = fixedLineLength; }
/// <summary> /// Create a new Cobol compilation project in a local directory /// </summary> public CompilationProject(string projectName, string rootDirectory, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength, ColumnsLayout columnsLayout, TypeCobolOptions compilationOptions) { Name = projectName; RootDirectory = rootDirectory; SourceFileProvider = new SourceFileProvider(); rootDirectoryLibrary = SourceFileProvider.AddLocalDirectoryLibrary(rootDirectory, false, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength); Encoding = encoding; EndOfLineDelimiter = endOfLineDelimiter; FixedLineLength = fixedLineLength; ColumnsLayout = columnsLayout; CompilationOptions = compilationOptions; CobolFiles = new Dictionary <string, CobolFile>(); CobolTextReferences = new Dictionary <string, CobolFile>(); CobolProgramCalls = new Dictionary <string, CobolFile>(); }
// -- Project creation and persistence -- /// <summary> /// Create a new Cobol compilation project in a local directory /// </summary> public CompilationProject(string projectName, string rootDirectory, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength, ColumnsLayout columnsLayout, TypeCobolOptions compilationOptions) { Name = projectName; RootDirectory = rootDirectory; SourceFileProvider = new SourceFileProvider(); rootDirectoryLibrary = SourceFileProvider.AddLocalDirectoryLibrary(rootDirectory, true, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength); Encoding = encoding; EndOfLineDelimiter = endOfLineDelimiter; FixedLineLength = fixedLineLength; ColumnsLayout = columnsLayout; CompilationOptions = compilationOptions; CobolFiles = new Dictionary<string, CobolFile>(); CobolTextReferences = new Dictionary<string, CobolFile>(); CobolProgramCalls = new Dictionary<string, CobolFile>(); }
public DocumentFormat(Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength, ColumnsLayout columnsLayout) { Encoding = encoding; EndOfLineDelimiter = endOfLineDelimiter; if (endOfLineDelimiter == EndOfLineDelimiter.FixedLengthLines) { if (columnsLayout == ColumnsLayout.FreeTextFormat) { throw new ArgumentException("With free text format, fixed length lines are not allowed"); } else if (columnsLayout == ColumnsLayout.CobolReferenceFormat && fixedLineLength < 72) { throw new ArgumentException("With Cobol reference format, fixed length lines must be at least 72 characters long"); } FixedLineLength = fixedLineLength; } ColumnsLayout = columnsLayout; }
/// <summary> /// Initialize a Cobol file from a text file in the local filesystem /// </summary> /// <param name="name">Name of the Cobol text, as specified in a Cobol program (COPY textName)</param> /// <param name="fullPath">Full path of the file in the local filesystem</param> /// <param name="encoding">Encoding used to read or write the Cobol file /// <param name="endOfLineDelimiter">Tells the compiler how to normalize the end of line characters</param> /// <param name="fixedLineLength">Used only in case the text is formatted with fixed length lines</param> public LocalCobolFile(string name, string fullPath, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) : this(null, name, fullPath, encoding, endOfLineDelimiter, fixedLineLength) { }
/// <summary> /// This version of the constructor is called by LocalDirectoryLibrary only /// </summary> internal LocalCobolFile(LocalDirectoryLibrary parentCobolLibrary, string name, string fullPath, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) : base(name, encoding, endOfLineDelimiter, fixedLineLength) { localFileInfo = new FileInfo(fullPath); if (!localFileInfo.Exists) { throw new ArgumentException(String.Format("Full path for local Cobol file is invalid : {0}"), fullPath); } FullPath = localFileInfo.FullName; this.parentCobolLibrary = parentCobolLibrary; }
/// <summary> /// Add all Cobol files contained in a local directory, filtered by a set of extensions, to a specific text library named : libraryName /// </summary> /// <param name="libraryName">Name of the Cobol library, as specified in a Cobol program (COPY textName OF libraryName)</param> public LocalDirectoryLibrary AddLocalDirectoryLibrary(string libraryName, string rootPath, bool includeSubdirectories, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { LocalDirectoryLibrary localLibrary = new LocalDirectoryLibrary(libraryName, rootPath, includeSubdirectories, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength); AddCobolLibrary(localLibrary); return localLibrary; }
/// <summary> /// Add all Cobol files contained in a local directory, filtered by a set of extensions, to the default text library /// </summary> /// <param name="rootPath">Local directory containing all the Cobol files of this library</param> /// <param name="includeSubdirectories">Does this library also includes the files contained in all the subdirectories found below the root path ?</param> /// <param name="fileExtensions">File extensions which should be optionnaly appended to the text name to find corresponding Cobol files (for example : { ".cbl",".cpy" })</param> /// <param name="encoding">Character encoding used to read and write all the files contained in this library (use IBMCodePages.GetDotNetEncodingFromIBMCCSID if necessary)</param> /// <param name="endOfLineDelimiter">Type of line delimiter which is used in the files of this library</param> /// <param name="fixedLineLength">If the files of this library all have a fixed line length : number of chars found on each line (for example : 80)</param> public LocalDirectoryLibrary AddLocalDirectoryLibrary(string rootPath, bool includeSubdirectories, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { return AddLocalDirectoryLibrary(DEFAULT_LIBRARY_NAME, rootPath, includeSubdirectories, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength); }
/// <summary> /// Constructor /// </summary> /// <param name="buildEngine"></param> /// <param name="projectName"></param> /// <param name="rootDirectory"></param> /// <param name="fileExtensions"></param> /// <param name="encoding"></param> /// <param name="endOfLineDelimiter"></param> /// <param name="fixedLineLength"></param> /// <param name="columnsLayout"></param> /// <param name="compilationOptions"></param> public BuildProject(BuildEngine buildEngine, string projectName, string rootDirectory, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength, ColumnsLayout columnsLayout, TypeCobolOptions compilationOptions) : base(projectName, rootDirectory, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength, columnsLayout, compilationOptions) { BuilderEngine = buildEngine; }
/// <summary> /// Add all Cobol files contained in a local directory, filtered by a set of extensions, to the default text library /// </summary> /// <param name="rootPath">Local directory containing all the Cobol files of this library</param> /// <param name="includeSubdirectories">Does this library also includes the files contained in all the subdirectories found below the root path ?</param> /// <param name="fileExtensions">File extensions which should be optionnaly appended to the text name to find corresponding Cobol files (for example : { ".cbl",".cpy" })</param> /// <param name="encoding">Character encoding used to read and write all the files contained in this library (use IBMCodePages.GetDotNetEncodingFromIBMCCSID if necessary)</param> /// <param name="endOfLineDelimiter">Type of line delimiter which is used in the files of this library</param> /// <param name="fixedLineLength">If the files of this library all have a fixed line length : number of chars found on each line (for example : 80)</param> public LocalDirectoryLibrary AddLocalDirectoryLibrary(string rootPath, bool includeSubdirectories, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { return(AddLocalDirectoryLibrary(DEFAULT_LIBRARY_NAME, rootPath, includeSubdirectories, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength)); }
/// <summary> /// Add all Cobol files contained in a local directory, filtered by a set of extensions, to a specific text library named : libraryName /// </summary> /// <param name="libraryName">Name of the Cobol library, as specified in a Cobol program (COPY textName OF libraryName)</param> public LocalDirectoryLibrary AddLocalDirectoryLibrary(string libraryName, string rootPath, bool includeSubdirectories, string[] fileExtensions, Encoding encoding, EndOfLineDelimiter endOfLineDelimiter, int fixedLineLength) { LocalDirectoryLibrary localLibrary = new LocalDirectoryLibrary(libraryName, rootPath, includeSubdirectories, fileExtensions, encoding, endOfLineDelimiter, fixedLineLength); AddCobolLibrary(localLibrary); return(localLibrary); }