Skip to content

Commit

Permalink
オブファスケーター:ユーザー関数のインライン展開対応分をVSCE側に反映
Browse files Browse the repository at this point in the history
  • Loading branch information
r-koubou committed Mar 26, 2018
1 parent e7270bc commit 62b135d
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Version 0.4.0(BETA2)

- Obfuscator(BETA)

Added: inline function

Default is OFF. If you try, turn on vscode preference **"ksp.obfuscator.inline.function"**

## Version 0.4.0(BETA1)

**Fixed(Provisional)**
Expand Down
Binary file modified kspparser/KSPSyntaxParser.jar
Binary file not shown.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ksp",
"displayName": "KONTAKT Script Processor (KSP)",
"description": "Language support for NI KONTAKT Script Processor (KSP)",
"version": "0.4.0-beta1",
"version": "0.4.0-beta2",
"publisher": "rkoubou",
"license": "MIT",
"keywords": [
Expand Down Expand Up @@ -116,6 +116,11 @@
"type": "string",
"default": ".out.txt",
"description": "%configuration.obfuscator.suffix%"
},
"ksp.obfuscator.inline.function": {
"type": "boolean",
"default": false,
"description": "%configuration.obfuscator.inline.function%"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions package.nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"configuration.validate.unused": "true の場合、パーサーは未使用変数と未使用のユーザー関数を検知します (ksp.validate.syntax.only=falseの場合のみ有効)",
"configuration.java.location": "javaコマンドの場所。デフォルトでは環境変数PATHに通しているものとして動作します。",
"configuration.obfuscator.suffix": "コマンドパレットでオブファスケーターを実行することによって生成される、デフォルトのファイル拡張子",
"configuration.obfuscator.inline.function": "true の場合、オブファスケーター実行時に全てのユーザー定義関数をインライン展開します",

"command.obfuscate": "NI KSP: オブファスケーターの実行"

Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"configuration.validate.strict": "If true, parser will be 'strict' mode. (Require:ksp.validate.syntax.only=false)",
"configuration.validate.unused": "If true, parser will detect unused variables, user functions. (Require:ksp.validate.syntax.only=false)",
"configuration.obfuscator.suffix": "Default file suffix which generate by Obfuscator from command palette",
"configuration.obfuscator.inline.function": "If true, all user defined functions will be expanded (=inline expansion) when run Obfuscator",

"command.obfuscate": "NI KSP: Run Obfuscator"
}
2 changes: 2 additions & 0 deletions src/features/KSPConfigurationConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const KEY_PARSE_STRICT = 'validate.strict';
export const KEY_PARSE_UNUSED = 'validate.unused';
// Obfuscator
export const KEY_OBFUSCATOR_SUFFIX = 'obfuscator.suffix';
export const KEY_OBFUSCATOR_INLINE_FUNCTION = 'obfuscator.inline.function';

export const DEFAULT_JAVA_LOCATION = 'java';
export const DEFAULT_ENABLE_VALIDATE = false;
Expand All @@ -30,3 +31,4 @@ export const DEFAULT_PARSE_SYNTAX_ONLY = false;
export const DEFAULT_PARSE_STRICT = false;
export const DEFAULT_PARSE_UNUSED = false;
export const DEFAULT_OBFUSCATOR_SUFFIX = '.out.txt';
export const DEFAULT_INLINE_FUNCTION = false
13 changes: 11 additions & 2 deletions src/features/KSPObfuscatorCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export function doObfuscate( context: vscode.ExtensionContext )
// Run Obfuscator
//--------------------------------------------------------------------------
function obfuscate( output:string ){

let inline: boolean = config.DEFAULT_INLINE_FUNCTION;
KSPConfigurationManager.getConfig<boolean>( config.KEY_OBFUSCATOR_INLINE_FUNCTION, config.DEFAULT_INLINE_FUNCTION, (v, user) =>{
inline = v;
});

// java -Dkspparser.stdout.encoding=UTF-8 -Dkspparser.datadir=path/to/data -jar kspsyntaxparser.jar <document.fileName>
args.push( "-Dkspparser.stdout.encoding=UTF-8" )
args.push( "-Dkspparser.datadir=" + thisExtentionDir + "/kspparser/data" )
Expand All @@ -68,10 +74,13 @@ export function doObfuscate( context: vscode.ExtensionContext )
args.push( thisExtentionDir + "/kspparser/KSPSyntaxParser.jar" );
args.push( "--strict" );
args.push( "--obfuscate" );
args.push( "--source" );
args.push( textDocument.fileName );
if( inline )
{
args.push( "--inline-userfunction" )
}
args.push( "--output" );
args.push( output );
args.push( textDocument.fileName );

try
{
Expand Down
1 change: 0 additions & 1 deletion src/features/KSPValidationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ export class KSPValidationProvider
{
args.push( "--unused" );
}
args.push( "--source" );
args.push( src );

try
Expand Down

0 comments on commit 62b135d

Please sign in to comment.