mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 08:29:46 -06:00
bugfix dosbox; convert linefeeds to dos crlf's
This commit is contained in:
@@ -24,8 +24,3 @@ Note that Turbo C is C only, so it belongs in your `c.local.properties`.
|
||||
Also note that you will immediately get an error with the default example source code, because the compiler doesn't support `//` comments.
|
||||
|
||||
Also note that in this old C version, you must declare all variables in the first few lines of your functions.
|
||||
|
||||
### Weird behaviour
|
||||
|
||||
* Including default header files seem to break the compilation without error.
|
||||
* Line numbers for compilation errors always seem to point to line 1
|
||||
|
||||
Vendored
+4
@@ -5,6 +5,7 @@ export declare class BaseCompiler {
|
||||
public outputFilebase: string;
|
||||
protected mtime;
|
||||
protected env;
|
||||
protected compileFilename;
|
||||
protected getSharedLibraryPathsAsArguments(libraries: object[], libDownloadPath: string);
|
||||
protected getSharedLibraryPathsAsLdLibraryPaths(libraries: object[]);
|
||||
protected getCompilerCacheKey(compiler: string, args: string[], options: object);
|
||||
@@ -12,6 +13,9 @@ export declare class BaseCompiler {
|
||||
protected async newTempDir();
|
||||
protected filename(fn: string): string;
|
||||
protected optionsForFilter(filters: object, outputFilename: string): string[];
|
||||
protected getExtraFilepath(dirPath: string, filename: string): string;
|
||||
protected async writeAllFiles(dirPath: string, source: string, files: any[], filters: object);
|
||||
protected async writeMultipleFiles(files: any[], dirPath: string): Promise<any[]>;
|
||||
public compilerProps: (key: string) => string;
|
||||
public getOutputFilename(dirPath: string, outputFilebase: string, key?: object): string;
|
||||
public async exec(filepath: string, args: string[], execOptions);
|
||||
|
||||
@@ -41,6 +41,37 @@ export class DosboxCompiler extends BaseCompiler {
|
||||
this.root = this.compilerProps(`compiler.${this.compiler.id}.root`);
|
||||
}
|
||||
|
||||
protected override async writeMultipleFiles(files: any[], dirPath: string): Promise<any[]> {
|
||||
const filesToWrite: any[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (!file.filename) throw new Error('One of more files do not have a filename');
|
||||
|
||||
const fullpath = this.getExtraFilepath(dirPath, file.filename);
|
||||
const contents = file.contents.replaceAll(/\n/g, '\r\n');
|
||||
filesToWrite.push(fs.outputFile(fullpath, contents));
|
||||
}
|
||||
|
||||
return Promise.all(filesToWrite);
|
||||
}
|
||||
|
||||
protected override async writeAllFiles(dirPath: string, source: string, files: any[], filters: object) {
|
||||
if (!source) throw new Error(`File ${this.compileFilename} has no content or file is missing`);
|
||||
|
||||
const inputFilename = path.join(dirPath, this.compileFilename);
|
||||
await fs.writeFile(inputFilename, source.replaceAll(/\n/g, '\r\n'));
|
||||
|
||||
if (files && files.length > 0) {
|
||||
(filters as any).dontMaskFilenames = true;
|
||||
|
||||
await this.writeMultipleFiles(files, dirPath);
|
||||
}
|
||||
|
||||
return {
|
||||
inputFilename,
|
||||
};
|
||||
}
|
||||
|
||||
private getDosboxArgs(tempDir: string, compileArgs: string[]) {
|
||||
const binPath = path.relative(this.root, path.dirname(this.compiler.exe));
|
||||
const exeName = path.basename(this.compiler.exe).replace(/\.exe$/i, '');
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
import path from 'path';
|
||||
|
||||
import {logger} from '../logger';
|
||||
import {TurboCParser} from './argument-parsers';
|
||||
|
||||
import {TurboCParser} from './argument-parsers';
|
||||
import {DosboxCompiler} from './dosbox-compiler';
|
||||
|
||||
export class TurboCCompiler extends DosboxCompiler {
|
||||
|
||||
Reference in New Issue
Block a user