From ba6219645bc9f63292f9e10585a1623ddeb20b3f Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 30 Apr 2022 23:13:49 -0300 Subject: [PATCH 001/112] Added API Function names --- dev/src/SmartC/shaper/templates.ts | 70 ++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/dev/src/SmartC/shaper/templates.ts b/dev/src/SmartC/shaper/templates.ts index 076fff9..48eb834 100644 --- a/dev/src/SmartC/shaper/templates.ts +++ b/dev/src/SmartC/shaper/templates.ts @@ -753,5 +753,75 @@ export const APITableTemplate: SC_FUNCTION[] = [ declaration: 'long', sentences: [], name: 'Add_Minutes_To_Timestamp' + }, + { + argsMemObj: [], + asmName: 'Check_Sig_B_With_A', + declaration: 'long', + sentences: [], + name: 'Check_Sig_B_With_A' + }, + { + argsMemObj: [], + asmName: 'Get_Code_Hash_Id', + declaration: 'long', + sentences: [], + name: 'Get_Code_Hash_Id' + }, + { + argsMemObj: [], + asmName: 'Get_Map_Value_Keys_In_A', + declaration: 'long', + sentences: [], + name: 'Get_Map_Value_Keys_In_A' + }, + { + argsMemObj: [], + asmName: 'Set_Map_Value_Keys_In_A', + declaration: 'void', + sentences: [], + name: 'Set_Map_Value_Keys_In_A' + }, + { + argsMemObj: [], + asmName: 'Issue_Asset', + declaration: 'long', + sentences: [], + name: 'Issue_Asset' + }, + { + argsMemObj: [], + asmName: 'Mint_Asset', + declaration: 'void', + sentences: [], + name: 'Mint_Asset' + }, + { + argsMemObj: [], + asmName: 'Distribute_To_Asset_Holders', + declaration: 'void', + sentences: [], + name: 'Distribute_To_Asset_Holders' + }, + { + argsMemObj: [], + asmName: 'Get_Asset_Holders_Count', + declaration: 'long', + sentences: [], + name: 'Get_Asset_Holders_Count' + }, + { + argsMemObj: [], + asmName: 'Get_Activation_Fee', + declaration: 'long', + sentences: [], + name: 'Get_Activation_Fee' + }, + { + argsMemObj: [], + asmName: 'Put_Last_Block_GSig_In_A', + declaration: 'void', + sentences: [], + name: 'Put_Last_Block_GSig_In_A' } ] From 08b8b1f80c8d2f2a6a5ed0c8a7ce3c112c2bed06 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 30 Apr 2022 23:20:22 -0300 Subject: [PATCH 002/112] Added highglight for API functions --- dev/3rd-party/highlight.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/3rd-party/highlight.min.js b/dev/3rd-party/highlight.min.js index 37cf3c6..abde02e 100644 --- a/dev/3rd-party/highlight.min.js +++ b/dev/3rd-party/highlight.min.js @@ -320,7 +320,7 @@ className:"title",begin:e(s)+n.IDENT_RE,relevance:0 keyword:["asm","break","case","const","continue","default","do","else","exit","for","goto","halt","if","return","sizeof","sleep","struct","switch","while"], type:["long","void"], literal:"true false NULL", -built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp" +built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp Check_Sig_B_With_A Get_Code_Hash_Id Get_Map_Value_Keys_In_A Set_Map_Value_Keys_In_A Issue_Asset Mint_Asset Distribute_To_Asset_Holders Get_Asset_Holders_Count Get_Activation_Fee Put_Last_Block_GSig_In_A" },g=[c,a,t,n.C_BLOCK_COMMENT_MODE,l,i],m={variants:[{begin:/=/,end:/;/},{ begin:/\(/,end:/\)/},{beginKeywords:"return else",end:/;/}], keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, From 29871d3c364e4c1c4000d530003816fba0f2803e Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 16:47:20 -0300 Subject: [PATCH 003/112] Keyword sleep without arguments --- .../SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts | 4 +++- dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts | 1 + dev/src/SmartC/syntaxProcessor/createTree.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts b/dev/src/SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts index db98d8a..2f17a9b 100644 --- a/dev/src/SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts +++ b/dev/src/SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts @@ -34,7 +34,9 @@ export default function keywordToAsm ( } return TmpMemObj.asmCode case 'sleep': - FlatMem = assertNotUndefined(FlatMem) + if (FlatMem === undefined) { + return 'SLP\n' + } TmpMemObj = flattenMemory(AuxVars, assertNotUndefined(FlatMem), OperatorToken.line) TmpMemObj.asmCode += `SLP $${TmpMemObj.FlatMem.asmName}\n` AuxVars.freeRegister(FlatMem.address) diff --git a/dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts b/dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts index dc46818..d7b4c21 100644 --- a/dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts +++ b/dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts @@ -88,6 +88,7 @@ export default function endAsnProcessor ( case 'asm': case 'exit': case 'halt': + case 'sleep': return { SolvedMem: utils.createVoidMemObj(), asmCode: createInstruction(AuxVars, CurrentNode.Token) diff --git a/dev/src/SmartC/syntaxProcessor/createTree.ts b/dev/src/SmartC/syntaxProcessor/createTree.ts index 130eb95..ab8e064 100644 --- a/dev/src/SmartC/syntaxProcessor/createTree.ts +++ b/dev/src/SmartC/syntaxProcessor/createTree.ts @@ -168,7 +168,6 @@ function KeywordToAST (tokens: TOKEN[], keywordLoc: number) : AST { ` Probable missing ';' before keyword ${tokens[keywordLoc].value}.`) } switch (tokens[0].value) { - case 'sleep': case 'goto': case 'const': case 'sizeof': @@ -208,6 +207,7 @@ function KeywordToAST (tokens: TOKEN[], keywordLoc: number) : AST { Center: createTree(tokens.slice(1)) } case 'return': + case 'sleep': if (tokens.length === 1) { return { type: 'endASN', Token: tokens[0] } } From d014ba5c50a5f3427c10d317fcf8737c2942ffdb Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 16:55:48 -0300 Subject: [PATCH 004/112] Testcases for sleep --- dev/src/SmartC/__tests__/keywords.a.spec.ts | 7 +++++++ dev/src/SmartC/__tests__/keywords.b.spec.ts | 7 ------- dev/src/templateTests.ts | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dev/src/SmartC/__tests__/keywords.a.spec.ts b/dev/src/SmartC/__tests__/keywords.a.spec.ts index 7879ebf..8c29b2f 100644 --- a/dev/src/SmartC/__tests__/keywords.a.spec.ts +++ b/dev/src/SmartC/__tests__/keywords.a.spec.ts @@ -148,6 +148,13 @@ describe('Keywords right usage', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: sleep (no arguments)', () => { + const code = '#pragma optimizationLevel 0\nlong a, b; a++; sleep;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nINC @a\nSLP\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) it('should compile: sleep', () => { const code = '#pragma optimizationLevel 0\nlong a, b; a++; sleep 1;' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nINC @a\nSET @r0 #0000000000000001\nSLP $r0\nFIN\n' diff --git a/dev/src/SmartC/__tests__/keywords.b.spec.ts b/dev/src/SmartC/__tests__/keywords.b.spec.ts index d27c359..4f0bc91 100644 --- a/dev/src/SmartC/__tests__/keywords.b.spec.ts +++ b/dev/src/SmartC/__tests__/keywords.b.spec.ts @@ -50,13 +50,6 @@ describe('Keywords wrong usage', () => { compiler.compile() }).toThrowError(/^At line/) }) - test('should throw: sleep without argument', () => { - expect(() => { - const code = 'long a; sleep; a++;' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) test('should throw: const without arguments', () => { expect(() => { const code = 'long a; const ;' diff --git a/dev/src/templateTests.ts b/dev/src/templateTests.ts index ad98ae9..4057123 100644 --- a/dev/src/templateTests.ts +++ b/dev/src/templateTests.ts @@ -45,7 +45,6 @@ export const tests: CTestType [] = [ ['long a, test_b; test(a); void test(long b) { long c; c++; }', true, ''], ['syntaxProcessor error tests', null, 'div'], - ['long a; sleep; a++;', true, ''], ['long a; const ;', true, ''], ['long a; goto; a++;', true, ''], ['long a, b; halt 1; a++;', true, ''], From 94789949396b6b6c68eacf875348f10b5fd00fd3 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 17:03:56 -0300 Subject: [PATCH 005/112] Updated help for sleep --- docs/1-Basis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index ebf018c..c975346 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -14,7 +14,7 @@ Some keywords have the same meaning and use in C: `asm`, `break`, `continue`, `d * `case`: The standard C is fully supported, featuring also that expressions can be added using parenthesis. If standard switch is used, an expression can be used: `switch (a) { case (b/2): ... }` and it will be evaluated as `if (a == b/2) ... `. If the logical switch statement is used, then it is possible to add a logical expression in `case` using parenthesis, in the form `switch (true) { case (a>5): ...}` and it will be evaluated as `if (a>5) ...` There are also additional keywords: -* `sleep N`: Puts the contract in 'sleep' mode during N blocks. Argument N must be specified and can be an expression. `sleep 1;` makes your contract to stop being processed at current block and resumes it at next one. +* `sleep`: Puts the contract in 'sleep' mode and resumes contract execution on next block. Alternativelly it can have an argument to indicate the number of blocks to sleep and the argument can be an expression. This tree sentences have the same result `sleep;`, `sleep 0;`, and `sleep 1;`, but it is prefered the first one because the instruction is smaller. * `exit`: Puts the contract in 'stop' mode and set program to restart from main function ('finished' mode). It will be inactive until a new transaction is received. Once a tx is received, it will start execution at `void main(void)` function. If main function is not defined, it will start again from beginning of code. `exit` takes no argument. If contract activation amount is zero, contract will resume execution on next block. * `halt`: Puts the contract in 'stop' mode. It will be inactive until a new transaction is received, then it will resume execution at next instruction. It takes no argument. If contract activation amount is zero, contract will resume execution on next block. From 8f17a080121bc284e2914dfdd2cc5e75ec76c02e Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 20:30:00 -0300 Subject: [PATCH 006/112] Added built-in functions 'pow' and 'mdv' --- .../assemblyProcessor/createInstruction.ts | 26 +++++++ .../astProcessor/functionSolver.ts | 39 +++++++---- dev/src/SmartC/codeGenerator/utils.ts | 3 + dev/src/SmartC/shaper/shaper.ts | 11 ++- dev/src/SmartC/shaper/templates.ts | 70 +++++++++++++++++++ dev/src/SmartC/typings/contractTypes.ts | 2 + dev/src/SmartC/typings/syntaxTypes.ts | 2 +- 7 files changed, 138 insertions(+), 15 deletions(-) diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/createInstruction.ts b/dev/src/SmartC/codeGenerator/assemblyProcessor/createInstruction.ts index 07e209a..9158d7d 100644 --- a/dev/src/SmartC/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/dev/src/SmartC/codeGenerator/assemblyProcessor/createInstruction.ts @@ -87,6 +87,32 @@ export function createAPICallInstruction ( return assemblyCode + '\n' } +/** Create assembly code for built-in functions */ +export function createBuiltInInstruction ( + AstAuxVars: GENCODE_AUXVARS, BuiltInToken: TOKEN, RetMem: MEMORY_SLOT, argsMem: MEMORY_SLOT[] +) : string { + let assemblyCode = '' + const tempArgsMem: MEMORY_SLOT[] = [] + argsMem.forEach((VarObj) => { + const Temp = flattenMemory(AstAuxVars, VarObj, -1) + assemblyCode += Temp.asmCode + tempArgsMem.push(Temp.FlatMem) + }) + switch (BuiltInToken.value) { + case 'pow': + assemblyCode += `SET @${RetMem.asmName} $${tempArgsMem[0].asmName}\n` + + `POW @${RetMem.asmName} $${tempArgsMem[1].asmName}\n` + break + case 'mdv': + assemblyCode += `SET @${RetMem.asmName} $${tempArgsMem[0].asmName}\n` + + `MDV @${RetMem.asmName} $${tempArgsMem[1].asmName} $${tempArgsMem[2].asmName}\n` + break + default: + throw new Error(`Internal error at line: ${BuiltInToken.line}. Built-in function not implemented.`) + } + return assemblyCode +} + /** * From ParamMemObj create an memory object suitable for assembly operations (a regular long variable). * Do do rely in createInstruction, all hardwork done internally. Returns also instructions maybe needed for diff --git a/dev/src/SmartC/codeGenerator/astProcessor/functionSolver.ts b/dev/src/SmartC/codeGenerator/astProcessor/functionSolver.ts index 8c285d6..386ce6b 100644 --- a/dev/src/SmartC/codeGenerator/astProcessor/functionSolver.ts +++ b/dev/src/SmartC/codeGenerator/astProcessor/functionSolver.ts @@ -2,7 +2,7 @@ import { assertExpression, assertNotUndefined } from '../../repository/repositor import { CONTRACT, SC_FUNCTION } from '../../typings/contractTypes' import { LOOKUP_ASN, AST, MEMORY_SLOT } from '../../typings/syntaxTypes' import { - createSimpleInstruction, createInstruction, createAPICallInstruction + createSimpleInstruction, createInstruction, createAPICallInstruction, createBuiltInInstruction } from '../assemblyProcessor/createInstruction' import { GENCODE_AUXVARS, GENCODE_ARGS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' @@ -19,12 +19,16 @@ export default function functionSolver ( const fnName = assertNotUndefined(CurrentNode.Token.extValue) const FnToCall = Program.functions.find(val => val.name === fnName) const ApiToCall = Program.Global.APIFunctions.find(val => val.name === fnName) + const BuiltInToCall = Program.Global.BuiltInFunctions.find(val => val.name === fnName) const subSentences = utils.splitASTOnDelimiters(assertNotUndefined(CurrentNode.FunctionArgs)) if (FnToCall) { return userFunctionSolver(FnToCall, subSentences) } + if (BuiltInToCall) { + return internalFunctionSolver('builtin', BuiltInToCall, subSentences) + } if (ApiToCall) { - return apiFunctionSolver(ApiToCall, subSentences) + return internalFunctionSolver('api', ApiToCall, subSentences) } throw new Error(`At line: ${CurrentNode.Token.line}. Function '${fnName}' not declared.`) } @@ -109,11 +113,11 @@ export default function functionSolver ( return { SolvedMem: FnRetObj, asmCode: returnAssemblyCode } } - function apiFunctionSolver (ApiToCall: SC_FUNCTION, rawArgs: AST[]) : GENCODE_SOLVED_OBJECT { + function internalFunctionSolver (type: 'builtin' | 'api', ifnToCall: SC_FUNCTION, rawArgs: AST[]) : GENCODE_SOLVED_OBJECT { let FnRetObj: MEMORY_SLOT const processedArgs: MEMORY_SLOT [] = [] let returnAssemblyCode = '' - if (ApiToCall.declaration === 'void') { + if (ifnToCall.declaration === 'void') { FnRetObj = utils.createVoidMemObj() } else { FnRetObj = AuxVars.getNewRegister() // reserve tempvar for return type @@ -121,10 +125,10 @@ export default function functionSolver ( if (rawArgs[0].type === 'nullASN') { rawArgs.pop() } - if (rawArgs.length !== ApiToCall.argsMemObj.length) { + if (rawArgs.length !== ifnToCall.argsMemObj.length) { throw new Error(`At line: ${CurrentNode.Token.line}.` + - ` Wrong number of arguments for function '${ApiToCall.name}'.` + - ` It must have '${ApiToCall.argsMemObj.length}' args.`) + ` Wrong number of arguments for function '${ifnToCall.name}'.` + + ` It must have '${ifnToCall.argsMemObj.length}' args.`) } rawArgs.forEach(RawSentence => { const ArgGenObj = genCode(Program, AuxVars, { @@ -148,12 +152,21 @@ export default function functionSolver ( } processedArgs.push(ArgGenObj.SolvedMem) }) - returnAssemblyCode += createAPICallInstruction( - AuxVars, - utils.genAPICallToken(CurrentNode.Token.line, ApiToCall.asmName), - FnRetObj, - processedArgs - ) + if (type === 'api') { + returnAssemblyCode += createAPICallInstruction( + AuxVars, + utils.genAPICallToken(CurrentNode.Token.line, ifnToCall.asmName), + FnRetObj, + processedArgs + ) + } else { + returnAssemblyCode += createBuiltInInstruction( + AuxVars, + utils.genBuiltInToken(CurrentNode.Token.line, ifnToCall.asmName), + FnRetObj, + processedArgs + ) + } processedArgs.forEach(varnm => AuxVars.freeRegister(varnm.address)) return { SolvedMem: FnRetObj, asmCode: returnAssemblyCode } } diff --git a/dev/src/SmartC/codeGenerator/utils.ts b/dev/src/SmartC/codeGenerator/utils.ts index 5f4faae..7874139 100644 --- a/dev/src/SmartC/codeGenerator/utils.ts +++ b/dev/src/SmartC/codeGenerator/utils.ts @@ -76,6 +76,9 @@ export default { genAPICallToken (line: number, name?: string): TOKEN { return { type: 'APICall', precedence: 0, value: assertNotUndefined(name), line: line } }, + genBuiltInToken (line: number, name?: string): TOKEN { + return { type: 'BuiltInCall', precedence: 0, value: assertNotUndefined(name), line: line } + }, genPushToken (line: number): TOKEN { return { type: 'Push', precedence: 12, value: '', line: line } }, diff --git a/dev/src/SmartC/shaper/shaper.ts b/dev/src/SmartC/shaper/shaper.ts index d06f97f..a3ba981 100644 --- a/dev/src/SmartC/shaper/shaper.ts +++ b/dev/src/SmartC/shaper/shaper.ts @@ -5,7 +5,9 @@ import { REGISTER_TYPE_DEFINITION } from '../typings/syntaxTypes' import { assertNotUndefined, deepCopy } from '../repository/repository' -import { APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate } from './templates' +import { + APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate +} from './templates' import sentencesProcessor from './sentencesProcessor' import memoryProcessor from './memoryProcessor' import { SHAPER_AUXVARS } from './shaperTypes' @@ -38,6 +40,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { if (Program.Config.APIFunctions) { Program.Global.APIFunctions = APITableTemplate.slice() } + Program.Global.BuiltInFunctions = BuiltInTemplate.slice() validateFunctions() validateMemory() consolidateMemory() @@ -446,6 +449,12 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { ` Found second definition for function '${Program.functions[j].name}'.`) } } + for (j = 0; j < Program.Global.BuiltInFunctions.length; j++) { + if (Program.functions[i].name === Program.Global.BuiltInFunctions[j].name) { + throw new Error(`At line: ${Program.functions[i].line}.` + + ` Function '${Program.functions[i].name}' has same name of one built-in Functions.`) + } + } if (Program.Config.APIFunctions === true) { for (j = 0; j < Program.Global.APIFunctions.length; j++) { if (Program.functions[i].name === Program.Global.APIFunctions[j].name || diff --git a/dev/src/SmartC/shaper/templates.ts b/dev/src/SmartC/shaper/templates.ts index 48eb834..70cedd6 100644 --- a/dev/src/SmartC/shaper/templates.ts +++ b/dev/src/SmartC/shaper/templates.ts @@ -49,6 +49,76 @@ export function getTypeDefinitionTemplate return RetObj as ObjectTypeDefinition } +export const BuiltInTemplate: SC_FUNCTION[] = [ + /* Note here: asmName and name shall be the same */ + { + argsMemObj: [ + { + address: -1, + name: 'addr1', + asmName: 'pow_addr1', + type: 'long', + scope: 'pow', + declaration: 'long', + size: 1, + isDeclared: true + }, + { + address: -1, + name: 'addr2', + asmName: 'pow_addr2', + type: 'long', + scope: 'pow', + declaration: 'long', + size: 1, + isDeclared: true + } + ], + asmName: 'pow', + declaration: 'long', + sentences: [], + name: 'pow' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr1', + asmName: 'mdv_addr1', + type: 'long', + scope: 'mdf', + declaration: 'long', + size: 1, + isDeclared: true + }, + { + address: -1, + name: 'addr2', + asmName: 'mdv_addr2', + type: 'long', + scope: 'mdv', + declaration: 'long', + size: 1, + isDeclared: true + }, + { + address: -1, + name: 'addr3', + asmName: 'mdv_addr3', + type: 'long', + scope: 'mdv', + declaration: 'long', + size: 1, + isDeclared: true + } + ], + asmName: 'mdv', + declaration: 'long', + sentences: [], + name: 'mdv' + } +] + export function getMemoryTemplate (memType: MEMORY_BASE_TYPES) : MEMORY_SLOT { return { type: memType, diff --git a/dev/src/SmartC/typings/contractTypes.ts b/dev/src/SmartC/typings/contractTypes.ts index 2bb1286..b5c5848 100644 --- a/dev/src/SmartC/typings/contractTypes.ts +++ b/dev/src/SmartC/typings/contractTypes.ts @@ -68,6 +68,8 @@ export type SC_FUNCTION = { } export type SC_GLOBAL = { + /** Definitions for Built-In functions */ + BuiltInFunctions: SC_FUNCTION[] /** Definitions for API functions */ APIFunctions: SC_FUNCTION[] /** macros values */ diff --git a/dev/src/SmartC/typings/syntaxTypes.ts b/dev/src/SmartC/typings/syntaxTypes.ts index 13dcb63..9241d56 100644 --- a/dev/src/SmartC/typings/syntaxTypes.ts +++ b/dev/src/SmartC/typings/syntaxTypes.ts @@ -10,7 +10,7 @@ export type PRE_TOKEN = { export type TOKEN_TYPES = 'Variable' | 'Constant' | 'Operator' | 'UnaryOperator' | 'SetUnaryOperator' | 'Assignment'| 'SetOperator'|'Comparision'|'CheckOperator'| 'Arr'|'CodeCave'|'CodeDomain'|'Delimiter'|'Terminator'|'Macro'|'Member'|'Colon'| -'Keyword'|'Function' | 'APICall' | 'Push' +'Keyword'|'Function' | 'APICall' | 'BuiltInCall' | 'Push' export type DECLARATION_TYPES = 'void' | 'long' | 'struct' | 'void_ptr' | 'long_ptr' | 'struct_ptr' | '' From bc6c76f95b639345115664e2e8591ab17c5b03d6 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 20:53:54 -0300 Subject: [PATCH 007/112] Syntax highlight for built-in functions --- dev/3rd-party/highlight.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/3rd-party/highlight.min.js b/dev/3rd-party/highlight.min.js index abde02e..7de8ebf 100644 --- a/dev/3rd-party/highlight.min.js +++ b/dev/3rd-party/highlight.min.js @@ -320,7 +320,7 @@ className:"title",begin:e(s)+n.IDENT_RE,relevance:0 keyword:["asm","break","case","const","continue","default","do","else","exit","for","goto","halt","if","return","sizeof","sleep","struct","switch","while"], type:["long","void"], literal:"true false NULL", -built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp Check_Sig_B_With_A Get_Code_Hash_Id Get_Map_Value_Keys_In_A Set_Map_Value_Keys_In_A Issue_Asset Mint_Asset Distribute_To_Asset_Holders Get_Asset_Holders_Count Get_Activation_Fee Put_Last_Block_GSig_In_A" +built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp Check_Sig_B_With_A Get_Code_Hash_Id Get_Map_Value_Keys_In_A Set_Map_Value_Keys_In_A Issue_Asset Mint_Asset Distribute_To_Asset_Holders Get_Asset_Holders_Count Get_Activation_Fee Put_Last_Block_GSig_In_A pow mdv" },g=[c,a,t,n.C_BLOCK_COMMENT_MODE,l,i],m={variants:[{begin:/=/,end:/;/},{ begin:/\(/,end:/\)/},{beginKeywords:"return else",end:/;/}], keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, From 6c5639884df6578b5a9ae24cf8c3be47f9c0f450 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 21:47:38 -0300 Subject: [PATCH 008/112] Documentation for built-in functions --- docs/1-Basis.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index c975346..6f0e6e4 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -70,6 +70,30 @@ Variables declarations can be inside other sentences, like `for (long i; i<10; i As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru macro definition. There are two special functions: `void main(void)` explained before and `void catch(void)` explained at **Contract states** topic. It is not obligatory to use them. Functions can return also arrays and structs; the returning values can be used directly: example `if ( arrFn(a)[2] == 25 )` or `b = structFn(a)->value;` +### Built-in functions +In 2022 it was introduced two new specific instructions. They are coded in SmartC as built-in functions, so no declaration is needed to use them. +#### mdv +* Prototype: +`long mdv(long m1, long m2, long div);` +* Description: +Computes the value of `m1` multiplied by `m2` with 128-bit precision (no overflow) and then divides this result by `div`. +The calculation is returned as value. +* Notes: + 1) This instruction will be used in optimizations, even if not explicit declared. Use this form to ensure the instruction, or check generated assembly code if in doubt. +#### pow +* Prototype: +`long pow(long base, long expBy1e8);` +* Description: +Computes the value of `base` to the power of `expBy1e8`, where expBy1e8 is used as fixed point representation with 8 decimals (like the values in Signa). The result is returned as long value, decimals are truncated. +* Examples: + * sqrt(49) = 7 :: `val = pow(49, 5000_0000);` + * 5 * 5 * 5 * 5 = 5^4 = 625 :: `val = pow(5, 4_0000_0000);` + * sqrt(48) = 6 :: `val = pow(48, 5000_0000);` +* Notes + 1) pow will return zero if the result is matematically undefined; + 2) pow will return zero if base is negative; + 3) pow will return zero if result is greater than 9223372036854775807 (max positive long). + ### Global statements All global statements are grouped at the beginning of assembly code (even if after functions or end of file). When the contract is executed first time, it does not begin at main function, but will start at the beginning of file and run all global statements. If there is a main function, it will be then executed during this first run. If you stop execution in global statements (with `exit`), the main function will not be processed and the starting point for next transactions will be the start of code. In this case (not using main function) use `halt` keyword to wait next transaction. From 9265ca2a86eb8ca50ff9bd01793799798afd8d23 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 4 May 2022 21:48:46 -0300 Subject: [PATCH 009/112] Fix in built-in function implementation --- dev/src/SmartC/smartc.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/src/SmartC/smartc.ts b/dev/src/SmartC/smartc.ts index 4bf69cd..98ab1b9 100644 --- a/dev/src/SmartC/smartc.ts +++ b/dev/src/SmartC/smartc.ts @@ -40,6 +40,7 @@ export class SmartC { private MachineCode?: MACHINE_OBJECT private Program: CONTRACT = { Global: { + BuiltInFunctions: [], APIFunctions: [], macros: [], sentences: [] From bddbc2e91cb2d02aaf32387dbf069aac4f8bcaf5 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 5 May 2022 11:10:05 -0300 Subject: [PATCH 010/112] Optimization MUL+DIV to MDV --- .../assemblyProcessor/optimizer.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts b/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts index 00e851c..92691b8 100644 --- a/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts +++ b/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts @@ -30,6 +30,7 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri codeLines.forEach(swapBranches) codeLines.forEach(notOpt) codeLines.forEach(popPushRegister) + codeLines.forEach(mdvOpt) codeLines = codeLines.flatMap(branchOpt) } if (O >= 3) { @@ -216,7 +217,7 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri * NOT @r0 -> NOT @a * SET @a $r0 -> DELETE * ``` */ - function notOpt (value: string, index: number, array: string[]) : void { + function notOpt (value: string, index: number, array: string[]) : void { const notdat = /^\s*NOT\s+@(r\d)\s*$/.exec(value) if (notdat === null) { return @@ -234,6 +235,27 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri } } + /** Optimizes MUL + DIV to MDV + * ``` + * MUL @a $c -> DELETE + * DIV @a $d -> MDV @a $c $d + * ``` */ + function mdvOpt (value: string, index: number, array: string[]) : void { + const muldat = /^\s*MUL\s+@(\w+)\s+\$(\w+)\s*$/.exec(value) + if (muldat === null) { + return + } + const divdat = /^\s*DIV\s+@(\w+)\s+\$(\w+)\s*$/.exec(array[index + 1]) + if (divdat === null) { + return + } + if (muldat[1] === divdat[1]) { + array[index] = `MDV @${muldat[1]} $${muldat[2]} $${divdat[2]}` + array[index + 1] = 'DELETE' + optimizedLines++ + } + } + /** Optimizes the meaningless SET * ``` * SET @var $var -> DELETE From e21b7931970f2ff414f3fdf32a791ced329d21c0 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 5 May 2022 11:13:59 -0300 Subject: [PATCH 011/112] Testcase for MDV optimization --- dev/src/SmartC/__tests__/optimizations.a.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev/src/SmartC/__tests__/optimizations.a.spec.ts b/dev/src/SmartC/__tests__/optimizations.a.spec.ts index 3914e5b..a4b5130 100644 --- a/dev/src/SmartC/__tests__/optimizations.a.spec.ts +++ b/dev/src/SmartC/__tests__/optimizations.a.spec.ts @@ -148,6 +148,13 @@ describe('Optimizations level 2', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: mul+div to mdv', () => { + const code = '#pragma optimizationLevel 2\n long a, b, c, d; a = b * c / d;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nMDV @a $c $d\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) /* Please note that these optimizations are not well tested. Code generated by smartc From b0ddc367655958b815b2d99a99a3d33ce3473b83 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 5 May 2022 11:39:12 -0300 Subject: [PATCH 012/112] Testcases for built-in functions --- dev/src/SmartC/__tests__/functions.a.spec.ts | 52 --------------- dev/src/SmartC/__tests__/functions.b.spec.ts | 70 ++++++++++++++++++++ 2 files changed, 70 insertions(+), 52 deletions(-) create mode 100644 dev/src/SmartC/__tests__/functions.b.spec.ts diff --git a/dev/src/SmartC/__tests__/functions.a.spec.ts b/dev/src/SmartC/__tests__/functions.a.spec.ts index f125bcf..b59c05a 100644 --- a/dev/src/SmartC/__tests__/functions.a.spec.ts +++ b/dev/src/SmartC/__tests__/functions.a.spec.ts @@ -330,55 +330,3 @@ void *ret(long *aa, void *bb) { aa++; return aa; }` }).toThrowError(/^At line/) }) }) - -describe('API functions', () => { - it('should compile: right use', () => { - const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong a;Set_A1(a);' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFUN set_A1 $a\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - test('should throw: missing argument', () => { - expect(() => { - const code = '#pragma optimizationLevel 0\n#include APIFunctions\nSet_A1();' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) - it('should compile: Function with same name as API but not including it', () => { - const code = '#pragma optimizationLevel 0\nlong a=0; void Get_B1(void) { a++; }' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFIN\n\n__fn_Get_B1:\nINC @a\nRET\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - test('should throw: Function with same name as API and including it', () => { - expect(() => { - const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong a=0; void Get_B1(void) { a++; }' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) - test('should throw: wrong variable types on API Function argument', () => { - expect(() => { - const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong * a;Set_A1(a);' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) - it('should compile: Passing long inside struct (with offset)', () => { - const code = '#include APIFunctions\n#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; } ;struct KOMBI car[2]; long a;\nSet_A1(car[a].collector);' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^declare a\n\nSET @r0 #0000000000000003\nMUL @r0 $a\nINC @r0\nSET @r1 $($car + $r0)\nFUN set_A1 $r1\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - test('should throw: Undeclared function when APIFunction is declared', () => { - expect(() => { - const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong b, a = 0; test();' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) -}) diff --git a/dev/src/SmartC/__tests__/functions.b.spec.ts b/dev/src/SmartC/__tests__/functions.b.spec.ts new file mode 100644 index 0000000..b36e82f --- /dev/null +++ b/dev/src/SmartC/__tests__/functions.b.spec.ts @@ -0,0 +1,70 @@ +import { SmartC } from '../smartc' + +describe('API functions', () => { + it('should compile: right use', () => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong a;Set_A1(a);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFUN set_A1 $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: missing argument', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\nSet_A1();' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: Function with same name as API but not including it', () => { + const code = '#pragma optimizationLevel 0\nlong a=0; void Get_B1(void) { a++; }' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFIN\n\n__fn_Get_B1:\nINC @a\nRET\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: Function with same name as API and including it', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong a=0; void Get_B1(void) { a++; }' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: wrong variable types on API Function argument', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong * a;Set_A1(a);' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: Passing long inside struct (with offset)', () => { + const code = '#include APIFunctions\n#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; } ;struct KOMBI car[2]; long a;\nSet_A1(car[a].collector);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^declare a\n\nSET @r0 #0000000000000003\nMUL @r0 $a\nINC @r0\nSET @r1 $($car + $r0)\nFUN set_A1 $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: Undeclared function when APIFunction is declared', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\nlong b, a = 0; test();' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) +}) + +describe('Built-in functions', () => { + it('should compile: mdv()', () => { + const code = '#pragma optimizationLevel 0\nlong a, b, c, d; a = mdv(b, c, d);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nMDV @a $c $d\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: pow()', () => { + const code = '#pragma optimizationLevel 0\nlong a, b, c; a=pow(b,c);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nPOW @a $c\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) From da3011a16233f1b29ff052c21aa8cbdecf8035f3 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 5 May 2022 13:40:47 -0300 Subject: [PATCH 013/112] Code lint --- dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts | 2 +- dev/src/testcases.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts b/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts index 92691b8..6ee17f6 100644 --- a/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts +++ b/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts @@ -217,7 +217,7 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri * NOT @r0 -> NOT @a * SET @a $r0 -> DELETE * ``` */ - function notOpt (value: string, index: number, array: string[]) : void { + function notOpt (value: string, index: number, array: string[]) : void { const notdat = /^\s*NOT\s+@(r\d)\s*$/.exec(value) if (notdat === null) { return diff --git a/dev/src/testcases.ts b/dev/src/testcases.ts index f7c3bc4..521a6a6 100644 --- a/dev/src/testcases.ts +++ b/dev/src/testcases.ts @@ -46,7 +46,7 @@ export function runTestCases (jestTest: boolean = false) : string { testMessageA = asmCompiler.getMachineCode().ByteCode testMessageB = asmCompiler.getMachineCode().ByteData testFailed = false - } catch (e) { + } catch (e: any) { testError = e } if (currentByteTest[1] === testFailed && @@ -79,7 +79,7 @@ export function runTestCases (jestTest: boolean = false) : string { cCompiler.compile() testMessage = cCompiler.getAssemblyCode() testFailed = false - } catch (e) { + } catch (e: any) { testError = e.message } if (currentTest[1] === testFailed && testMessage === currentTest[2]) { From bdc0751a152cfab42432a7c35574c4e7512a5986 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 5 May 2022 13:41:15 -0300 Subject: [PATCH 014/112] chore: npm update --- dev/package-lock.json | 5347 +++++++++++++++++++---------------------- 1 file changed, 2502 insertions(+), 2845 deletions(-) diff --git a/dev/package-lock.json b/dev/package-lock.json index 71816cf..2d74e06 100644 --- a/dev/package-lock.json +++ b/dev/package-lock.json @@ -25,6 +25,19 @@ "typescript": "^4.3.5" } }, + "node_modules/@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.12.11", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", @@ -35,35 +48,35 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", - "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.10.tgz", + "integrity": "sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.8.tgz", - "integrity": "sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.15.8", - "@babel/generator": "^7.15.8", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.8", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.8", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.10.tgz", + "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-compilation-targets": "^7.17.10", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.9", + "@babel/parser": "^7.17.10", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.10", + "@babel/types": "^7.17.10", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" + "json5": "^2.2.1", + "semver": "^6.3.0" }, "engines": { "node": ">=6.9.0" @@ -74,12 +87,12 @@ } }, "node_modules/@babel/core/node_modules/@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" }, "engines": { "node": ">=6.9.0" @@ -94,47 +107,29 @@ "semver": "bin/semver.js" } }, - "node_modules/@babel/core/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@babel/generator": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.8.tgz", - "integrity": "sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", + "integrity": "sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==", "dev": true, "dependencies": { - "@babel/types": "^7.15.6", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/types": "^7.17.10", + "@jridgewell/gen-mapping": "^0.1.0", + "jsesc": "^2.5.1" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/generator/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.10.tgz", + "integrity": "sha512-gh3RxjWbauw/dFiU/7whjd0qN9K6nPJMqe6+Er7rOavFh0CQUSwhAE3IcTho2rywPJFxej6TUUHDkWcYI6gGqQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.15.0", - "@babel/helper-validator-option": "^7.14.5", - "browserslist": "^4.16.6", + "@babel/compat-data": "^7.17.10", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.20.2", "semver": "^6.3.0" }, "engines": { @@ -153,186 +148,146 @@ "semver": "bin/semver.js" } }, - "node_modules/@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", - "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", + "node_modules/@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", "dev": true, "dependencies": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", + "node_modules/@babel/helper-function-name": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz", + "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/template": "^7.16.7", + "@babel/types": "^7.17.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", - "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz", - "integrity": "sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg==", - "dev": true, - "dependencies": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", + "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz", - "integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", - "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", "dev": true, - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", - "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", + "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.17.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", - "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.9.tgz", + "integrity": "sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==", "dev": true, "dependencies": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.9", + "@babel/types": "^7.17.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.14.5", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -340,6 +295,18 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/highlight/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -354,6 +321,21 @@ "node": ">=4" } }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -363,10 +345,31 @@ "node": ">=0.8.0" } }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/parser": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.8.tgz", - "integrity": "sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.10.tgz", + "integrity": "sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -523,12 +526,12 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.14.5.tgz", - "integrity": "sha512-u6OXzDaIXjEstBRRoBCQ/uKQKlbuaeE5in0RvWdA4pN6AhqxTIwUsnHPU1CFZA/amYObMsuWhYfRl3Ch90HD0Q==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.10.tgz", + "integrity": "sha512-xJefea1DWXW09pW4Tm9bjwVlPDyYA2it3fWlmEjpYz6alPvTUjL0EOzNzI/FEOyI3r4/J7uVH5UqKgl1TQ5hqQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.16.7" }, "engines": { "node": ">=6.9.0" @@ -538,44 +541,45 @@ } }, "node_modules/@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", - "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/template/node_modules/@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", - "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.10.tgz", + "integrity": "sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.10", + "@babel/types": "^7.17.10", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -584,12 +588,12 @@ } }, "node_modules/@babel/traverse/node_modules/@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" }, "engines": { "node": ">=6.9.0" @@ -605,12 +609,12 @@ } }, "node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", + "integrity": "sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", + "@babel/helper-validator-identifier": "^7.16.7", "to-fast-properties": "^2.0.0" }, "engines": { @@ -667,9 +671,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", - "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, "node_modules/@istanbuljs/load-nyc-config": { @@ -777,16 +781,16 @@ } }, "node_modules/@jest/console": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.3.1.tgz", - "integrity": "sha512-RkFNWmv0iui+qsOr/29q9dyfKTTT5DCuP31kUwg7rmOKPT/ozLeGLKJKVIiOfbiKyleUZKIrHwhmiZWVe8IMdw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.5.1.tgz", + "integrity": "sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^27.3.1", - "jest-util": "^27.3.1", + "jest-message-util": "^27.5.1", + "jest-util": "^27.5.1", "slash": "^3.0.0" }, "engines": { @@ -794,35 +798,35 @@ } }, "node_modules/@jest/core": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-27.3.1.tgz", - "integrity": "sha512-DMNE90RR5QKx0EA+wqe3/TNEwiRpOkhshKNxtLxd4rt3IZpCt+RSL+FoJsGeblRZmqdK4upHA/mKKGPPRAifhg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-27.5.1.tgz", + "integrity": "sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ==", "dev": true, "dependencies": { - "@jest/console": "^27.3.1", - "@jest/reporters": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/reporters": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.8.1", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-changed-files": "^27.3.0", - "jest-config": "^27.3.1", - "jest-haste-map": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-regex-util": "^27.0.6", - "jest-resolve": "^27.3.1", - "jest-resolve-dependencies": "^27.3.1", - "jest-runner": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", - "jest-watcher": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^27.5.1", + "jest-config": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-resolve-dependencies": "^27.5.1", + "jest-runner": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", + "jest-watcher": "^27.5.1", "micromatch": "^4.0.4", "rimraf": "^3.0.0", "slash": "^3.0.0", @@ -841,77 +845,77 @@ } }, "node_modules/@jest/environment": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.3.1.tgz", - "integrity": "sha512-BCKCj4mOVLme6Tanoyc9k0ultp3pnmuyHw73UHRPeeZxirsU/7E3HC4le/VDb/SMzE1JcPnto+XBKFOcoiJzVw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", + "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", "dev": true, "dependencies": { - "@jest/fake-timers": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", - "jest-mock": "^27.3.0" + "jest-mock": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/@jest/fake-timers": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.3.1.tgz", - "integrity": "sha512-M3ZFgwwlqJtWZ+QkBG5NmC23A9w+A6ZxNsO5nJxJsKYt4yguBd3i8TpjQz5NfCX91nEve1KqD9RA2Q+Q1uWqoA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", + "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@sinonjs/fake-timers": "^8.0.1", "@types/node": "*", - "jest-message-util": "^27.3.1", - "jest-mock": "^27.3.0", - "jest-util": "^27.3.1" + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/@jest/globals": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.3.1.tgz", - "integrity": "sha512-Q651FWiWQAIFiN+zS51xqhdZ8g9b88nGCobC87argAxA7nMfNQq0Q0i9zTfQYgLa6qFXk2cGANEqfK051CZ8Pg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", + "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", "dev": true, "dependencies": { - "@jest/environment": "^27.3.1", - "@jest/types": "^27.2.5", - "expect": "^27.3.1" + "@jest/environment": "^27.5.1", + "@jest/types": "^27.5.1", + "expect": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/@jest/reporters": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-27.3.1.tgz", - "integrity": "sha512-m2YxPmL9Qn1emFVgZGEiMwDntDxRRQ2D58tiDQlwYTg5GvbFOKseYCcHtn0WsI8CG4vzPglo3nqbOiT8ySBT/w==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-27.5.1.tgz", + "integrity": "sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.3", + "istanbul-lib-instrument": "^5.1.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "jest-haste-map": "^27.3.1", - "jest-resolve": "^27.3.1", - "jest-util": "^27.3.1", - "jest-worker": "^27.3.1", + "istanbul-reports": "^3.1.3", + "jest-haste-map": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", "slash": "^3.0.0", "source-map": "^0.6.0", "string-length": "^4.0.1", @@ -931,13 +935,13 @@ } }, "node_modules/@jest/source-map": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.0.6.tgz", - "integrity": "sha512-Fek4mi5KQrqmlY07T23JRi0e7Z9bXTOOD86V/uS0EIW4PClvPDqZOyFlLpNJheS6QI0FNX1CgmPjtJ4EA/2M+g==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.5.1.tgz", + "integrity": "sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==", "dev": true, "dependencies": { "callsites": "^3.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "source-map": "^0.6.0" }, "engines": { @@ -945,13 +949,13 @@ } }, "node_modules/@jest/test-result": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.3.1.tgz", - "integrity": "sha512-mLn6Thm+w2yl0opM8J/QnPTqrfS4FoXsXF2WIWJb2O/GBSyResL71BRuMYbYRsGt7ELwS5JGcEcGb52BNrumgg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.5.1.tgz", + "integrity": "sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag==", "dev": true, "dependencies": { - "@jest/console": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/types": "^27.5.1", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, @@ -960,38 +964,38 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.3.1.tgz", - "integrity": "sha512-siySLo07IMEdSjA4fqEnxfIX8lB/lWYsBPwNFtkOvsFQvmBrL3yj3k3uFNZv/JDyApTakRpxbKLJ3CT8UGVCrA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz", + "integrity": "sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ==", "dev": true, "dependencies": { - "@jest/test-result": "^27.3.1", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", - "jest-runtime": "^27.3.1" + "@jest/test-result": "^27.5.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-runtime": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/@jest/transform": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.3.1.tgz", - "integrity": "sha512-3fSvQ02kuvjOI1C1ssqMVBKJpZf6nwoCiSu00zAKh5nrp3SptNtZy/8s5deayHnqxhjD9CWDJ+yqQwuQ0ZafXQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.5.1.tgz", + "integrity": "sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw==", "dev": true, "dependencies": { "@babel/core": "^7.1.0", - "@jest/types": "^27.2.5", - "babel-plugin-istanbul": "^6.0.0", + "@jest/types": "^27.5.1", + "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", - "jest-regex-util": "^27.0.6", - "jest-util": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-util": "^27.5.1", "micromatch": "^4.0.4", - "pirates": "^4.0.1", + "pirates": "^4.0.4", "slash": "^3.0.0", "source-map": "^0.6.1", "write-file-atomic": "^3.0.0" @@ -1001,9 +1005,9 @@ } }, "node_modules/@jest/types": { - "version": "27.2.5", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.2.5.tgz", - "integrity": "sha512-nmuM4VuDtCZcY+eTpw+0nvstwReMsjPoj7ZR80/BbixulhLaiX+fbv8oeLW8WZlJMcsGQsTmMKT/iTZu1Uy/lQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", "dev": true, "dependencies": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -1016,6 +1020,53 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", + "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", + "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", + "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1061,9 +1112,9 @@ } }, "node_modules/@sinonjs/fake-timers": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.0.1.tgz", - "integrity": "sha512-AU7kwFxreVd6OAXcAFlKSmZquiRUU0FvYm44k1Y1QbK7Co4m0aqfGMhjykIeQp/H6rcl+nFmj0zfdUcGVs9Dew==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", "dev": true, "dependencies": { "@sinonjs/commons": "^1.7.0" @@ -1079,9 +1130,9 @@ } }, "node_modules/@types/babel__core": { - "version": "7.1.16", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz", - "integrity": "sha512-EAEHtisTMM+KaKwfWdC3oyllIqswlznXCIVCt7/oRNrh+DhgT4UEBNC/jlADNjvw7UnfbcdkGQcPVZ1xYiLcrQ==", + "version": "7.1.19", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", + "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", "dev": true, "dependencies": { "@babel/parser": "^7.1.0", @@ -1092,9 +1143,9 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.3.tgz", - "integrity": "sha512-/GWCmzJWqV7diQW54smJZzWbSFf4QYtF71WCKhcx6Ru/tFyQIY2eiiITcCAeuPbNSvT9YCGkVMqqvSk2Z0mXiA==", + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", "dev": true, "dependencies": { "@babel/types": "^7.0.0" @@ -1111,9 +1162,9 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.14.2.tgz", - "integrity": "sha512-K2waXdXBi2302XUdcHcR1jCeU0LL4TD9HRs/gk0N2Xvrht+G/BfJa4QObBQZfhMdxiCpV3COl5Nfq4uKTeTnJA==", + "version": "7.17.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.17.1.tgz", + "integrity": "sha512-kVzjari1s2YVi77D3w1yuvohV2idweYXMCDzqBiVNN63TcDWrIlTVOYpqVrvbbyOE/IyzBoTKF0fdnLPEORFxA==", "dev": true, "dependencies": { "@babel/types": "^7.3.0" @@ -1129,9 +1180,9 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", - "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "dev": true }, "node_modules/@types/istanbul-lib-report": { @@ -1153,31 +1204,37 @@ } }, "node_modules/@types/jest": { - "version": "27.0.2", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz", - "integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==", + "version": "27.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz", + "integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==", "dev": true, "dependencies": { - "jest-diff": "^27.0.0", + "jest-matcher-utils": "^27.0.0", "pretty-format": "^27.0.0" } }, "node_modules/@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, "node_modules/@types/node": { - "version": "16.11.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz", - "integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA==", + "version": "17.0.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz", + "integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==", "dev": true }, "node_modules/@types/prettier": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.1.tgz", - "integrity": "sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.0.tgz", + "integrity": "sha512-G/AdOadiZhnJp0jXCaBQU449W2h716OW/EoXeYkCytxKL06X1WCXB4DZpp8TpZ8eyIJVS1cw4lrlkkSYU21cDw==", "dev": true }, "node_modules/@types/stack-utils": { @@ -1196,21 +1253,22 @@ } }, "node_modules/@types/yargs-parser": { - "version": "20.2.1", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", - "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.29.2.tgz", - "integrity": "sha512-x4EMgn4BTfVd9+Z+r+6rmWxoAzBaapt4QFqE+d8L8sUtYZYLDTK6VG/y/SMMWA5t1/BVU5Kf+20rX4PtWzUYZg==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz", + "integrity": "sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "4.29.2", - "@typescript-eslint/scope-manager": "4.29.2", + "@typescript-eslint/experimental-utils": "4.33.0", + "@typescript-eslint/scope-manager": "4.33.0", "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", "regexpp": "^3.1.0", "semver": "^7.3.5", "tsutils": "^3.21.0" @@ -1233,15 +1291,15 @@ } }, "node_modules/@typescript-eslint/experimental-utils": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.29.2.tgz", - "integrity": "sha512-P6mn4pqObhftBBPAv4GQtEK7Yos1fz/MlpT7+YjH9fTxZcALbiiPKuSIfYP/j13CeOjfq8/fr9Thr2glM9ub7A==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz", + "integrity": "sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.7", - "@typescript-eslint/scope-manager": "4.29.2", - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/typescript-estree": "4.29.2", + "@typescript-eslint/scope-manager": "4.33.0", + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/typescript-estree": "4.33.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1257,14 +1315,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.2.tgz", - "integrity": "sha512-WQ6BPf+lNuwteUuyk1jD/aHKqMQ9jrdCn7Gxt9vvBnzbpj7aWEf+aZsJ1zvTjx5zFxGCt000lsbD9tQPEL8u6g==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", + "integrity": "sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "4.29.2", - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/typescript-estree": "4.29.2", + "@typescript-eslint/scope-manager": "4.33.0", + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/typescript-estree": "4.33.0", "debug": "^4.3.1" }, "engines": { @@ -1284,13 +1342,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.2.tgz", - "integrity": "sha512-mfHmvlQxmfkU8D55CkZO2sQOueTxLqGvzV+mG6S/6fIunDiD2ouwsAoiYCZYDDK73QCibYjIZmGhpvKwAB5BOA==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", + "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/visitor-keys": "4.29.2" + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0" }, "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" @@ -1301,9 +1359,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.2.tgz", - "integrity": "sha512-K6ApnEXId+WTGxqnda8z4LhNMa/pZmbTFkDxEBLQAbhLZL50DjeY0VIDCml/0Y3FlcbqXZrABqrcKxq+n0LwzQ==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", + "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", "dev": true, "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" @@ -1314,13 +1372,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.2.tgz", - "integrity": "sha512-TJ0/hEnYxapYn9SGn3dCnETO0r+MjaxtlWZ2xU+EvytF0g4CqTpZL48SqSNn2hXsPolnewF30pdzR9a5Lj3DNg==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/visitor-keys": "4.29.2", + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0", "debug": "^4.3.1", "globby": "^11.0.3", "is-glob": "^4.0.1", @@ -1341,12 +1399,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.2.tgz", - "integrity": "sha512-bDgJLQ86oWHJoZ1ai4TZdgXzJxsea3Ee9u9wsTAvjChdj2WLcVsgWYAPeY7RQMn16tKrlQaBnpKv7KBfs4EQag==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", + "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.29.2", + "@typescript-eslint/types": "4.33.0", "eslint-visitor-keys": "^2.0.0" }, "engines": { @@ -1358,19 +1416,19 @@ } }, "node_modules/abab": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", - "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, "node_modules/accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "dependencies": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" @@ -1490,15 +1548,18 @@ } }, "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { - "color-convert": "^1.9.0" + "color-convert": "^2.0.1" }, "engines": { - "node": ">=4" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/anymatch": { @@ -1524,16 +1585,16 @@ } }, "node_modules/array-includes": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz", - "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", + "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5", "get-intrinsic": "^1.1.1", - "is-string": "^1.0.5" + "is-string": "^1.0.7" }, "engines": { "node": ">= 0.4" @@ -1552,14 +1613,15 @@ } }, "node_modules/array.prototype.flat": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", - "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", + "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" + "es-abstract": "^1.19.2", + "es-shim-unscopables": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -1584,18 +1646,18 @@ "dev": true }, "node_modules/babel-jest": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.3.1.tgz", - "integrity": "sha512-SjIF8hh/ir0peae2D6S6ZKRhUy7q/DnpH7k/V6fT4Bgs/LXXUztOpX4G2tCgq8mLo5HA9mN6NmlFMeYtKmIsTQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz", + "integrity": "sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg==", "dev": true, "dependencies": { - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^27.2.0", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^27.5.1", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "slash": "^3.0.0" }, "engines": { @@ -1621,35 +1683,10 @@ "node": ">=8" } }, - "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.0.4.tgz", - "integrity": "sha512-W6jJF9rLGEISGoCyXRqa/JCGQGmmxPO10TMu7izaUTynxvBvTjqzAIIGCK9USBmIbQAaSWD6XJPrM9Pv5INknw==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-istanbul/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/babel-plugin-jest-hoist": { - "version": "27.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.2.0.tgz", - "integrity": "sha512-TOux9khNKdi64mW+0OIhcmbAn75tTlzKhxmiNXevQaPbrBYK7YKjP1jl6NHTJ6XR5UgUrJbCnWlKVnJn29dfjw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz", + "integrity": "sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ==", "dev": true, "dependencies": { "@babel/template": "^7.3.3", @@ -1685,12 +1722,12 @@ } }, "node_modules/babel-preset-jest": { - "version": "27.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.2.0.tgz", - "integrity": "sha512-z7MgQ3peBwN5L5aCqBKnF6iqdlvZvFUQynEhu0J+X9nHLU72jO3iY331lcYrg+AssJ8q7xsv5/3AICzVmJ/wvg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz", + "integrity": "sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag==", "dev": true, "dependencies": { - "babel-plugin-jest-hoist": "^27.2.0", + "babel-plugin-jest-hoist": "^27.5.1", "babel-preset-current-node-syntax": "^1.0.0" }, "engines": { @@ -1753,15 +1790,25 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.4.tgz", - "integrity": "sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ==", + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.3.tgz", + "integrity": "sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], "dependencies": { - "caniuse-lite": "^1.0.30001265", - "electron-to-chromium": "^1.3.867", + "caniuse-lite": "^1.0.30001332", + "electron-to-chromium": "^1.4.118", "escalade": "^3.1.1", - "node-releases": "^2.0.0", + "node-releases": "^2.0.3", "picocolors": "^1.0.0" }, "bin": { @@ -1769,10 +1816,6 @@ }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" } }, "node_modules/bs-logger": { @@ -1834,14 +1877,20 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001269", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz", - "integrity": "sha512-UOy8okEVs48MyHYgV+RdW1Oiudl1H6KolybD6ZquD0VcrPSgj25omXO1S7rDydjpqaISCwA8Pyx+jUQKZwWO5w==", + "version": "1.0.30001336", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", + "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ] }, "node_modules/chalk": { "version": "4.1.2", @@ -1859,60 +1908,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/chalk/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/chalk/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/char-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", @@ -1923,9 +1918,9 @@ } }, "node_modules/ci-info": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", - "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, "node_modules/cjs-module-lexer": { @@ -1962,18 +1957,21 @@ "dev": true }, "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { - "color-name": "1.1.3" + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/combined-stream": { @@ -2140,9 +2138,9 @@ } }, "node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -2169,9 +2167,9 @@ "dev": true }, "node_modules/deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "node_modules/deepmerge": { @@ -2184,15 +2182,19 @@ } }, "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, "dependencies": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/delayed-stream": { @@ -2235,9 +2237,9 @@ "dev": true }, "node_modules/diff-sequences": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.0.6.tgz", - "integrity": "sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==", "dev": true, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" @@ -2295,9 +2297,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.873", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.873.tgz", - "integrity": "sha512-TiHlCgl2uP26Z0c67u442c0a2MZCWZNCRnPTQDPhVJ4h9G6z2zU0lApD9H0K9R5yFL5SfdaiVsVD2izOY24xBQ==", + "version": "1.4.134", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.134.tgz", + "integrity": "sha512-OdD7M2no4Mi8PopfvoOuNcwYDJ2mNFxaBfurA6okG3fLBaMcFah9S+si84FhX+FIWLKkdaiHfl4A+5ep/gOVrg==", "dev": true }, "node_modules/emittery": { @@ -2355,23 +2357,26 @@ } }, "node_modules/es-abstract": { - "version": "1.18.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.5.tgz", - "integrity": "sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA==", + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", + "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "has-symbols": "^1.0.2", + "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.11.0", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", "string.prototype.trimend": "^1.0.4", @@ -2385,6 +2390,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -2403,38 +2417,38 @@ } }, "node_modules/esbuild": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.8.tgz", - "integrity": "sha512-A4af7G7YZLfG5OnARJRMtlpEsCkq/zHZQXewgPA864l9D6VjjbH1SuFYK/OSV6BtHwDGkdwyRrX0qQFLnMfUcw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", + "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", "dev": true, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" }, "optionalDependencies": { - "esbuild-android-arm64": "0.13.8", - "esbuild-darwin-64": "0.13.8", - "esbuild-darwin-arm64": "0.13.8", - "esbuild-freebsd-64": "0.13.8", - "esbuild-freebsd-arm64": "0.13.8", - "esbuild-linux-32": "0.13.8", - "esbuild-linux-64": "0.13.8", - "esbuild-linux-arm": "0.13.8", - "esbuild-linux-arm64": "0.13.8", - "esbuild-linux-mips64le": "0.13.8", - "esbuild-linux-ppc64le": "0.13.8", - "esbuild-netbsd-64": "0.13.8", - "esbuild-openbsd-64": "0.13.8", - "esbuild-sunos-64": "0.13.8", - "esbuild-windows-32": "0.13.8", - "esbuild-windows-64": "0.13.8", - "esbuild-windows-arm64": "0.13.8" + "esbuild-android-arm64": "0.13.15", + "esbuild-darwin-64": "0.13.15", + "esbuild-darwin-arm64": "0.13.15", + "esbuild-freebsd-64": "0.13.15", + "esbuild-freebsd-arm64": "0.13.15", + "esbuild-linux-32": "0.13.15", + "esbuild-linux-64": "0.13.15", + "esbuild-linux-arm": "0.13.15", + "esbuild-linux-arm64": "0.13.15", + "esbuild-linux-mips64le": "0.13.15", + "esbuild-linux-ppc64le": "0.13.15", + "esbuild-netbsd-64": "0.13.15", + "esbuild-openbsd-64": "0.13.15", + "esbuild-sunos-64": "0.13.15", + "esbuild-windows-32": "0.13.15", + "esbuild-windows-64": "0.13.15", + "esbuild-windows-arm64": "0.13.15" } }, "node_modules/esbuild-android-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.8.tgz", - "integrity": "sha512-AilbChndywpk7CdKkNSZ9klxl+9MboLctXd9LwLo3b0dawmOF/i/t2U5d8LM6SbT1Xw36F8yngSUPrd8yPs2RA==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", + "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", "cpu": [ "arm64" ], @@ -2445,9 +2459,9 @@ ] }, "node_modules/esbuild-darwin-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.8.tgz", - "integrity": "sha512-b6sdiT84zV5LVaoF+UoMVGJzR/iE2vNUfUDfFQGrm4LBwM/PWXweKpuu6RD9mcyCq18cLxkP6w/LD/w9DtX3ng==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", + "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", "cpu": [ "x64" ], @@ -2458,9 +2472,9 @@ ] }, "node_modules/esbuild-darwin-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.8.tgz", - "integrity": "sha512-R8YuPiiJayuJJRUBG4H0VwkEKo6AvhJs2m7Tl0JaIer3u1FHHXwGhMxjJDmK+kXwTFPriSysPvcobXC/UrrZCQ==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", + "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", "cpu": [ "arm64" ], @@ -2471,9 +2485,9 @@ ] }, "node_modules/esbuild-freebsd-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.8.tgz", - "integrity": "sha512-zBn6urrn8FnKC+YSgDxdof9jhPCeU8kR/qaamlV4gI8R3KUaUK162WYM7UyFVAlj9N0MyD3AtB+hltzu4cysTw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", + "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", "cpu": [ "x64" ], @@ -2484,9 +2498,9 @@ ] }, "node_modules/esbuild-freebsd-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.8.tgz", - "integrity": "sha512-pWW2slN7lGlkx0MOEBoUGwRX5UgSCLq3dy2c8RIOpiHtA87xAUpDBvZK10MykbT+aMfXc0NI2lu1X+6kI34xng==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", + "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", "cpu": [ "arm64" ], @@ -2497,9 +2511,9 @@ ] }, "node_modules/esbuild-linux-32": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.8.tgz", - "integrity": "sha512-T0I0ueeKVO/Is0CAeSEOG9s2jeNNb8jrrMwG9QBIm3UU18MRB60ERgkS2uV3fZ1vP2F8i3Z2e3Zju4lg9dhVmw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", + "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", "cpu": [ "ia32" ], @@ -2510,9 +2524,9 @@ ] }, "node_modules/esbuild-linux-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.8.tgz", - "integrity": "sha512-Bm8SYmFtvfDCIu9sjKppFXzRXn2BVpuCinU1ChTuMtdKI/7aPpXIrkqBNOgPTOQO9AylJJc1Zw6EvtKORhn64w==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", + "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", "cpu": [ "x64" ], @@ -2523,9 +2537,9 @@ ] }, "node_modules/esbuild-linux-arm": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.8.tgz", - "integrity": "sha512-4/HfcC40LJ4GPyboHA+db0jpFarTB628D1ifU+/5bunIgY+t6mHkJWyxWxAAE8wl/ZIuRYB9RJFdYpu1AXGPdg==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", + "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", "cpu": [ "arm" ], @@ -2536,9 +2550,9 @@ ] }, "node_modules/esbuild-linux-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.8.tgz", - "integrity": "sha512-X4pWZ+SL+FJ09chWFgRNO3F+YtvAQRcWh0uxKqZSWKiWodAB20flsW/OWFYLXBKiVCTeoGMvENZS/GeVac7+tQ==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", + "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", "cpu": [ "arm64" ], @@ -2549,9 +2563,9 @@ ] }, "node_modules/esbuild-linux-mips64le": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.8.tgz", - "integrity": "sha512-o7e0D+sqHKT31v+mwFircJFjwSKVd2nbkHEn4l9xQ1hLR+Bv8rnt3HqlblY3+sBdlrOTGSwz0ReROlKUMJyldA==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", + "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", "cpu": [ "mips64el" ], @@ -2562,9 +2576,9 @@ ] }, "node_modules/esbuild-linux-ppc64le": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.8.tgz", - "integrity": "sha512-eZSQ0ERsWkukJp2px/UWJHVNuy0lMoz/HZcRWAbB6reoaBw7S9vMzYNUnflfL3XA6WDs+dZn3ekHE4Y2uWLGig==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", + "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", "cpu": [ "ppc64" ], @@ -2575,9 +2589,9 @@ ] }, "node_modules/esbuild-netbsd-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.8.tgz", - "integrity": "sha512-gZX4kP7gVvOrvX0ZwgHmbuHczQUwqYppxqtoyC7VNd80t5nBHOFXVhWo2Ad/Lms0E8b+wwgI/WjZFTCpUHOg9Q==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", + "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", "cpu": [ "x64" ], @@ -2588,9 +2602,9 @@ ] }, "node_modules/esbuild-openbsd-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.8.tgz", - "integrity": "sha512-afzza308X4WmcebexbTzAgfEWt9MUkdTvwIa8xOu4CM2qGbl2LanqEl8/LUs8jh6Gqw6WsicEK52GPrS9wvkcw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", + "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", "cpu": [ "x64" ], @@ -2601,9 +2615,9 @@ ] }, "node_modules/esbuild-sunos-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.8.tgz", - "integrity": "sha512-mWPZibmBbuMKD+LDN23LGcOZ2EawMYBONMXXHmbuxeT0XxCNwadbCVwUQ/2p5Dp5Kvf6mhrlIffcnWOiCBpiVw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", + "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", "cpu": [ "x64" ], @@ -2614,9 +2628,9 @@ ] }, "node_modules/esbuild-windows-32": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.8.tgz", - "integrity": "sha512-QsZ1HnWIcnIEApETZWw8HlOhDSWqdZX2SylU7IzGxOYyVcX7QI06ety/aDcn437mwyO7Ph4RrbhB+2ntM8kX8A==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", + "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", "cpu": [ "ia32" ], @@ -2627,9 +2641,9 @@ ] }, "node_modules/esbuild-windows-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.8.tgz", - "integrity": "sha512-76Fb57B9eE/JmJi1QmUW0tRLQZfGo0it+JeYoCDTSlbTn7LV44ecOHIMJSSgZADUtRMWT9z0Kz186bnaB3amSg==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", + "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", "cpu": [ "x64" ], @@ -2640,9 +2654,9 @@ ] }, "node_modules/esbuild-windows-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.8.tgz", - "integrity": "sha512-HW6Mtq5eTudllxY2YgT62MrVcn7oq2o8TAoAvDUhyiEmRmDY8tPwAhb1vxw5/cdkbukM3KdMYtksnUhF/ekWeg==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", + "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", "cpu": [ "arm64" ], @@ -2702,9 +2716,9 @@ } }, "node_modules/escodegen/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -2864,13 +2878,13 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.2.tgz", - "integrity": "sha512-QG8pcgThYOuqxupd06oYTZoNOGaUdTY1PqK+oS6ElF6vs4pBdk/aYxFVQQXzcrAqp9m7cl7lb2ubazX+g16k2Q==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", "dev": true, "dependencies": { "debug": "^3.2.7", - "pkg-dir": "^2.0.0" + "find-up": "^2.1.0" }, "engines": { "node": ">=4" @@ -2929,32 +2943,30 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.24.0.tgz", - "integrity": "sha512-Kc6xqT9hiYi2cgybOc0I2vC9OgAYga5o/rAFinam/yF/t5uBqxQbauNPMC6fgb640T/89P0gFoO27FOilJ/Cqg==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", "dev": true, "dependencies": { - "array-includes": "^3.1.3", - "array.prototype.flat": "^1.2.4", + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", "debug": "^2.6.9", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.5", - "eslint-module-utils": "^2.6.2", - "find-up": "^2.0.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", "has": "^1.0.3", - "is-core-module": "^2.4.0", - "minimatch": "^3.0.4", - "object.values": "^1.1.3", - "pkg-up": "^2.0.0", - "read-pkg-up": "^3.0.0", - "resolve": "^1.20.0", - "tsconfig-paths": "^3.9.0" + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, "node_modules/eslint-plugin-import/node_modules/debug": { @@ -3038,9 +3050,9 @@ } }, "node_modules/eslint-plugin-promise": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.1.0.tgz", - "integrity": "sha512-NGmI6BH5L12pl7ScQHbg7tvtk4wPxxj8yPHH47NvSmMtFneC077PSeY3huFj06ZWZvtbfxSPt3RuOQD5XcR4ng==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz", + "integrity": "sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==", "dev": true, "engines": { "node": "^10.12.0 || >=12.0.0" @@ -3171,9 +3183,9 @@ } }, "node_modules/esquery/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -3192,9 +3204,9 @@ } }, "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -3266,34 +3278,20 @@ } }, "node_modules/expect": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-27.3.1.tgz", - "integrity": "sha512-MrNXV2sL9iDRebWPGOGFdPQRl2eDQNu/uhxIMShjjx74T6kC6jFIkmQ6OqXDtevjGUkyB2IT56RzDBqXf/QPCg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", + "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", - "ansi-styles": "^5.0.0", - "jest-get-type": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-regex-util": "^27.0.6" + "@jest/types": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/expect/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3301,9 +3299,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -3313,7 +3311,7 @@ "micromatch": "^4.0.4" }, "engines": { - "node": ">=8" + "node": ">=8.6.0" } }, "node_modules/fast-json-stable-stringify": { @@ -3329,9 +3327,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz", - "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3429,15 +3427,15 @@ } }, "node_modules/flatted": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", - "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, "node_modules/follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz", + "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", "dev": true, "funding": [ { @@ -3574,10 +3572,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -3607,9 +3621,9 @@ } }, "node_modules/globals": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", - "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3622,16 +3636,16 @@ } }, "node_modules/globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" }, "engines": { @@ -3655,10 +3669,42 @@ "node": ">= 0.10" } }, + "node_modules/globule/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globule/node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, "node_modules/handle-thing": { @@ -3680,27 +3726,39 @@ } }, "node_modules/has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" @@ -3724,12 +3782,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, "node_modules/hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", @@ -3849,9 +3901,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, "dependencies": { "agent-base": "6", @@ -3883,9 +3935,9 @@ } }, "node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -3908,9 +3960,9 @@ } }, "node_modules/import-local": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz", - "integrity": "sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", "dev": true, "dependencies": { "pkg-dir": "^4.2.0", @@ -3921,90 +3973,11 @@ }, "engines": { "node": ">=8" - } - }, - "node_modules/import-local/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/import-local/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/import-local/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -4100,9 +4073,9 @@ } }, "node_modules/is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", - "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -4154,9 +4127,9 @@ } }, "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" @@ -4166,9 +4139,9 @@ } }, "node_modules/is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true, "engines": { "node": ">= 0.4" @@ -4187,9 +4160,9 @@ } }, "node_modules/is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" @@ -4223,6 +4196,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -4271,6 +4256,18 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -4293,14 +4290,15 @@ } }, "node_modules/istanbul-lib-instrument": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", - "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz", + "integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==", "dev": true, "dependencies": { - "@babel/core": "^7.7.5", + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-coverage": "^3.2.0", "semver": "^6.3.0" }, "engines": { @@ -4330,27 +4328,6 @@ "node": ">=8" } }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/istanbul-lib-source-maps": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", @@ -4366,9 +4343,9 @@ } }, "node_modules/istanbul-reports": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.5.tgz", - "integrity": "sha512-5+19PlhnGabNWB7kOFnuxT8H3T/iIyQzIbQMxXsURmmvKg86P2sbkrGOT77VnHw0Qr0gc2XzRaRfMZYYbSQCJQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", + "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -4379,14 +4356,14 @@ } }, "node_modules/jest": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-27.3.1.tgz", - "integrity": "sha512-U2AX0AgQGd5EzMsiZpYt8HyZ+nSVIh5ujQ9CPp9EQZJMjXIiSZpJNweZl0swatKRoqHWgGKM3zaSwm4Zaz87ng==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz", + "integrity": "sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==", "dev": true, "dependencies": { - "@jest/core": "^27.3.1", + "@jest/core": "^27.5.1", "import-local": "^3.0.2", - "jest-cli": "^27.3.1" + "jest-cli": "^27.5.1" }, "bin": { "jest": "bin/jest.js" @@ -4404,12 +4381,12 @@ } }, "node_modules/jest-changed-files": { - "version": "27.3.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.3.0.tgz", - "integrity": "sha512-9DJs9garMHv4RhylUMZgbdCJ3+jHSkpL9aaVKp13xtXAD80qLTLrqcDZL1PHA9dYA0bCI86Nv2BhkLpLhrBcPg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.5.1.tgz", + "integrity": "sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "execa": "^5.0.0", "throat": "^6.0.1" }, @@ -4418,27 +4395,27 @@ } }, "node_modules/jest-circus": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.3.1.tgz", - "integrity": "sha512-v1dsM9II6gvXokgqq6Yh2jHCpfg7ZqV4jWY66u7npz24JnhP3NHxI0sKT7+ZMQ7IrOWHYAaeEllOySbDbWsiXw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.5.1.tgz", + "integrity": "sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw==", "dev": true, "dependencies": { - "@jest/environment": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", - "expect": "^27.3.1", + "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "pretty-format": "^27.3.1", + "jest-each": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1", "slash": "^3.0.0", "stack-utils": "^2.0.3", "throat": "^6.0.1" @@ -4448,21 +4425,21 @@ } }, "node_modules/jest-cli": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-27.3.1.tgz", - "integrity": "sha512-WHnCqpfK+6EvT62me6WVs8NhtbjAS4/6vZJnk7/2+oOr50cwAzG4Wxt6RXX0hu6m1169ZGMlhYYUNeKBXCph/Q==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-27.5.1.tgz", + "integrity": "sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw==", "dev": true, "dependencies": { - "@jest/core": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/core": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "jest-config": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", "prompts": "^2.0.1", "yargs": "^16.2.0" }, @@ -4482,32 +4459,35 @@ } }, "node_modules/jest-config": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-27.3.1.tgz", - "integrity": "sha512-KY8xOIbIACZ/vdYCKSopL44I0xboxC751IX+DXL2+Wx6DKNycyEfV3rryC3BPm5Uq/BBqDoMrKuqLEUNJmMKKg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-27.5.1.tgz", + "integrity": "sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA==", "dev": true, "dependencies": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^27.3.1", - "@jest/types": "^27.2.5", - "babel-jest": "^27.3.1", + "@babel/core": "^7.8.0", + "@jest/test-sequencer": "^27.5.1", + "@jest/types": "^27.5.1", + "babel-jest": "^27.5.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.1", - "graceful-fs": "^4.2.4", - "jest-circus": "^27.3.1", - "jest-environment-jsdom": "^27.3.1", - "jest-environment-node": "^27.3.1", - "jest-get-type": "^27.3.1", - "jest-jasmine2": "^27.3.1", - "jest-regex-util": "^27.0.6", - "jest-resolve": "^27.3.1", - "jest-runner": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-circus": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "jest-environment-node": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-jasmine2": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runner": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", "micromatch": "^4.0.4", - "pretty-format": "^27.3.1" + "parse-json": "^5.2.0", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" @@ -4522,24 +4502,24 @@ } }, "node_modules/jest-diff": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.3.1.tgz", - "integrity": "sha512-PCeuAH4AWUo2O5+ksW4pL9v5xJAcIKPUPfIhZBcG1RKv/0+dvaWTQK1Nrau8d67dp65fOqbeMdoil+6PedyEPQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "diff-sequences": "^27.0.6", - "jest-get-type": "^27.3.1", - "pretty-format": "^27.3.1" + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-docblock": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.0.6.tgz", - "integrity": "sha512-Fid6dPcjwepTFraz0YxIMCi7dejjJ/KL9FBjPYhBp4Sv1Y9PdhImlKZqYU555BlN4TQKaTc+F2Av1z+anVyGkA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.5.1.tgz", + "integrity": "sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ==", "dev": true, "dependencies": { "detect-newline": "^3.0.0" @@ -4549,33 +4529,33 @@ } }, "node_modules/jest-each": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.3.1.tgz", - "integrity": "sha512-E4SwfzKJWYcvOYCjOxhZcxwL+AY0uFMvdCOwvzgutJiaiodFjkxQQDxHm8FQBeTqDnSmKsQWn7ldMRzTn2zJaQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.5.1.tgz", + "integrity": "sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", - "jest-get-type": "^27.3.1", - "jest-util": "^27.3.1", - "pretty-format": "^27.3.1" + "jest-get-type": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-environment-jsdom": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.3.1.tgz", - "integrity": "sha512-3MOy8qMzIkQlfb3W1TfrD7uZHj+xx8Olix5vMENkj5djPmRqndMaXtpnaZkxmxM+Qc3lo+yVzJjzuXbCcZjAlg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz", + "integrity": "sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw==", "dev": true, "dependencies": { - "@jest/environment": "^27.3.1", - "@jest/fake-timers": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", - "jest-mock": "^27.3.0", - "jest-util": "^27.3.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1", "jsdom": "^16.6.0" }, "engines": { @@ -4583,47 +4563,47 @@ } }, "node_modules/jest-environment-node": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.3.1.tgz", - "integrity": "sha512-T89F/FgkE8waqrTSA7/ydMkcc52uYPgZZ6q8OaZgyiZkJb5QNNCF6oPZjH9IfPFfcc9uBWh1574N0kY0pSvTXw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.5.1.tgz", + "integrity": "sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw==", "dev": true, "dependencies": { - "@jest/environment": "^27.3.1", - "@jest/fake-timers": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", - "jest-mock": "^27.3.0", - "jest-util": "^27.3.1" + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-get-type": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.3.1.tgz", - "integrity": "sha512-+Ilqi8hgHSAdhlQ3s12CAVNd8H96ZkQBfYoXmArzZnOfAtVAJEiPDBirjByEblvG/4LPJmkL+nBqPO3A1YJAEg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", "dev": true, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-haste-map": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.3.1.tgz", - "integrity": "sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.5.1.tgz", + "integrity": "sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/graceful-fs": "^4.1.2", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-regex-util": "^27.0.6", - "jest-serializer": "^27.0.6", - "jest-util": "^27.3.1", - "jest-worker": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^27.5.1", + "jest-serializer": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", "micromatch": "^4.0.4", "walker": "^1.0.7" }, @@ -4635,28 +4615,27 @@ } }, "node_modules/jest-jasmine2": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.3.1.tgz", - "integrity": "sha512-WK11ZUetDQaC09w4/j7o4FZDUIp+4iYWH/Lik34Pv7ukL+DuXFGdnmmi7dT58J2ZYKFB5r13GyE0z3NPeyJmsg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz", + "integrity": "sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ==", "dev": true, "dependencies": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^27.3.1", - "@jest/source-map": "^27.0.6", - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/source-map": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "expect": "^27.3.1", + "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "pretty-format": "^27.3.1", + "jest-each": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1", "throat": "^6.0.1" }, "engines": { @@ -4664,46 +4643,46 @@ } }, "node_modules/jest-leak-detector": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.3.1.tgz", - "integrity": "sha512-78QstU9tXbaHzwlRlKmTpjP9k4Pvre5l0r8Spo4SbFFVy/4Abg9I6ZjHwjg2QyKEAMg020XcjP+UgLZIY50yEg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz", + "integrity": "sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ==", "dev": true, "dependencies": { - "jest-get-type": "^27.3.1", - "pretty-format": "^27.3.1" + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.3.1.tgz", - "integrity": "sha512-hX8N7zXS4k+8bC1Aj0OWpGb7D3gIXxYvPNK1inP5xvE4ztbz3rc4AkI6jGVaerepBnfWB17FL5lWFJT3s7qo8w==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "jest-diff": "^27.3.1", - "jest-get-type": "^27.3.1", - "pretty-format": "^27.3.1" + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-message-util": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.3.1.tgz", - "integrity": "sha512-bh3JEmxsTZ/9rTm0jQrPElbY2+y48Rw2t47uMfByNyUVR+OfPh4anuyKsGqsNkXk/TI4JbLRZx+7p7Hdt6q1yg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", + "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^27.3.1", + "pretty-format": "^27.5.1", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -4712,24 +4691,24 @@ } }, "node_modules/jest-message-util/node_modules/@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/jest-mock": { - "version": "27.3.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.3.0.tgz", - "integrity": "sha512-ziZiLk0elZOQjD08bLkegBzv5hCABu/c8Ytx45nJKkysQwGaonvmTxwjLqEA4qGdasq9o2I8/HtdGMNnVsMTGw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", + "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/node": "*" }, "engines": { @@ -4754,27 +4733,27 @@ } }, "node_modules/jest-regex-util": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.0.6.tgz", - "integrity": "sha512-SUhPzBsGa1IKm8hx2F4NfTGGp+r7BXJ4CulsZ1k2kI+mGLG+lxGrs76veN2LF/aUdGosJBzKgXmNCw+BzFqBDQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", + "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", "dev": true, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-resolve": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.3.1.tgz", - "integrity": "sha512-Dfzt25CFSPo3Y3GCbxynRBZzxq9AdyNN+x/v2IqYx6KVT5Z6me2Z/PsSGFSv3cOSUZqJ9pHxilao/I/m9FouLw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz", + "integrity": "sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", "resolve": "^1.20.0", "resolve.exports": "^1.1.0", "slash": "^3.0.0" @@ -4784,45 +4763,44 @@ } }, "node_modules/jest-resolve-dependencies": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.3.1.tgz", - "integrity": "sha512-X7iLzY8pCiYOnvYo2YrK3P9oSE8/3N2f4pUZMJ8IUcZnT81vlSonya1KTO9ZfKGuC+svE6FHK/XOb8SsoRUV1A==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz", + "integrity": "sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", - "jest-regex-util": "^27.0.6", - "jest-snapshot": "^27.3.1" + "@jest/types": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-snapshot": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-runner": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-27.3.1.tgz", - "integrity": "sha512-r4W6kBn6sPr3TBwQNmqE94mPlYVn7fLBseeJfo4E2uCTmAyDFm2O5DYAQAFP7Q3YfiA/bMwg8TVsciP7k0xOww==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-27.5.1.tgz", + "integrity": "sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ==", "dev": true, "dependencies": { - "@jest/console": "^27.3.1", - "@jest/environment": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/environment": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.8.1", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-docblock": "^27.0.6", - "jest-environment-jsdom": "^27.3.1", - "jest-environment-node": "^27.3.1", - "jest-haste-map": "^27.3.1", - "jest-leak-detector": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-resolve": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-util": "^27.3.1", - "jest-worker": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "jest-environment-node": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-leak-detector": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", "source-map-support": "^0.5.6", "throat": "^6.0.1" }, @@ -4831,93 +4809,78 @@ } }, "node_modules/jest-runtime": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.3.1.tgz", - "integrity": "sha512-qtO6VxPbS8umqhEDpjA4pqTkKQ1Hy4ZSi9mDVeE9Za7LKBo2LdW2jmT+Iod3XFaJqINikZQsn2wEi0j9wPRbLg==", - "dev": true, - "dependencies": { - "@jest/console": "^27.3.1", - "@jest/environment": "^27.3.1", - "@jest/globals": "^27.3.1", - "@jest/source-map": "^27.0.6", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", - "@types/yargs": "^16.0.0", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.5.1.tgz", + "integrity": "sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A==", + "dev": true, + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/globals": "^27.5.1", + "@jest/source-map": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "execa": "^5.0.0", - "exit": "^0.1.2", "glob": "^7.1.3", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-mock": "^27.3.0", - "jest-regex-util": "^27.0.6", - "jest-resolve": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^16.2.0" + "strip-bom": "^4.0.0" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/jest-runtime/node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-serializer": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.0.6.tgz", - "integrity": "sha512-PtGdVK9EGC7dsaziskfqaAPib6wTViY3G8E5wz9tLVPhHyiDNTZn/xjZ4khAw+09QkoOVpn7vF5nPSN6dtBexA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.5.1.tgz", + "integrity": "sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==", "dev": true, "dependencies": { "@types/node": "*", - "graceful-fs": "^4.2.4" + "graceful-fs": "^4.2.9" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-snapshot": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.3.1.tgz", - "integrity": "sha512-APZyBvSgQgOT0XumwfFu7X3G5elj6TGhCBLbBdn3R1IzYustPGPE38F51dBWMQ8hRXa9je0vAdeVDtqHLvB6lg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.5.1.tgz", + "integrity": "sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA==", "dev": true, "dependencies": { "@babel/core": "^7.7.2", "@babel/generator": "^7.7.2", - "@babel/parser": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", "@babel/traverse": "^7.7.2", "@babel/types": "^7.0.0", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/babel__traverse": "^7.0.4", "@types/prettier": "^2.1.5", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^27.3.1", - "graceful-fs": "^4.2.4", - "jest-diff": "^27.3.1", - "jest-get-type": "^27.3.1", - "jest-haste-map": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-resolve": "^27.3.1", - "jest-util": "^27.3.1", + "expect": "^27.5.1", + "graceful-fs": "^4.2.9", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-util": "^27.5.1", "natural-compare": "^1.4.0", - "pretty-format": "^27.3.1", + "pretty-format": "^27.5.1", "semver": "^7.3.2" }, "engines": { @@ -4925,16 +4888,16 @@ } }, "node_modules/jest-util": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.3.1.tgz", - "integrity": "sha512-8fg+ifEH3GDryLQf/eKZck1DEs2YuVPBCMOaHQxVVLmQwl/CDhWzrvChTX4efLZxGrw+AA0mSXv78cyytBt/uw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", + "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "picomatch": "^2.2.3" }, "engines": { @@ -4942,26 +4905,26 @@ } }, "node_modules/jest-validate": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.3.1.tgz", - "integrity": "sha512-3H0XCHDFLA9uDII67Bwi1Vy7AqwA5HqEEjyy934lgVhtJ3eisw6ShOF1MDmRPspyikef5MyExvIm0/TuLzZ86Q==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz", + "integrity": "sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^27.3.1", + "jest-get-type": "^27.5.1", "leven": "^3.1.0", - "pretty-format": "^27.3.1" + "pretty-format": "^27.5.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-validate/node_modules/camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, "engines": { "node": ">=10" @@ -4971,17 +4934,17 @@ } }, "node_modules/jest-watcher": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.3.1.tgz", - "integrity": "sha512-9/xbV6chABsGHWh9yPaAGYVVKurWoP3ZMCv6h+O1v9/+pkOroigs6WzZ0e9gLP/njokUwM7yQhr01LKJVMkaZA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.5.1.tgz", + "integrity": "sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw==", "dev": true, "dependencies": { - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", - "jest-util": "^27.3.1", + "jest-util": "^27.5.1", "string-length": "^4.0.1" }, "engines": { @@ -4989,9 +4952,9 @@ } }, "node_modules/jest-worker": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.3.1.tgz", - "integrity": "sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, "dependencies": { "@types/node": "*", @@ -5002,15 +4965,6 @@ "node": ">= 10.13.0" } }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-worker/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -5092,9 +5046,9 @@ } }, "node_modules/jsdom/node_modules/acorn": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", - "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -5115,10 +5069,10 @@ "node": ">=4" } }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, "node_modules/json-schema-traverse": { @@ -5134,13 +5088,10 @@ "dev": true }, "node_modules/json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", "dev": true, - "dependencies": { - "minimist": "^1.2.5" - }, "bin": { "json5": "lib/cli.js" }, @@ -5204,6 +5155,12 @@ "light-server": "bin/light-server" } }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "node_modules/linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -5213,21 +5170,6 @@ "uc.micro": "^1.0.1" } }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -5247,12 +5189,6 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -5314,12 +5250,12 @@ "dev": true }, "node_modules/makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", "dev": true, "dependencies": { - "tmpl": "1.0.x" + "tmpl": "1.0.5" } }, "node_modules/markdown-folder-to-html": { @@ -5383,13 +5319,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" @@ -5408,21 +5344,21 @@ } }, "node_modules/mime-db": { - "version": "1.50.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz", - "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.33", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz", - "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "dependencies": { - "mime-db": "1.50.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" @@ -5444,9 +5380,9 @@ "dev": true }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" @@ -5456,9 +5392,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "node_modules/morgan": { @@ -5505,9 +5441,9 @@ "dev": true }, "node_modules/negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, "engines": { "node": ">= 0.6" @@ -5519,42 +5455,12 @@ "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", "dev": true }, - "node_modules/node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/node-releases": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.0.tgz", - "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.4.tgz", + "integrity": "sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==", "dev": true }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -5583,9 +5489,9 @@ "dev": true }, "node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -5619,14 +5525,14 @@ } }, "node_modules/object.values": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", - "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.2" + "es-abstract": "^1.19.1" }, "engines": { "node": ">= 0.4" @@ -5758,16 +5664,21 @@ } }, "node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "dependencies": { + "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" }, "engines": { - "node": ">=4" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/parse5": { @@ -5834,9 +5745,9 @@ "dev": true }, "node_modules/picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" @@ -5845,49 +5756,95 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "node_modules/pirates": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", "dev": true, "engines": { - "node": ">=4" + "node": ">= 6" } }, - "node_modules/pirates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", - "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "dependencies": { - "node-modules-regexp": "^1.0.0" + "find-up": "^4.0.0" }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "dependencies": { - "find-up": "^2.1.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", - "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "dependencies": { - "find-up": "^2.1.0" + "p-locate": "^4.1.0" }, "engines": { - "node": ">=4" + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" } }, "node_modules/prelude-ls": { @@ -5900,12 +5857,11 @@ } }, "node_modules/pretty-format": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.3.1.tgz", - "integrity": "sha512-DR/c+pvFc52nLimLROYjnXPtolawm+uWDxr4FjuLDLUn+ktWnSN851KoHwHzzqq6rfCOjkzN8FLgDrSub6UDuA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "dependencies": { - "@jest/types": "^27.2.5", "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" @@ -6014,45 +5970,6 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "node_modules/read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "dependencies": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", - "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", - "dev": true, - "dependencies": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -6116,13 +6033,17 @@ "dev": true }, "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", "dev": true, "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6246,9 +6167,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -6261,9 +6182,9 @@ } }, "node_modules/send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "dev": true, "dependencies": { "debug": "2.6.9", @@ -6273,9 +6194,9 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" @@ -6309,31 +6230,31 @@ } }, "node_modules/send/node_modules/http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", "dev": true, "dependencies": { "depd": "~1.1.2", "inherits": "2.0.4", - "setprototypeof": "1.1.1", + "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "toidentifier": "1.0.1" }, "engines": { "node": ">= 0.6" } }, "node_modules/send/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/send/node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true }, "node_modules/serve-index": { @@ -6370,15 +6291,15 @@ "dev": true }, "node_modules/serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "dev": true, "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" }, "engines": { "node": ">= 0.8.0" @@ -6412,9 +6333,9 @@ } }, "node_modules/shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "dependencies": { "glob": "^7.0.0", @@ -6443,9 +6364,9 @@ } }, "node_modules/signal-exit": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", - "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "node_modules/sisteransi": { @@ -6480,39 +6401,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -6523,47 +6411,15 @@ } }, "node_modules/source-map-support": { - "version": "0.5.20", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", - "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", - "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", - "dev": true - }, "node_modules/spdy": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", @@ -6682,64 +6538,66 @@ } }, "node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/strip-final-newline": { @@ -6764,15 +6622,15 @@ } }, "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/supports-hyperlinks": { @@ -6788,25 +6646,16 @@ "node": ">=8" } }, - "node_modules/supports-hyperlinks/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" + "node": ">= 0.4" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/symbol-tree": { @@ -6816,26 +6665,25 @@ "dev": true }, "node_modules/table": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", - "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "dependencies": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0" + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=10.0.0" } }, "node_modules/table/node_modules/ajv": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.2.tgz", - "integrity": "sha512-9807RlWAgT564wT+DjeyU5OFMPjmzxVobvDFmNAhY+5zD6A2ly3jDp6sgnfyDtlIQ+7H97oc/DGCzzfu9rjw9w==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", @@ -6924,9 +6772,9 @@ } }, "node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true, "engines": { "node": ">=0.6" @@ -6959,9 +6807,9 @@ } }, "node_modules/ts-jest": { - "version": "27.0.7", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.7.tgz", - "integrity": "sha512-O41shibMqzdafpuP+CkrOL7ykbmLh+FqQrXEmV9CydQ5JBk0Sj0uAEF5TNNe94fZWKm3yYvWa/IbyV4Yg1zK2Q==", + "version": "27.1.4", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.4.tgz", + "integrity": "sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==", "dev": true, "dependencies": { "bs-logger": "0.x", @@ -6995,20 +6843,45 @@ }, "babel-jest": { "optional": true + }, + "esbuild": { + "optional": true } } }, "node_modules/tsconfig-paths": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.10.1.tgz", - "integrity": "sha512-rETidPDgCpltxF7MjBZlAFPUHv5aHH2MymyPvh+vEyWAED4Eb/WeMbsnD/JDr4OKPOA1TssDHgIcpTN5Kh0p6Q==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", "dev": true, "dependencies": { - "json5": "^2.2.0", - "minimist": "^1.2.0", + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -7073,9 +6946,9 @@ } }, "node_modules/typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", + "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7101,14 +6974,14 @@ "dev": true }, "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" }, "funding": { @@ -7164,9 +7037,9 @@ "dev": true }, "node_modules/v8-to-istanbul": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.0.tgz", - "integrity": "sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", "dev": true, "dependencies": { "@types/istanbul-lib-coverage": "^2.0.1", @@ -7186,16 +7059,6 @@ "node": ">= 8" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -7218,12 +7081,12 @@ } }, "node_modules/walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", "dev": true, "dependencies": { - "makeerror": "1.0.x" + "makeerror": "1.0.12" } }, "node_modules/wbuf": { @@ -7330,39 +7193,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -7382,9 +7212,9 @@ } }, "node_modules/ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "dev": true, "engines": { "node": ">=8.3.0" @@ -7458,6 +7288,16 @@ } }, "dependencies": { + "@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, "@babel/code-frame": { "version": "7.12.11", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", @@ -7468,41 +7308,41 @@ } }, "@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", - "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.10.tgz", + "integrity": "sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw==", "dev": true }, "@babel/core": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.8.tgz", - "integrity": "sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.15.8", - "@babel/generator": "^7.15.8", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.8", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.8", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.10.tgz", + "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-compilation-targets": "^7.17.10", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.9", + "@babel/parser": "^7.17.10", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.10", + "@babel/types": "^7.17.10", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" + "json5": "^2.2.1", + "semver": "^6.3.0" }, "dependencies": { "@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" } }, "semver": { @@ -7510,43 +7350,29 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true } } }, "@babel/generator": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.8.tgz", - "integrity": "sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", + "integrity": "sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==", "dev": true, "requires": { - "@babel/types": "^7.15.6", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } + "@babel/types": "^7.17.10", + "@jridgewell/gen-mapping": "^0.1.0", + "jsesc": "^2.5.1" } }, "@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.10.tgz", + "integrity": "sha512-gh3RxjWbauw/dFiU/7whjd0qN9K6nPJMqe6+Er7rOavFh0CQUSwhAE3IcTho2rywPJFxej6TUUHDkWcYI6gGqQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.15.0", - "@babel/helper-validator-option": "^7.14.5", - "browserslist": "^4.16.6", + "@babel/compat-data": "^7.17.10", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.20.2", "semver": "^6.3.0" }, "dependencies": { @@ -7558,148 +7384,126 @@ } } }, - "@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", - "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" } }, - "@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", + "@babel/helper-function-name": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz", + "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/template": "^7.16.7", + "@babel/types": "^7.17.0" } }, "@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", "dev": true, "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" } }, "@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", - "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" } }, "@babel/helper-module-transforms": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz", - "integrity": "sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", + "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" } }, "@babel/helper-plugin-utils": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz", - "integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", "dev": true }, - "@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", - "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, "@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", - "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", + "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.17.0" } }, "@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.7" } }, "@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true }, "@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", "dev": true }, "@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", - "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.9.tgz", + "integrity": "sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==", "dev": true, "requires": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.9", + "@babel/types": "^7.17.0" } }, "@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.5", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -7711,18 +7515,48 @@ "supports-color": "^5.3.0" } }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, "@babel/parser": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.8.tgz", - "integrity": "sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.10.tgz", + "integrity": "sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==", "dev": true }, "@babel/plugin-syntax-async-generators": { @@ -7834,60 +7668,61 @@ } }, "@babel/plugin-syntax-typescript": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.14.5.tgz", - "integrity": "sha512-u6OXzDaIXjEstBRRoBCQ/uKQKlbuaeE5in0RvWdA4pN6AhqxTIwUsnHPU1CFZA/amYObMsuWhYfRl3Ch90HD0Q==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.10.tgz", + "integrity": "sha512-xJefea1DWXW09pW4Tm9bjwVlPDyYA2it3fWlmEjpYz6alPvTUjL0EOzNzI/FEOyI3r4/J7uVH5UqKgl1TQ5hqQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.16.7" } }, "@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", - "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" }, "dependencies": { "@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" } } } }, "@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", - "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.10.tgz", + "integrity": "sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.10", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.17.9", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.10", + "@babel/types": "^7.17.10", "debug": "^4.1.0", "globals": "^11.1.0" }, "dependencies": { "@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" } }, "globals": { @@ -7899,12 +7734,12 @@ } }, "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", + "version": "7.17.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", + "integrity": "sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.9", + "@babel/helper-validator-identifier": "^7.16.7", "to-fast-properties": "^2.0.0" } }, @@ -7951,9 +7786,9 @@ } }, "@humanwhocodes/object-schema": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", - "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, "@istanbuljs/load-nyc-config": { @@ -8033,49 +7868,49 @@ "dev": true }, "@jest/console": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.3.1.tgz", - "integrity": "sha512-RkFNWmv0iui+qsOr/29q9dyfKTTT5DCuP31kUwg7rmOKPT/ozLeGLKJKVIiOfbiKyleUZKIrHwhmiZWVe8IMdw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.5.1.tgz", + "integrity": "sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^27.3.1", - "jest-util": "^27.3.1", + "jest-message-util": "^27.5.1", + "jest-util": "^27.5.1", "slash": "^3.0.0" } }, "@jest/core": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-27.3.1.tgz", - "integrity": "sha512-DMNE90RR5QKx0EA+wqe3/TNEwiRpOkhshKNxtLxd4rt3IZpCt+RSL+FoJsGeblRZmqdK4upHA/mKKGPPRAifhg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-27.5.1.tgz", + "integrity": "sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ==", "dev": true, "requires": { - "@jest/console": "^27.3.1", - "@jest/reporters": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/reporters": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.8.1", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-changed-files": "^27.3.0", - "jest-config": "^27.3.1", - "jest-haste-map": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-regex-util": "^27.0.6", - "jest-resolve": "^27.3.1", - "jest-resolve-dependencies": "^27.3.1", - "jest-runner": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", - "jest-watcher": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^27.5.1", + "jest-config": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-resolve-dependencies": "^27.5.1", + "jest-runner": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", + "jest-watcher": "^27.5.1", "micromatch": "^4.0.4", "rimraf": "^3.0.0", "slash": "^3.0.0", @@ -8083,68 +7918,68 @@ } }, "@jest/environment": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.3.1.tgz", - "integrity": "sha512-BCKCj4mOVLme6Tanoyc9k0ultp3pnmuyHw73UHRPeeZxirsU/7E3HC4le/VDb/SMzE1JcPnto+XBKFOcoiJzVw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", + "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", "dev": true, "requires": { - "@jest/fake-timers": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", - "jest-mock": "^27.3.0" + "jest-mock": "^27.5.1" } }, "@jest/fake-timers": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.3.1.tgz", - "integrity": "sha512-M3ZFgwwlqJtWZ+QkBG5NmC23A9w+A6ZxNsO5nJxJsKYt4yguBd3i8TpjQz5NfCX91nEve1KqD9RA2Q+Q1uWqoA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", + "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@sinonjs/fake-timers": "^8.0.1", "@types/node": "*", - "jest-message-util": "^27.3.1", - "jest-mock": "^27.3.0", - "jest-util": "^27.3.1" + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" } }, "@jest/globals": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.3.1.tgz", - "integrity": "sha512-Q651FWiWQAIFiN+zS51xqhdZ8g9b88nGCobC87argAxA7nMfNQq0Q0i9zTfQYgLa6qFXk2cGANEqfK051CZ8Pg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", + "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", "dev": true, "requires": { - "@jest/environment": "^27.3.1", - "@jest/types": "^27.2.5", - "expect": "^27.3.1" + "@jest/environment": "^27.5.1", + "@jest/types": "^27.5.1", + "expect": "^27.5.1" } }, "@jest/reporters": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-27.3.1.tgz", - "integrity": "sha512-m2YxPmL9Qn1emFVgZGEiMwDntDxRRQ2D58tiDQlwYTg5GvbFOKseYCcHtn0WsI8CG4vzPglo3nqbOiT8ySBT/w==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-27.5.1.tgz", + "integrity": "sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw==", "dev": true, "requires": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.3", + "istanbul-lib-instrument": "^5.1.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "jest-haste-map": "^27.3.1", - "jest-resolve": "^27.3.1", - "jest-util": "^27.3.1", - "jest-worker": "^27.3.1", + "istanbul-reports": "^3.1.3", + "jest-haste-map": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", "slash": "^3.0.0", "source-map": "^0.6.0", "string-length": "^4.0.1", @@ -8153,67 +7988,67 @@ } }, "@jest/source-map": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.0.6.tgz", - "integrity": "sha512-Fek4mi5KQrqmlY07T23JRi0e7Z9bXTOOD86V/uS0EIW4PClvPDqZOyFlLpNJheS6QI0FNX1CgmPjtJ4EA/2M+g==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.5.1.tgz", + "integrity": "sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==", "dev": true, "requires": { "callsites": "^3.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "source-map": "^0.6.0" } }, "@jest/test-result": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.3.1.tgz", - "integrity": "sha512-mLn6Thm+w2yl0opM8J/QnPTqrfS4FoXsXF2WIWJb2O/GBSyResL71BRuMYbYRsGt7ELwS5JGcEcGb52BNrumgg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.5.1.tgz", + "integrity": "sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag==", "dev": true, "requires": { - "@jest/console": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/types": "^27.5.1", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" } }, "@jest/test-sequencer": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.3.1.tgz", - "integrity": "sha512-siySLo07IMEdSjA4fqEnxfIX8lB/lWYsBPwNFtkOvsFQvmBrL3yj3k3uFNZv/JDyApTakRpxbKLJ3CT8UGVCrA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz", + "integrity": "sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ==", "dev": true, "requires": { - "@jest/test-result": "^27.3.1", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", - "jest-runtime": "^27.3.1" + "@jest/test-result": "^27.5.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-runtime": "^27.5.1" } }, "@jest/transform": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.3.1.tgz", - "integrity": "sha512-3fSvQ02kuvjOI1C1ssqMVBKJpZf6nwoCiSu00zAKh5nrp3SptNtZy/8s5deayHnqxhjD9CWDJ+yqQwuQ0ZafXQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.5.1.tgz", + "integrity": "sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/types": "^27.2.5", - "babel-plugin-istanbul": "^6.0.0", + "@jest/types": "^27.5.1", + "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", - "jest-regex-util": "^27.0.6", - "jest-util": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-util": "^27.5.1", "micromatch": "^4.0.4", - "pirates": "^4.0.1", + "pirates": "^4.0.4", "slash": "^3.0.0", "source-map": "^0.6.1", "write-file-atomic": "^3.0.0" } }, "@jest/types": { - "version": "27.2.5", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.2.5.tgz", - "integrity": "sha512-nmuM4VuDtCZcY+eTpw+0nvstwReMsjPoj7ZR80/BbixulhLaiX+fbv8oeLW8WZlJMcsGQsTmMKT/iTZu1Uy/lQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -8223,6 +8058,44 @@ "chalk": "^4.0.0" } }, + "@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", + "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", + "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", + "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -8259,9 +8132,9 @@ } }, "@sinonjs/fake-timers": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.0.1.tgz", - "integrity": "sha512-AU7kwFxreVd6OAXcAFlKSmZquiRUU0FvYm44k1Y1QbK7Co4m0aqfGMhjykIeQp/H6rcl+nFmj0zfdUcGVs9Dew==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", "dev": true, "requires": { "@sinonjs/commons": "^1.7.0" @@ -8274,9 +8147,9 @@ "dev": true }, "@types/babel__core": { - "version": "7.1.16", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz", - "integrity": "sha512-EAEHtisTMM+KaKwfWdC3oyllIqswlznXCIVCt7/oRNrh+DhgT4UEBNC/jlADNjvw7UnfbcdkGQcPVZ1xYiLcrQ==", + "version": "7.1.19", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", + "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -8287,9 +8160,9 @@ } }, "@types/babel__generator": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.3.tgz", - "integrity": "sha512-/GWCmzJWqV7diQW54smJZzWbSFf4QYtF71WCKhcx6Ru/tFyQIY2eiiITcCAeuPbNSvT9YCGkVMqqvSk2Z0mXiA==", + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", "dev": true, "requires": { "@babel/types": "^7.0.0" @@ -8306,9 +8179,9 @@ } }, "@types/babel__traverse": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.14.2.tgz", - "integrity": "sha512-K2waXdXBi2302XUdcHcR1jCeU0LL4TD9HRs/gk0N2Xvrht+G/BfJa4QObBQZfhMdxiCpV3COl5Nfq4uKTeTnJA==", + "version": "7.17.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.17.1.tgz", + "integrity": "sha512-kVzjari1s2YVi77D3w1yuvohV2idweYXMCDzqBiVNN63TcDWrIlTVOYpqVrvbbyOE/IyzBoTKF0fdnLPEORFxA==", "dev": true, "requires": { "@babel/types": "^7.3.0" @@ -8324,9 +8197,9 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", - "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", "dev": true }, "@types/istanbul-lib-report": { @@ -8348,31 +8221,37 @@ } }, "@types/jest": { - "version": "27.0.2", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz", - "integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==", + "version": "27.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz", + "integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==", "dev": true, "requires": { - "jest-diff": "^27.0.0", + "jest-matcher-utils": "^27.0.0", "pretty-format": "^27.0.0" } }, "@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, "@types/node": { - "version": "16.11.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz", - "integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA==", + "version": "17.0.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz", + "integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==", "dev": true }, "@types/prettier": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.1.tgz", - "integrity": "sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.0.tgz", + "integrity": "sha512-G/AdOadiZhnJp0jXCaBQU449W2h716OW/EoXeYkCytxKL06X1WCXB4DZpp8TpZ8eyIJVS1cw4lrlkkSYU21cDw==", "dev": true }, "@types/stack-utils": { @@ -8391,76 +8270,77 @@ } }, "@types/yargs-parser": { - "version": "20.2.1", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", - "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.29.2.tgz", - "integrity": "sha512-x4EMgn4BTfVd9+Z+r+6rmWxoAzBaapt4QFqE+d8L8sUtYZYLDTK6VG/y/SMMWA5t1/BVU5Kf+20rX4PtWzUYZg==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz", + "integrity": "sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.29.2", - "@typescript-eslint/scope-manager": "4.29.2", + "@typescript-eslint/experimental-utils": "4.33.0", + "@typescript-eslint/scope-manager": "4.33.0", "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", "regexpp": "^3.1.0", "semver": "^7.3.5", "tsutils": "^3.21.0" } }, "@typescript-eslint/experimental-utils": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.29.2.tgz", - "integrity": "sha512-P6mn4pqObhftBBPAv4GQtEK7Yos1fz/MlpT7+YjH9fTxZcALbiiPKuSIfYP/j13CeOjfq8/fr9Thr2glM9ub7A==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz", + "integrity": "sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==", "dev": true, "requires": { "@types/json-schema": "^7.0.7", - "@typescript-eslint/scope-manager": "4.29.2", - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/typescript-estree": "4.29.2", + "@typescript-eslint/scope-manager": "4.33.0", + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/typescript-estree": "4.33.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.2.tgz", - "integrity": "sha512-WQ6BPf+lNuwteUuyk1jD/aHKqMQ9jrdCn7Gxt9vvBnzbpj7aWEf+aZsJ1zvTjx5zFxGCt000lsbD9tQPEL8u6g==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", + "integrity": "sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.29.2", - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/typescript-estree": "4.29.2", + "@typescript-eslint/scope-manager": "4.33.0", + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/typescript-estree": "4.33.0", "debug": "^4.3.1" } }, "@typescript-eslint/scope-manager": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.2.tgz", - "integrity": "sha512-mfHmvlQxmfkU8D55CkZO2sQOueTxLqGvzV+mG6S/6fIunDiD2ouwsAoiYCZYDDK73QCibYjIZmGhpvKwAB5BOA==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", + "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", "dev": true, "requires": { - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/visitor-keys": "4.29.2" + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0" } }, "@typescript-eslint/types": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.2.tgz", - "integrity": "sha512-K6ApnEXId+WTGxqnda8z4LhNMa/pZmbTFkDxEBLQAbhLZL50DjeY0VIDCml/0Y3FlcbqXZrABqrcKxq+n0LwzQ==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", + "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.2.tgz", - "integrity": "sha512-TJ0/hEnYxapYn9SGn3dCnETO0r+MjaxtlWZ2xU+EvytF0g4CqTpZL48SqSNn2hXsPolnewF30pdzR9a5Lj3DNg==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", "dev": true, "requires": { - "@typescript-eslint/types": "4.29.2", - "@typescript-eslint/visitor-keys": "4.29.2", + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0", "debug": "^4.3.1", "globby": "^11.0.3", "is-glob": "^4.0.1", @@ -8469,29 +8349,29 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.29.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.2.tgz", - "integrity": "sha512-bDgJLQ86oWHJoZ1ai4TZdgXzJxsea3Ee9u9wsTAvjChdj2WLcVsgWYAPeY7RQMn16tKrlQaBnpKv7KBfs4EQag==", + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", + "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.29.2", + "@typescript-eslint/types": "4.33.0", "eslint-visitor-keys": "^2.0.0" } }, "abab": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", - "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" } }, "acorn": { @@ -8574,12 +8454,12 @@ "dev": true }, "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "color-convert": "^2.0.1" } }, "anymatch": { @@ -8602,16 +8482,16 @@ } }, "array-includes": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz", - "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", + "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5", "get-intrinsic": "^1.1.1", - "is-string": "^1.0.5" + "is-string": "^1.0.7" } }, "array-union": { @@ -8621,14 +8501,15 @@ "dev": true }, "array.prototype.flat": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", - "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", + "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", "dev": true, "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" + "es-abstract": "^1.19.2", + "es-shim-unscopables": "^1.0.0" } }, "astral-regex": { @@ -8644,18 +8525,18 @@ "dev": true }, "babel-jest": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.3.1.tgz", - "integrity": "sha512-SjIF8hh/ir0peae2D6S6ZKRhUy7q/DnpH7k/V6fT4Bgs/LXXUztOpX4G2tCgq8mLo5HA9mN6NmlFMeYtKmIsTQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz", + "integrity": "sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg==", "dev": true, "requires": { - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^27.2.0", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^27.5.1", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "slash": "^3.0.0" } }, @@ -8670,33 +8551,12 @@ "@istanbuljs/schema": "^0.1.2", "istanbul-lib-instrument": "^5.0.4", "test-exclude": "^6.0.0" - }, - "dependencies": { - "istanbul-lib-instrument": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.0.4.tgz", - "integrity": "sha512-W6jJF9rLGEISGoCyXRqa/JCGQGmmxPO10TMu7izaUTynxvBvTjqzAIIGCK9USBmIbQAaSWD6XJPrM9Pv5INknw==", - "dev": true, - "requires": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } } }, "babel-plugin-jest-hoist": { - "version": "27.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.2.0.tgz", - "integrity": "sha512-TOux9khNKdi64mW+0OIhcmbAn75tTlzKhxmiNXevQaPbrBYK7YKjP1jl6NHTJ6XR5UgUrJbCnWlKVnJn29dfjw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz", + "integrity": "sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ==", "dev": true, "requires": { "@babel/template": "^7.3.3", @@ -8726,12 +8586,12 @@ } }, "babel-preset-jest": { - "version": "27.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.2.0.tgz", - "integrity": "sha512-z7MgQ3peBwN5L5aCqBKnF6iqdlvZvFUQynEhu0J+X9nHLU72jO3iY331lcYrg+AssJ8q7xsv5/3AICzVmJ/wvg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz", + "integrity": "sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag==", "dev": true, "requires": { - "babel-plugin-jest-hoist": "^27.2.0", + "babel-plugin-jest-hoist": "^27.5.1", "babel-preset-current-node-syntax": "^1.0.0" } }, @@ -8782,15 +8642,15 @@ "dev": true }, "browserslist": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.4.tgz", - "integrity": "sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ==", + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.3.tgz", + "integrity": "sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001265", - "electron-to-chromium": "^1.3.867", + "caniuse-lite": "^1.0.30001332", + "electron-to-chromium": "^1.4.118", "escalade": "^3.1.1", - "node-releases": "^2.0.0", + "node-releases": "^2.0.3", "picocolors": "^1.0.0" } }, @@ -8841,9 +8701,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001269", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz", - "integrity": "sha512-UOy8okEVs48MyHYgV+RdW1Oiudl1H6KolybD6ZquD0VcrPSgj25omXO1S7rDydjpqaISCwA8Pyx+jUQKZwWO5w==", + "version": "1.0.30001336", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", + "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", "dev": true }, "chalk": { @@ -8854,47 +8714,6 @@ "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "char-regex": { @@ -8904,9 +8723,9 @@ "dev": true }, "ci-info": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", - "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true }, "cjs-module-lexer": { @@ -8939,18 +8758,18 @@ "dev": true }, "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "color-name": "1.1.3" + "color-name": "~1.1.4" } }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "combined-stream": { @@ -9099,9 +8918,9 @@ } }, "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -9120,9 +8939,9 @@ "dev": true }, "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "deepmerge": { @@ -9132,12 +8951,13 @@ "dev": true }, "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, "requires": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" } }, "delayed-stream": { @@ -9171,9 +8991,9 @@ "dev": true }, "diff-sequences": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.0.6.tgz", - "integrity": "sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==", "dev": true }, "dir-glob": { @@ -9218,9 +9038,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.873", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.873.tgz", - "integrity": "sha512-TiHlCgl2uP26Z0c67u442c0a2MZCWZNCRnPTQDPhVJ4h9G6z2zU0lApD9H0K9R5yFL5SfdaiVsVD2izOY24xBQ==", + "version": "1.4.134", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.134.tgz", + "integrity": "sha512-OdD7M2no4Mi8PopfvoOuNcwYDJ2mNFxaBfurA6okG3fLBaMcFah9S+si84FhX+FIWLKkdaiHfl4A+5ep/gOVrg==", "dev": true }, "emittery": { @@ -9266,23 +9086,26 @@ } }, "es-abstract": { - "version": "1.18.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.5.tgz", - "integrity": "sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA==", + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", + "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "has-symbols": "^1.0.2", + "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.11.0", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", "string.prototype.trimend": "^1.0.4", @@ -9290,6 +9113,15 @@ "unbox-primitive": "^1.0.1" } }, + "es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -9302,146 +9134,146 @@ } }, "esbuild": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.8.tgz", - "integrity": "sha512-A4af7G7YZLfG5OnARJRMtlpEsCkq/zHZQXewgPA864l9D6VjjbH1SuFYK/OSV6BtHwDGkdwyRrX0qQFLnMfUcw==", - "dev": true, - "requires": { - "esbuild-android-arm64": "0.13.8", - "esbuild-darwin-64": "0.13.8", - "esbuild-darwin-arm64": "0.13.8", - "esbuild-freebsd-64": "0.13.8", - "esbuild-freebsd-arm64": "0.13.8", - "esbuild-linux-32": "0.13.8", - "esbuild-linux-64": "0.13.8", - "esbuild-linux-arm": "0.13.8", - "esbuild-linux-arm64": "0.13.8", - "esbuild-linux-mips64le": "0.13.8", - "esbuild-linux-ppc64le": "0.13.8", - "esbuild-netbsd-64": "0.13.8", - "esbuild-openbsd-64": "0.13.8", - "esbuild-sunos-64": "0.13.8", - "esbuild-windows-32": "0.13.8", - "esbuild-windows-64": "0.13.8", - "esbuild-windows-arm64": "0.13.8" + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", + "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", + "dev": true, + "requires": { + "esbuild-android-arm64": "0.13.15", + "esbuild-darwin-64": "0.13.15", + "esbuild-darwin-arm64": "0.13.15", + "esbuild-freebsd-64": "0.13.15", + "esbuild-freebsd-arm64": "0.13.15", + "esbuild-linux-32": "0.13.15", + "esbuild-linux-64": "0.13.15", + "esbuild-linux-arm": "0.13.15", + "esbuild-linux-arm64": "0.13.15", + "esbuild-linux-mips64le": "0.13.15", + "esbuild-linux-ppc64le": "0.13.15", + "esbuild-netbsd-64": "0.13.15", + "esbuild-openbsd-64": "0.13.15", + "esbuild-sunos-64": "0.13.15", + "esbuild-windows-32": "0.13.15", + "esbuild-windows-64": "0.13.15", + "esbuild-windows-arm64": "0.13.15" } }, "esbuild-android-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.8.tgz", - "integrity": "sha512-AilbChndywpk7CdKkNSZ9klxl+9MboLctXd9LwLo3b0dawmOF/i/t2U5d8LM6SbT1Xw36F8yngSUPrd8yPs2RA==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", + "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", "dev": true, "optional": true }, "esbuild-darwin-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.8.tgz", - "integrity": "sha512-b6sdiT84zV5LVaoF+UoMVGJzR/iE2vNUfUDfFQGrm4LBwM/PWXweKpuu6RD9mcyCq18cLxkP6w/LD/w9DtX3ng==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", + "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", "dev": true, "optional": true }, "esbuild-darwin-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.8.tgz", - "integrity": "sha512-R8YuPiiJayuJJRUBG4H0VwkEKo6AvhJs2m7Tl0JaIer3u1FHHXwGhMxjJDmK+kXwTFPriSysPvcobXC/UrrZCQ==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", + "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", "dev": true, "optional": true }, "esbuild-freebsd-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.8.tgz", - "integrity": "sha512-zBn6urrn8FnKC+YSgDxdof9jhPCeU8kR/qaamlV4gI8R3KUaUK162WYM7UyFVAlj9N0MyD3AtB+hltzu4cysTw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", + "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", "dev": true, "optional": true }, "esbuild-freebsd-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.8.tgz", - "integrity": "sha512-pWW2slN7lGlkx0MOEBoUGwRX5UgSCLq3dy2c8RIOpiHtA87xAUpDBvZK10MykbT+aMfXc0NI2lu1X+6kI34xng==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", + "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", "dev": true, "optional": true }, "esbuild-linux-32": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.8.tgz", - "integrity": "sha512-T0I0ueeKVO/Is0CAeSEOG9s2jeNNb8jrrMwG9QBIm3UU18MRB60ERgkS2uV3fZ1vP2F8i3Z2e3Zju4lg9dhVmw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", + "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", "dev": true, "optional": true }, "esbuild-linux-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.8.tgz", - "integrity": "sha512-Bm8SYmFtvfDCIu9sjKppFXzRXn2BVpuCinU1ChTuMtdKI/7aPpXIrkqBNOgPTOQO9AylJJc1Zw6EvtKORhn64w==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", + "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", "dev": true, "optional": true }, "esbuild-linux-arm": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.8.tgz", - "integrity": "sha512-4/HfcC40LJ4GPyboHA+db0jpFarTB628D1ifU+/5bunIgY+t6mHkJWyxWxAAE8wl/ZIuRYB9RJFdYpu1AXGPdg==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", + "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", "dev": true, "optional": true }, "esbuild-linux-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.8.tgz", - "integrity": "sha512-X4pWZ+SL+FJ09chWFgRNO3F+YtvAQRcWh0uxKqZSWKiWodAB20flsW/OWFYLXBKiVCTeoGMvENZS/GeVac7+tQ==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", + "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", "dev": true, "optional": true }, "esbuild-linux-mips64le": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.8.tgz", - "integrity": "sha512-o7e0D+sqHKT31v+mwFircJFjwSKVd2nbkHEn4l9xQ1hLR+Bv8rnt3HqlblY3+sBdlrOTGSwz0ReROlKUMJyldA==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", + "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", "dev": true, "optional": true }, "esbuild-linux-ppc64le": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.8.tgz", - "integrity": "sha512-eZSQ0ERsWkukJp2px/UWJHVNuy0lMoz/HZcRWAbB6reoaBw7S9vMzYNUnflfL3XA6WDs+dZn3ekHE4Y2uWLGig==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", + "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", "dev": true, "optional": true }, "esbuild-netbsd-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.8.tgz", - "integrity": "sha512-gZX4kP7gVvOrvX0ZwgHmbuHczQUwqYppxqtoyC7VNd80t5nBHOFXVhWo2Ad/Lms0E8b+wwgI/WjZFTCpUHOg9Q==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", + "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", "dev": true, "optional": true }, "esbuild-openbsd-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.8.tgz", - "integrity": "sha512-afzza308X4WmcebexbTzAgfEWt9MUkdTvwIa8xOu4CM2qGbl2LanqEl8/LUs8jh6Gqw6WsicEK52GPrS9wvkcw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", + "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", "dev": true, "optional": true }, "esbuild-sunos-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.8.tgz", - "integrity": "sha512-mWPZibmBbuMKD+LDN23LGcOZ2EawMYBONMXXHmbuxeT0XxCNwadbCVwUQ/2p5Dp5Kvf6mhrlIffcnWOiCBpiVw==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", + "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", "dev": true, "optional": true }, "esbuild-windows-32": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.8.tgz", - "integrity": "sha512-QsZ1HnWIcnIEApETZWw8HlOhDSWqdZX2SylU7IzGxOYyVcX7QI06ety/aDcn437mwyO7Ph4RrbhB+2ntM8kX8A==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", + "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", "dev": true, "optional": true }, "esbuild-windows-64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.8.tgz", - "integrity": "sha512-76Fb57B9eE/JmJi1QmUW0tRLQZfGo0it+JeYoCDTSlbTn7LV44ecOHIMJSSgZADUtRMWT9z0Kz186bnaB3amSg==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", + "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", "dev": true, "optional": true }, "esbuild-windows-arm64": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.8.tgz", - "integrity": "sha512-HW6Mtq5eTudllxY2YgT62MrVcn7oq2o8TAoAvDUhyiEmRmDY8tPwAhb1vxw5/cdkbukM3KdMYtksnUhF/ekWeg==", + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", + "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", "dev": true, "optional": true }, @@ -9477,9 +9309,9 @@ }, "dependencies": { "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true }, "levn": { @@ -9625,13 +9457,13 @@ } }, "eslint-module-utils": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.2.tgz", - "integrity": "sha512-QG8pcgThYOuqxupd06oYTZoNOGaUdTY1PqK+oS6ElF6vs4pBdk/aYxFVQQXzcrAqp9m7cl7lb2ubazX+g16k2Q==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", "dev": true, "requires": { "debug": "^3.2.7", - "pkg-dir": "^2.0.0" + "find-up": "^2.1.0" }, "dependencies": { "debug": { @@ -9673,26 +9505,24 @@ } }, "eslint-plugin-import": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.24.0.tgz", - "integrity": "sha512-Kc6xqT9hiYi2cgybOc0I2vC9OgAYga5o/rAFinam/yF/t5uBqxQbauNPMC6fgb640T/89P0gFoO27FOilJ/Cqg==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", "dev": true, "requires": { - "array-includes": "^3.1.3", - "array.prototype.flat": "^1.2.4", + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", "debug": "^2.6.9", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.5", - "eslint-module-utils": "^2.6.2", - "find-up": "^2.0.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", "has": "^1.0.3", - "is-core-module": "^2.4.0", - "minimatch": "^3.0.4", - "object.values": "^1.1.3", - "pkg-up": "^2.0.0", - "read-pkg-up": "^3.0.0", - "resolve": "^1.20.0", - "tsconfig-paths": "^3.9.0" + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" }, "dependencies": { "debug": { @@ -9759,9 +9589,9 @@ } }, "eslint-plugin-promise": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.1.0.tgz", - "integrity": "sha512-NGmI6BH5L12pl7ScQHbg7tvtk4wPxxj8yPHH47NvSmMtFneC077PSeY3huFj06ZWZvtbfxSPt3RuOQD5XcR4ng==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz", + "integrity": "sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==", "dev": true, "requires": {} }, @@ -9825,9 +9655,9 @@ }, "dependencies": { "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } @@ -9842,9 +9672,9 @@ }, "dependencies": { "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } @@ -9897,25 +9727,15 @@ "dev": true }, "expect": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-27.3.1.tgz", - "integrity": "sha512-MrNXV2sL9iDRebWPGOGFdPQRl2eDQNu/uhxIMShjjx74T6kC6jFIkmQ6OqXDtevjGUkyB2IT56RzDBqXf/QPCg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", + "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", "dev": true, "requires": { - "@jest/types": "^27.2.5", - "ansi-styles": "^5.0.0", - "jest-get-type": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-regex-util": "^27.0.6" - }, - "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true - } + "@jest/types": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1" } }, "fast-deep-equal": { @@ -9925,9 +9745,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -9950,9 +9770,9 @@ "dev": true }, "fastq": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz", - "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -10037,15 +9857,15 @@ } }, "flatted": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", - "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, "follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz", + "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", "dev": true }, "form-data": { @@ -10134,10 +9954,20 @@ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -10158,25 +9988,25 @@ } }, "globals": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", - "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", "dev": true, "requires": { "type-fest": "^0.20.2" } }, "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" } }, @@ -10189,12 +10019,37 @@ "glob": "~7.1.1", "lodash": "~4.17.10", "minimatch": "~3.0.2" + }, + "dependencies": { + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, "handle-thing": { @@ -10213,21 +10068,30 @@ } }, "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true }, "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.1" + } + }, "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, "has-tostringtag": { @@ -10239,12 +10103,6 @@ "has-symbols": "^1.0.2" } }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, "hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", @@ -10353,9 +10211,9 @@ } }, "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, "requires": { "agent-base": "6", @@ -10378,9 +10236,9 @@ } }, "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "import-fresh": { @@ -10394,73 +10252,13 @@ } }, "import-local": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz", - "integrity": "sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", "dev": true, "requires": { "pkg-dir": "^4.2.0", "resolve-cwd": "^3.0.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } } }, "imurmurhash": { @@ -10534,9 +10332,9 @@ "dev": true }, "is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", - "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", "dev": true, "requires": { "has": "^1.0.3" @@ -10570,18 +10368,18 @@ "dev": true }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { "is-extglob": "^2.1.1" } }, "is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true }, "is-number": { @@ -10591,9 +10389,9 @@ "dev": true }, "is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "requires": { "has-tostringtag": "^1.0.0" @@ -10615,6 +10413,15 @@ "has-tostringtag": "^1.0.0" } }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -10645,6 +10452,15 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -10664,14 +10480,15 @@ "dev": true }, "istanbul-lib-instrument": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", - "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz", + "integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==", "dev": true, "requires": { - "@babel/core": "^7.7.5", + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-coverage": "^3.2.0", "semver": "^6.3.0" }, "dependencies": { @@ -10692,23 +10509,6 @@ "istanbul-lib-coverage": "^3.0.0", "make-dir": "^3.0.0", "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "istanbul-lib-source-maps": { @@ -10723,9 +10523,9 @@ } }, "istanbul-reports": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.5.tgz", - "integrity": "sha512-5+19PlhnGabNWB7kOFnuxT8H3T/iIyQzIbQMxXsURmmvKg86P2sbkrGOT77VnHw0Qr0gc2XzRaRfMZYYbSQCJQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", + "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", "dev": true, "requires": { "html-escaper": "^2.0.0", @@ -10733,276 +10533,278 @@ } }, "jest": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-27.3.1.tgz", - "integrity": "sha512-U2AX0AgQGd5EzMsiZpYt8HyZ+nSVIh5ujQ9CPp9EQZJMjXIiSZpJNweZl0swatKRoqHWgGKM3zaSwm4Zaz87ng==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz", + "integrity": "sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==", "dev": true, "requires": { - "@jest/core": "^27.3.1", + "@jest/core": "^27.5.1", "import-local": "^3.0.2", - "jest-cli": "^27.3.1" + "jest-cli": "^27.5.1" } }, "jest-changed-files": { - "version": "27.3.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.3.0.tgz", - "integrity": "sha512-9DJs9garMHv4RhylUMZgbdCJ3+jHSkpL9aaVKp13xtXAD80qLTLrqcDZL1PHA9dYA0bCI86Nv2BhkLpLhrBcPg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.5.1.tgz", + "integrity": "sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "execa": "^5.0.0", "throat": "^6.0.1" } }, "jest-circus": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.3.1.tgz", - "integrity": "sha512-v1dsM9II6gvXokgqq6Yh2jHCpfg7ZqV4jWY66u7npz24JnhP3NHxI0sKT7+ZMQ7IrOWHYAaeEllOySbDbWsiXw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.5.1.tgz", + "integrity": "sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw==", "dev": true, "requires": { - "@jest/environment": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", - "expect": "^27.3.1", + "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "pretty-format": "^27.3.1", + "jest-each": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1", "slash": "^3.0.0", "stack-utils": "^2.0.3", "throat": "^6.0.1" } }, "jest-cli": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-27.3.1.tgz", - "integrity": "sha512-WHnCqpfK+6EvT62me6WVs8NhtbjAS4/6vZJnk7/2+oOr50cwAzG4Wxt6RXX0hu6m1169ZGMlhYYUNeKBXCph/Q==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-27.5.1.tgz", + "integrity": "sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw==", "dev": true, "requires": { - "@jest/core": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/core": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", "exit": "^0.1.2", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "jest-config": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", "prompts": "^2.0.1", "yargs": "^16.2.0" } }, "jest-config": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-27.3.1.tgz", - "integrity": "sha512-KY8xOIbIACZ/vdYCKSopL44I0xboxC751IX+DXL2+Wx6DKNycyEfV3rryC3BPm5Uq/BBqDoMrKuqLEUNJmMKKg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-27.5.1.tgz", + "integrity": "sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA==", "dev": true, "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^27.3.1", - "@jest/types": "^27.2.5", - "babel-jest": "^27.3.1", + "@babel/core": "^7.8.0", + "@jest/test-sequencer": "^27.5.1", + "@jest/types": "^27.5.1", + "babel-jest": "^27.5.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.1", - "graceful-fs": "^4.2.4", - "jest-circus": "^27.3.1", - "jest-environment-jsdom": "^27.3.1", - "jest-environment-node": "^27.3.1", - "jest-get-type": "^27.3.1", - "jest-jasmine2": "^27.3.1", - "jest-regex-util": "^27.0.6", - "jest-resolve": "^27.3.1", - "jest-runner": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-circus": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "jest-environment-node": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-jasmine2": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runner": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", "micromatch": "^4.0.4", - "pretty-format": "^27.3.1" + "parse-json": "^5.2.0", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" } }, "jest-diff": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.3.1.tgz", - "integrity": "sha512-PCeuAH4AWUo2O5+ksW4pL9v5xJAcIKPUPfIhZBcG1RKv/0+dvaWTQK1Nrau8d67dp65fOqbeMdoil+6PedyEPQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", "dev": true, "requires": { "chalk": "^4.0.0", - "diff-sequences": "^27.0.6", - "jest-get-type": "^27.3.1", - "pretty-format": "^27.3.1" + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" } }, "jest-docblock": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.0.6.tgz", - "integrity": "sha512-Fid6dPcjwepTFraz0YxIMCi7dejjJ/KL9FBjPYhBp4Sv1Y9PdhImlKZqYU555BlN4TQKaTc+F2Av1z+anVyGkA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.5.1.tgz", + "integrity": "sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ==", "dev": true, "requires": { "detect-newline": "^3.0.0" } }, "jest-each": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.3.1.tgz", - "integrity": "sha512-E4SwfzKJWYcvOYCjOxhZcxwL+AY0uFMvdCOwvzgutJiaiodFjkxQQDxHm8FQBeTqDnSmKsQWn7ldMRzTn2zJaQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.5.1.tgz", + "integrity": "sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", - "jest-get-type": "^27.3.1", - "jest-util": "^27.3.1", - "pretty-format": "^27.3.1" + "jest-get-type": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1" } }, "jest-environment-jsdom": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.3.1.tgz", - "integrity": "sha512-3MOy8qMzIkQlfb3W1TfrD7uZHj+xx8Olix5vMENkj5djPmRqndMaXtpnaZkxmxM+Qc3lo+yVzJjzuXbCcZjAlg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz", + "integrity": "sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw==", "dev": true, "requires": { - "@jest/environment": "^27.3.1", - "@jest/fake-timers": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", - "jest-mock": "^27.3.0", - "jest-util": "^27.3.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1", "jsdom": "^16.6.0" } }, "jest-environment-node": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.3.1.tgz", - "integrity": "sha512-T89F/FgkE8waqrTSA7/ydMkcc52uYPgZZ6q8OaZgyiZkJb5QNNCF6oPZjH9IfPFfcc9uBWh1574N0kY0pSvTXw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.5.1.tgz", + "integrity": "sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw==", "dev": true, "requires": { - "@jest/environment": "^27.3.1", - "@jest/fake-timers": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", - "jest-mock": "^27.3.0", - "jest-util": "^27.3.1" + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" } }, "jest-get-type": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.3.1.tgz", - "integrity": "sha512-+Ilqi8hgHSAdhlQ3s12CAVNd8H96ZkQBfYoXmArzZnOfAtVAJEiPDBirjByEblvG/4LPJmkL+nBqPO3A1YJAEg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", "dev": true }, "jest-haste-map": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.3.1.tgz", - "integrity": "sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.5.1.tgz", + "integrity": "sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/graceful-fs": "^4.1.2", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "fsevents": "^2.3.2", - "graceful-fs": "^4.2.4", - "jest-regex-util": "^27.0.6", - "jest-serializer": "^27.0.6", - "jest-util": "^27.3.1", - "jest-worker": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^27.5.1", + "jest-serializer": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", "micromatch": "^4.0.4", "walker": "^1.0.7" } }, "jest-jasmine2": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.3.1.tgz", - "integrity": "sha512-WK11ZUetDQaC09w4/j7o4FZDUIp+4iYWH/Lik34Pv7ukL+DuXFGdnmmi7dT58J2ZYKFB5r13GyE0z3NPeyJmsg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz", + "integrity": "sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ==", "dev": true, "requires": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^27.3.1", - "@jest/source-map": "^27.0.6", - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/environment": "^27.5.1", + "@jest/source-map": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "expect": "^27.3.1", + "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "pretty-format": "^27.3.1", + "jest-each": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1", "throat": "^6.0.1" } }, "jest-leak-detector": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.3.1.tgz", - "integrity": "sha512-78QstU9tXbaHzwlRlKmTpjP9k4Pvre5l0r8Spo4SbFFVy/4Abg9I6ZjHwjg2QyKEAMg020XcjP+UgLZIY50yEg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz", + "integrity": "sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ==", "dev": true, "requires": { - "jest-get-type": "^27.3.1", - "pretty-format": "^27.3.1" + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" } }, "jest-matcher-utils": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.3.1.tgz", - "integrity": "sha512-hX8N7zXS4k+8bC1Aj0OWpGb7D3gIXxYvPNK1inP5xvE4ztbz3rc4AkI6jGVaerepBnfWB17FL5lWFJT3s7qo8w==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^27.3.1", - "jest-get-type": "^27.3.1", - "pretty-format": "^27.3.1" + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" } }, "jest-message-util": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.3.1.tgz", - "integrity": "sha512-bh3JEmxsTZ/9rTm0jQrPElbY2+y48Rw2t47uMfByNyUVR+OfPh4anuyKsGqsNkXk/TI4JbLRZx+7p7Hdt6q1yg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", + "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^27.3.1", + "pretty-format": "^27.5.1", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, "dependencies": { "@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.7" } } } }, "jest-mock": { - "version": "27.3.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.3.0.tgz", - "integrity": "sha512-ziZiLk0elZOQjD08bLkegBzv5hCABu/c8Ytx45nJKkysQwGaonvmTxwjLqEA4qGdasq9o2I8/HtdGMNnVsMTGw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", + "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/node": "*" } }, @@ -11014,209 +10816,194 @@ "requires": {} }, "jest-regex-util": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.0.6.tgz", - "integrity": "sha512-SUhPzBsGa1IKm8hx2F4NfTGGp+r7BXJ4CulsZ1k2kI+mGLG+lxGrs76veN2LF/aUdGosJBzKgXmNCw+BzFqBDQ==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", + "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", "dev": true }, "jest-resolve": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.3.1.tgz", - "integrity": "sha512-Dfzt25CFSPo3Y3GCbxynRBZzxq9AdyNN+x/v2IqYx6KVT5Z6me2Z/PsSGFSv3cOSUZqJ9pHxilao/I/m9FouLw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz", + "integrity": "sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", "resolve": "^1.20.0", "resolve.exports": "^1.1.0", "slash": "^3.0.0" } }, "jest-resolve-dependencies": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.3.1.tgz", - "integrity": "sha512-X7iLzY8pCiYOnvYo2YrK3P9oSE8/3N2f4pUZMJ8IUcZnT81vlSonya1KTO9ZfKGuC+svE6FHK/XOb8SsoRUV1A==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz", + "integrity": "sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg==", "dev": true, "requires": { - "@jest/types": "^27.2.5", - "jest-regex-util": "^27.0.6", - "jest-snapshot": "^27.3.1" + "@jest/types": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-snapshot": "^27.5.1" } }, "jest-runner": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-27.3.1.tgz", - "integrity": "sha512-r4W6kBn6sPr3TBwQNmqE94mPlYVn7fLBseeJfo4E2uCTmAyDFm2O5DYAQAFP7Q3YfiA/bMwg8TVsciP7k0xOww==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-27.5.1.tgz", + "integrity": "sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ==", "dev": true, "requires": { - "@jest/console": "^27.3.1", - "@jest/environment": "^27.3.1", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/console": "^27.5.1", + "@jest/environment": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.8.1", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-docblock": "^27.0.6", - "jest-environment-jsdom": "^27.3.1", - "jest-environment-node": "^27.3.1", - "jest-haste-map": "^27.3.1", - "jest-leak-detector": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-resolve": "^27.3.1", - "jest-runtime": "^27.3.1", - "jest-util": "^27.3.1", - "jest-worker": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "jest-environment-node": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-leak-detector": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", "source-map-support": "^0.5.6", "throat": "^6.0.1" } }, "jest-runtime": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.3.1.tgz", - "integrity": "sha512-qtO6VxPbS8umqhEDpjA4pqTkKQ1Hy4ZSi9mDVeE9Za7LKBo2LdW2jmT+Iod3XFaJqINikZQsn2wEi0j9wPRbLg==", - "dev": true, - "requires": { - "@jest/console": "^27.3.1", - "@jest/environment": "^27.3.1", - "@jest/globals": "^27.3.1", - "@jest/source-map": "^27.0.6", - "@jest/test-result": "^27.3.1", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", - "@types/yargs": "^16.0.0", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.5.1.tgz", + "integrity": "sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A==", + "dev": true, + "requires": { + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/globals": "^27.5.1", + "@jest/source-map": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "execa": "^5.0.0", - "exit": "^0.1.2", "glob": "^7.1.3", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-mock": "^27.3.0", - "jest-regex-util": "^27.0.6", - "jest-resolve": "^27.3.1", - "jest-snapshot": "^27.3.1", - "jest-util": "^27.3.1", - "jest-validate": "^27.3.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^16.2.0" - }, - "dependencies": { - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - } + "strip-bom": "^4.0.0" } }, "jest-serializer": { - "version": "27.0.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.0.6.tgz", - "integrity": "sha512-PtGdVK9EGC7dsaziskfqaAPib6wTViY3G8E5wz9tLVPhHyiDNTZn/xjZ4khAw+09QkoOVpn7vF5nPSN6dtBexA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.5.1.tgz", + "integrity": "sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==", "dev": true, "requires": { "@types/node": "*", - "graceful-fs": "^4.2.4" + "graceful-fs": "^4.2.9" } }, "jest-snapshot": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.3.1.tgz", - "integrity": "sha512-APZyBvSgQgOT0XumwfFu7X3G5elj6TGhCBLbBdn3R1IzYustPGPE38F51dBWMQ8hRXa9je0vAdeVDtqHLvB6lg==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.5.1.tgz", + "integrity": "sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA==", "dev": true, "requires": { "@babel/core": "^7.7.2", "@babel/generator": "^7.7.2", - "@babel/parser": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", "@babel/traverse": "^7.7.2", "@babel/types": "^7.0.0", - "@jest/transform": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", "@types/babel__traverse": "^7.0.4", "@types/prettier": "^2.1.5", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^27.3.1", - "graceful-fs": "^4.2.4", - "jest-diff": "^27.3.1", - "jest-get-type": "^27.3.1", - "jest-haste-map": "^27.3.1", - "jest-matcher-utils": "^27.3.1", - "jest-message-util": "^27.3.1", - "jest-resolve": "^27.3.1", - "jest-util": "^27.3.1", + "expect": "^27.5.1", + "graceful-fs": "^4.2.9", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-util": "^27.5.1", "natural-compare": "^1.4.0", - "pretty-format": "^27.3.1", + "pretty-format": "^27.5.1", "semver": "^7.3.2" } }, "jest-util": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.3.1.tgz", - "integrity": "sha512-8fg+ifEH3GDryLQf/eKZck1DEs2YuVPBCMOaHQxVVLmQwl/CDhWzrvChTX4efLZxGrw+AA0mSXv78cyytBt/uw==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", + "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", - "graceful-fs": "^4.2.4", + "graceful-fs": "^4.2.9", "picomatch": "^2.2.3" } }, "jest-validate": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.3.1.tgz", - "integrity": "sha512-3H0XCHDFLA9uDII67Bwi1Vy7AqwA5HqEEjyy934lgVhtJ3eisw6ShOF1MDmRPspyikef5MyExvIm0/TuLzZ86Q==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz", + "integrity": "sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ==", "dev": true, "requires": { - "@jest/types": "^27.2.5", + "@jest/types": "^27.5.1", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^27.3.1", + "jest-get-type": "^27.5.1", "leven": "^3.1.0", - "pretty-format": "^27.3.1" + "pretty-format": "^27.5.1" }, "dependencies": { "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true } } }, "jest-watcher": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.3.1.tgz", - "integrity": "sha512-9/xbV6chABsGHWh9yPaAGYVVKurWoP3ZMCv6h+O1v9/+pkOroigs6WzZ0e9gLP/njokUwM7yQhr01LKJVMkaZA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.5.1.tgz", + "integrity": "sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw==", "dev": true, "requires": { - "@jest/test-result": "^27.3.1", - "@jest/types": "^27.2.5", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", - "jest-util": "^27.3.1", + "jest-util": "^27.5.1", "string-length": "^4.0.1" } }, "jest-worker": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.3.1.tgz", - "integrity": "sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, "requires": { "@types/node": "*", @@ -11224,12 +11011,6 @@ "supports-color": "^8.0.0" }, "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -11293,9 +11074,9 @@ }, "dependencies": { "acorn": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", - "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", "dev": true } } @@ -11306,10 +11087,10 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, "json-schema-traverse": { @@ -11325,13 +11106,10 @@ "dev": true }, "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "dev": true }, "kleur": { "version": "3.0.3", @@ -11377,6 +11155,12 @@ "ws": "^7.3.1" } }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -11386,18 +11170,6 @@ "uc.micro": "^1.0.1" } }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -11414,12 +11186,6 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -11471,12 +11237,12 @@ "dev": true }, "makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", "dev": true, "requires": { - "tmpl": "1.0.x" + "tmpl": "1.0.5" } }, "markdown-folder-to-html": { @@ -11529,13 +11295,13 @@ "dev": true }, "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.2", + "picomatch": "^2.3.1" } }, "mime": { @@ -11545,18 +11311,18 @@ "dev": true }, "mime-db": { - "version": "1.50.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz", - "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true }, "mime-types": { - "version": "2.1.33", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz", - "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "requires": { - "mime-db": "1.50.0" + "mime-db": "1.52.0" } }, "mimic-fn": { @@ -11572,18 +11338,18 @@ "dev": true }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "morgan": { @@ -11629,9 +11395,9 @@ "dev": true }, "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true }, "node-int64": { @@ -11640,38 +11406,12 @@ "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", "dev": true }, - "node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true - }, "node-releases": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.0.tgz", - "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.4.tgz", + "integrity": "sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ==", "dev": true }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -11694,9 +11434,9 @@ "dev": true }, "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true }, "object-keys": { @@ -11718,14 +11458,14 @@ } }, "object.values": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", - "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.2" + "es-abstract": "^1.19.1" } }, "obuf": { @@ -11821,13 +11561,15 @@ } }, "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "requires": { + "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" } }, "parse5": { @@ -11879,42 +11621,75 @@ "dev": true }, "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", - "dev": true - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "pirates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", - "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", - "dev": true, - "requires": { - "node-modules-regexp": "^1.0.0" - } + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "dev": true }, "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", - "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "requires": { - "find-up": "^2.1.0" + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } } }, "prelude-ls": { @@ -11924,12 +11699,11 @@ "dev": true }, "pretty-format": { - "version": "27.3.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.3.1.tgz", - "integrity": "sha512-DR/c+pvFc52nLimLROYjnXPtolawm+uWDxr4FjuLDLUn+ktWnSN851KoHwHzzqq6rfCOjkzN8FLgDrSub6UDuA==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "requires": { - "@jest/types": "^27.2.5", "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" @@ -12001,38 +11775,6 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "dependencies": { - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - } - } - }, - "read-pkg-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", - "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - } - }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -12078,13 +11820,14 @@ "dev": true }, "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", "dev": true, "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-cwd": { @@ -12168,18 +11911,18 @@ "dev": true }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "dev": true, "requires": { "lru-cache": "^6.0.0" } }, "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "dev": true, "requires": { "debug": "2.6.9", @@ -12189,9 +11932,9 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" @@ -12221,28 +11964,28 @@ "dev": true }, "http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", "dev": true, "requires": { "depd": "~1.1.2", "inherits": "2.0.4", - "setprototypeof": "1.1.1", + "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "toidentifier": "1.0.1" } }, "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true } } @@ -12280,15 +12023,15 @@ } }, "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "dev": true, "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" } }, "setprototypeof": { @@ -12313,9 +12056,9 @@ "dev": true }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "requires": { "glob": "^7.0.0", @@ -12335,9 +12078,9 @@ } }, "signal-exit": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", - "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "sisteransi": { @@ -12361,32 +12104,6 @@ "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } } }, "source-map": { @@ -12396,47 +12113,15 @@ "dev": true }, "source-map-support": { - "version": "0.5.20", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", - "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", - "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", - "dev": true - }, "spdy": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", @@ -12527,49 +12212,51 @@ } }, "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" } }, "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" } }, "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true }, "strip-final-newline": { @@ -12585,12 +12272,12 @@ "dev": true }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } }, "supports-hyperlinks": { @@ -12601,25 +12288,14 @@ "requires": { "has-flag": "^4.0.0", "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -12627,23 +12303,22 @@ "dev": true }, "table": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", - "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "requires": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0" + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" }, "dependencies": { "ajv": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.2.tgz", - "integrity": "sha512-9807RlWAgT564wT+DjeyU5OFMPjmzxVobvDFmNAhY+5zD6A2ly3jDp6sgnfyDtlIQ+7H97oc/DGCzzfu9rjw9w==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -12715,9 +12390,9 @@ } }, "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true }, "tough-cookie": { @@ -12741,9 +12416,9 @@ } }, "ts-jest": { - "version": "27.0.7", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.7.tgz", - "integrity": "sha512-O41shibMqzdafpuP+CkrOL7ykbmLh+FqQrXEmV9CydQ5JBk0Sj0uAEF5TNNe94fZWKm3yYvWa/IbyV4Yg1zK2Q==", + "version": "27.1.4", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.4.tgz", + "integrity": "sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==", "dev": true, "requires": { "bs-logger": "0.x", @@ -12757,14 +12432,32 @@ } }, "tsconfig-paths": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.10.1.tgz", - "integrity": "sha512-rETidPDgCpltxF7MjBZlAFPUHv5aHH2MymyPvh+vEyWAED4Eb/WeMbsnD/JDr4OKPOA1TssDHgIcpTN5Kh0p6Q==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", "dev": true, "requires": { - "json5": "^2.2.0", - "minimist": "^1.2.0", + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } } }, "tslib": { @@ -12813,9 +12506,9 @@ } }, "typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", + "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true }, "uberproto": { @@ -12831,14 +12524,14 @@ "dev": true }, "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" } }, @@ -12882,9 +12575,9 @@ "dev": true }, "v8-to-istanbul": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.0.tgz", - "integrity": "sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "^2.0.1", @@ -12900,16 +12593,6 @@ } } }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -12929,12 +12612,12 @@ } }, "walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", "dev": true, "requires": { - "makeerror": "1.0.x" + "makeerror": "1.0.12" } }, "wbuf": { @@ -13015,32 +12698,6 @@ "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } } }, "wrappy": { @@ -13062,9 +12719,9 @@ } }, "ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "dev": true, "requires": {} }, From 8eb36718c09e4a179f85020a81326ffbf08f4331 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 8 May 2022 11:39:07 -0300 Subject: [PATCH 015/112] Add #program codeHashId --- dev/src/SmartC/assembler/assembler.ts | 16 +++++++++++++++- dev/src/SmartC/codeGenerator/codeGenerator.ts | 3 +++ dev/src/SmartC/shaper/shaper.ts | 7 +++++++ dev/src/SmartC/smartc.ts | 2 ++ dev/src/SmartC/typings/contractTypes.ts | 2 ++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dev/src/SmartC/assembler/assembler.ts b/dev/src/SmartC/assembler/assembler.ts index 198b8e0..b066243 100644 --- a/dev/src/SmartC/assembler/assembler.ts +++ b/dev/src/SmartC/assembler/assembler.ts @@ -57,6 +57,10 @@ type ASM_OBJECT = { PUserStackPages: number /** Selected size for code stack */ PCodeStackPages: number + /** Previous calculates codeHashId. If zero, it is ignored */ + PCodeHashId: string + /** Calculated codeHashId for this run */ + codeHashId: string /** hexstring of compiled program */ bytecode: string /** hexstring for memory starting values */ @@ -238,6 +242,8 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { PActivationAmount: '', PUserStackPages: 0, PCodeStackPages: 0, + PCodeHashId: '', + codeHashId: '', bytecode: '', bytedata: '' } @@ -275,6 +281,11 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { // last pass, join all contents in little endian notation (code and data) AsmObj.code.forEach(finishHim) AsmObj.bytedata = fatality(AsmObj.memory) + // codeHashId calculation and checks + AsmObj.codeHashId = hashMachineCode(AsmObj.bytecode) + if (AsmObj.PCodeHashId !== '' && AsmObj.PCodeHashId !== '0' && AsmObj.PCodeHashId !== AsmObj.codeHashId) { + throw new Error(`assembler() error #8. This compilation did not produce expected machine code hash id. Expected: ${AsmObj.PCodeHashId} Generated: ${AsmObj.codeHashId}.`) + } return buildRetObj() } @@ -330,6 +341,9 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { case 'codeStackPages': AsmObj.PCodeStackPages = Number(parts[2].trim()) break + case 'codeHashId': + AsmObj.PCodeHashId = parts[2].trim() + break default: throw new Error(`assembler() error #7. Unknow '^program' directive: '${parts[1]}'`) } @@ -512,7 +526,7 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { CodePages: codepages, MinimumFeeNQT: minimumfee.toString(10), ByteCode: AsmObj.bytecode, - MachineCodeHashId: hashMachineCode(AsmObj.bytecode), + MachineCodeHashId: AsmObj.codeHashId, ByteData: AsmObj.bytedata, Memory: AsmObj.memory.map(Obj => Obj.name), Labels: AsmObj.labels, diff --git a/dev/src/SmartC/codeGenerator/codeGenerator.ts b/dev/src/SmartC/codeGenerator/codeGenerator.ts index d32c41e..65ee519 100644 --- a/dev/src/SmartC/codeGenerator/codeGenerator.ts +++ b/dev/src/SmartC/codeGenerator/codeGenerator.ts @@ -125,6 +125,9 @@ export default function codeGenerator (Program: CONTRACT) { if (Program.Config.PCodeStackPages !== 0) { writeAsmLine(`^program codeStackPages ${Program.Config.PCodeStackPages}`) } + if (Program.Config.PCodeHashId !== '') { + writeAsmLine(`^program codeHashId ${Program.Config.PCodeHashId}`) + } } /** Handles variables declarations to assembly code. */ diff --git a/dev/src/SmartC/shaper/shaper.ts b/dev/src/SmartC/shaper/shaper.ts index a3ba981..68a8510 100644 --- a/dev/src/SmartC/shaper/shaper.ts +++ b/dev/src/SmartC/shaper/shaper.ts @@ -244,6 +244,13 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { } throw new Error(`At line: ${MacroToken.line}.` + ' Program code stack pages must be a number between 0 and 10, included.') + case 'codeHashId': + if (/^\d+\s*$/.test(MacroToken.value)) { + Program.Config.PCodeHashId = MacroToken.value.trim() + return + } + throw new Error(`At line: ${MacroToken.line}.` + + ' Program code hash id must be a decimal number. Use 0 to let compiler fill the value at assembly output.') default: throw new Error(`At line: ${MacroToken.line}.` + ` Unknow macro property: '#${MacroToken.type} ${MacroToken.property}'.` + diff --git a/dev/src/SmartC/smartc.ts b/dev/src/SmartC/smartc.ts index 98ab1b9..1d2274d 100644 --- a/dev/src/SmartC/smartc.ts +++ b/dev/src/SmartC/smartc.ts @@ -65,6 +65,7 @@ export class SmartC { PActivationAmount: '', PUserStackPages: 0, PCodeStackPages: 0, + PCodeHashId: '', outputSourceLineNumber: false } } @@ -100,6 +101,7 @@ export class SmartC { throw new Error('Invalid usage. Language must be "C" or "Assembly".') } this.MachineCode = assembler(this.assemblyCode) + this.assemblyCode = this.assemblyCode.replace(/(^\s*\^program\s+codeHashId)\s+0/, `$1 ${this.MachineCode.MachineCodeHashId}`) return this } diff --git a/dev/src/SmartC/typings/contractTypes.ts b/dev/src/SmartC/typings/contractTypes.ts index b5c5848..7793550 100644 --- a/dev/src/SmartC/typings/contractTypes.ts +++ b/dev/src/SmartC/typings/contractTypes.ts @@ -32,6 +32,8 @@ export type SC_CONFIG = { PUserStackPages: number, /** Code stack pages to be available:: #program codeStackPages */ PCodeStackPages: number, + /** Machine code hash id to be matched during compilation: #program codeHashId */ + PCodeHashId: string, /** Adds a comment in generated assembly code with the respective C source code line number */ outputSourceLineNumber: boolean, } From 37742493de9af288992cc0a57ceb2eee880bb2f2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 8 May 2022 11:39:38 -0300 Subject: [PATCH 016/112] Documentation for codeHashId --- docs/1-Basis.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 6f0e6e4..5621d1d 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -24,8 +24,16 @@ Others keyword have no assembly support. They are disabled: `auto`, `double`, `f Some special features can be enabled/disable via preprocessor directives: #### #program * `#program name YourProgramName`: Set program's name. Only regular letters and numbers allowed, max 30 chars in length. +A value is mandatory for deployment. * `#program description Your program description`: Set program's description. No new lines and max length is 1000 chars. +This is optional. * `#program activationAmount 100000000`: Set program's activation amount in NQT (1 Signum = 100000000 NQT). If an incoming transaction has an amount is less than this value, it will not be processed by program (but the amount will be received!). Set a low value but bigger than worst case amount needed to run in your program. If set too low, your program will be frozen during execution (out of gas). If set too high, program balance will be high after execution (unburned balance). Remember to handle this case if creating serious program! +A value is mandatory for deployment. +* `#program codeHashId N`: Ensure the compiled program will have this exact code hash id. +Use `0` to make this information available at assembly output (during development). +Use the actual number if you plan do distribute the source code, so the compiler will raise an error on divergency. +This is optional. + #### #include * `#include APIFunctions [true/false/1/0/]`: Make Signum API functions available for use as functions. Default value is `false`. It can be enabled by declaring it with empty argument, `true` or `1`. Function names follow the [ciyam at documentation](https://ciyam.org/at/at_api.html). All API names and a pseudo-code are avaliable also in section **API Pseudo-Code**. #### #define From e8a990a38f8eb9ed93eebff18a37666995416a6e Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 8 May 2022 11:40:32 -0300 Subject: [PATCH 017/112] Testcases for program codeHashId --- dev/src/SmartC/__tests__/macros.a.spec.ts | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dev/src/SmartC/__tests__/macros.a.spec.ts b/dev/src/SmartC/__tests__/macros.a.spec.ts index 62fd41d..c04cf09 100644 --- a/dev/src/SmartC/__tests__/macros.a.spec.ts +++ b/dev/src/SmartC/__tests__/macros.a.spec.ts @@ -105,6 +105,34 @@ describe('#program', () => { compiler.compile() }).toThrowError(/^At line/) }) + it('should compile: codeHashId', () => { + const code = '#pragma optimizationLevel 0\n#program codeHashId 0 \n long a; a++;' + const assembly = '^program codeHashId 16984156175653688123\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: codeHashId right', () => { + const code = '#pragma optimizationLevel 0\n#program codeHashId 16984156175653688123 \n long a; a++;' + const assembly = '^program codeHashId 16984156175653688123\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: codeHashId wrong', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\n#program codeHashId 1 \n long a; a++;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^assembler\(\)/) + }) + test('should throw: codeHashId wrong', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\n#program codeHashId 0x237a33 \n long a; a++;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) }) describe('#pragma', () => { From d8c64986fb68c80bf93a27a43f8411b955e6a198 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 8 May 2022 21:02:10 -0300 Subject: [PATCH 018/112] Fix codeHashId replace to be multiline --- dev/src/SmartC/__tests__/macros.a.spec.ts | 7 +++++++ dev/src/SmartC/smartc.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dev/src/SmartC/__tests__/macros.a.spec.ts b/dev/src/SmartC/__tests__/macros.a.spec.ts index c04cf09..b84b4ed 100644 --- a/dev/src/SmartC/__tests__/macros.a.spec.ts +++ b/dev/src/SmartC/__tests__/macros.a.spec.ts @@ -119,6 +119,13 @@ describe('#program', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: codeHashId not on first line', () => { + const code = '#program name GetATCodeHashId\n#program codeHashId 0 \nlong a;\na++;' + const assembly = '^program name GetATCodeHashId\n^program codeHashId 16984156175653688123\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) test('should throw: codeHashId wrong', () => { expect(() => { const code = '#pragma optimizationLevel 0\n#program codeHashId 1 \n long a; a++;' diff --git a/dev/src/SmartC/smartc.ts b/dev/src/SmartC/smartc.ts index 1d2274d..79694da 100644 --- a/dev/src/SmartC/smartc.ts +++ b/dev/src/SmartC/smartc.ts @@ -101,7 +101,7 @@ export class SmartC { throw new Error('Invalid usage. Language must be "C" or "Assembly".') } this.MachineCode = assembler(this.assemblyCode) - this.assemblyCode = this.assemblyCode.replace(/(^\s*\^program\s+codeHashId)\s+0/, `$1 ${this.MachineCode.MachineCodeHashId}`) + this.assemblyCode = this.assemblyCode.replace(/(^\s*\^program\s+codeHashId)\s+0/m, `$1 ${this.MachineCode.MachineCodeHashId}`) return this } From fc7485683885b8269beab28e922d26c5381c2147 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 14 May 2022 22:21:57 -0300 Subject: [PATCH 019/112] Assembly syntax highlighting to npm module --- dev/package-lock.json | 13 + dev/package.json | 1 + dev/src/__tests__/asmHighlight.spec.ts | 64 ----- dev/src/asmHighlight.ts | 377 ------------------------- dev/src/index.js | 14 +- 5 files changed, 25 insertions(+), 444 deletions(-) delete mode 100644 dev/src/__tests__/asmHighlight.spec.ts delete mode 100644 dev/src/asmHighlight.ts diff --git a/dev/package-lock.json b/dev/package-lock.json index 2d74e06..2d10e43 100644 --- a/dev/package-lock.json +++ b/dev/package-lock.json @@ -21,6 +21,7 @@ "jest": "^27.3.1", "light-server": "^2.9.1", "markdown-folder-to-html": "^2.4.0", + "smartc-assembly-highlight": "^1.0.2", "ts-jest": "^27.0.7", "typescript": "^4.3.5" } @@ -6401,6 +6402,12 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, + "node_modules/smartc-assembly-highlight": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/smartc-assembly-highlight/-/smartc-assembly-highlight-1.0.2.tgz", + "integrity": "sha512-j2vJO0XEnaRtO57WGixL4ofrNvoWv3BZF3ezkLAzJdeDU6AKSu6CR9C0Cc6MN38tNN9J1lUknDrZdvuVMRJsKg==", + "dev": true + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -12106,6 +12113,12 @@ "is-fullwidth-code-point": "^3.0.0" } }, + "smartc-assembly-highlight": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/smartc-assembly-highlight/-/smartc-assembly-highlight-1.0.2.tgz", + "integrity": "sha512-j2vJO0XEnaRtO57WGixL4ofrNvoWv3BZF3ezkLAzJdeDU6AKSu6CR9C0Cc6MN38tNN9J1lUknDrZdvuVMRJsKg==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/dev/package.json b/dev/package.json index aa1b823..2daff63 100644 --- a/dev/package.json +++ b/dev/package.json @@ -49,6 +49,7 @@ "jest": "^27.3.1", "light-server": "^2.9.1", "markdown-folder-to-html": "^2.4.0", + "smartc-assembly-highlight": "^1.0.2", "ts-jest": "^27.0.7", "typescript": "^4.3.5" } diff --git a/dev/src/__tests__/asmHighlight.spec.ts b/dev/src/__tests__/asmHighlight.spec.ts deleted file mode 100644 index 513fe18..0000000 --- a/dev/src/__tests__/asmHighlight.spec.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { asmHighlight } from '../asmHighlight' - -describe('Assembly compilation:', () => { - it('should highlight: regular opCodes', () => { - const code = 'SET @a #0000000000000100\nSET @b $a\nCLR @b\nINC @b\nDEC @a\nADD @a $b\nSUB @a $b\nMUL @a $b\nDIV @a $b\nBOR @a $b\nAND @a $b\nXOR @a $b\nSET @a $b\nNOT @a\nSET @a $($b)\nSET @a $c\nADD @a $b\nSET @a $($b + $c)\nPSH $b\nJSR :__fn_teste\nPOP @a\nSET @($a) $b\nSET @($a + $b) $c\nMOD @a $b\nSHL @a $b\nSHR @a $b\nSLP $a\nJMP :__fn_main\n\n__fn_teste:\nPOP @teste_d\nSET @r0 $teste_d\nINC @r0\nPSH $r0\nRET\n\n__fn_main:\nPCS\nINC @a\nFIN' - const highlighted = "SET @a #0000000000000100
SET @b $a
CLR @b
INC @b
DEC @a
ADD @a $b
SUB @a $b
MUL @a $b
DIV @a $b
BOR @a $b
AND @a $b
XOR @a $b
SET @a $b
NOT @a
SET @a $($b)
SET @a $c
ADD @a $b
SET @a $($b + $c)
PSH $b
JSR :__fn_teste
POP @a
SET @($a) $b
SET @($a + $b) $c
MOD @a $b
SHL @a $b
SHR @a $b
SLP $a
JMP :__fn_main

__fn_teste:
POP @teste_d
SET @r0 $teste_d
INC @r0
PSH $r0
RET

__fn_main:
PCS
INC @a
FIN
" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight: opCodes for api functions', () => { - const code = 'FUN clear_A_B\nFUN set_A1 $a\nFUN set_A1_A2 $a $b\nFUN @a check_A_equals_B\nFUN @a add_Minutes_to_Timestamp $b $c\n' - const highlighted = "FUN clear_A_B
FUN set_A1 $a
FUN set_A1_A2 $a $b
FUN @a check_A_equals_B
FUN @a add_Minutes_to_Timestamp $b $c

" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight: rare opCodes ', () => { - const code = 'FIZ $a\nSTZ $a\nERR :__error\nINC @a\nNOP\nNOP\n__error:\nDEC @a' - const highlighted = "FIZ $a
STZ $a
ERR :__error
INC @a
NOP
NOP
__error:
DEC @a
" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight: all branches opCodes with positive offset (no overflow)', () => { - const code = 'BZR $a :__if1_endif\nINC @b\n__if1_endif:\nBNZ $a :__if2_endif\nINC @b\n__if2_endif:\nBLE $a $b :__if3_endif\nINC @b\n__if3_endif:\nBGE $a $b :__if4_endif\nINC @b\n__if4_endif:\nBLT $a $b :__if5_endif\nINC @b\n__if5_endif:\nBGT $a $b :__if6_endif\nINC @b\n__if6_endif:\nBNE $a $b :__if7_endif\nINC @b\n__if7_endif:\nBEQ $a $b :__if8_endif\nINC @b\n__if8_endif:\nFIN\n' - const highlighted = "BZR $a :__if1_endif
INC @b
__if1_endif:
BNZ $a :__if2_endif
INC @b
__if2_endif:
BLE $a $b :__if3_endif
INC @b
__if3_endif:
BGE $a $b :__if4_endif
INC @b
__if4_endif:
BLT $a $b :__if5_endif
INC @b
__if5_endif:
BGT $a $b :__if6_endif
INC @b
__if6_endif:
BNE $a $b :__if7_endif
INC @b
__if7_endif:
BEQ $a $b :__if8_endif
INC @b
__if8_endif:
FIN

" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight: all branches opCodes with positive offset (no overflow)', () => { - const code = 'BZR $a :__if1_endif\nINC @b\n__if1_endif:\nBNZ $a :__if2_endif\nINC @b\n__if2_endif:\nBLE $a $b :__if3_endif\nINC @b\n__if3_endif:\nBGE $a $b :__if4_endif\nINC @b\n__if4_endif:\nBLT $a $b :__if5_endif\nINC @b\n__if5_endif:\nBGT $a $b :__if6_endif\nINC @b\n__if6_endif:\nBNE $a $b :__if7_endif\nINC @b\n__if7_endif:\nBEQ $a $b :__if8_endif\nINC @b\n__if8_endif:\nFIN\n' - const highlighted = "BZR $a :__if1_endif
INC @b
__if1_endif:
BNZ $a :__if2_endif
INC @b
__if2_endif:
BLE $a $b :__if3_endif
INC @b
__if3_endif:
BGE $a $b :__if4_endif
INC @b
__if4_endif:
BLT $a $b :__if5_endif
INC @b
__if5_endif:
BGT $a $b :__if6_endif
INC @b
__if6_endif:
BNE $a $b :__if7_endif
INC @b
__if7_endif:
BEQ $a $b :__if8_endif
INC @b
__if8_endif:
FIN

" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight: ^declare, ^const, ^comment, ^program and multi spaces', () => { - const code = '^declare r0\n^const SET @c #9887766554433221\n^comment This is a comment\n SET @a #0000000000000005\n ^program something something something\n' - const highlighted = "^declare r0
^const SET @c #9887766554433221
^comment This is a comment
SET @a #0000000000000005
^program something something something

" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight with line numbers', () => { - const code = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000001\nSLP $r0\nFUN @a get_B1\nFIN\n' - const highlighted = "
1
^declare r0
2
^declare r1
3
^declare r2
4
^declare a
5
6
SET @r0 #0000000000000001
7
SLP $r0
8
FUN @a get_B1
9
FIN
10
" - const result = asmHighlight(code, true) - expect(result).toBe(highlighted) - }) - it('should highlight atv3 new codes', () => { - const code = '^comment new opCodes SIP-37\nSLP\nPOW @base $exp\nMDV @x $y $den\n^comment new APICodes SIP-37\nFUN @ret Check_Sig_B_With_A\nFUN @ret Get_Code_Hash_Id\nFUN @ret Get_Activation_Fee\nFUN Put_Last_Block_GSig_In_A\n^comment new APICodes SIP-38\nFUN @ret Get_Map_Value_Keys_In_A\nFUN Set_Map_Value_Keys_In_A\n^comment new APICodes SIP-39\nFUN @ret Issue_Asset\nFUN Mint_Asset\nFUN Distribute_To_Asset_Holders\nFUN @ret Get_Asset_Holders_Count\n' - const highlighted = "^comment new opCodes SIP-37
SLP
POW @base $exp
MDV @x $y $den
^comment new APICodes SIP-37
FUN @ret Check_Sig_B_With_A
FUN @ret Get_Code_Hash_Id
FUN @ret Get_Activation_Fee
FUN Put_Last_Block_GSig_In_A
^comment new APICodes SIP-38
FUN @ret Get_Map_Value_Keys_In_A
FUN Set_Map_Value_Keys_In_A
^comment new APICodes SIP-39
FUN @ret Issue_Asset
FUN Mint_Asset
FUN Distribute_To_Asset_Holders
FUN @ret Get_Asset_Holders_Count

" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight error: ^comment and multi spaces', () => { - const code = 'SET @a #0000000000000100\nC @a\n\nFUN Xclear_A_B\nFUN Xset_A1 $a\nFUN Xset_A1_A2 $a $b\nFUN @a Xcheck_A_equals_B\nFUN @a Xadd_Minutes_to_Timestamp $b $c' - const highlighted = "SET @a #0000000000000100
C @a

FUN Xclear_A_B
FUN Xset_A1 $a
FUN Xset_A1_A2 $a $b
FUN @a Xcheck_A_equals_B
FUN @a Xadd_Minutes_to_Timestamp $b $c
" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) - it('should highlight error: Rule not found and Non existent 0x36 api function', () => { - const code = 'long day here\nFUN @A 0x36APIFunction $B' - const highlighted = "long day here
FUN @A 0x36APIFunction $B
" - const result = asmHighlight(code, false) - expect(result).toBe(highlighted) - }) -}) diff --git a/dev/src/asmHighlight.ts b/dev/src/asmHighlight.ts deleted file mode 100644 index 3509e64..0000000 --- a/dev/src/asmHighlight.ts +++ /dev/null @@ -1,377 +0,0 @@ -// Author: Rui Deleterium -// Project: https://github.com/deleterium/SmartC -// License: BSD 3-Clause License -// Some parts based on w3schools code for highlighting howto - -/** - * Converts assembly code in HTML code with syntax highlight - * @param asmSourceCode plain text assembly program - * @returns same text with syntax highlight in html - */ -// eslint-disable-next-line no-unused-vars -export function asmHighlight (asmSourceCode: string, addLineNumber: boolean) { - const Config = { - divId: 'asmCodeline', - divClass: 'asmLine', - spanErrorClass: 'asmError', - spanLabelClass: 'asmLabel', - spanNumberClass: 'asmNumber', - spanCommentClass: 'asmComment', - spanVariableClass: 'asmVariable', - spanDirectiveClass: 'asmDirective', - spanInstructionClass: 'asmInstruction' - } - type codeRule = { - opCode: number - size: number - regex: RegExp - } - const allowedCodes: codeRule[] = [ - { opCode: 0xf0, size: 0, regex: /^\s*$/ }, - { opCode: 0xf1, size: 0, regex: /^\s*(\w+):\s*$/ }, - { opCode: 0xf2, size: 0, regex: /^(\s*\^comment)(\s+.*)/ }, - { opCode: 0xf3, size: 0, regex: /^(\s*\^declare)(\s+\w+\s*)$/ }, - { opCode: 0xf4, size: 0, regex: /^(\s*\^const)(\s+.*)/ }, - { opCode: 0xf5, size: 0, regex: /^(\s*\^program\s+\w+\b)(.*)$/ }, - { opCode: 0x01, size: 13, regex: /^(\s*SET\s+)(@\w+\s+)(#[\da-f]{16}\b\s*)$/ }, // SET @var #0000000000000001 - { opCode: 0x02, size: 9, regex: /^(\s*SET\s+)(@\w+\s+)(\$\w+\s*)$/ }, // SET @var $var - { opCode: 0x03, size: 5, regex: /^(\s*CLR\s+)(@\w+\s*)$/ }, - { opCode: 0x04, size: 5, regex: /^(\s*INC\s+)(@\w+\s*)$/ }, - { opCode: 0x05, size: 5, regex: /^(\s*DEC\s+)(@\w+\s*)$/ }, - { opCode: 0x06, size: 9, regex: /^(\s*ADD\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x07, size: 9, regex: /^(\s*SUB\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x08, size: 9, regex: /^(\s*MUL\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x09, size: 9, regex: /^(\s*DIV\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x0a, size: 9, regex: /^(\s*BOR\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x0b, size: 9, regex: /^(\s*AND\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x0c, size: 9, regex: /^(\s*XOR\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x0d, size: 5, regex: /^(\s*NOT\s+)(@\w+\s*)$/ }, - { opCode: 0x0e, size: 9, regex: /^(\s*SET\s+)(@\w+)(\s+\$\()(\$\w+)(\)\s*)$/ }, - { opCode: 0x0f, size: 13, regex: /^(\s*SET\s+)(@\w+\s+)(\$\()(\$\w+)(\s*\+\s*)(\$\w+)(\)\s*)$/ }, - { opCode: 0x10, size: 5, regex: /^(\s*PSH\s+)(\$\w+\s*)$/ }, - { opCode: 0x11, size: 5, regex: /^(\s*POP\s+)(@\w+\s*)$/ }, - { opCode: 0x12, size: 5, regex: /^(\s*JSR\s+)(:\w+\s*)$/ }, // JSR :function - { opCode: 0x13, size: 1, regex: /^\s*RET\s*$/ }, - { opCode: 0x14, size: 9, regex: /^(\s*SET\s+)(@\()(\$\w+)(\)\s+)(\$\w+\s*)$/ }, - { opCode: 0x15, size: 13, regex: /^(\s*SET\s+)(@\()(\$\w+)(\s*\+\s*)(\$\w+)(\)\s+)(\$\w+\s*)$/ }, - { opCode: 0x16, size: 9, regex: /^(\s*MOD\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x17, size: 9, regex: /^(\s*SHL\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x18, size: 9, regex: /^(\s*SHR\s+)(@\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x19, size: 9, regex: /^(\s*POW\s+)(@\w+\s+)(\$\w+\s*)$/ }, // POW @var $var - { opCode: 0x1a, size: 5, regex: /^(\s*JMP\s+)(:\w+\s*)$/ }, // JMP :label - { opCode: 0x1b, size: 6, regex: /^(\s*BZR\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BZR $var :label - { opCode: 0x1e, size: 6, regex: /^(\s*BNZ\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BZR $var :label - { opCode: 0x1f, size: 10, regex: /^(\s*BGT\s+)(\$\w+\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BGT $var $var :label - { opCode: 0x20, size: 10, regex: /^(\s*BLT\s+)(\$\w+\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BLT $var $var :label - { opCode: 0x21, size: 10, regex: /^(\s*BGE\s+)(\$\w+\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BGE $var $var :label - { opCode: 0x22, size: 10, regex: /^(\s*BLE\s+)(\$\w+\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BLE $var $var :label - { opCode: 0x23, size: 10, regex: /^(\s*BEQ\s+)(\$\w+\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BEQ $var $var :label - { opCode: 0x24, size: 10, regex: /^(\s*BNE\s+)(\$\w+\s+)(\$\w+\s+)(:\w+\s*)$/ }, // BNE $var $var :label - { opCode: 0x25, size: 5, regex: /^(\s*SLP\s+)(\$\w+\s*)$/ }, - { opCode: 0x26, size: 5, regex: /^(\s*FIZ\s+)(\$\w+\s*)$/ }, - { opCode: 0x27, size: 5, regex: /^(\s*STZ\s+)(\$\w+\s*)$/ }, - { opCode: 0x28, size: 1, regex: /^\s*FIN\s*$/ }, - { opCode: 0x29, size: 1, regex: /^\s*STP\s*$/ }, - { opCode: 0x2a, size: 1, regex: /^\s*SLP\s*$/ }, - { opCode: 0x2b, size: 5, regex: /^(\s*ERR\s+)(:\w+\s*)$/ }, // ERR :label - { opCode: 0x2c, size: 13, regex: /^(\s*MDV\s+)(@\w+\s+)(\$\w+\s+)(\$\w+\s*)$/ }, // MDV @var $var $var - { opCode: 0x30, size: 1, regex: /^\s*PCS\s*$/ }, - { opCode: 0x32, size: 3, regex: /^(\s*FUN\s+)(\w+\s*)$/ }, - { opCode: 0x33, size: 7, regex: /^(\s*FUN\s+)(\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x34, size: 11, regex: /^(\s*FUN\s+)(\w+\s+)(\$\w+\s+)(\$(\w+)\s*)$/ }, - { opCode: 0x35, size: 7, regex: /^(\s*FUN\s+)(@\w+\s+)(\w+\s*)$/ }, - { opCode: 0x36, size: 11, regex: /^\s*(FUN)\s+@(\w+)\s+(\w+)\s+\$(\w+)\s*$/ }, - { opCode: 0x37, size: 15, regex: /^(\s*FUN\s+)(@\w+\s+)(\w+\s+)(\$\w+\s+)(\$\w+\s*)$/ }, - { opCode: 0x7f, size: 1, regex: /^\s*NOP\s*$/ } - ] - - const allowedFunctions = [ - { fnCode: 0x0100, fnName: 'get_A1' }, - { fnCode: 0x0101, fnName: 'get_A2' }, - { fnCode: 0x0102, fnName: 'get_A3' }, - { fnCode: 0x0103, fnName: 'get_A4' }, - { fnCode: 0x0104, fnName: 'get_B1' }, - { fnCode: 0x0105, fnName: 'get_B2' }, - { fnCode: 0x0106, fnName: 'get_B3' }, - { fnCode: 0x0107, fnName: 'get_B4' }, - { fnCode: 0x0110, fnName: 'set_A1' }, - { fnCode: 0x0111, fnName: 'set_A2' }, - { fnCode: 0x0112, fnName: 'set_A3' }, - { fnCode: 0x0113, fnName: 'set_A4' }, - { fnCode: 0x0114, fnName: 'set_A1_A2' }, - { fnCode: 0x0115, fnName: 'set_A3_A4' }, - { fnCode: 0x0116, fnName: 'set_B1' }, - { fnCode: 0x0117, fnName: 'set_B2' }, - { fnCode: 0x0118, fnName: 'set_B3' }, - { fnCode: 0x0119, fnName: 'set_B4' }, - { fnCode: 0x011a, fnName: 'set_B1_B2' }, - { fnCode: 0x011b, fnName: 'set_B3_B4' }, - { fnCode: 0x0120, fnName: 'clear_A' }, - { fnCode: 0x0121, fnName: 'clear_B' }, - { fnCode: 0x0122, fnName: 'clear_A_B' }, - { fnCode: 0x0123, fnName: 'copy_A_From_B' }, - { fnCode: 0x0124, fnName: 'copy_B_From_A' }, - { fnCode: 0x0125, fnName: 'check_A_Is_Zero' }, - { fnCode: 0x0126, fnName: 'check_B_Is_Zero' }, - { fnCode: 0x0127, fnName: 'check_A_equals_B' }, - { fnCode: 0x0128, fnName: 'swap_A_and_B' }, - { fnCode: 0x0129, fnName: 'OR_A_with_B' }, - { fnCode: 0x012a, fnName: 'OR_B_with_A' }, - { fnCode: 0x012b, fnName: 'AND_A_with_B' }, - { fnCode: 0x012c, fnName: 'AND_B_with_A' }, - { fnCode: 0x012d, fnName: 'XOR_A_with_B' }, - { fnCode: 0x012e, fnName: 'XOR_B_with_A' }, - { fnCode: 0x0140, fnName: 'add_A_to_B' }, - { fnCode: 0x0141, fnName: 'add_B_to_A' }, - { fnCode: 0x0142, fnName: 'sub_A_from_B' }, - { fnCode: 0x0143, fnName: 'sub_B_from_A' }, - { fnCode: 0x0144, fnName: 'mul_A_by_B' }, - { fnCode: 0x0145, fnName: 'mul_B_by_A' }, - { fnCode: 0x0146, fnName: 'div_A_by_B' }, - { fnCode: 0x0147, fnName: 'div_B_by_A' }, - { fnCode: 0x0200, fnName: 'MD5_A_to_B' }, - { fnCode: 0x0201, fnName: 'check_MD5_A_with_B' }, - { fnCode: 0x0202, fnName: 'HASH160_A_to_B' }, - { fnCode: 0x0203, fnName: 'check_HASH160_A_with_B' }, - { fnCode: 0x0204, fnName: 'SHA256_A_to_B' }, - { fnCode: 0x0205, fnName: 'check_SHA256_A_with_B' }, - { fnCode: 0x0206, fnName: 'Check_Sig_B_With_A' }, - { fnCode: 0x0300, fnName: 'get_Block_Timestamp' }, - { fnCode: 0x0301, fnName: 'get_Creation_Timestamp' }, - { fnCode: 0x0302, fnName: 'get_Last_Block_Timestamp' }, - { fnCode: 0x0303, fnName: 'put_Last_Block_Hash_In_A' }, - { fnCode: 0x0304, fnName: 'A_to_Tx_after_Timestamp' }, - { fnCode: 0x0305, fnName: 'get_Type_for_Tx_in_A' }, - { fnCode: 0x0306, fnName: 'get_Amount_for_Tx_in_A' }, - { fnCode: 0x0307, fnName: 'get_Timestamp_for_Tx_in_A' }, - { fnCode: 0x0308, fnName: 'get_Ticket_Id_for_Tx_in_A' }, - { fnCode: 0x0309, fnName: 'message_from_Tx_in_A_to_B' }, - { fnCode: 0x030a, fnName: 'B_to_Address_of_Tx_in_A' }, - { fnCode: 0x030b, fnName: 'B_to_Address_of_Creator' }, - { fnCode: 0x030c, fnName: 'Get_Code_Hash_Id' }, - { fnCode: 0x0400, fnName: 'get_Current_Balance' }, - { fnCode: 0x0401, fnName: 'get_Previous_Balance' }, - { fnCode: 0x0402, fnName: 'send_to_Address_in_B' }, - { fnCode: 0x0403, fnName: 'send_All_to_Address_in_B' }, - { fnCode: 0x0404, fnName: 'send_Old_to_Address_in_B' }, - { fnCode: 0x0405, fnName: 'send_A_to_Address_in_B' }, - { fnCode: 0x0406, fnName: 'add_Minutes_to_Timestamp' }, - { fnCode: 0x0407, fnName: 'Get_Map_Value_Keys_In_A' }, - { fnCode: 0x0408, fnName: 'Set_Map_Value_Keys_In_A' }, - { fnCode: 0x0409, fnName: 'Issue_Asset' }, - { fnCode: 0x040a, fnName: 'Mint_Asset' }, - { fnCode: 0x040b, fnName: 'Distribute_To_Asset_Holders' }, - { fnCode: 0x040c, fnName: 'Get_Asset_Holders_Count' }, - { fnCode: 0x040d, fnName: 'Get_Activation_Fee' }, - { fnCode: 0x040e, fnName: 'Put_Last_Block_GSig_In_A' } - ] - - /** - * Main function to loop thru lines - * @param assemblySource - * @param addDivLine true: add a
for every line; false: add
- * @returns HTML string - */ - function toHTML (assemblySource: string, addDivLine: boolean = true): string { - // process line by line - const lines = assemblySource.split('\n') - let ret = '' - // loop thru all lines - lines.forEach((line, idx) => { - if (addDivLine === true) { - ret += `
${idx + 1}
` - } - // Find a rule for instruction - const FoundRule = allowedCodes.find(Rule => Rule.regex.exec(line) !== null) - ret += colorThisLine(line, FoundRule) - if (addDivLine === true) ret += '
' - else ret += '
' - }) - if (addDivLine) { - return "
" + ret + '
' - } - return ret - } - - function toSpan (text: string, classname: string) { - return `${text}` - } - - function colorThisLine (asmLine: string, Rule: codeRule | undefined): string { - let apiName: string - let parts = null - if (Rule !== undefined) { - parts = Rule.regex.exec(asmLine) - } - if (parts === null || Rule === undefined) { - // No rule found to highlight line - return toSpan(asmLine, Config.spanErrorClass) - } - switch (Rule.opCode) { - case 0xf0: // is empty line - return asmLine - case 0xf1: // is label line - return toSpan(parts[0], Config.spanLabelClass) - case 0xf2: // comment - return toSpan(parts[1], Config.spanDirectiveClass) + - toSpan(parts[2], Config.spanCommentClass) - case 0xf3: // declare - return toSpan(parts[1], Config.spanDirectiveClass) + - toSpan(parts[2], Config.spanVariableClass) - case 0xf4: { // const - const SetRule = allowedCodes.find(Obj => Obj.opCode === 0x01) - return toSpan(parts[1], Config.spanDirectiveClass) + - colorThisLine(parts[2], SetRule) - } - case 0xf5: // program - return toSpan(parts[1], Config.spanDirectiveClass) + - parts[2] - case 0x01: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanNumberClass) - case 0x02: - case 0x06: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanVariableClass) - case 0x03: - case 0x04: - case 0x05: - case 0x0d: - case 0x10: - case 0x11: - case 0x25: - case 0x26: - case 0x27: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) - case 0x13: - case 0x28: - case 0x29: - case 0x2a: - case 0x30: - case 0x7f: - return toSpan(parts[0], Config.spanInstructionClass) - case 0x0e: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - parts[3] + - toSpan(parts[4], Config.spanVariableClass) + - parts[5] - case 0x0f: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - parts[3] + - toSpan(parts[4], Config.spanVariableClass) + - parts[5] + - toSpan(parts[6], Config.spanVariableClass) + - parts[7] - case 0x14: - return toSpan(parts[1], Config.spanInstructionClass) + - parts[2] + - toSpan(parts[3], Config.spanVariableClass) + - parts[4] + - toSpan(parts[5], Config.spanVariableClass) - case 0x15: - return toSpan(parts[1], Config.spanInstructionClass) + - parts[2] + - toSpan(parts[3], Config.spanVariableClass) + - parts[4] + - toSpan(parts[5], Config.spanVariableClass) + - parts[6] + - toSpan(parts[7], Config.spanVariableClass) - case 0x12: - case 0x1a: - case 0x2b: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanLabelClass) - case 0x1b: - case 0x1e: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanLabelClass) - case 0x1f: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanVariableClass) + - toSpan(parts[4], Config.spanLabelClass) - case 0x2c: - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanVariableClass) + - toSpan(parts[4], Config.spanVariableClass) - case 0x32: - apiName = parts[2].trim() - if (allowedFunctions.findIndex(Obj => Obj.fnName === apiName) === -1) { - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanErrorClass) - } - return toSpan(parts[0], Config.spanInstructionClass) - case 0x33: - apiName = parts[2].trim() - if (allowedFunctions.findIndex(Obj => Obj.fnName === apiName) === -1) { - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanErrorClass) + - toSpan(parts[3], Config.spanVariableClass) - } - return toSpan(parts[1] + parts[2], Config.spanInstructionClass) + - toSpan(parts[3], Config.spanVariableClass) - case 0x34: - apiName = parts[2].trim() - if (allowedFunctions.findIndex(Obj => Obj.fnName === apiName) === -1) { - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanErrorClass) + - toSpan(parts[3], Config.spanVariableClass) + - toSpan(parts[4], Config.spanVariableClass) - } - return toSpan(parts[1] + parts[2], Config.spanInstructionClass) + - toSpan(parts[3], Config.spanVariableClass) + - toSpan(parts[4], Config.spanVariableClass) - case 0x35: - apiName = parts[3].trim() - if (allowedFunctions.findIndex(Obj => Obj.fnName === apiName) === -1) { - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanErrorClass) - } - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanInstructionClass) - case 0x37: - apiName = parts[3].trim() - if (allowedFunctions.findIndex(Obj => Obj.fnName === apiName) === -1) { - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanErrorClass) + - toSpan(parts[4], Config.spanVariableClass) + - toSpan(parts[5], Config.spanVariableClass) - } - return toSpan(parts[1], Config.spanInstructionClass) + - toSpan(parts[2], Config.spanVariableClass) + - toSpan(parts[3], Config.spanInstructionClass) + - toSpan(parts[4], Config.spanVariableClass) + - toSpan(parts[5], Config.spanVariableClass) - case 0x36: - default: - return toSpan(asmLine, Config.spanErrorClass) - } - } - - return toHTML(asmSourceCode, addLineNumber) -} diff --git a/dev/src/index.js b/dev/src/index.js index 3b680c6..2f4b5be 100644 --- a/dev/src/index.js +++ b/dev/src/index.js @@ -1,5 +1,5 @@ import { SmartC } from './SmartC/smartc.js' -import { asmHighlight } from './asmHighlight.js' +import sah from 'smartc-assembly-highlight' import { runTestCases } from './testcases.js' /* Following global functions are define on the files: @@ -125,7 +125,11 @@ function compileCode () { const asmCode = compiler.getAssemblyCode() const bcode = compiler.getMachineCode() - document.getElementById('assembly_output').innerHTML = asmHighlight(asmCode, false) + sah.Config.preAll = '' + sah.Config.postAll = '' + sah.Config.preLine = '' + sah.Config.postLine = '
' + document.getElementById('assembly_output').innerHTML = sah.colorText(asmCode) const t1 = new Date() let compileMessage = `Compile sucessfull!!! Done at ${t1.getHours()}:${t1.getMinutes()}:${t1.getSeconds()} in ${t1 - t0} ms.` @@ -200,7 +204,11 @@ function SetColorCode () { if (document.getElementById('source_is_c').checked) { dest.innerHTML = hljs.highlight(source.value, { language: 'c' }).value } else { - dest.innerHTML = asmHighlight(source.value, true) + sah.Config.preAll = "
" + sah.Config.postAll = '
' + sah.Config.preLine = "
%line%
" + sah.Config.postLine = '
' + dest.innerHTML = sah.colorText(source.value) } source.className = 'transp' } From af6c7ff9e9d34eba025180ca96bcb14e2b3873e1 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 14 May 2022 22:39:27 -0300 Subject: [PATCH 020/112] Included API's Get_Asset_Circulating and B_To_Assets_Of_Tx_In_A and --- dev/src/SmartC/__tests__/assembly.a.spec.ts | 4 ++-- dev/src/SmartC/assembler/assembler.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/src/SmartC/__tests__/assembly.a.spec.ts b/dev/src/SmartC/__tests__/assembly.a.spec.ts index 04594c5..c179f26 100644 --- a/dev/src/SmartC/__tests__/assembly.a.spec.ts +++ b/dev/src/SmartC/__tests__/assembly.a.spec.ts @@ -128,8 +128,8 @@ describe('Assembly compilation:', () => { expect(result.MachineCodeHashId).toBe('17223659044509638052') }) it('should compile: atv3 opCodes and apiCodes', () => { - const code = '^comment new opCodes SIP-37\nSLP\nPOW @base $exp\nMDV @x $y $den\n^comment new APICodes SIP-37\nFUN @ret Check_Sig_B_With_A\nFUN @ret Get_Code_Hash_Id\nFUN @ret Get_Activation_Fee\nFUN Put_Last_Block_GSig_In_A\n^comment new APICodes SIP-38\nFUN @ret Get_Map_Value_Keys_In_A\nFUN Set_Map_Value_Keys_In_A\n^comment new APICodes SIP-39\nFUN @ret Issue_Asset\nFUN Mint_Asset\nFUN Distribute_To_Asset_Holders\nFUN @ret Get_Asset_Holders_Count\n' - const MachineCode = '2a1900000000010000002c02000000030000000400000035060205000000350c0305000000350d0405000000320e043507040500000032080435090405000000320a04320b04350c0405000000' + const code = '^comment new opCodes SIP-37\nSLP\nPOW @base $exp\nMDV @x $y $den\n^comment new APICodes SIP-37\nFUN @ret Check_Sig_B_With_A\nFUN @ret Get_Code_Hash_Id\nFUN @ret Get_Activation_Fee\nFUN Put_Last_Block_GSig_In_A\n^comment new APICodes SIP-38\nFUN @ret Get_Map_Value_Keys_In_A\nFUN Set_Map_Value_Keys_In_A\n^comment new APICodes SIP-39\nFUN @ret Issue_Asset\nFUN Mint_Asset\nFUN Distribute_To_Asset_Holders\nFUN @ret Get_Asset_Holders_Count\nFUN @ret Get_Asset_Circulating\nFUN B_To_Assets_Of_Tx_In_A\n' + const MachineCode = '2a1900000000010000002c02000000030000000400000035060205000000350c0305000000350d0405000000320e043507040500000032080435090405000000320a04320b04350c0405000000350f0405000000320d03' const MachineData = '' const result = new SmartC({ language: 'Assembly', sourceCode: code }).compile().getMachineCode() expect(result.ByteCode).toBe(MachineCode) diff --git a/dev/src/SmartC/assembler/assembler.ts b/dev/src/SmartC/assembler/assembler.ts index b066243..487e182 100644 --- a/dev/src/SmartC/assembler/assembler.ts +++ b/dev/src/SmartC/assembler/assembler.ts @@ -217,6 +217,7 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { { name: 'B_to_Address_of_Tx_in_A', apiCode: 0x030a, opCode: 0x32 }, { name: 'B_to_Address_of_Creator', apiCode: 0x030b, opCode: 0x32 }, { name: 'Get_Code_Hash_Id', apiCode: 0x030c, opCode: 0x35 }, + { name: 'B_To_Assets_Of_Tx_In_A', apiCode: 0x030d, opCode: 0x32 }, { name: 'get_Current_Balance', apiCode: 0x0400, opCode: 0x35 }, { name: 'get_Previous_Balance', apiCode: 0x0401, opCode: 0x35 }, { name: 'send_to_Address_in_B', apiCode: 0x0402, opCode: 0x33 }, @@ -231,7 +232,8 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { { name: 'Distribute_To_Asset_Holders', apiCode: 0x040b, opCode: 0x32 }, { name: 'Get_Asset_Holders_Count', apiCode: 0x040c, opCode: 0x35 }, { name: 'Get_Activation_Fee', apiCode: 0x040d, opCode: 0x35 }, - { name: 'Put_Last_Block_GSig_In_A', apiCode: 0x040e, opCode: 0x32 } + { name: 'Put_Last_Block_GSig_In_A', apiCode: 0x040e, opCode: 0x32 }, + { name: 'Get_Asset_Circulating', apiCode: 0x040f, opCode: 0x35 } ] const AsmObj: ASM_OBJECT = { memory: [], From 0d2571edef19c6d21cac2841225f2bc338a01732 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 14 May 2022 22:53:44 -0300 Subject: [PATCH 021/112] Updated C highlight for API's Get_Asset_Circulating and B_To_Assets_Of_Tx_In_A --- dev/3rd-party/highlight.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/3rd-party/highlight.min.js b/dev/3rd-party/highlight.min.js index 7de8ebf..f8d5b19 100644 --- a/dev/3rd-party/highlight.min.js +++ b/dev/3rd-party/highlight.min.js @@ -320,7 +320,7 @@ className:"title",begin:e(s)+n.IDENT_RE,relevance:0 keyword:["asm","break","case","const","continue","default","do","else","exit","for","goto","halt","if","return","sizeof","sleep","struct","switch","while"], type:["long","void"], literal:"true false NULL", -built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp Check_Sig_B_With_A Get_Code_Hash_Id Get_Map_Value_Keys_In_A Set_Map_Value_Keys_In_A Issue_Asset Mint_Asset Distribute_To_Asset_Holders Get_Asset_Holders_Count Get_Activation_Fee Put_Last_Block_GSig_In_A pow mdv" +built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp Check_Sig_B_With_A Get_Code_Hash_Id Get_Map_Value_Keys_In_A Set_Map_Value_Keys_In_A Issue_Asset Mint_Asset Distribute_To_Asset_Holders Get_Asset_Holders_Count Get_Activation_Fee Put_Last_Block_GSig_In_A Get_Asset_Circulating B_To_Assets_Of_Tx_In_A pow mdv" },g=[c,a,t,n.C_BLOCK_COMMENT_MODE,l,i],m={variants:[{begin:/=/,end:/;/},{ begin:/\(/,end:/\)/},{beginKeywords:"return else",end:/;/}], keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, From 5365d4dc1bdc47d302a3fd0498fd88065125821e Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 14 May 2022 23:19:21 -0300 Subject: [PATCH 022/112] Fix recursive regex --- dev/src/SmartC/smartc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/src/SmartC/smartc.ts b/dev/src/SmartC/smartc.ts index 79694da..445a373 100644 --- a/dev/src/SmartC/smartc.ts +++ b/dev/src/SmartC/smartc.ts @@ -101,7 +101,7 @@ export class SmartC { throw new Error('Invalid usage. Language must be "C" or "Assembly".') } this.MachineCode = assembler(this.assemblyCode) - this.assemblyCode = this.assemblyCode.replace(/(^\s*\^program\s+codeHashId)\s+0/m, `$1 ${this.MachineCode.MachineCodeHashId}`) + this.assemblyCode = this.assemblyCode.replace(/^(\s*\^program\s+codeHashId)\s+0\s*$/m, `$1 ${this.MachineCode.MachineCodeHashId}`) return this } From 2165091058cdd7e10492bf1e477120e8d33421b8 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 15 May 2022 10:14:25 -0300 Subject: [PATCH 023/112] Structural changes to return modified assembly code --- dev/src/SmartC/assembler/assembler.ts | 37 ++++++++++++++++--------- dev/src/SmartC/smartc.ts | 11 ++++---- dev/src/SmartC/typings/contractTypes.ts | 2 ++ 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/dev/src/SmartC/assembler/assembler.ts b/dev/src/SmartC/assembler/assembler.ts index 487e182..d5a643f 100644 --- a/dev/src/SmartC/assembler/assembler.ts +++ b/dev/src/SmartC/assembler/assembler.ts @@ -59,6 +59,10 @@ type ASM_OBJECT = { PCodeStackPages: number /** Previous calculates codeHashId. If zero, it is ignored */ PCodeHashId: string + /** Line of codeHashId preprocessor instruction */ + PCodeHashIdLine: number + /** Modified assembly source code */ + assembledCode: string /** Calculated codeHashId for this run */ codeHashId: string /** hexstring of compiled program */ @@ -245,6 +249,8 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { PUserStackPages: 0, PCodeStackPages: 0, PCodeHashId: '', + PCodeHashIdLine: -1, + assembledCode: '', codeHashId: '', bytecode: '', bytedata: '' @@ -255,12 +261,11 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { // process line by line const line = assemblyCode.split('\n') // first pass, fill address, opcodes, apicodes, constants - line.forEach((codeLine, idx) => { + AsmObj.code = line.map((codeLine, idx) => { for (const CurrRule of opCodeTable) { const parts = CurrRule.regex.exec(codeLine) if (parts !== null) { - process(parts, CurrRule) - return + return process(parts, CurrRule, idx) } } throw new Error(`assembler() error #1. No rule found to process line ${idx}: "${codeLine}".`) @@ -285,9 +290,14 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { AsmObj.bytedata = fatality(AsmObj.memory) // codeHashId calculation and checks AsmObj.codeHashId = hashMachineCode(AsmObj.bytecode) - if (AsmObj.PCodeHashId !== '' && AsmObj.PCodeHashId !== '0' && AsmObj.PCodeHashId !== AsmObj.codeHashId) { + if (AsmObj.PCodeHashId === '0') { + AsmObj.PCodeHashId = AsmObj.codeHashId + line[AsmObj.PCodeHashIdLine] = `^program codeHashId ${AsmObj.codeHashId}` + } + if (AsmObj.PCodeHashId !== '' && AsmObj.PCodeHashId !== AsmObj.codeHashId) { throw new Error(`assembler() error #8. This compilation did not produce expected machine code hash id. Expected: ${AsmObj.PCodeHashId} Generated: ${AsmObj.codeHashId}.`) } + AsmObj.assembledCode = line.join('\n') return buildRetObj() } @@ -301,30 +311,29 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { } /** Process one matched instruction */ - function process (parts: RegExpExecArray, Instruction: OPCODE_RULE) { + function process (parts: RegExpExecArray, Instruction: OPCODE_RULE, line: number): CODE_INSTRUCTION { // Create a new object const CodeObj = genCodeInstr() CodeObj.source = parts[0] switch (Instruction.opCode) { case 0xF0: // blank line - return + return CodeObj case 0xF1: // label: CodeObj.station = parts[1] - AsmObj.code.push(CodeObj) - return + return CodeObj case 0xF2: // '^comment user_comment' - return + return CodeObj case 0xF3: // '^declare varName' getMemoryAddress(parts[1]) - return + return CodeObj case 0xF4: // '^const SET @(varName) #(hex_content)' AsmObj.memory[getMemoryAddress(parts[1])].value = BigInt('0x' + parts[2]) - return + return CodeObj case 0xF5: // '^program type information' switch (parts[1]) { @@ -345,11 +354,12 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { break case 'codeHashId': AsmObj.PCodeHashId = parts[2].trim() + AsmObj.PCodeHashIdLine = line break default: throw new Error(`assembler() error #7. Unknow '^program' directive: '${parts[1]}'`) } - return + return CodeObj } CodeObj.size = Instruction.size CodeObj.instructionValues.push({ type: 'O', value: BigInt(Instruction.opCode) }) @@ -396,7 +406,7 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { throw new Error('Internal error.') } } - AsmObj.code.push(CodeObj) + return CodeObj } /** Returns a skeleton code instruction object */ @@ -532,6 +542,7 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { ByteData: AsmObj.bytedata, Memory: AsmObj.memory.map(Obj => Obj.name), Labels: AsmObj.labels, + AssemblyCode: AsmObj.assembledCode, PName: AsmObj.PName, PDescription: AsmObj.PDescription, PActivationAmount: AsmObj.PActivationAmount diff --git a/dev/src/SmartC/smartc.ts b/dev/src/SmartC/smartc.ts index 445a373..108770c 100644 --- a/dev/src/SmartC/smartc.ts +++ b/dev/src/SmartC/smartc.ts @@ -36,7 +36,7 @@ import { CONTRACT, MACHINE_OBJECT } from './typings/contractTypes' export class SmartC { private readonly language private readonly sourceCode - private assemblyCode?: string + private preAssemblyCode?: string private MachineCode?: MACHINE_OBJECT private Program: CONTRACT = { Global: { @@ -92,16 +92,15 @@ export class SmartC { parsed = parser(tokenized) shaper(this.Program, parsed) syntaxProcessor(this.Program) - this.assemblyCode = codeGenerator(this.Program) + this.preAssemblyCode = codeGenerator(this.Program) break case 'Assembly': - this.assemblyCode = this.sourceCode + this.preAssemblyCode = this.sourceCode break default: throw new Error('Invalid usage. Language must be "C" or "Assembly".') } - this.MachineCode = assembler(this.assemblyCode) - this.assemblyCode = this.assemblyCode.replace(/^(\s*\^program\s+codeHashId)\s+0\s*$/m, `$1 ${this.MachineCode.MachineCodeHashId}`) + this.MachineCode = assembler(this.preAssemblyCode) return this } @@ -113,7 +112,7 @@ export class SmartC { if (!this.MachineCode) { throw new Error('Source code was not compiled.') } - return this.assemblyCode ?? '' + return this.MachineCode.AssemblyCode } /** diff --git a/dev/src/SmartC/typings/contractTypes.ts b/dev/src/SmartC/typings/contractTypes.ts index 7793550..5074b06 100644 --- a/dev/src/SmartC/typings/contractTypes.ts +++ b/dev/src/SmartC/typings/contractTypes.ts @@ -119,6 +119,8 @@ export type MACHINE_OBJECT = { label: string address: number }[] + /** Program assembly source code */ + AssemblyCode: string /** Program name */ PName: string /** Program description */ From c99fae5d4c44b135e3ec252753b33cfa40edf1b2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 15 May 2022 10:35:45 -0300 Subject: [PATCH 024/112] Removing frontend files --- dev/3rd-party/highlight.min.js | 340 ------- dev/3rd-party/styles/tomorrow.css | 173 ---- dev/3rd-party/winbox.bundle.js | 23 - dev/assets/SmartC-Watermark.png | Bin 17357 -> 0 bytes dev/assets/favicon-16.png | Bin 892 -> 0 bytes dev/assets/favicon-32.png | Bin 1927 -> 0 bytes dev/assets/favicon.png | Bin 13987 -> 0 bytes dev/assets/whiteLogo.png | Bin 2486 -> 0 bytes dev/index.html | 87 -- dev/src/__tests__/testcases.spec.ts | 10 - dev/src/index.js | 417 -------- dev/src/templateTests.ts | 1364 --------------------------- dev/src/testcases.ts | 108 --- dev/style.css | 263 ------ 14 files changed, 2785 deletions(-) delete mode 100644 dev/3rd-party/highlight.min.js delete mode 100644 dev/3rd-party/styles/tomorrow.css delete mode 100644 dev/3rd-party/winbox.bundle.js delete mode 100644 dev/assets/SmartC-Watermark.png delete mode 100644 dev/assets/favicon-16.png delete mode 100644 dev/assets/favicon-32.png delete mode 100644 dev/assets/favicon.png delete mode 100644 dev/assets/whiteLogo.png delete mode 100644 dev/index.html delete mode 100644 dev/src/__tests__/testcases.spec.ts delete mode 100644 dev/src/index.js delete mode 100644 dev/src/templateTests.ts delete mode 100644 dev/src/testcases.ts delete mode 100644 dev/style.css diff --git a/dev/3rd-party/highlight.min.js b/dev/3rd-party/highlight.min.js deleted file mode 100644 index f8d5b19..0000000 --- a/dev/3rd-party/highlight.min.js +++ /dev/null @@ -1,340 +0,0 @@ -/*! - Highlight.js v11.0.1 (git: 1cf31f015d) - (c) 2006-2021 Ivan Sagalaev and other contributors - License: BSD-3-Clause - Tunned for SmartC: https://github.com/deleterium/SmartC - */ -var hljs=function(){"use strict";var e={exports:{}};function t(e){ -return e instanceof Map?e.clear=e.delete=e.set=()=>{ -throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{ -throw Error("set is read-only") -}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((n=>{var i=e[n] -;"object"!=typeof i||Object.isFrozen(i)||t(i)})),e} -e.exports=t,e.exports.default=t;var n=e.exports;class i{constructor(e){ -void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} -ignoreMatch(){this.isMatchIgnored=!0}}function r(e){ -return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") -}function s(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t] -;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const o=e=>!!e.kind -;class a{constructor(e,t){ -this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){ -this.buffer+=r(e)}openNode(e){if(!o(e))return;let t=e.kind -;t=e.sublanguage?"language-"+t:((e,{prefix:t})=>{if(e.includes(".")){ -const n=e.split(".") -;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ") -}return`${t}${e}`})(t,{prefix:this.classPrefix}),this.span(t)}closeNode(e){ -o(e)&&(this.buffer+="")}value(){return this.buffer}span(e){ -this.buffer+=``}}class l{constructor(){this.rootNode={ -children:[]},this.stack=[this.rootNode]}get top(){ -return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ -this.top.children.push(e)}openNode(e){const t={kind:e,children:[]} -;this.add(t),this.stack.push(t)}closeNode(){ -if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ -for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} -walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){ -return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t), -t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){ -"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ -l._collapse(e)})))}}class c extends l{constructor(e){super(),this.options=e} -addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())} -addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root -;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){ -return new a(this,this.options).value()}finalize(){return!0}}function g(e){ -return e?"string"==typeof e?e:e.source:null}function d(...e){ -return e.map((e=>g(e))).join("")}function u(...e){return"("+((e=>{ -const t=e[e.length-1] -;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{} -})(e).capture?"":"?:")+e.map((e=>g(e))).join("|")+")"}function h(e){ -return RegExp(e.toString()+"|").exec("").length-1} -const f=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ -;function p(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n -;let i=g(e),r="";for(;i.length>0;){const e=f.exec(i);if(!e){r+=i;break} -r+=i.substring(0,e.index), -i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+(Number(e[1])+t):(r+=e[0], -"("===e[0]&&n++)}return r})).map((e=>`(${e})`)).join(t)} -const b="[a-zA-Z]\\w*",m="[a-zA-Z_]\\w*",E="\\b\\d+(\\.\\d+)?",x="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",y="\\b(0b[01]+)",w={ -begin:"\\\\[\\s\\S]",relevance:0},_={scope:"string",begin:"'",end:"'", -illegal:"\\n",contains:[w]},v={scope:"string",begin:'"',end:'"',illegal:"\\n", -contains:[w]},O=(e,t,n={})=>{const i=s({scope:"comment",begin:e,end:t, -contains:[]},n);i.contains.push({scope:"doctag", -begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", -end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) -;const r=u("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) -;return i.contains.push({begin:d(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i -},k=O("//","$"),N=O("/\\*","\\*/"),S=O("#","$");var M=Object.freeze({ -__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:b,UNDERSCORE_IDENT_RE:m, -NUMBER_RE:E,C_NUMBER_RE:x,BINARY_NUMBER_RE:y, -RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", -SHEBANG:(e={})=>{const t=/^#![ ]*\// -;return e.binary&&(e.begin=d(t,/.*\b/,e.binary,/\b.*/)),s({scope:"meta",begin:t, -end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)}, -BACKSLASH_ESCAPE:w,APOS_STRING_MODE:_,QUOTE_STRING_MODE:v,PHRASAL_WORDS_MODE:{ -begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ -},COMMENT:O,C_LINE_COMMENT_MODE:k,C_BLOCK_COMMENT_MODE:N,HASH_COMMENT_MODE:S, -NUMBER_MODE:{scope:"number",begin:E,relevance:0},C_NUMBER_MODE:{scope:"number", -begin:x,relevance:0},BINARY_NUMBER_MODE:{scope:"number",begin:y,relevance:0}, -REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//, -end:/\/[gimuy]*/,illegal:/\n/,contains:[w,{begin:/\[/,end:/\]/,relevance:0, -contains:[w]}]}]},TITLE_MODE:{scope:"title",begin:b,relevance:0}, -UNDERSCORE_TITLE_MODE:{scope:"title",begin:m,relevance:0},METHOD_GUARD:{ -begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{ -"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{ -t.data._beginMatch!==e[1]&&t.ignoreMatch()}})});function R(e,t){ -"."===e.input[e.index-1]&&t.ignoreMatch()}function j(e,t){ -void 0!==e.className&&(e.scope=e.className,delete e.className)}function A(e,t){ -t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", -e.__beforeBegin=R,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, -void 0===e.relevance&&(e.relevance=0))}function I(e,t){ -Array.isArray(e.illegal)&&(e.illegal=u(...e.illegal))}function B(e,t){ -if(e.match){ -if(e.begin||e.end)throw Error("begin & end are not supported with match") -;e.begin=e.match,delete e.match}}function T(e,t){ -void 0===e.relevance&&(e.relevance=1)}const L=(e,t)=>{if(!e.beforeMatch)return -;if(e.starts)throw Error("beforeMatch cannot be used with starts") -;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t] -})),e.keywords=n.keywords, -e.begin=d(n.beforeMatch,d("(?=",n.begin,")")),e.starts={relevance:0, -contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch -},D=["of","and","for","in","not","or","if","then","parent","list","value"] -;function P(e,t,n="keyword"){const i=Object.create(null) -;return"string"==typeof e?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach((n=>{ -Object.assign(i,P(e[n],t,n))})),i;function r(e,n){ -t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|") -;i[n[0]]=[e,C(n[0],n[1])]}))}}function C(e,t){ -return t?Number(t):(e=>D.includes(e.toLowerCase()))(e)?0:1}const H={},$=e=>{ -console.error(e)},U=(e,...t)=>{console.log("WARN: "+e,...t)},z=(e,t)=>{ -H[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),H[`${e}/${t}`]=!0) -},K=Error();function W(e,t,{key:n}){let i=0;const r=e[n],s={},o={} -;for(let e=1;e<=t.length;e++)o[e+i]=r[e],s[e+i]=!0,i+=h(t[e-1]) -;e[n]=o,e[n]._emit=s,e[n]._multi=!0}function X(e){(e=>{ -e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, -delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ -_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope -}),(e=>{if(Array.isArray(e.begin)){ -if(e.skip||e.excludeBegin||e.returnBegin)throw $("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), -K -;if("object"!=typeof e.beginScope||null===e.beginScope)throw $("beginScope must be object"), -K;W(e,e.begin,{key:"beginScope"}),e.begin=p(e.begin,{joinWith:""})}})(e),(e=>{ -if(Array.isArray(e.end)){ -if(e.skip||e.excludeEnd||e.returnEnd)throw $("skip, excludeEnd, returnEnd not compatible with endScope: {}"), -K -;if("object"!=typeof e.endScope||null===e.endScope)throw $("endScope must be object"), -K;W(e,e.end,{key:"endScope"}),e.end=p(e.end,{joinWith:""})}})(e)}function G(e){ -function t(t,n){return RegExp(g(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))} -class n{constructor(){ -this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} -addRule(e,t){ -t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), -this.matchAt+=h(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) -;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(p(e,{joinWith:"|" -}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex -;const t=this.matcherRe.exec(e);if(!t)return null -;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n] -;return t.splice(0,n),Object.assign(t,i)}}class i{constructor(){ -this.rules=[],this.multiRegexes=[], -this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ -if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n -;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))), -t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ -return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ -this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ -const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex -;let n=t.exec(e) -;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{ -const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)} -return n&&(this.regexIndex+=n.position+1, -this.regexIndex===this.count&&this.considerAll()),n}} -if(e.compilerExtensions||(e.compilerExtensions=[]), -e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") -;return e.classNameAliases=s(e.classNameAliases||{}),function n(r,o){const a=r -;if(r.isCompiled)return a -;[j,B,X,L].forEach((e=>e(r,o))),e.compilerExtensions.forEach((e=>e(r,o))), -r.__beforeBegin=null,[A,I,T].forEach((e=>e(r,o))),r.isCompiled=!0;let l=null -;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords), -l=r.keywords.$pattern, -delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=P(r.keywords,e.case_insensitive)), -a.keywordPatternRe=t(l,!0), -o&&(r.begin||(r.begin=/\B|\b/),a.beginRe=t(r.begin),r.end||r.endsWithParent||(r.end=/\B|\b/), -r.end&&(a.endRe=t(r.end)), -a.terminatorEnd=g(r.end)||"",r.endsWithParent&&o.terminatorEnd&&(a.terminatorEnd+=(r.end?"|":"")+o.terminatorEnd)), -r.illegal&&(a.illegalRe=t(r.illegal)), -r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>s(e,{ -variants:null},t)))),e.cachedVariants?e.cachedVariants:Z(e)?s(e,{ -starts:e.starts?s(e.starts):null -}):Object.isFrozen(e)?s(e):e))("self"===e?r:e)))),r.contains.forEach((e=>{n(e,a) -})),r.starts&&n(r.starts,o),a.matcher=(e=>{const t=new i -;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" -}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" -}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function Z(e){ -return!!e&&(e.endsWithParent||Z(e.starts))}const F=r,V=s,q=Symbol("nomatch") -;var J=(e=>{const t=Object.create(null),r=Object.create(null),s=[];let o=!0 -;const a="Could not find the language '{}', did you forget to load/include a language module?",l={ -disableAutodetect:!0,name:"Plain text",contains:[]};let g={ -ignoreUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, -languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", -cssSelector:"pre code",languages:null,__emitter:c};function d(e){ -return g.noHighlightRe.test(e)}function u(e,t,n,i){let r="",s="" -;"object"==typeof t?(r=e, -n=t.ignoreIllegals,s=t.language,i=void 0):(z("10.7.0","highlight(lang, code, ...args) has been deprecated."), -z("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), -s=e,r=t),void 0===n&&(n=!0);const o={code:r,language:s};w("before:highlight",o) -;const a=o.result?o.result:h(o.language,o.code,n,i) -;return a.code=o.code,w("after:highlight",a),a}function h(e,n,r,s){ -const l=Object.create(null);function c(){if(!k.keywords)return void S.addText(M) -;let e=0;k.keywordPatternRe.lastIndex=0;let t=k.keywordPatternRe.exec(M),n="" -;for(;t;){n+=M.substring(e,t.index) -;const r=_.case_insensitive?t[0].toLowerCase():t[0],s=(i=r,k.keywords[i]);if(s){ -const[e,i]=s -;if(S.addText(n),n="",l[r]=(l[r]||0)+1,l[r]<=7&&(R+=i),e.startsWith("_"))n+=t[0];else{ -const n=_.classNameAliases[e]||e;S.addKeyword(t[0],n)}}else n+=t[0] -;e=k.keywordPatternRe.lastIndex,t=k.keywordPatternRe.exec(M)}var i -;n+=M.substr(e),S.addText(n)}function d(){null!=k.subLanguage?(()=>{ -if(""===M)return;let e=null;if("string"==typeof k.subLanguage){ -if(!t[k.subLanguage])return void S.addText(M) -;e=h(k.subLanguage,M,!0,N[k.subLanguage]),N[k.subLanguage]=e._top -}else e=f(M,k.subLanguage.length?k.subLanguage:null) -;k.relevance>0&&(R+=e.relevance),S.addSublanguage(e._emitter,e.language) -})():c(),M=""}function u(e,t){let n=1;for(;void 0!==t[n];){if(!e._emit[n]){n++ -;continue}const i=_.classNameAliases[e[n]]||e[n],r=t[n] -;i?S.addKeyword(r,i):(M=r,c(),M=""),n++}}function p(e,t){ -return e.scope&&"string"==typeof e.scope&&S.openNode(_.classNameAliases[e.scope]||e.scope), -e.beginScope&&(e.beginScope._wrap?(S.addKeyword(M,_.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), -M=""):e.beginScope._multi&&(u(e.beginScope,t),M="")),k=Object.create(e,{parent:{ -value:k}}),k}function b(e,t,n){let r=((e,t)=>{const n=e&&e.exec(t) -;return n&&0===n.index})(e.endRe,n);if(r){if(e["on:end"]){const n=new i(e) -;e["on:end"](t,n),n.isMatchIgnored&&(r=!1)}if(r){ -for(;e.endsParent&&e.parent;)e=e.parent;return e}} -if(e.endsWithParent)return b(e.parent,t,n)}function m(e){ -return 0===k.matcher.regexIndex?(M+=e[0],1):(I=!0,0)}function x(e){ -const t=e[0],i=n.substr(e.index),r=b(k,e,i);if(!r)return q;const s=k -;k.endScope&&k.endScope._wrap?(d(), -S.addKeyword(t,k.endScope._wrap)):k.endScope&&k.endScope._multi?(d(), -u(k.endScope,e)):s.skip?M+=t:(s.returnEnd||s.excludeEnd||(M+=t), -d(),s.excludeEnd&&(M=t));do{ -k.scope&&!k.isMultiClass&&S.closeNode(),k.skip||k.subLanguage||(R+=k.relevance), -k=k.parent}while(k!==r.parent) -;return r.starts&&p(r.starts,e),s.returnEnd?0:t.length}let y={};function w(t,s){ -const a=s&&s[0];if(M+=t,null==a)return d(),0 -;if("begin"===y.type&&"end"===s.type&&y.index===s.index&&""===a){ -if(M+=n.slice(s.index,s.index+1),!o){const t=Error(`0 width match regex (${e})`) -;throw t.languageName=e,t.badRule=y.rule,t}return 1} -if(y=s,"begin"===s.type)return(e=>{ -const t=e[0],n=e.rule,r=new i(n),s=[n.__beforeBegin,n["on:begin"]] -;for(const n of s)if(n&&(n(e,r),r.isMatchIgnored))return m(t) -;return n.skip?M+=t:(n.excludeBegin&&(M+=t), -d(),n.returnBegin||n.excludeBegin||(M=t)),p(n,e),n.returnBegin?0:t.length})(s) -;if("illegal"===s.type&&!r){ -const e=Error('Illegal lexeme "'+a+'" for mode "'+(k.scope||"")+'"') -;throw e.mode=k,e}if("end"===s.type){const e=x(s);if(e!==q)return e} -if("illegal"===s.type&&""===a)return 1 -;if(A>1e5&&A>3*s.index)throw Error("potential infinite loop, way more iterations than matches") -;return M+=a,a.length}const _=E(e) -;if(!_)throw $(a.replace("{}",e)),Error('Unknown language: "'+e+'"') -;const v=G(_);let O="",k=s||v;const N={},S=new g.__emitter(g);(()=>{const e=[] -;for(let t=k;t!==_;t=t.parent)t.scope&&e.unshift(t.scope) -;e.forEach((e=>S.openNode(e)))})();let M="",R=0,j=0,A=0,I=!1;try{ -for(k.matcher.considerAll();;){ -A++,I?I=!1:k.matcher.considerAll(),k.matcher.lastIndex=j -;const e=k.matcher.exec(n);if(!e)break;const t=w(n.substring(j,e.index),e) -;j=e.index+t}return w(n.substr(j)),S.closeAllNodes(),S.finalize(),O=S.toHTML(),{ -language:e,value:O,relevance:R,illegal:!1,_emitter:S,_top:k}}catch(t){ -if(t.message&&t.message.includes("Illegal"))return{language:e,value:F(n), -illegal:!0,relevance:0,_illegalBy:{message:t.message,index:j, -context:n.slice(j-100,j+100),mode:t.mode,resultSoFar:O},_emitter:S};if(o)return{ -language:e,value:F(n),illegal:!1,relevance:0,errorRaised:t,_emitter:S,_top:k} -;throw t}}function f(e,n){n=n||g.languages||Object.keys(t);const i=(e=>{ -const t={value:F(e),illegal:!1,relevance:0,_top:l,_emitter:new g.__emitter(g)} -;return t._emitter.addText(e),t})(e),r=n.filter(E).filter(y).map((t=>h(t,e,!1))) -;r.unshift(i);const s=r.sort(((e,t)=>{ -if(e.relevance!==t.relevance)return t.relevance-e.relevance -;if(e.language&&t.language){if(E(e.language).supersetOf===t.language)return 1 -;if(E(t.language).supersetOf===e.language)return-1}return 0})),[o,a]=s,c=o -;return c.secondBest=a,c}function p(e){let t=null;const n=(e=>{ -let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"" -;const n=g.languageDetectRe.exec(t);if(n){const t=E(n[1]) -;return t||(U(a.replace("{}",n[1])), -U("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"} -return t.split(/\s+/).find((e=>d(e)||E(e)))})(e);if(d(n))return -;w("before:highlightElement",{el:e,language:n -}),!g.ignoreUnescapedHTML&&e.children.length>0&&(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), -console.warn("https://github.com/highlightjs/highlight.js/issues/2886"), -console.warn(e)),t=e;const i=t.textContent,s=n?u(i,{language:n,ignoreIllegals:!0 -}):f(i);e.innerHTML=s.value,((e,t,n)=>{const i=t&&r[t]||n -;e.classList.add("hljs"),e.classList.add("language-"+i) -})(e,n,s.language),e.result={language:s.language,re:s.relevance, -relevance:s.relevance},s.secondBest&&(e.secondBest={ -language:s.secondBest.language,relevance:s.secondBest.relevance -}),w("after:highlightElement",{el:e,result:s,text:i})}let b=!1;function m(){ -"loading"!==document.readyState?document.querySelectorAll(g.cssSelector).forEach(p):b=!0 -}function E(e){return e=(e||"").toLowerCase(),t[e]||t[r[e]]} -function x(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ -r[e.toLowerCase()]=t}))}function y(e){const t=E(e) -;return t&&!t.disableAutodetect}function w(e,t){const n=e;s.forEach((e=>{ -e[n]&&e[n](t)}))} -"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ -b&&m()}),!1),Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:m, -highlightElement:p, -highlightBlock:e=>(z("10.7.0","highlightBlock will be removed entirely in v12.0"), -z("10.7.0","Please use highlightElement now."),p(e)),configure:e=>{g=V(g,e)}, -initHighlighting:()=>{ -m(),z("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, -initHighlightingOnLoad:()=>{ -m(),z("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") -},registerLanguage:(n,i)=>{let r=null;try{r=i(e)}catch(e){ -if($("Language definition for '{}' could not be registered.".replace("{}",n)), -!o)throw e;$(e),r=l} -r.name||(r.name=n),t[n]=r,r.rawDefinition=i.bind(null,e),r.aliases&&x(r.aliases,{ -languageName:n})},unregisterLanguage:e=>{delete t[e] -;for(const t of Object.keys(r))r[t]===e&&delete r[t]}, -listLanguages:()=>Object.keys(t),getLanguage:E,registerAliases:x, -autoDetection:y,inherit:V,addPlugin:e=>{(e=>{ -e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{ -e["before:highlightBlock"](Object.assign({block:t.el},t)) -}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{ -e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),s.push(e)} -}),e.debugMode=()=>{o=!1},e.safeMode=()=>{o=!0},e.versionString="11.0.1" -;for(const e in M)"object"==typeof M[e]&&n(M[e]);return Object.assign(e,M),e -})({}),Y=Object.freeze({__proto__:null});const Q=J -;for(const e of Object.keys(Y)){const t=e.replace("grmr_","") -;Q.registerLanguage(t,Y[e])}return Q}() -;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);hljs.registerLanguage("c",(()=>{"use strict";function e(e){ -return((...e)=>e.map((e=>(e=>e?"string"==typeof e?e:e.source:null)(e))).join(""))("(?:",e,")?") -}return n=>{const t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}] -}),s="[a-zA-Z_]\\w*::",r="(decltype\\(auto\\)|"+e(s)+"[a-zA-Z_]\\w*"+e("<[^<>]+>")+")",a={ -className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{ -match:/\batomic_[a-z]{3,6}\b/}]},i={className:"string",variants:[{ -begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{ -begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", -end:"'",illegal:"."},n.END_SAME_AS_BEGIN({ -begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={ -className:"number",variants:[{begin:"\\b(0b[01']+)"},{ -begin:"(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" -},{ -begin:"(-?)(\\b0[xX][a-fA-F0-9_\']+|(\\b\\d[\\d_\']*(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)" -}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,keywords:{ -keyword:"if else endif define undef pragma program ifdef ifndef include" -},contains:[{begin:/\\\n/,relevance:0},n.inherit(i,{className:"string"}),{ -className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},o={ -className:"title",begin:e(s)+n.IDENT_RE,relevance:0 -},d=e(s)+n.IDENT_RE+"\\s*\\(",u={ -keyword:["asm","break","case","const","continue","default","do","else","exit","for","goto","halt","if","return","sizeof","sleep","struct","switch","while"], -type:["long","void"], -literal:"true false NULL", -built_in:"Get_A1 Get_A2 Get_A3 Get_A4 Get_B1 Get_B2 Get_B3 Get_B4 Set_A1 Set_A2 Set_A3 Set_A4 Set_A1_A2 Set_A3_A4 Set_B1 Set_B2 Set_B3 Set_B4 Set_B1_B2 Set_B3_B4 Clear_A Clear_B Clear_A_And_B Copy_A_From_B Copy_B_From_A Check_A_Is_Zero Check_B_Is_Zero Check_A_Equals_B Swap_A_and_B OR_A_with_B OR_B_with_A AND_A_with_B AND_B_with_A XOR_A_with_B XOR_B_with_A Add_A_To_B Add_B_To_A Sub_A_From_B Sub_B_From_A Mul_A_By_B Mul_B_By_A Div_A_By_B Div_B_By_A MD5_A_To_B Check_MD5_A_With_B HASH160_A_To_B Check_HASH160_A_With_B SHA256_A_To_B Check_SHA256_A_With_B Get_Block_Timestamp Get_Creation_Timestamp Get_Last_Block_Timestamp Put_Last_Block_Hash_In_A A_To_Tx_After_Timestamp Get_Type_For_Tx_In_A Get_Amount_For_Tx_In_A Get_Timestamp_For_Tx_In_A Get_Random_Id_For_Tx_In_A Message_From_Tx_In_A_To_B B_To_Address_Of_Tx_In_A B_To_Address_Of_Creator Get_Current_Balance Get_Previous_Balance Send_To_Address_In_B Send_All_To_Address_In_B Send_Old_To_Address_In_B Send_A_To_Address_In_B Add_Minutes_To_Timestamp Check_Sig_B_With_A Get_Code_Hash_Id Get_Map_Value_Keys_In_A Set_Map_Value_Keys_In_A Issue_Asset Mint_Asset Distribute_To_Asset_Holders Get_Asset_Holders_Count Get_Activation_Fee Put_Last_Block_GSig_In_A Get_Asset_Circulating B_To_Assets_Of_Tx_In_A pow mdv" -},g=[c,a,t,n.C_BLOCK_COMMENT_MODE,l,i],m={variants:[{begin:/=/,end:/;/},{ -begin:/\(/,end:/\)/},{beginKeywords:"return else",end:/;/}], -keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, -contains:g.concat(["self"]),relevance:0}]),relevance:0},_={ -begin:"("+r+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, -keywords:u,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", -keywords:u,relevance:0},{begin:d,returnBegin:!0,contains:[n.inherit(o,{ -className:"title.function"})],relevance:0},{relevance:0,match:/,/},{ -className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0, -contains:[t,n.C_BLOCK_COMMENT_MODE,i,l,a,{begin:/\(/,end:/\)/,keywords:u, -relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,i,l,a]}] -},a,t,n.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:u, -disableAutodetect:!0,illegal:"=]/,contains:[{ -beginKeywords:"struct"},n.TITLE_MODE]}]),exports:{preprocessor:c, -strings:i,keywords:u}}}})()); \ No newline at end of file diff --git a/dev/3rd-party/styles/tomorrow.css b/dev/3rd-party/styles/tomorrow.css deleted file mode 100644 index 6270bce..0000000 --- a/dev/3rd-party/styles/tomorrow.css +++ /dev/null @@ -1,173 +0,0 @@ - -/*! - Theme: Tomorrow - Author: Chris Kempson (http://chriskempson.com) - License: ~ MIT (or more permissive) [via base16-schemes-source] - Maintainer: @highlightjs/core-team - Version: 2021.05.0 -*/ - -/* - WARNING: DO NOT EDIT THIS FILE DIRECTLY. - This theme file was auto-generated from the Base16 scheme tomorrow - by the Highlight.js Base16 template builder. - - https://github.com/highlightjs/base16-highlightjs -*/ - -/* -base00 #ffffff Default Background -base01 #e0e0e0 Lighter Background (Used for status bars, line number and folding marks) -base02 #d6d6d6 Selection Background -base03 #8e908c Comments, Invisibles, Line Highlighting -base04 #969896 Dark Foreground (Used for status bars) -base05 #4d4d4c Default Foreground, Caret, Delimiters, Operators -base06 #282a2e Light Foreground (Not often used) -base07 #1d1f21 Light Background (Not often used) -base08 #c82829 Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted -base09 #f5871f Integers, Boolean, Constants, XML Attributes, Markup Link Url -base0A #eab700 Classes, Markup Bold, Search Text Background -base0B #718c00 Strings, Inherited Class, Markup Code, Diff Inserted -base0C #3e999f Support, Regular Expressions, Escape Characters, Markup Quotes -base0D #4271ae Functions, Methods, Attribute IDs, Headings -base0E #8959a8 Keywords, Storage, Selector, Markup Italic, Diff Changed -base0F #a3685a Deprecated, Opening/Closing Embedded Language Tags, e.g. -*/ - -pre code.hljs { - display: block; - overflow-x: auto; - padding: 1em; -} - -code.hljs { - padding: 3px 5px; -} - -.hljs { - color: #4d4d4c; - background: #ffffff; -} - -.hljs ::selection { - color: #d6d6d6; -} - -/* purposely do not highlight these things */ -/* comment just to remeber they exist and can be used: -.hljs-formula, .hljs-params, .hljs-property */ - -/* base03 - #8e908c - Comments, Invisibles, Line Highlighting */ -.hljs-comment { - color: #8e908c; -} - -/* base04 - #969896 - Dark Foreground (Used for status bars) */ -.hljs-tag { - color: #969896; -} - -/* base05 - #4d4d4c - Default Foreground, Caret, Delimiters, Operators */ -.hljs-subst, -.hljs-punctuation, -.hljs-operator { - color: #4d4d4c; -} - -.hljs-operator { - opacity: 0.7; -} - -/* base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted */ -.hljs-bullet, -.hljs-variable, -.hljs-template-variable, -.hljs-selector-tag, -.hljs-name, -.hljs-deletion { - color: #c82829; -} - -/* base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url */ -.hljs-symbol, -.hljs-number, -.hljs-link, -.hljs-attr, -.hljs-variable.constant_, -.hljs-literal { - color: #ff0000; -} - -/* base0A - Classes, Markup Bold, Search Text Background */ -.hljs-title, -.hljs-class .hljs-title, -.hljs-title.class_ -{ - color: palevioletred; -} - -.hljs-strong { - font-weight:bold; - color: #eab700; -} - -/* base0B - Strings, Inherited Class, Markup Code, Diff Inserted */ -.hljs-code, -.hljs-addition, -.hljs-title.class_.inherited__, -.hljs-string { - font-weight:bold; - color: green; -} - -/* base0C - Support, Regular Expressions, Escape Characters, Markup Quotes */ -.hljs-built_in, -.hljs-doctag, /* guessing */ -.hljs-quote, -.hljs-keyword.hljs-atrule, -.hljs-regexp { - color: #2d57a5; -} - -/* base0D - Functions, Methods, Attribute IDs, Headings */ -.hljs-function .hljs-title, -.hljs-attribute, -.ruby .hljs-property, -.hljs-title.function_, -.hljs-section { - font-weight:bold; - color: mediumblue; -} - -/* base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed */ -.hljs-type, -/* .hljs-selector-id, */ -/* .hljs-selector-class, */ -/* .hljs-selector-attr, */ -/* .hljs-selector-pseudo, */ -.hljs-template-tag, -.diff .hljs-meta, -.hljs-keyword { - color: purple; -} -.hljs-emphasis { - color: #8959a8; - font-style: italic; -} - -/* base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. */ -.hljs-meta, -/* - prevent top level .keyword and .string scopes - from leaking into meta by accident -*/ -.hljs-meta .hljs-keyword, -.hljs-meta .hljs-string -{ - color: #6e3f33; -} - -.hljs-meta .hljs-keyword, -/* for v10 compatible themes */ -.hljs-meta-keyword { - font-weight: bold; -} \ No newline at end of file diff --git a/dev/3rd-party/winbox.bundle.js b/dev/3rd-party/winbox.bundle.js deleted file mode 100644 index 4a8648c..0000000 --- a/dev/3rd-party/winbox.bundle.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * WinBox.js v0.1.9 (Bundle) - * Copyright 2021 Nextapps GmbH - * Author: Thomas Wilkerling - * Licence: Apache-2.0 - * https://github.com/nextapps-de/winbox - */ -(function(){'use strict';var e,h=document.createElement("style");h.innerHTML="@keyframes fade-in{0%{opacity:0}to{opacity:.85}}.winbox.modal:after,.winbox.modal:before{content:''}.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22);transition:width .3s,height .3s,transform .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);will-change:transform,width,height;contain:layout size;text-align:left;touch-action:none}.max,.no-shadow{box-shadow:none}.wb-header,.winbox iframe{position:absolute;width:100%}.wb-header{left:0;top:0;height:35px;color:#fff;overflow:hidden}.wb-body,.wb-n,.wb-s{position:absolute;left:0}.wb-n,.wb-s{height:10px}.wb-body{right:0;top:35px;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict}.wb-title{font-family:Arial,sans-serif;font-size:14px;padding-left:10px;cursor:move;line-height:35px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-n{top:-5px;right:0;cursor:n-resize}.wb-e{position:absolute;top:0;right:-5px;bottom:0;width:10px;cursor:w-resize}.wb-s,.wb-se,.wb-sw{bottom:-5px}.wb-s{right:0;cursor:n-resize}.wb-w,.winbox.modal:before{position:absolute;top:0;bottom:0}.wb-w{left:-5px;width:10px;cursor:w-resize}.wb-ne,.wb-nw,.wb-sw{width:15px;height:15px;position:absolute}.wb-nw{top:-5px;left:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize}.wb-ne{top:-5px;right:-5px}.wb-sw{left:-5px}.wb-se{position:absolute;right:-5px;width:15px;height:15px;cursor:nw-resize}.wb-icon{float:right;height:35px;max-width:100%;text-align:center}.wb-icon *{display:inline-block;width:30px;height:100%;background-position:center;background-repeat:no-repeat;cursor:pointer;max-width:100%}.no-close .wb-close,.no-full .wb-full,.no-header .wb-header,.no-max .wb-max,.no-min .wb-min,.no-resize .wb-body~div,.winbox.min .wb-body>*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-title,.winbox.min .wb-title{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center bottom 11px}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-title{pointer-events:none}.max .wb-body{margin:0!important}.winbox iframe{height:100%;border:0}.winbox.modal:before{left:0;right:0;background:inherit;border-radius:inherit}.winbox.modal:after{position:absolute;top:-100vh;left:-100vw;right:-100vw;bottom:-100vh;background:#0d1117;animation:fade-in .2s ease-out forwards;z-index:-1}.no-animation{transition:none}.no-header .wb-body{top:0}.no-move:not(.min) .wb-title{pointer-events:none}"; -var l=document.getElementsByTagName("head")[0];l.firstChild?l.insertBefore(h,l.firstChild):l.appendChild(h);var q=document.createElement("div");q.innerHTML="
";function r(a,b,c,g){a.addEventListener(b,c,g||!1===g?g:!0)}function t(a){a.stopPropagation();a.cancelable&&a.preventDefault()}function w(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};var x=document.documentElement,y=[],B=0,C=0,D,G,H,K,L,N,O; -function Q(a,b){if(!(this instanceof Q))return new Q(a);D||R();this.g=q.cloneNode(!0);this.body=this.g.getElementsByClassName("wb-body")[0];var c,g;if(a){if(b){var f=a;a=b}if("string"===typeof a)f=a;else{if(g=a.modal)var u=c="center";var z=a.id;var I=a.root;f=f||a.title;var E=a.mount;var d=a.html;var A=a.url;var k=a.width;var m=a.height;u=a.x||u;c=a.y||c;var F=a.max;var n=a.top;var p=a.left;var v=a.bottom;var J=a.right;D=a.index||D;var X=a.onclose;var Y=a.onfocus;var Z=a.onblur;var aa=a.onmove;var ba= -a.onresize;b=a.background;var P=a.border;var M=a["class"];b&&this.setBackground(b);P&&w(this.body,"margin",P+(isNaN(P)?"":"px"))}}this.setTitle(f||"");a=N;f=O;n=n?S(n,f):0;v=v?S(v,f):0;p=p?S(p,a):0;J=J?S(J,a):0;a-=p+J;f-=n+v;k=k?S(k,a):a/2|0;m=m?S(m,f):f/2|0;u=u?S(u,a,k):p;c=c?S(c,f,m):n;D=D||10;this.g.id=this.id=z||"winbox-"+ ++B;this.g.className="winbox"+(M?" "+("string"===typeof M?M:M.join(" ")):"")+(g?" modal":"");this.x=u;this.y=c;this.width=k;this.height=m;this.top=n;this.right=J;this.bottom= -v;this.left=p;this.max=this.min=!1;this.j=X;this.l=Y;this.i=Z;this.o=aa;this.m=ba;F?this.maximize():this.move().resize();this.focus();E?this.mount(E):d?this.body.innerHTML=d:A&&this.setUrl(A);ca(this);(I||document.body).appendChild(this.g)}Q["new"]=function(a){return new Q(a)};function S(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c|0:c));return a} -function R(){var a=document.body;a[K="requestFullscreen"]||a[K="msRequestFullscreen"]||a[K="webkitRequestFullscreen"]||a[K="mozRequestFullscreen"]||(K="");L=K&&K.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");r(window,"resize",function(){N=x.clientWidth;O=x.clientHeight;T()});N=x.clientWidth;O=x.clientHeight} -function ca(a){U(a,"title");U(a,"n");U(a,"s");U(a,"w");U(a,"e");U(a,"nw");U(a,"ne");U(a,"se");U(a,"sw");r(a.g.getElementsByClassName("wb-min")[0],"click",function(b){t(b);a.minimize()});r(a.g.getElementsByClassName("wb-max")[0],"click",function(b){t(b);a.focus().maximize()});K?r(a.g.getElementsByClassName("wb-full")[0],"click",function(b){t(b);a.focus().fullscreen()}):a.addClass("no-full");r(a.g.getElementsByClassName("wb-close")[0],"click",function(b){t(b);a.close()||(a=null)});r(a.g,"click",function(){a.focus()}, -!1)}function V(a){y.splice(y.indexOf(a),1);T();a.removeClass("min");a.min=!1;a.g.title=""}function T(){for(var a=y.length,b=0,c,g;bk){a.maximize();return}}a.max||(w(a.g,"transition","none"),(z=d.touches)&&(z=z[0])?(d=z,r(window,"touchmove",g),r(window,"touchend",f)):(r(window,"mousemove",g),r(window,"mouseup",f)),I=d.pageX,E=d.pageY,a.focus())}}function g(d){t(d);z&&(d=d.touches[0]);var A=d.pageX;d=d.pageY;var k=A-I,m=d-E,F;if("title"===b){a.x+=k;a.y+=m;var n=F=1}else{if("e"===b||"se"===b||"ne"===b){a.width+=k;var p= -1}else if("w"===b||"sw"===b||"nw"===b)a.x+=k,a.width-=k,n=p=1;if("s"===b||"se"===b||"sw"===b){a.height+=m;var v=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=m,a.height-=m,F=v=1}if(p||v)p&&(a.width=Math.max(Math.min(a.width,N-a.x-a.right),150)),v&&(a.height=Math.max(Math.min(a.height,O-a.y-a.bottom),35)),a.resize();if(n||F)n&&(a.x=Math.max(Math.min(a.x,N-a.width-a.right),a.left)),F&&(a.y=Math.max(Math.min(a.y,O-a.height-a.bottom),a.top)),a.move();I=A;E=d}function f(d){t(d);w(a.g,"transition","");z?(window.removeEventListener("touchmove", -g,!0),window.removeEventListener("touchend",f,!0)):(window.removeEventListener("mousemove",g,!0),window.removeEventListener("mouseup",f,!0))}var u=a.g.getElementsByClassName("wb-"+b)[0],z,I,E;r(u,"mousedown",c);r(u,"touchstart",c,{passive:!1})}e=Q.prototype;e.mount=function(a){this.unmount();a.h||(a.h=a.parentNode);this.body.textContent="";this.body.appendChild(a);return this};e.unmount=function(a){var b=this.body.firstChild;if(b){var c=a||b.h;c&&c.appendChild(b);b.h=a}return this}; -e.setTitle=function(a){a=this.title=a;this.g.getElementsByClassName("wb-title")[0].firstChild.nodeValue=a;return this};e.setBackground=function(a){w(this.g,"background",a);return this};e.setUrl=function(a){this.body.innerHTML='';return this};e.focus=function(){H!==this&&(w(this.g,"z-index",D++),this.addClass("focus"),H&&(H.removeClass("focus"),H.i&&H.i()),H=this,this.l&&this.l());return this};e.hide=function(){return this.addClass("hide")};e.show=function(){return this.removeClass("hide")}; -e.minimize=function(a){G&&W();!a&&this.min?(V(this),this.resize().move().focus()):!1===a||this.min||(y.push(this),T(),this.g.title=this.title,this.addClass("min"),this.min=!0);this.max&&(this.removeClass("max"),this.max=!1);return this};e.maximize=function(a){if("undefined"===typeof a||a!==this.max)this.min&&V(this),(this.max=!this.max)?this.addClass("max").resize(N-this.left-this.right,O-this.top-this.bottom,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max");return this}; -e.fullscreen=function(a){if("undefined"===typeof a||a!==G)this.min&&(this.resize().move(),V(this)),G&&W()||(this.body[K](),G=!0);return this};function W(){G=!1;if(document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[L](),!0}e.close=function(a){if(this.j&&this.j(a))return!0;this.min&&V(this);this.unmount();this.g.parentNode.removeChild(this.g);H===this&&(H=null)}; -e.move=function(a,b,c){a||0===a?c||(this.x=a?a=S(a,N-this.left-this.right,this.width):0,this.y=b?b=S(b,O-this.top-this.bottom,this.height):0):(a=this.x,b=this.y);w(this.g,"transform","translate("+a+"px,"+b+"px)");this.o&&this.o(a,b);return this};e.resize=function(a,b,c){a||0===a?c||(this.width=a?a=S(a,N-this.left-this.right):0,this.height=b?b=S(b,O-this.top-this.bottom):0):(a=this.width,b=this.height);w(this.g,"width",a+"px");w(this.g,"height",b+"px");this.m&&this.m(a,b);return this}; -e.addClass=function(a){this.g.classList.add(a);return this};e.removeClass=function(a){this.g.classList.remove(a);return this};window.WinBox=Q;}).call(this); diff --git a/dev/assets/SmartC-Watermark.png b/dev/assets/SmartC-Watermark.png deleted file mode 100644 index 72ad328fc96590cc7f541022029cad7a965efaf9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17357 zcmeHtc{r49-~W(^NVf_pYnDcqvF}t8GuB43FJlY_V;TFdi2I4CF-X?RkbNh{n&Or< zvSgPnyC`e%Ue|O#&vQS=`~LI%-rw{7)pT?muJbz2@ACPs=XqX#GtkpyV&GtaKp;$T zts6)Pgr)=nIrjMkEilq;PB#jHQ11oYHt|BDe0kjQZuVFg43C$;JBA12hqZ@5{67=ovBJ|Sv5n{O~9rh!mEL1Qu z;*~@u{h}It_|)iLg;9T^aeaEQx!ae+O#LXgGX6;6tS#IYzRIiL`i!fnjMjb%@49i@ z;qWc}#tR4W&pIC8xWS0Bh+M*G?XF~YTvbY{Ojz13shDvo-gDsC(7x4WuD9ZnK3UEi zs6MUvgqioFLHX|aus3l8X|K~xmtl`?@HjxVL(PR*Hih+fa`>K~e>R^K&h>JPBxI&u zd{L$UT@cgb9R8%h17wDlwV`S5QJ3eo_9x9B#J3#3sbE3{LQiElcbRB(9M2USdhV)i z!P5HnkZ~yev>8+vuT%=a`S zDcWOBtXW+1S-YT7r2H!%8#c#1u9KqG-pg2jPd~1RXF9N(Pd0tv>v~V5VySP<;y=GT z_sKTa?otd7n@r^06J1wwYgvM>^ys^vJN@Ag{Kdx)-mK;P&2n)_m*=F{lu^ad9BM`~ z>}+!-AA4$yPG)5M)%&t&Sw8+gs+YW8iJeL(9tktkw3}vyJ@kCldiI43G2xkB?~LRz z`nP+MCAoc&D-LfDOIL=~bv4TKSY^BmM;;I@Du}iMVsGtj6_U*)q^g~|-b%T4eVShz zFrO2CC0&{5G~irV*z6EK7x|ItnAxa*lFIti?XuCez;W}o?Zp~r@$uT7k@k^ zTO#8WN3PLT^*v@*d54PP{^oeb9EW)7za-M1-J>{~Hgf-)wtqN>98vIyEtL5s&*2Zi^@a?mmJf9vt zt986~`^~LRNGnje5*W>nug|+>021?6VsM6h@C`+szX}2@{|DWFnf-U&DU*R&y1I%t+|b^j zc<>u4d?0^CJ2y1ePLc8_%vM$bW^X4gDlLh@h)PS#Vnl6Ga`vKV2?+(1q=Ky-Oh)oA zq~NZeUMN>I1|$U#7sCQ{Fw(Ztwze3QC`?`gpo0Ncqogo$q7oPhX?r`E1PUW9^%oNQ zcr4(RD3`xV1(LD@NXbacODIU$D~O_OWl^HiwsO*<^71f@sGYrxf}Mhlyp$|VjzY=~ zt$5Q7k3#|G#Ntp67;$%32g(Z&aK&o|a1}mDG1xyx3|vrN_P_!aJ{_#9x8FZs+{WTC zhF&NTO$k{kIcZ5*IXM|Ad6wh4lnx_=6t*r_UQ=Jbpg?3;`D`hI&&|G`*xXfzszmXQ&)lL9Oz4a3-r z+S&nt+ezD^q@@+?CI7DYKd5`U*?ak-@R(~3fTn;pfCEvq;kitK68f*Q_&Q=hoM4g? zq7o9KlCawnQi{^DiV`xSFeybCj8FVeg~h?B{=3G?;{Od3Wy*xVqyb>v&oLmq0NG0X zAL;5(%s?3bgTFs*@gL*>kp9Kw-@^A7T)*J@w-ETZCjauTUvT|f2>e@MOe;NY+Q(eED;s*@U zdBJrx=;ltIJuSveaf$%`!H?H0G8(A4&#E)tv()Pxk)o>~mX)jva32j(}cFgHs zY2SN1HN0wcl8Qgflke>N_ZWH`+tN+Xi4=N(;;-K?1b!j#3xQt<{6gRt0>2RWg}^Ta z{u=_yBb}##!I%-@_V0h2EQjNrKZlu}04^XQtAYZIqqcYQ;R?#VPBq*h(Ef7kCGw!&m#aKY?Qm>FIH}NE_4kQ^3v|x9A||< zn&dB%zBV{@U`OcNActCE#~~0{5FM0!s%n*_bb(qq8gdd?xGSdkbh68EA4TPbz@Gx9 zxD@xfE>88#KOW`xjpX|L;G78{S&R3R*@CE<2E8)r?^lg!C_~cP(1nz5Uf-j+;+S+| zSgr$Np=!0tmcHz6+3WewAR)LjHdGJ@V~+>oy!GU%cx7p8Na3yP02VM2I(YXL#f&YJ zi&Pal6v0H261wK*7pvLWU{pvvKx$fE8;|@lw%IK}J@Qi>n1~^Dfms@9GJCV>cX|-! zNC{u^#U_8NCl1uOdK!S&%TWUk5_eXF2_!JI2AE(_9RI;makpNB;7tfjIyKC81zfgN zsbv~0BfZd7b8O{42tuY_IT2s?@oLWxeCEQb+gkLz5XjXuD1{wB}r_9;o1y!5fq*G=dqR%#>|U?CW>-9z(iXbU?LYAw$aQ!WmdSIJRe%U z$V1|0ZHl(y2bh1DmTu2K6}!dTu1nBGgn571{KDE*x@KuRr9gqz+l1dge%p7A45u&g zSxZ54R|Sn3A=GysYBMP(P#7L|A>XZxoGKoKPaMr29p&t~p?71NPMF>W4BXqeRbkzl zL`*kUa~^BZ#V5`3uhQyl%`XoM(4}7ok?t*iL4@SvxCs_V^Ns6>gFB)bZIUFHFU=%6 zE^Uh9p{I~OoGzm{f_~htX9hCBuCg#XjrHztzk$~Ly6`;Q|D$00z?sAE2Njdd&gp&3 zC#P=lPXMa@@JpDj2%q_$w?0tplA;#c*Bst7iZPtd*)b)hi(O=z1aaIR4M0I&^jqx@0Py(_x zCA1!XFo(}D46t79P)B^zWBXB3w6$r3ZaM*_FmJ`sd6q;GCyWlZdE0~Ow)({a!l{ng zfq``Opqr2iaK{lE`>lHN$n#Pa=V6>do+4q~RzSo+D$vPgWiN3@{57~Q3vN$~UnHuv z2@5otk-ft>DblTW*VLXUE{YFYoRYVGimqIJ9dvH@5CeR+a8;?hKV+^${asPGrGLh@ z?@47X`clZ@5eXpMbeNU}#BaZByHTxp_40G>!RLDxJFWs(K{J+wM)SM%9mWQ56UM%7 z?8!o>O#zKu`>fCbHax`BK-yRt5+QvrT-{g_Y+v9~TUe;zPVYhn{N6Qo2Zp-?nsQ}m znZHex8=W?5`A+zy>bPu1W!Kx^=%7@Ch2|%-wJBWG^1b?lz6-C)Awy$uh`7A?#JF;o z*sUqna4ZXjMw@c`XvJjS9GW10E_luI*q%{Go2g7j;PRdDMT*0$v|-*Mp2?02_*+jq zG&-vuJb#PsBwQ4%@yT!gO0kXA8W0hQai#E0-zCetUP(yAuzkxn4XIN*t_n|B$)GNE zoqQyZz|n~X=NhYrgV6e#k!?kc04t1_qKNXO2x;AD)H7cnuF7nqJlOR_#GGr(Qcc8$ zj}lTnzUi|s=g?z0-3`W#_#_rsrNU&YoOQM9wI{R``}BAc`wsGSM~P*1ysLH9y7Xfs zstf%U++5TNCDcHEnDY0`t;SZP{E_!E$yBjDf~3@qS93E3NFRZ*S^?B|aZA8l>GQfH zZv2M=q@4i+6=~0I**5Huo3@$=y8;!MjQi^l2c&Rj_{2k-0$0O3sLGEG^E{a2gK6ex zTD6(MoZhCSgCE?Kh#cNo^39mDq|2D|9vR;|{W+PEf#amK7Xt^jm6y~BDZf1&6%=T4 zB2U*Mud_=~$j?}0Ni(_i0~tj|b_dRit>zxAOP-l{WrPZ%c*FOP9t6O6rFtK|-3tz} zs^}EGzQgXQtIQOH8hszl)`iblkcguX2L#8zZY#z)U1H~?P+qUBkG4X-qs=Lap0Fgu zadvtZzP|UEV%zT%ITaVg#%0@{^!ZIx?QX3Tf_z3_zoJ<6u%K|WLAP}rP-dpa6{}3X zY)GS+EyfO@*;57QDm&_{@P#UU)%8~18D~FodOkz{LI|vOeyLIX<@_BgKkD@14LW|x zL!vP`eb?A??*lm*;#Uy|eb%8pTIz!2sMa5kQi)yAZ26C!*YqYQgG_JQJf7ug53&JL+4k@?Ul6+{15SSbgjxBSlZb|DI6iIGaEVEe6|N_QSMeE|&8`uv z=F)Ub0;>%B^K#;blauFD9OCzHrDgterU*Zo0fl*8La40~YsLO^AST)SF3wA~zkky< z4MhDr;Y`)8l;u*qvwhlZ=%qLJ?p$OC5VGO1hfmz_OCaLwF^E00jG-A^gt5|=y+{K) z!>}4?GuT-+=#PY5#SA4asP%Gqg1cIyU<&_EB=xp4*ouTvnFuOKFsjL8TeF?>Pn-#z z`*6DH5Ui+SyneV7c^nspW`91c3A4?2&ySV)PmU)w_yM%^Q4;n(ohTg-6-(;EJz4HXkJLB6G#*S$rJp4 zc|55OEY<1tCgi8b1}D!B3%IL zGcz7Xm%)Hy)+ByWNI`!uYJG-(olwAZ^7b-MJBENEl=H90TU=mmZDIgWm)lP?yByn|kJ(EJ8EKCH{X34>_yv8jzs*=aH&1h!o30#i*>MQRq2nZ7tIi)JKL zBixtP{RLq6899CYW27X_hA7j-`8U?K079=;pUR#rhO9Ht!ogZIBcqK^oW&82wNNR) zR&Gz>U+7Yz$;$-0+tvee!_Czu&$R4VMWQJonwVg0xECBU{;5aRv9(;g`r~?D8E#9; zLuKEO+fr{O_=f(6KaN3~+%F3Hr}Q=Ey7_YI^*Laxtq1r7yk0GT-Wn6CaV=V~WgeQg ztYy-PP4S$}iQ<=28ShYU-)Uv1w@PlhL-CIcT$ zULBu@HXAYJ7sBmn>CYxj#1RPkM9^633YnVVW+q zy@>~eTq@Nv_4dBqTvK3p$8w;8FE<+b4zu-feLPl8peb)M7~xofI3ge8lHG}+U9bBc zOb1IIgjrpI#+=El2xFOqqcJ)3hqn-#6rE`~nr-yel&(}vEe3S7korrJY!2fax%y+TxjC1bODqPqL?URD&ZPpKU0(jv@Ca|IFRRbr;M2p84-R31Ni5j9vYAKAqHGN4WwqJQ+>nrz@b&k3o z6?5f8P`TP_=MNzk%{3G$$e%MowRT)XOTamrvPn1Ni$qLY{k+WdXYaQd%FQNK%-jGe&Wt{~N_EGdDt+pv;+9)77e8VQPuyAM7^xv}$;Q=As7B$p= zv8{`6|K`t+K6q3-jbz)(@t0~&m!ukeH6~-Nxu|AgExj`oOkCNFXM+KPrI+(3<-WLe zV2Nm-8h+;m^h%GsBpOX+&n!ce6aiKaX=NPCFo7FO{Y6;@;l78IZS2T_qN@27%)u8=MVQnE3S8@LGH(~zH9;?Pq1^hvc(%)5l}oB$u6NsD~U ze$Uwk+{PNGJRU6besvmv|Gz+VI~Ys8^1y~H7S&i;b_ORx^RKOGs%BG*$aWp%$jN7N@Cl*4&t=N*aJ9=(l}@p8^Y98tv|C2u!G~MOm(2%% zfY46$#6R!gFGgy%PXQj2Nk1}!OM!30>Dr#k#P3PSd9&Gk`B6#MQxUk&Q5Q!9;R?Ye zASGWF%m%6E6x1R4w!D_zim;>e(79|hZb_`^Q{X7kl7Sr1dT2K^^@A5!6-im;%4XGd zMLtOvQJmi+))75Mig+9yE7&_4<4H<|L{F-q$qk;t#U|r2evKVNkQAzv3qaX>x$iqS z%764X&Z_OXyq5NrP|oMPOGhw}+q-MT4BKcSy_G#(WF2nd?M+Fbb}o6uBPAV^nzw}p ztrZmqB}u8Lvp+ZZ=U84~u%hhxy@#`jqjk}iwB${FshYLd*mp&auz{UXqjzF?2nK&v z(C5Cc^O8DS#lnB++%c0CsEHE4&yZEjFP2d=f>aoW>>u zEOL81TTGOcs`ZVZHH;eCfBi`6mJs|fVYb&`<2L95FIz-NZ#o&$LV~n>A8y4F>Lh1% zR(|*-vrLRUj(7ONb_qBVnY)a+|GLk>Yt542t=SfkW{3GBIjm(q&Bx`kA3Z4AhXo!| z)<&m+ms5P-hx&ZWKCu*MCbaiRU5ATRQ#9xXnN|+)iJO1CCz1KNl~Us@Z^F;bNV!c| zF08q2`x^qysM^SFJXbz(^TM3{_#Sb#_61th@Etu$oUOGR$)d zT1`nup}T3Ml?fSr--oR^YqBH{dS~rQM73~n#28lQoy={@!QKsNxNK-js^mL+gD#U$hLGI* zHbM5A*8n`{`PMskseUy>xdzkal zr#Fk^#{_Hs_9ztpGye5kXb)b6hidj9uSc{v#^vH3_ucdxn=+wmQ3(DVq)TJs(hw!q z*OR%eK?t?b><1knY{8rqak7y5;iLkB{>;3@%U9W5A{DF$IW5F@kJBB}=u6~va%&Y= zXTK=}byhpazLvrYzeNn2mL?Y~%WEYomB;#vSN8aK_?yIWy0soRIapP0Z~OXK$c46Y zQc1KQ+yjOUnF{Vny3G2j9AFYzvN^M9xa}KVCIxw1WU}_9e{{F7*sSK55}2XB94pT- z?&(Nxfmf4fDEX$oD{RMTpM9eN3k`a3r&BM!69V~-0DcSbltb1zpzpGXyk5o@kQEOW zE|V}DS@A=jNwbQt_vAIiD9V3hK0)y2hfO;56_p@#@$r|FMJSh z8WCSN6fO?1%yiJ^0q(^Ym<`_coR?zb=AgvGMSCUZ*PoF#fG;`Y6JM{6j0uzs80_>D-E)$Z zbQwyr*X02@U&Z%~dLu@80x5^3qt#lutnzD9lVjyU7nF-g?tyn&TK6m7D=5R&)W?sT z^jBfeD}SD6d}@uf#iPfyOf!o!R(|YC0ejoeC!Gg&%%YCNbo{omhfRj!| zV84QUJv{l5(dp<@#l{RXP{T71BUiK$kkVzQPa>1FkDNO`#sz2sXLU?WQ=xwlniF{Q`5`67!bpnR&B;~VXgdTn^KqS0?=Y)$J2dJ zbCcTi!KTgn_&Iva=dc0r^>!QXp9igNar149xhV2_JF72l^rC|?XyX~s@i~1q({`bx zveO}Z$AIMT=qxp*0v#|RS74#a6?cQm{Q>jxo%KuVqpgkh1RAqqpm(2suii1Wz;Ar( z_&ce_ufP^;{4=)c;1&V~*a@(D=OL$;2OcAng}Pxfsta&c9|BdUA#LSB?6d}mbV=Yc z@pOI^)p|LR;o%F^3vA|Q2Tu68Sw$2VW1I7N+7l(M=)_s|cWJb~fHiB6{e7P0rU zG}-NkLVNYyX|qtP5U!pJsV$h1`!Uo7A)HyAwE>gOJFWHx2lf50WhqOnJBU={nje3J z?X(biZfZ|=$bIP`_U2@3AWR1DLGty5prYZLoOP_>Be|REz{$ktA>sBM;)4f`Wutiy z!cpPh6)@~uVtJ*9e=O4?f&7J$8{lDvo^x5hl5t^TO}YK;A4SEC8Gln#GHoGGQ<;;% zgMij)C@F86pUiwEHfjjw=GW;9o&M-N`o+FwBrU6Aq>!WdFyepjfzs*)mWl8_;t18SUoO^Ml{f5_3?KI%4@jJyhvd6(wlV#ozo z-=+{#p&DK6g@`mtp86UD&n4_Wn*9S0DX!4k)bFf)e$4Cy6~w0YLQm-1FyAR}Rpv?F z*H>yYDTG(WNF2+Ov~|ZCs}cA#$t{N3XOwZbbR-<5&ahi#L!@vFF(Gx9Da28&Hyu^# z(N+ba2bc{5p&|b(hblK+oMDLM`P#Cd?UM^x=t#4@=*JH%u;LIkz2xcDt;mw@QAa^;s7bc(cF77HXd?`SQnmyu=+a zNT&kzp{p8f@b1vvdLzOzu}VFY+qcDG=P1Qt=aCyPTTCMBbzqj}GBI;$iLARWILu;o zEu-O7#{0H))iz_bpjcD|s69k&3+58pgB+n9N~Ec+(nn|5HCt7{$D(<_Obx{0zbR>O$9+NQEUqdEBbj}_W95Avj6pC z*hHb|HDl+BvauplM~Z4+U9t2b`Iwg#C4U)mr4Lyyoi1&-dH=C9D+lF@us%>{)9!qT zQ(D#CcFFc|%u%k!2y>R zlceR9Y?530tVnw&cGueXRvN7l1^Lq93JiVe10zCc85!}?=$&#w{O2_|!q3~`eC8>z zt%M22wV)@}<24BSAAfLC8N(YG13O-*sIYbL8@DJz5-xuOPV!opMB4ocGb$sa%Gopm zDv<(Fz_vu8>ua>Y;AGlKUrYooMa;9?GEvZH?Pqu7mx+j+w;RjsF5PX-G(B(e@@&_y zfad;B{A@D1L;w$LirzK|6;SY-*(xB6nRFKxE#L^10{5|s6@UVeo^1!hj(I?l5kYCW zrt+IbPJ~GlO?^4#75?e0ZFG+>!7kknt5W?*zTJ>;U;AA4LKEmP-v`P3N$1jc)VDn= zv)>^^T*c16=ivS&u0~0Js)q&DH=Tf5SPHU!i#S zyCxLpcF?!)^LVykQ`I+Z_C4uj|1&TTObu}%X^V!u9{;!ulkeD$tUBrx7A~=&G^dcp zDjj^kjoUWr)3V=_)l;~ma4$a2ZDOF7e^Z3$@U1#u8l=gajYHU!NJv4mL zIm$RrVuwLcpQ18;Xz$KLqYg~#xJr@XQl=ip1j8dgnPp?tEb{Cqf)!3OyE} z#}=K*h|O7i#3CgE>bm(z`J{QvW6XwmF|B9&E(-2F*)I&wh@vZ@qexaafde>)l0vRb zRCV?V)|oLnGp|s}MbmPj;mGjdxw!XE?EA77*|%*T26x@z87Lc!Jz2x(nXw z)y;VOWz5FWw$Yp91GMs$qV@7wuqtd zId5xfaN3~UBX>xVlH#YwJ$0>RJmZ#J| zJKPe>Wui~DH*izfXYaUQyiE{|ZPZH+tn@K$4(SJTXi0GXw1=6$nw)lxl(jQAvRW5E zW3Rc+{5b~Pg=NO(5M>)*JZO{G!x~%223Z%*TLtUlmnErLDCUqE&kA|v_0ipJ$Z2gr z^4t376EVMoC%Rz)gU|$%g>!KpkC2Ps4EE|T^6x3(UYF(bpG;yd;RUzAFP#nVdLzHE zM?vrEcl9oym#WlV#{~91l~Fb1fOus#kcp;7GM3pirZV4?YpKRs(ZH7nCpRcJCRZ;Q zLwyAcfK81pZWIop$>dz&lM7L!)P>$wMN-;EK{J<|`GA$^f|X@XNCF2836`obAJ!Jt zf_ahLc>XPyg|#S9pT7-Wn_{E*Mum6$zVGk>&}r_n0&hekWvF(cV1B!5zWgEM+gGvn zw-*jW@@tIYSWf93hTYX94j_tfxX7BJ0(V73u4@3ca)?Zea@x_f}sd=B=oDDAzc{Y0E+Rt$CFT2OIa)j*JO2wCjNheK+YhM8IwW z;^UCk_sRE;|75jZuHSw_e;v+sP}@SlAHRP$Dd;gUp+qT~h{%1Kpx*{veUNXx!eri6 zzptzeN!O*g&)Rslt45y)DZza^deXU6&4O|L+>{0-1iwy8wEHg^UE^eo6D z)2i6622a$J+4zZ-Y60?kdOv9V+^=SgN8|Xl0UV)NPiljM0%eG@fC2(<@`YUp&K3D% zs;we9PzG@LuhhkqGmg(4$|O?ppiZ7CLdz$;_S(l*NuVWNk_-aH6T$3yojOWjjy6Y%%0RUF?ACI{ zk145K6{QI5QG>9?1*B}ZRvI4r@SGCs7K6~$2#2(~^yROn=V)~(C+9XntSupHj%~#= z+CbzpQPK)~P70C7*_gG(8S+vOOnorDi)Et!l3ucvqS`&I07YMl1=CQ(; zVCb+{AMkHQwgtx27+*zGMEFAPu68PTdIyS&hUiihWN-9-XYj53U0V%e)2`<3AO*7i z60OBDg`%(DfpmD)lY&_GjI6hC7Hf;=v6Tog;%yWMfi$+OV diff --git a/dev/assets/favicon-16.png b/dev/assets/favicon-16.png deleted file mode 100644 index ce07441798ef7dd330f6567880dd3c076f5047e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 892 zcmV-?1B3jDP)EX>4Tx04R}tkv&MmKpe$iQ>CJn4i*$~$k2*|1yK=4twIqhlv<%x2a`)bgeDD1 zii@M*T5#}VvFhOBtgC~oAP9bdxVbqgx=4xtOA0MwJUH&hyL*qjcYshYGu7-E160j2 z(uug3&8>)mSM(r+evBY0F;kySrIPR*U-$6w^)AMD%0G~)a!*s(UUMHT~ zv~yF6ykH@QG+f>{K$3L zby?xO#aS&^S@WL!g~7bGyu@{yLr7o&i%3C)j4C!zhJ_fd8Yw2yv>*5I4?6x7xny!} zfRSS!6{wILKlmT~?$#_!jJrv}IMDfG+aFONunRP5w*7r<+l>>z{|sDdEq|pBOn;JI zYiW@qAhZo!T(>lN54hX`2A*`ukQ~WRQz#UG_cQvY9ME?Qbg#O-HTQA)0A#4Em|Lfdix00DSOL_t(I%axNcPr^_Xg+Gdm zBTnFs!A%mIK*E9~?l5;#(2XX9fnUHtNN}{spt#cRCcq#B6BBiCsJh$6K}M!FF1%U_ z5Ng zKqh<2#QYZ2Hc)nLW9A9Wlkb3xU^$jfrCJA|*{BhY75o>EfMeG-W>iZ(dhKlVk|8OYe@i7Id*fke z$+BbVgkuHo>yKx$Crr%gy95j#%;`dXe?gpuV+AJW6rjHaXu!E3RjPH5C>m*va9cFe zW$<@y0L`_HGx3Nja38d*DzevD0gUE3OT*L>PSy;Q2B-_ewBb1S=l%ce=l=jM{-D>3 S^f7|~0000EX>4Tx04R}tkv&MmKpe$iQ>CJn4i*$~$k2*|1yK=4twIqhlv<%x2a`)bgeDD1 zii@M*T5#}VvFhOBtgC~oAP9bdxVbqgx=4xtOA0MwJUH&hyL*qjcYshYGu7-E160j2 z(uug3&8>)mSM(r+evBY0F;kySrIPR*U-$6w^)AMD%0G~)a!*s(UUMHT~ zv~yF6ykH@QG+f>{K$3L zby?xO#aS&^S@WL!g~7bGyu@{yLr7o&i%3C)j4C!zhJ_fd8Yw2yv>*5I4?6x7xny!} zfRSS!6{wILKlmT~?$#_!jJrv}IMDfG+aFONunRP5w*7r<+l>>z{|sDdEq|pBOn;JI zYiW@qAhZo!T(>lN54hX`2A*`ukQ~WRQz#UG_cQvY9ME?Qbg#O-HTQA)0A#4EIx7-P#Ij zwUPK}Qi0O?NYOyV(8R^nRmwtRl|B8yWxLDnT~M2JzUT0e%5407VXq`Eh&pm3*U}kPQ=i18abpKwt|L+Qpyq=FLcw#2D4c z1N$@Am5o3F@QI_g=r-bsE`^_u6L*$^BGZ99?Zh2i@q#Z_Fnm}XhHhc>jSS=P$*Zn# z2OtJmDg{M$m4c!!3wy=Wb}Jw&Y9#O@FvZ)PkC%)fVew3?)`!>|8t5M#g`=UCOJ#Sx z?LP#VDg{NI6ZQ&Qn^zz!>OkNu5bjO6VSU3md2Bmff&%#T zfu2zx0OK4MbGaLzmy_#~17w<#2nh-1$k9{e6qJ*5tehhS-xCrNOxBK7zC0=nIID4Z zDj+LrXTa=>JaKj`5fMEpDZ9qPl!MOkg(>-zlwPA(uO1}MiSwmIIAE3)HPHPEqyS{Y zgdM=@w!%gTkfi6wTFDMaZBa7fNwWoH!-U?zO1;_XDHCbBcY>ySCvaGrf74SYI`M59 z-hwsVJ3*#V^`*f3T6i~GKvvX!z#^}w0vz{Fcn{TAr$HOI4}xMEyK;!xB0(+ zH>YK>IW5Z_YYW$xnX;k=%UXI3^l&&Y&Xl^lnAF|Hx;yIOI*u6#Op<|k_c#xw^z;_e zQj-vZmlh!)Ej5XYH!N?~HEZ_)_8<60 z*W+DrNrH-sN@51|;oE}ktXn$Lb?RVAR@D2UUHrpyKU>E5aU*GRG;y@x6bq6MIvpr^ z(NMN+O{Tuy&VqyuoV-}=c0z}x*$MqLr}XM^+vhTC#$^2b{5X5=B8ykE| zY55OZ{rgA1hNad@+SVLCFDUoe;K0rWygPdecdBcMpY#zmwkOY}0Kn4eF&Nh^LotMN z{l+a~#;$!PxA%3PzdDc7vg`Eh(Vg5qN&HtL1CPe28z?+|f$*?b*lAiru4$gv2zoEk zgvDZI)W|o<-t^9M5$)eTmtCf{golMvbf%cGsu943tf*zOq6%42#rloAgw6I?2q8pC z={3=4WQ-iG6v;o!?hWeiK3nVY59J#!VT{ zaamEzBw11S0tv2Rm}y!?L_|-5Bjz?|x>k4Gq-8!?nWl@^+Z&zh>nii9s;VX_IfKhL z+@9;b{#p&^RN%_Zhr~`Wk~k+8N#dn*fh58DjTvMgD)j~z`vXN<4d<2(y)D?dVw6uZ zJzR&p5h!f?F>(nr&+5tj3S8yS`Ubj2&hzy=H$O%#FD~#@&x9FSxgO(ta`K&-ZpW^# zJn((F$9$1L)i_%Ul8(rRNhaXK|D_;7{0(3PZunZ2I6IcQ%6xwMZllMG{c~X|b(Q&T zm1Jlf#+F{enF$>h^IyO;z^b=0`*10hm3Md}ZU8xHGo0gxG8Yp&D4MFOYO)WN_#(Fg z(=;y6zChS3Y*J9vc}vg719>L&2(Ny2M!T7g&vvT=->gwuQkg$asYojmn z@eYgmrq9Mi*efhjP?Q-M4RmXb*H|0zfA)yC)2Gjk)KHVhL?cB5002`_K}HJzAmB>~fPw@bjNOWDz&ByMK)xNmPdTlyPysYjG<=bd6TOOOFAJpy*@d;qL0$ohDHtiV45qIC_;_)6X_w4ZqX0@(98u;0R^`OwP^_=X!Ol~ zo;$ZvL8IC8pZVO!#zu04!l9N61pB(cm$F~1#Y!POdU6?j5>bGQ1r*=f#R5SMV1H)U zWZt2&K;>Q(e-B0RZ2)F{#3^6^y6U-bhaW#y@I-@&0#83*+ z*J-&CkqkR7JrM~NbmTNiRG6hDlzFPO0AtLh23xq-<`M`fK2iwlg+yD7`O!=8y6?_^ zY$8FER|T40eP^_;!RjatPGqGnzKIuTC`my4Btm__DB*-6(*UGyTen%PAwkd8jfERa zQA$Q5N|ETK;JXy0ff<_xBTPsIU$91(i>&fAjW^*{zVIF*Z+ zCjw9E21_3&=3aXVS)?f*z-qyW+oWAb>hN~C{w|3qj1zi^qya^jDYAl_QzkJfk6iI2 z2mbv);+f#@A32>bT##Q>X4@)X2M-OWB#LHg#cncN!@1Twey|nt22jDxv1=R}wk(`y zsVg}F7gZz2TCsLvJk+~b9bMXAOqRMyX4Tl`z6O7wdN8rjBDJd_4`CY5SADNt-C1R# z@l)2jQ6xrP%L(wvyLrNlgrXwYI@`Iu`K}{K@)G^h-e>#o^@~bTiOsQ9S`j0AU;HmL z1UP@*7hE4~E{4PxY|!4|s7|xi+nM5t9FK;Y!$DrFPTH!GEy9a7zZ^V2j&2h9$V0t# z!12Z(mI~11;))z|PK}Ag!Wx#5Xc5HHZ_%i!REk*Z_f3dTDBMz3tlsM{k}(C_NWz9z zkx?bhZ07?=rKFrc-L0G1;YE&3sIBM$0r%bC zO|b5Xyt?|`Gpwsu%z6u$AN|I^ga}3fCrovd**aKn)k9NG+ z+z-=+^SiS@5g9R$X&Wh>$2YujNy6;~s4|DY%*KAa_|&Q=J*U$UoZ?q`OC%AQa_0Vx z#EKT02$YSK*l#N}Z=NNFRn;f=GqLbQtBdcZs%Q6)3{eovI9xBLJlzR0IiO=xW6dP)C$FQo z{9KoS3_{iEscA3buP+k-!jal^jxRT6+t=`t5l(NdF70$XU{&GXH}t=ZW%ZM|7vkr1 zYRnkea(nkhY@X*Q9@1YQ1@bcw7`oq-UDHGf3au@iGPrngeEYrA)5Dl=c&-@{rO16A z*N0WF9H6*ucnDs%pDvvUvTC?zO!&nZ5QE>qidBcO#F> zyK2ODxXn?lX?BuTvTglrq03s&jlxVHz}P=;0%2 zw#(-)mSU{qb8~x22!+&hO^pV@b6OOrWp} zK}aY!7(yCWnXbe{P`MG%+*iM)n9VMr7H{cDc~BIMuXaLt#Gya3g#7+=QM@cWjQz#X zyBx-9<``+GGi3IA>`l;g2@VSMQ&s#`m}BH>;vI7)8DO$WzE+`SKn|H8K(l(704|QF zwLEU;1QczT1MZBR?fal~H0Hb0wWtRUz2&S*gkF+{zKl{_pV*vKP}XFNt^IVXHpJ*x zRX5%NO645cM)Ex5Q^SDyQ`_Q0Z6pgKPrRN61v9YYzXJOa?D{LoUUIjPQ67t zrN~VP?pH5h=q0pW89)}f`b0~^qf;U+FR37JVak&TTM`||lxRy`4T6I*Xt>Pr)*6Pb z3aEX0M}j@+S+?wtvC6gh`Pj|tNL1bxn@Rh-mfVzkc{#gAy$zznoGV^%-rNH@f&`hx z4q_T!U=$g&g|*$jgB@oiv}@2=D&8yQ=E>dTP=IQl)YX+EE(cAzU$=JMut!tdCs~b~ zwvxhD>7a#085MgSY0Yxz_(+_j!vn?^)V;8x|I-_VnXn!h8W@qg&-r<>k$SVMOIi*U z=UkG^r5rW?N+h5|I$aXM_u`0p!zbofcn#{0%OQ)B^&l7clP7^^ZU8++>xaBrm!&GRWJovV7J|HW5L(1t@j8fnr?kmhzx zE&x0`MP!;%;grFR>(UE-m7jQW&)~KXaX4)Bf23hexsDhYM@waI5v8C4Q2D(|!!JnCk2f1`Z z6Y56#+{v_#NqQ`YxQ&4LxL2&58wl{Kg;0ns zcjx?GVNtdZA&bkSR@xfa;mc4>Hsf-45Sa-x1oytGcn~6Rb?dmZ?v`b1r{=z(Y|^fb z6t=LypLDOf(Xa@`DKiqraN>;fhXc$cFyWe2J3LzV3s&lZsZm!X2-1mpI@8zwrEN+5 zpSQ&;i%%Cm7-i+`6IE)mlRJaBlEPsfNxl`fod#OWK6B`z9HC{;{>wD)&1VIo`ChcOJLae>l>JT$oS>#Bzcz4`{jML2bOK z1(fUz{_%sAfc8;fYf4H58<(K)Tok9@;|GMkQGI8R08)`hJ;mW0DMZKH9`DRb?TRN+ zk4K#49Ei6Ery8O!1)Ad2XT1Z5a@X|y)aV8awU@W7CC?}=1U%D zRgI{$zc$S|PlvH@hCZRKN@6gYn%kX-i9Qr+`tc)?oHI~tzkUjop7U(FSS=&nXw=Wr z#rmOZOsyu{;UeV$R6JPnAATX0*Rj4m4zP`31EgwhBH6^l3;57*Qukg6nJ!faywzyD z#|F5w;&HCz7qK?^NO z^#ZZvof|aRMy)pWL93tU2fM&O{GIu=AOdCuXm0kj(CG*oa{{VpgfH*bfcjXfk&Gflmas!iU* z)z`B@D=7906kC;CyjT#VFvwOCcs>=+qM``-p^F5GM{lKgWQ&b=t{^Q7Ps?vMrLO7r zOs+j5Lt{qRm;5f!z|^&|Tf%Mi&YqB;36%!2Fpy^^N(yyi-79QF?J!adzH-)k!M20( za=~RLaq^T{_&xszs+PRuyJk;2==RV1?%u|{$+*c@d9Ksx6T$|U%eJJ#KaMm*MXcPS ztF8;OLU1KZt-cWAVtQ2Ur&5kUlUFKQdz=AfYE52t&{l_D7Clw&Shon8X!!3b@&>V7XXx26V&TS$h7G~ zZgVDC1x8;0tjvE8+dXu}i?s`r8;xQ4`e!EM^B6-(pC47^Zl8G#WBu0*Wi%y=MRkti zZsTY&Rt;2%xpft_%D0WMbXt_Z7&iy7rOI8hTGP+I`CY`$s>AH$_E?mX=Y%QSTGT;I z67Qe0zdZ~TFTpK9ii_#L-sy5$Ry$Ve*2d)DbG`B@L46~8cr>f^4oLzaD|i_x{KchV zuPg2<>ZqNEYHkm$T%vEc4`{f#$H^=Cg`gBsy;yPalxdc0^tCv*@&E~1s^50~f*ec! zS%ZUwp%TLUYZNoaV>5r-MJ1Th<Ia3%WqA2pmPIax>1krDGAoG?Yw$aT3B@s_NGtceaq#8<1a0SxvlGM3SH;?y&wG zBzBq`T(zifRWe+!_1;*hF5)^jnX9-138mxxsSz~)NewvN%-?cR!3nNlo@`67g_o#3 z-~)7xlgQ%~Ey{=Lb{Q7{oD=mR@;DYc?q4QZ5Em?$cM|ZNQds>dUJzTfbhV1xSAaHy zM|jNV5JB=dNe#`?qa;CnOZdR!0crJvQR3nB*H$6J8nl8ZMDlY@LPT+>7n|+a!GV(+a=?6F!8XOrRksn8Jf0>w;?AgN5YjxW-cx;i*S#>bAzqKrma2SC zGLjey#?<3%)8V%Lcxj`eFIpGtL(g#p7ikcU5?kpvyRtv!bpB;-4_lq+ag8|1_me%y zdhr}`i+`q7Ehfw0_F88F?vKQ^$L(QZXutacqq-LhJG;xda|6f=I(i$a16Kt}l;2&3 zq{3X~$1JxF??o>TMQcyrK9y+HF^?VPhL>21@i)HIAwLht2{wOR+}v14EI!cb%2>Rm zgx4rDf*=uZmlzy7sk)w?z!_+nxC#m{TluAS+=iU<_)8#f8bi2s;bC|B?e;*;f+4^j zTk->u!lCN6UsJ!`zhSZn_Q%DI1*|_9`0g#hsbW5`_2A^!9Z)Jgjf3RHOus7Bohe_B z9F`~g8XiO^Rv^e28Pwd=;OoyrI?G>yZJ+W(__zWf_K*4MYUep7x%yXhwLnEtFPY*Y zsn?_d$wdRCPx`$^yM7rwnwgu^uk#a^w%G#%tIxkRQkeH*Hk)lM_A=DJYLWC?_kcOH z*zG$Jh7^w%Qw4-vhpF(2=;m*d#--+J0_6(n5%L_03-59!r$TYHQfpPn{(cTs9&YD z7-d#=cPYJvRPqJ>Bwhyls^bG)^{dWZO&tC7v!0ty2wGZvGC^U)zv?N*OdI1lsMIFT zG~=?HuyWPqENoXlP-O|m@cgS3*6}dXc`S;bDi_@_=I2SvviLM+xHL^Yo)KdAb)=4I zlwGg18dkPTEJ|4o*W!eCRG`{$7w;f$*^GZwZ>7>0&e~UrasygX>br6WKOj}zuOVLS zu?Ei9`A(WGwLX*2Iw>}brln+kI!-^-K6tyJ@wiG%92~7jWi~usux_N-cFzEdYF@LN zVE1o#U}`hMLn+stFv=y?AnCZu;sEe3{+MqX_Tb(NJYy@{T&0@a3LL%;1FQVu!iUB( z{h#VnlrPiaX42-)&WQ;;)@~0~QvKrJ<_9)M>i@85|JHcoJY`2%7@P+kdU}=bF6rixzONaM`9SHr8?t_pZx1&K2P?>ZI1UF?A_4H(eNyld3RiL(%uRC z=0{KE@XvFXnq%UFBSU=yEcUn)UX&~J-v$i5ej}y2Zcg!f9G6i!`@(9~1Msv8?;%{(&Zu}Z)d@POJ@r{u#Sp>Upn zPzkuVZatbVlji7imt)UT@`0!XPxvY)R`bm)4Vw|2{c=;3a1Zek3%q+;0k4VNzRwje z(I{M@Szp&74uZ`|=h)cH#%~BZJz4(O$Azz6^@YZMBM5!OY0uTzu_6J{^0=DSGv(36 z(ikp<)Cnyl)7CXP%g9`LzUPxD{LuQTaF9rosH9P*rve^d1|?Kr`w9B~(VCN%bDo-$O;N8q|@8ZadI;(Qs61@e9?asIizaKL+q8oh?6FQ z`k4fr$(x7FUXWyJJZNL7mZhL|$yfOXnE-En63(UB{)oW-Y@IuaeF0Woa{(v8--L(K zUHhGfyGX6Z? z7jT1ZiJJD$)N=pH95c2YNodA?o9DE6n$%AD_(CfmOB3$h5V8A+Jp{CyqMD*S7!yvn ztE?4Nhq+52Y6?oSvw`RIT$gRnbuYZ|c;E2yx-UgEUz$QgziAun6OnmFK*E@zugh1J z2|W9LWb=98mG2D2$`{Yum2I*8{Iu1VT}1rSDfOGMTXtyFSr)R5GFZ_UulTMp&YjIdyKyv7q=~(C7 z-+gPZEN=Slwns!gr`Ji^@}Mteh+isKu-K^R)*)FIRsQE~gvr$Q%V4Ton`PvZY>Q+- zG=m+Fg=e*f?TyM?K2HwYG|ukNIE!s;z`~M9XWB)*@U(z_^__+~Dp5k4i2fZ%MCuoY z<cOAT z@?vo`srAN$Enbq|4QP-Hen52BJ4n(FFOTK_P@XxE9ZDckLFS6zKInbMZdi!~EubqL zU5%on`IYuzd$_^!v3h+;QGo^rt~HJyF##5jOz7^_1x^N!W7#SF;{<)3 zTjhRmp*AKbeBJXM&h!*7Z8*A<8Afn zQk4Y)=rDY4$9MG(8}|QMr|Nz}mYxwdcxScKg*A7+NY9?NB9E)a#WqXX(bs`9=!|wm zZ$+tZSp37qmx_Erm=L5Ss%Nq@Qa&w*bN*RRXJ=DKG6Uz~#PJp0JICV^hO`X7=x&5R=PnEK zo8QM0bD^BhjPLt##zGR3e;DWNw{4lJnDNyTv7WP- z+~uDFSolZ*eHxrp))bPc4^b>*U^0(;;)8j!NPS5NTR%~OBnQ{eOnOZo)LkKO)R(01 z!%N*6ujP_`QyXSTP(em!9Ry}KQsE+s~Qffi`B44vWBVMZBpLScnM|iWJ#W zOV-XW=2Jr$?W*~ayT_`U)G6qBMN~MJPGq28u4}$OZrPBW@Nv*{N3>OdO4H{|LB)ag zUrtGUGegVAW|VU!6;VLVY9M{ORd}@EwUtx`ck_|P`de|2M@oTUS_+@0p8IY8w#@yctjdKtscz@AW%T4-vYic| z53%KqT@PBQxIart&Og-1>4o=8M3qdt@83@fKev=LySZD|JUXPQ{aSw?afKSTaE1zG zZ!Io>01HG&n|%~Mmif(sFM6IvpNG8&v@IEh7$`)MI8z+B|K*6*L^6i^-8ho!qV8r8 zwUO53Mr^kqB#Sz&nKA)sVYyl@C@RP&hI&#>?$1JdwZoB-obTk_e$!{qi^yN$Y=7GL zvs^?h{P)G+C41)bDtmhtF}~2(hIf1P6f1?3yxK{1~(7fCNC#5BK-aOL#C7ALb{|q(A|4`)=e7H_9Dg{_ty4Kdu{a> zjb?l;SLr(|$H`l_`lv%?03nEE2er(uw2Qoy8x|i{ZVRJ*>pwqgvcm{8;*q*?uJ~lO z^*o~#$Nu`8v&g)OT58-sR~*|5H`(tSZtFrr9YsyKzh77O{fmx2m)wp4p!j^_qLBl` z?tRYcU;238$_iDN^$Gt*-XhYNm=On$<93OfaJ?fdN3C|=S;No8U>PNKJ>FaObZC9q zG9^}S9s>Xb$^WzfATnyS6*2sfTevFG7%GYc@B=s>mo0ofm_{+7-d7tY4tK6Ehtd;| zSzW-&R4~XztnD!{xol9jb%?O{#j^PA+8R^QH_PoN_$23hh(ymhu|JOo%av0GyKlTf zQ)sjS%h!-r%uiR2$Y9}1m1RWsAuHuUc02dtXodhJfl@?KoxpQ0D60wHafR)hq#jEKVyhe(BNxAC`={(xIXW|#1{ zh${0Gc~O^c++P)V_`|L<@3pDs2QQA$<$b37{G!)-p6}R~K3Nu3u=(DafYmydQ+5*5 z_W1JC$mb<8>H9jqD4`4Wq@>>`y%W~|)=CJAI25BLAN%PQfHDbPub@HpnQhDZ7U?EW zkrb7hD*KeK7dr3k8$m+)&~g^1Nv|FrnB$I|AW6-E68B2MEo)^ zmFBTb$fghcd@`?FrtFJ23aVlWu}FX@*gR6Hpn~iE8czzu{_G_oEmA}>b5_b$2CL{A&%teyWFgif&sLXQ}{PQtyl<^)Uw@zqJ7$9SAjjn<=KOV%x=JEzw$N(TF zk;2%6JnpYF%F6fQV}2kw4-Fx2dt=i@g|wWSnt2rosDv*d?%>*V7c6XfU=lnn3U?O6 z1OT|cdI)(Osx)HVV@S~R1QjCTJOnDgvF4(Z>`|`s0p#tV>7A~?2X`SiK}JRDoWtie zRaksqMIlBz3W8_@`+5K1n!yCxS%X$F^EOBnl6^$67rV*?O`+;>qPTbT3}9?GDxAlG z;pAAnKVeCJD@R=HE_hs876Wd^)d#$2FBgzOjs(E{enO+p98T%xL9Iskgz0l@zVb?s z$FHEXDtkD!n+I_q4Ljg|yd45ib2m|QDWiepo<71yj?sPR^S~C;pZiF32ZArS!Yy04 z*KjO?D~Fu{pjd*4MJ-Qd-cewi97E;fz7C-!`uX|2KM9~}bwY!~%xVyz;*dXBC(0>i z;6}kkyQxz5JXwjKQur+Japnd|4%N9G9o4O^`SoAZ9t5^*~t{q>7awcv^|uG>** z6kjmA#-O00_U6~(a~jSzA32ISEk?MYwiCpJM4y^K?k`>iimmC3Y1Z_QAZ@joaT5$J z&hX9x`)MLqp|t#}UIGn=hiKG!0irJ}jBsU_(L?aM$+|Pzi9kpFJB0PR2TeOiNk`0GLyLs{;INYdsuRR#b zSHVe%=Sx_<<#rLg3x`O4$yh7U+DmBpXc^3nCc#LBg(Y8U#lw-!T#NUYNsy7fds>8~wF-ipIvRXCnnKRDqA`IQbvOXJtq2O!y5VDumM;Oq?a5>Nh}}GU0I& z%AF@In!eGWMipN<#yTVtuf8ittD*UHu%ypZfSk=M(hnKT$|ra~moDLpYBhvC!0YC``dA%D+m5OQ&A;$xYLlAC3GXf<F?KKsw)8^$&yXlfy-cgTPV)U1_C#`Zv{{lH%u7*b^lSN zW4TBddo#IR z6#GcvS?Wis8uaPPK71UGG?Ft2)u3t#8e$}Dl`&YhtTF&~)H60*L;y&5fzW;LCg#FEWI+qkAn$CyEu zM>Zm#=b;!2qo6PU6e#W=`Ta3B+FEHsHe$iuz!Y2iZ>?9!dVFN|3y8uSv6&8-J+@}6 z5{Y*j2WzSSWvR8xbtn2#%~L0YopDb9UQ z`?|*~*;k3zKR~`hLR$qc7hHjJ)_q!Sp)vIjF>dH5FBH9Aj#Lc2g`)wM6j9=H<+?jp z1%9c>J=Uizul6@zIZGk1CwcKx^;;=eGDrg54+VkrhkhrK^rT=Ql z=BlLoPy8i3x3-3Q8&L6O>iflxLC6gaDX%MkTu#%N4%Gx+!gviY@-??A2m)X$t*VDD zxp2EyCytRH8$X=$vGx+Fjs< zQvb$ZM-h>#J=;~``HK@ZlGbH!1@)8SJH3?QegrO}Ry8$$CT@^S`rX~5+Rxo zD!adP#aCh%YBd)E^k(sS_pfQi;O@QR0-uix?2 z9i!?L?!mu6lw5?ixQ3XWvHugJI^VKbvCp<+2_ezKvBm9R5Jva2JHzJGQh zJenva`cRq6{C+iPZ^^Od;FW64c@j&v#0Q?*Qh~P!g_(wns`JM=8UoL!fQ__ycnJ6( zHo;;)KYc&FQe3J#4nHxwT=pL?ce_hV@Sz63{jaKuBuEUM9$1&1c~E6=$=v#*s|Y9# zzxx%{t<@#1^MP=jJC6e}f{iqRfPSg%8YA~s0Pk|<%7qOBy0!%K`=`7dO7lpb${BAr zh>4yh@Op_akBT`VhxmvQno(AiJlHN2mePzn^0n*35U5v|P366(6pIYC$CaPD;9x5C z4_R0#ezS}pyQiHp6{piq(Uqj*mwL6)&dBYEPGfg%{pL9G*0_~prW}~I4Fpb7wF*O9n<_N&drw2C}$P7tCaqG8GR++n!y#?3Fc>NVbbn#YuVlCr>5 zQst&4LS(#9ppOYCh+S!&F1zSG!0=GIG5Mom&PH4!2i5u`#s*^~#*I$G^98}ro5VDB z-kY-dR_;-^o}^<28U}y(AD2e(gI(z{FeD={9pABPJ6^(R6LzF6g?9U&U38` zo~jX1mGFIXaNLVkFSYPvw%)Up#e`D+1sLrL*!R9PpJg5stx?b-q>%=GoY!5z8e+xE zD-*iXvI|a(H$OrZMR8Hm_$nHWv4Xy&DMNtIAh*T7KEw-W{zqmYGABLttJqIJ!REl39t^vc{+hLjs`p6 zJkVR&sB~tAC@N{gr&?f2>=ihqxe0_4o-C;`dm?KL8aFY5cWCG752eJI>qnSLls#Sv zz6g&RRe>49Cnztp3a~T0*045WNx{`6fi??yD1+lR9^v?k3~5#&`O6`L927rw;tf*| zf*Ug`HfgTGiTEHUQTo}}6tptW&rr&GRBmZ9!WMiag>J_(4bI^DNtt6|Mw!D3$&3lq z4$L=4(J2UYHYpREoRBtx{3)@8;x&ni2Y>X0dQpqL)_Zo?5ZBb(dw_b|EZ-EP2fXGj zI8t*2s~DU^z6@9y+MA(wqHTy1gp~jLo`5e_DnVU1Xej43lYUpH^`Zj6+2$`8E3Atc z5C!zVDE*A~6Wm;g>}A$I=}rv7Oa7%%u$}Qb3`c;r8gL-Ys6v_ab2?KT!h{~Nfcg;D z#e6bLD`MzS;l$Pl4!gWJ``AIGU^5#Ji@e!_wZMg{L-^ymo(yvTiQ*t8)cpT#pFj|W z*bF1)zu|=(z+x(9Ks$`3--7z>!4NmxXt(t|2A+ZzIPDvF+Cn(T>c3BQS#`p%XUVv2P|w52cVwQD&|Z&iuEp zBt?3?4$BTba{B*-BZJuXCmBixsBwaN2RgPNjMl}NpGtvJ z>Yc*;)W}PE_znu_5@0TXD8<>q_{d91IkFWpf(bC0zSQY%)$mD`DCN!LE!Ox1O|yte z{j~1PC5I=K!~IbdVjhp`qO3fiD$^$pNWJtwXn?Hk`u8RnD>2wA!}r8O)PO9>2tNEZ z8B})*2^!#4P@0Rx*p4DP(CGA$1*nGDLbj0l6zC*cIuyviM!?V6bNAp@=}Rf3e40Sf iUy#pG4#t3;1+6@BE7#EX>4Tx04R}tkv&MmKpe$iQ>CJn4i*$~$k2*|1yK=4twIqhlv<%x2a`)bgeDD1 zii@M*T5#}VvFhOBtgC~oAP9bdxVbqgx=4xtOA0MwJUH&hyL*qjcYshYGu7-E160j2 z(uug3&8>)mSM(r+evBY0F;kySrIPR*U-$6w^)AMD%0G~)a!*s(UUMHT~ zv~yF6ykH@QG+f>{K$3L zby?xO#aS&^S@WL!g~7bGyu@{yLr7o&i%3C)j4C!zhJ_fd8Yw2yv>*5I4?6x7xny!} zfRSS!6{wILKlmT~?$#_!jJrv}IMDfG+aFONunRP5w*7r<+l>>z{|sDdEq|pBOn;JI zYiW@qAhZo!T(>lN54hX`2A*`ukQ~WRQz#UG_cQvY9ME?Qbg#O-HTQA)0A#4E{fn^4<`4}26!@kyme;@8?m`t{}yLac_?!BE~a+7vv=IqRzozFdU7H~Km z4u`|xa5x+ehr{7;I2;a#!{Kl^Qiw{2Op+W0pa?((fHDBH089f=0AM_T(Gs->z~2D6 z09*jj2A~DNPXNv-rTUyg5?8`#01E*u2k;1hsQ|JP6xR=+1Hjh+_5nDelm2?kQ_5olu=0XBopU9l8X(Q8%b_5u2o6gL}?~j zlA@6mOWO=44V;;#XAuH&ptWO4H7LaV$!rMs}XyG}M zCJcX(d^i(ZMp$KB)z=LqN0I#8Bir+vZ6(n!QiGP!1r7^|cWg#EUX*>IpN~p6?34J8XG`aaC zTYaQ!C7G|KD-&5^*^$h3ib|qFY5;s@=^kwWTIKI4vg7NA7THvU>=4`7yCQ(6lv0gp zqY&AGI0fLI44uJW0#K@yx?)>!R+2KjDT9>(Dci=hXdxtLOIMMTpok6tO#pg_h<7i5 zr5+DeKY*_QbozK0D*|+XCbs~TDWy(FeK6k>V!-SoIXS?+Hhai;GeG)Wl4nEYw;}4v zn4Z8ky3V11_p9`fQ5jIip%D4)AvrzDW5~J?UDZH$6NEmW*KFQXCr8R0J%z{~Q?2C| zcR=>1^xuL2=@)pUKVbPGT&?e~g(cf!#;O2Jwp`c(S$F8<21uXlk-pP%9`Ba2e;Ktd zYgr1riewWsZ%;(3%aYyIB>`5t4FKlK3Os6@k-XJQUj48{-(ikI3n}vG8oam$;28k5 zN~soYJ0wb+mb|S2@HBv{KGIB;I*5!yDt*X02B1PIwM!}G_sP34Tv|~|Q7N@s7LUh# z)MI6o6cTT>+Y8`r01K5;ZCW>%FRN{xyNv%|1#sQCwvuEu$!d9mgEE8U3XxIck@qS3 zF0oST3}P0PTZh;^D2>vBaDN=@ki{PHA0&Bt5CevJM%+~aUoMqvX{!@l@U?m^FvW1< z{2*!eMM)ve9&h;elAL4?{v=--;^oqBhKY|N`Cf_@GVqe?Wpl6=6Qf3thom`53b|;Q zcRpttv5}l43q4<3D2AO?F3BHKtPuSjeSuMyERxR}W~-f1QpmrOsZ+YGtrot>unzIV z8-|Q2J`J#KD}*FFNLG22>j9EK4?KubQb@04YQ1qio8%_3nM%YU?omVDVjr@Sp%BV_ z-_l#I++)3j_u8n-EJT-V06R$*YBQd10K5)Ipe}2UNBF`7x~u_?k<2wF28|KvvP!fw zDUs^3%t8J6kb}C(`-U0N_(7)4ZctCcwAZhpTq((a+_X3N!qBU!SNOE8(z&kNXNjCw zhGAiNA(;z9TZ4LQoK3gGB)94>ag%C{m)E#$b5mpTstI6-nvIvg33Et}NC{I6}YFL1Ywi4!2D<G zV*vFs9?XiME@n&Kb^_Q1V4ROM?Eub4Mj_%Mp~-J_0IL8r!;Y=3ZHgstweW99*ksE~ zgw2)uzG1w#ZL*SF_PE;GJ3bgSf=#_DJ7lS$UTMd>c81D5ZKx)&qFW zqRhubrvEO^G}RWnl~O&!)ij6V1H_DwQ-$(*Em`zPnGs2aD5cH<2y>97gyh%&@#lD4 zs|ql+9Sfi&M1C8k%t?L1!p`5r9!F@C75GrImN5Vx1CVE2?~@hvP@8?D0L%|D)4PS( zp`F%9D@2sC4ZsV?Y_=<f5t~KJ?aIMj) z8(gHjQsySX`OILRem*iCKjQ^6)N)6+Tzc^~;PlwM{ z)FAe`ifIV{xr!zL`w`*KRix7gT?!F1KP{D=+d{-#Z;ZojcN^V^oh$D`%uY)Gpv(Dm z_@Il!;cz${4u`|xa5x+ehr{7;I2;a#!;w<{2e^p{kYDL^3jhEB07*qoM6N<$f?;KX AuK)l5 diff --git a/dev/index.html b/dev/index.html deleted file mode 100644 index 839141d..0000000 --- a/dev/index.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - SmartC - C Compiler for Signum - %version% - - - - - - - - - - - - -
SmartC - C Compiler for Signum - %version%
-
❐ Source code: -
- -

-            Cursor: 0:0
-        
-
- -
❐ Actions: -
- - -
- - - - - - - -
-
- -
❐ Status: -
-

-        
-
- -
❐ Assembly output: -
-

-

-        
-
- -
❐ Localhost node deployment form for smart contract: -
-
-
Deployment:
-    -
-
-
-
-
- -
Contract Name:
-
Description:
-
Bytecode:
-
Bytedata:
-
Data Pages:
-
Code Stack Pages:
-
User Stack Pages:
-
Min. Activation Amount NQT:
-
Secret Phrase:
-
Fee (NQT):
-
Tx Deadline (minutes):
-
Broadcast Tx?
-
-
-
-
Response:
- -
-
- - diff --git a/dev/src/__tests__/testcases.spec.ts b/dev/src/__tests__/testcases.spec.ts deleted file mode 100644 index c2de3db..0000000 --- a/dev/src/__tests__/testcases.spec.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { runTestCases } from '../testcases' - -describe('browser testcases', () => { - it('jest testcases', () => { - expect(runTestCases(true)).toBe('Test tescases ok!') - }) - it('all testcases', () => { - expect(runTestCases(false).split('\n')[0]).toMatch(/^.*(; 0 Failed\.)$/) - }) -}) diff --git a/dev/src/index.js b/dev/src/index.js deleted file mode 100644 index 2f4b5be..0000000 --- a/dev/src/index.js +++ /dev/null @@ -1,417 +0,0 @@ -import { SmartC } from './SmartC/smartc.js' -import sah from 'smartc-assembly-highlight' -import { runTestCases } from './testcases.js' - -/* Following global functions are define on the files: -WinBox -> 3rd-party/winbox.bundle.js -hljs -> 3rd-party/highlight.min.js -*/ - -/* global hljs WinBox */ - -window.onload = () => { - const scode = document.getElementById('source-code') - scode.addEventListener('keyup', textKeyUp) - scode.addEventListener('keydown', textKeyUp) - scode.addEventListener('click', textKeyUp) - scode.addEventListener('mousedown', SetSourceCode) - scode.addEventListener('mouseup', textKeyUp) - scode.addEventListener('paste', textKeyUp) - - document.getElementById('compile').addEventListener('click', compileCode) - document.getElementById('test').addEventListener('click', testCode) - document.getElementById('btn_help').addEventListener('click', detachHelp) - document.getElementById('source_is_c').addEventListener('click', toggleLang) - document.getElementById('save').addEventListener('click', SaveSource) - document.getElementById('load').addEventListener('click', LoadSource) - - document.getElementById('copy_assembly').addEventListener('click', () => navigator.clipboard.writeText(document.getElementById('assembly_output').innerText)) - - document.getElementById('source_legend').addEventListener('click', detachSource) - document.getElementById('actions_legend').addEventListener('click', detachActions) - document.getElementById('status_legend').addEventListener('click', detachStatus) - document.getElementById('assembly_legend').addEventListener('click', detachAssembly) - document.getElementById('deployment_legend').addEventListener('click', detachDeployment) - - const radios = document.querySelectorAll('input[name="deploy"]') - radios.forEach(Dom => { - Dom.addEventListener('click', deployClick) - }) - - textKeyUp() - toggleLang(document.getElementById('source_is_c')) - - detachDeployment().minimize(true) - - const startUpTest = new SmartC({ - language: 'C', - sourceCode: '#pragma version dev\n#pragma maxAuxVars 1\nlong a, b, c; a=b/~c;' - }) - - try { - startUpTest.compile() - if (startUpTest.getMachineCode().MachineCodeHashId === '7488355358104845254') { - document.getElementById('status_output').innerHTML = 'Start up test done!' - } else { - document.getElementById('status_output').innerHTML = 'Start up test failed...' - } - } catch (e) { - document.getElementById('status_output').innerHTML = 'Start up test crashed...' - } - - document.title = document.title.replace('%version%', startUpTest.getCompilerVersion()) - const h1TitleDom = document.getElementById('h1_title') - h1TitleDom.innerHTML = h1TitleDom.innerHTML.replace('%version%', startUpTest.getCompilerVersion()) - - hljs.addPlugin({ - 'after:highlight': (result) => { - let retString = '
' - const htmlLines = result.value.split('\n') - let spanStack = [] - retString += htmlLines.map((content, index) => { - let startSpanIndex, endSpanIndex - let needle = 0 - content = spanStack.join('') + content - spanStack = [] - do { - const remainingContent = content.slice(needle) - startSpanIndex = remainingContent.indexOf('/.exec(remainingContent) - if (nextSpan === null) { - // never: but ensure no exception is raised if it happens. - break - } - spanStack.push(nextSpan[0]) - needle += startSpanIndex + nextSpan[0].length - } else { - spanStack.pop() - needle += endSpanIndex + 1 - } - } while (true) - if (spanStack.length > 0) { - content += Array(spanStack.length).fill('').join('') - } - return `
${index + 1}
${content}
` - }).join('') - retString += '
' - result.value = retString - } - }) -} - -const PageGlobal = { - resizerInterval: undefined, - colorMode: 'source', - colorToggleTimeout: 0 -} - -function compileCode () { - const codeString = document.getElementById('source-code').value - const t0 = new Date() - - try { - let compiler - if (document.getElementById('source_is_c').checked) { - compiler = new SmartC({ language: 'C', sourceCode: codeString }) - } else { - compiler = new SmartC({ language: 'Assembly', sourceCode: codeString }) - } - compiler.compile() - const asmCode = compiler.getAssemblyCode() - const bcode = compiler.getMachineCode() - - sah.Config.preAll = '' - sah.Config.postAll = '' - sah.Config.preLine = '' - sah.Config.postLine = '
' - document.getElementById('assembly_output').innerHTML = sah.colorText(asmCode) - - const t1 = new Date() - let compileMessage = `Compile sucessfull!!! Done at ${t1.getHours()}:${t1.getMinutes()}:${t1.getSeconds()} in ${t1 - t0} ms.` - compileMessage += `
Machine code hash ID: ${bcode.MachineCodeHashId}` - if (document.getElementById('debug').checked) { - compileMessage += '\n\n' + JSON.stringify(bcode, null, ' ') - } - document.getElementById('status_output').innerHTML = compileMessage + '
' - - fillForm(bcode) - } catch (e) { - document.getElementById('assembly_output').innerHTML = '' - clearForm() - let compileMessage = `Compile failed\n\n${e.message}` - if (document.getElementById('debug').checked) { - compileMessage += '\n\n' + e.stack - } - document.getElementById('status_output').innerHTML = compileMessage - const lineError = /^At line: (\d+)/.exec(e.message) - if (lineError !== null) { - document.getElementById('source_line' + lineError[1]).className += ' asmError' - } - } -} - -function textKeyUp (force) { - const elem = document.getElementById('source-code') - const colored = document.getElementById('color_code') - - SetSourceCode(force) - - // grows text area - let gole = 1 - clearInterval(PageGlobal.resizerInterval) - PageGlobal.resizerInterval = setInterval(() => { - const targetHeight = elem.scrollHeight - if (targetHeight < Number(elem.style.height.replace('px', ''))) { - if (gole >= 128) { - let val = gole >> 7 - if (val > targetHeight) val = targetHeight - elem.style.height = (targetHeight - val) + 'px' - colored.style.height = targetHeight + 'px' - } - gole <<= 1 - } else { - elem.style.height = targetHeight + 'px' - elem.scrollTop = 0 - colored.style.height = targetHeight + 'px' - clearInterval(PageGlobal.resizerInterval) - } - }, 100) - - // update tooltip info (line:column) - const cpos = elem.value.substr(0, elem.selectionStart).split('\n') - document.getElementById('tooltip_span').innerHTML = 'Cursor: ' + cpos.length + ':' + cpos[cpos.length - 1].length -} - -function SetColorCode () { - const source = document.getElementById('source-code') - - if (source.selectionStart !== source.selectionEnd) { - // Do not highlight if some text is selected. This prevents - // text selection to fade away. - return - } - - if (PageGlobal.colorMode !== 'color') { - PageGlobal.colorMode = 'color' - clearTimeout(PageGlobal.colorToggleTimeout) - const dest = document.getElementById('color_code') - - if (document.getElementById('source_is_c').checked) { - dest.innerHTML = hljs.highlight(source.value, { language: 'c' }).value - } else { - sah.Config.preAll = "
" - sah.Config.postAll = '
' - sah.Config.preLine = "
%line%
" - sah.Config.postLine = '
' - dest.innerHTML = sah.colorText(source.value) - } - source.className = 'transp' - } -} - -function SetSourceCode (force) { - clearTimeout(PageGlobal.colorToggleTimeout) - PageGlobal.colorToggleTimeout = setTimeout(SetColorCode, 500) - if (PageGlobal.colorMode !== 'source' || force === true) { - PageGlobal.colorMode = 'source' - document.getElementById('source-code').className = 'opaque' - } -} - -function SaveSource () { - const text = document.getElementById('save').innerHTML - localStorage.setItem('program', document.getElementById('source-code').value) - setTimeout(() => { - document.getElementById('save').innerHTML = text - }, 5000) - document.getElementById('save').innerHTML = '☑' -} - -function LoadSource () { - let temp = document.getElementById('source-code').value - if (temp === '' || confirm('Sure over-write current program?') === true) { - document.getElementById('source-code').value = localStorage.getItem('program') - textKeyUp(true) - temp = document.getElementById('load').innerHTML - setTimeout(() => { - document.getElementById('load').innerHTML = temp - }, 5000) - document.getElementById('load').innerHTML = '☑' - } - document.getElementById('source-code').focus() -} - -/* debug use only -function stringifyReplacer(key, value) { - if (typeof value === 'bigint') { - return value.toString(16) + 'n'; - } else if (typeof value === 'number'){ - return value.toString(16); - } else { - return value; - } -} -*/ - -function detachSource () { - const ret = WinBox.new({ - title: 'Source code', - height: '100%', - top: 50, - mount: document.getElementById('source_window'), - onclose: function () { - document.getElementById('source_fieldset').style.display = 'block' - } - }) - document.getElementById('source_fieldset').style.display = 'none' - return ret -} - -function detachStatus () { - WinBox.new({ - title: 'Status', - mount: document.getElementById('status_window'), - height: '25%', - width: '50%', - x: '50%', - y: '75%', - top: 50, - onclose: function () { - document.getElementById('status_fieldset').style.display = 'block' - } - }) - document.getElementById('status_fieldset').style.display = 'none' -} - -function detachActions () { - WinBox.new({ - title: 'Actions', - mount: document.getElementById('actions_window'), - height: '20%', - width: '50%', - x: '50%', - y: '55%', - top: 50, - onclose: function () { - document.getElementById('actions_fieldset').style.display = 'block' - } - }) - document.getElementById('actions_fieldset').style.display = 'none' -} - -function detachDeployment () { - const ret = WinBox.new({ - title: 'Smart Contract Deployment', - mount: document.getElementById('deployment_window'), - top: 50, - height: '95%', - onclose: function () { - document.getElementById('deployment_fieldset').style.display = 'block' - } - }) - document.getElementById('deployment_fieldset').style.display = 'none' - return ret -} - -function detachAssembly () { - WinBox.new({ - title: 'Assembly output', - mount: document.getElementById('assembly_window'), - height: '50%', - width: '50%', - x: '50%', - y: '50', - top: 50, - onclose: function () { - document.getElementById('assembly_fieldset').style.display = 'block' - } - }) - document.getElementById('assembly_fieldset').style.display = 'none' -} - -function detachHelp () { - const helpage = WinBox.new({ - title: 'Help page', - url: './htmlDocs/index.html', - height: '70%', - width: '70%', - x: 'center', - y: 'center', - top: 50 - }) - helpage.focus() -} - -function fillForm (AtInfo) { - let myDom - myDom = document.getElementsByName('name') - myDom[0].value = AtInfo.PName - myDom = document.getElementsByName('description') - myDom[0].value = AtInfo.PDescription - myDom = document.getElementsByName('code') - myDom[0].value = AtInfo.ByteCode - myDom = document.getElementsByName('data') - myDom[0].value = AtInfo.ByteData - myDom = document.getElementsByName('dpages') - myDom[0].value = AtInfo.DataPages - myDom = document.getElementsByName('cspages') - myDom[0].value = AtInfo.CodeStackPages - myDom = document.getElementsByName('uspages') - myDom[0].value = AtInfo.UserStackPages - myDom = document.getElementsByName('minActivationAmountNQT') - myDom[0].value = AtInfo.PActivationAmount - myDom = document.getElementsByName('feeNQT') - myDom[0].value = AtInfo.MinimumFeeNQT -} - -function clearForm () { - let myDom - myDom = document.getElementsByName('name') - myDom[0].value = '' - myDom = document.getElementsByName('description') - myDom[0].value = '' - myDom = document.getElementsByName('code') - myDom[0].value = '' - myDom = document.getElementsByName('data') - myDom[0].value = '' - myDom = document.getElementsByName('dpages') - myDom[0].value = '0' - myDom = document.getElementsByName('cspages') - myDom[0].value = '0' - myDom = document.getElementsByName('uspages') - myDom[0].value = '0' - myDom = document.getElementsByName('minActivationAmountNQT') - myDom[0].value = '' - myDom = document.getElementsByName('feeNQT') - myDom[0].value = '' -} - -function testCode () { - document.getElementById('assembly_output').innerHTML = '' - clearForm() - let testTestcases = false - if (document.getElementById('debug').checked) { - testTestcases = true - } - document.getElementById('status_output').innerHTML = runTestCases(testTestcases) -} - -function toggleLang (ev) { - if ((ev.checked !== undefined && ev.checked) || (ev.target !== undefined && ev.target.checked)) { - document.getElementById('bt1').innerText = 'C' - } else { - document.getElementById('bt1').innerText = 'Assembly' - } - document.getElementById('assembly_output').innerHTML = '' - textKeyUp(true) -} - -function deployClick (evt) { - const formDom = document.getElementById('deploy_form') - formDom.action = `http://localhost:${evt.currentTarget.value}/burst` -} diff --git a/dev/src/templateTests.ts b/dev/src/templateTests.ts deleted file mode 100644 index 4057123..0000000 --- a/dev/src/templateTests.ts +++ /dev/null @@ -1,1364 +0,0 @@ -/* Please note that these are secondary tests and will be removed any time */ - -import { CTestType, AssemblyTestType } from './testcases' - -export const tests: CTestType [] = [ - - ['Preprocessor error tests', null, 'div'], - ['#ifdef debug\nlong a; a++;', true, ''], - ['#else\nlong a; a++;', true, ''], - ['#endif\nlong a; a++;', true, ''], - ['#ifdef debug\n#pragma maxAuxVars 1\n#else\n#pragma maxAuxVars 5\n#else\n#pragma maxAuxVars 7\n#endif\nlong a; a++;', true, ''], - - ['Tokenizer error tests', null, 'div'], - ['long a;/*asdf', true, ''], - ['long a="asdf;', true, ''], - ['long a=\'asdf;', true, ''], - ['long a; asm PSH $A;', true, ''], - ['long a; asm { PSH $A;', true, ''], - ['long a; struct { long b; }', true, ''], - ['long a; ²;', true, ''], - ['Something very wrong', true, ''], - - ['Parser error tests', null, 'div'], - ['long a; };', true, ''], - ['long a[ ;', true, ''], - ['void main ((void) { long a++; }', true, ''], - ['void main (void) { long a++;', true, ''], - ['long a = "TS-MPMZ-8CD9-HZMD-A7R1X";', true, ''], - ['long a = "TS-MPMZ-8CD9-HZMD-A9R2X";', true, ''], - - ['Shaper error tests', null, 'div'], - ['long a, b; test2() while (a) a++; long test2(void) { b++; return b; }', true, ''], - ['long a, b; test2() for (;;) a++; long test2(void) { b++; return b; }', true, ''], - ['long a, b; goto a; a++; a: b++;', true, ''], - ['long a, b; else a++; a: b++;', true, ''], - ['long a, b; do { a++; };', true, ''], - ['long a, b; do { a++; } long long;', true, ''], - ['long a, b; do { a++; } long (a);', true, ''], - ['long a, b; do { a++; } while (a) b++;', true, ''], - ['long a, b; break; b++;', true, ''], - ['long a, b; continue; b++;', true, ''], - ['long a, b; test(); void test() { c++; }', true, ''], - ['long a, b; test(b, a); void test(d++) { long c; c++; }', true, ''], - ['long a, b; test(b, a); void test(d) { long c; c++; }', true, ''], - ['long a, test_b; test(a); void test(long b) { long c; c++; }', true, ''], - - ['syntaxProcessor error tests', null, 'div'], - ['long a; const ;', true, ''], - ['long a; goto; a++;', true, ''], - ['long a, b; halt 1; a++;', true, ''], - ['long a, b; break 1; a++;', true, ''], - ['long a, b; continue a; a++;', true, ''], - ['long a, b; 4++; a++;', true, ''], - ['long a, b; ++4; a++;', true, ''], - ['long a, b; test()++; a++;', true, ''], - - ['Generator error tests', null, 'div'], - ['long a, b; for a++;', true, ''], - ['long a; goto a; a++;', true, ''], - ['long a; return;', true, ''], - ['long b, a = 0; test();', true, ''], - ['#include APIFunctions\nlong b, a = 0; test();', true, ''], - ['long a = test()[4]; void test(void) {}', true, ''], - ['struct KOMBI { long driver, collector, passenger; } car; long carro; carro.driver=0;', true, ''], - ['struct KOMBI { long driver, collector, passenger; } car; car.nobody=0;', true, ''], - ['struct KOMBI { long driver, collector, passenger; } car; car->driver=0;', true, ''], - ['struct KOMBI { long driver, collector, passenger; } *car; car.driver=0;', true, ''], - ['long a, b; if (a, b) { a++;}', true, ''], - ['long a, b; a = b + test(); void test(void) { a++; }', true, ''], - ['struct KOMBI { long driver, collector[4]; } car; long *b; car.collector=b;', true, ''], - - // void test - ['Arithmetic tests', null, 'div'], - ['Void test;', null, 'div'], - ['', false, '^declare r0\n^declare r1\n^declare r2\n\nFIN\n'], - [';', false, '^declare r0\n^declare r1\n^declare r2\n\nFIN\n'], - [';;;', false, '^declare r0\n^declare r1\n^declare r2\n\nFIN\n'], - - // Assignment - ['Assignment;', null, 'div'], - ['long a, b; a=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nFIN\n'], - ['long a; a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n'], - ['long a; a=;', true, ''], - ['long a; =a;', true, ''], - - // SetOperator - ['SetOperator;', null, 'div'], - ['long a, b; a+=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nADD @a $b\nFIN\n'], - ['long b; +=b;', true, ''], - ['long a; a+=;', true, ''], - - // Constant - ['Constant;', null, 'div'], - ['long a; a=2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000002\nFIN\n'], - ['2;', false, '^declare r0\n^declare r1\n^declare r2\n\nFIN\n'], - ['long a; a=0xA;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #000000000000000a\nFIN\n'], - ['long a; a=0;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFIN\n'], - ['long a; a+=2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nINC @a\nFIN\n'], - ['long a; a+=0xfffffff;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #000000000fffffff\nADD @a $r0\nFIN\n'], - ["long a; a='BURST-MKCL-2226-W6AH-7ARVS';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #5c6ee8000049c552\nFIN\n'], - ["long a; a='TS-MKCL-2226-W6AH-7ARVS';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #5c6ee8000049c552\nFIN\n'], - ["long a; a='S-MKCL-2226-W6AH-7ARVS';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #5c6ee8000049c552\nFIN\n'], - ["long a; a='';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFIN\n'], - ['long a; a=6660515985630020946;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #5c6ee8000049c552\nFIN\n'], - ['long a; a=18446744073709551615;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #ffffffffffffffff\nFIN\n'], - ['long a; a=18446744073709551616;', true, ''], - ['long a; a=18446744073709551617;', true, ''], - // allow '_' in decimal and hexadecimal numbers - ['long a, b, c, d; a=5_0000_0000; b=5_0000_0000; c=0x00ff_00fe_7fff; d=0x00ff00fe7fff;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a #000000001dcd6500\nSET @b #000000001dcd6500\nSET @c #000000ff00fe7fff\nSET @d #000000ff00fe7fff\nFIN\n'], - - ['long a; a="Hi there";', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #6572656874206948\nFIN\n'], - ['long a; a="Hi there big";', true, ''], - ['long a; 2=a;', true, ''], - - // Operator - ['Operator;', null, 'div'], - ['long a, b, c; a=b/c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nDIV @a $c\nFIN\n'], - ['long a, b, c; a=b%c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nMOD @a $c\nFIN\n'], - ['long a, b, c; a=b<>c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nSHR @a $c\nFIN\n'], - ['long a, b, c; a=b|c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nBOR @a $c\nFIN\n'], - ['long a, b, c; a=b^c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nXOR @a $c\nFIN\n'], - - // UnaryOperator - ['UnaryOperator;', null, 'div'], - ['#pragma optimizationLevel 0\nlong a, b; a=!b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBNZ $b :__NOT_1_sF\n__NOT_1_sT:\nSET @a #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @a\n__NOT_1_end:\nFIN\n'], - ['long a, b; a=~b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nNOT @a\nFIN\n'], - ['long a, b; a^=~b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @r0 $b\nNOT @r0\nXOR @a $r0\nFIN\n'], - ['long a, b; a=~0xff;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #00000000000000ff\nNOT @a\nFIN\n'], - ['long a, b, c; a>>=b^~c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $c\nNOT @r0\nXOR @r0 $b\nSHR @a $r0\nFIN\n'], - ['long a, b; a=~~b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nNOT @a\nNOT @a\nFIN\n'], - - ['long a, b, c; a=~b/c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nNOT @a\nDIV @a $c\nFIN\n'], - ['long a, b, c; a=~b/~c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nNOT @a\nSET @r0 $c\nNOT @r0\nDIV @a $r0\nFIN\n'], - ['long a, b, c; a=b/~c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $c\nNOT @r0\nSET @a $b\nDIV @a $r0\nFIN\n'], - - ['long a, b; ~a=b;', true, ''], - - // SetUnaryOperator - ['SetUnaryOperator;', null, 'div'], - ['long a; a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n'], - ['long a; a--;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nDEC @a\nFIN\n'], - ['long a; ++a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n'], - ['long a; --a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nDEC @a\nFIN\n'], - - ['long a, b, c; a=b++/c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nDIV @a $c\nINC @b\nFIN\n'], - ['long a, b, c; a=--b/c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nDEC @b\nSET @a $b\nDIV @a $c\nFIN\n'], - ['long a, b, c; a=~--b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nDEC @b\nSET @a $b\nNOT @a\nFIN\n'], - ['long a, b, c; a+=~b++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $b\nNOT @r0\nADD @a $r0\nINC @b\nFIN\n'], - ['long a, b, c; a=~b++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nNOT @a\nINC @b\nFIN\n'], - ['long a; a++=2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000002\nINC @a\nFIN\n'], - - ['long a; a=2++;', true, ''], - ['--;', true, ''], - ['2++;', true, ''], - ['long a, b, c; a=b- -c;', true, ''], - - // CheckOperator Unary - ['CheckOperator Unary;', null, 'div'], - ['long a, b; a=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nFIN\n'], - - ['long a, b; a+=-b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @r0\nSUB @r0 $b\nADD @a $r0\nFIN\n'], - ['long a, b; a=-b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @a\nSUB @a $b\nFIN\n'], - ['long a, b, c; a=b/-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @r0\nSUB @r0 $c\nSET @a $b\nDIV @a $r0\nFIN\n'], - ['long a, b, c; a=-b/c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @a\nSUB @a $b\nDIV @a $c\nFIN\n'], - ['long a, b; a=-2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #fffffffffffffffe\nFIN\n'], - ['long a, b; a=-~b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @r0 $b\nNOT @r0\nCLR @a\nSUB @a $r0\nFIN\n'], - ['long a, b; a=~-b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @a\nSUB @a $b\nNOT @a\nFIN\n'], - ['long a, b; a=-b-- ;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @a\nSUB @a $b\nDEC @b\nFIN\n'], - ['long a, b; a=---b;', true, ''], - - ['long a, b; a=+b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nFIN\n'], - ['long a, b, c; a=b/+c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nDIV @a $c\nFIN\n'], - ['long a, b, c; a=+b/-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @r0\nSUB @r0 $c\nSET @a $b\nDIV @a $r0\nFIN\n'], - ['long a, b, c; a=+b/+c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nDIV @a $c\nFIN\n'], - ['long a; a=+2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000002\nFIN\n'], - ['long a; a-=+~2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000002\nNOT @r0\nSUB @a $r0\nFIN\n'], - ['long a; a=~+2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000002\nNOT @a\nFIN\n'], - ['long a; a=+;', true, ''], - - ['long *a, b; a=&b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #0000000000000004\nFIN\n'], - - ['long a, *b; a=*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $($b)\nFIN\n'], - ['long *a, b; *a=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @($a) $b\nFIN\n'], - ['long a, *b; a=*b/5;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $($b)\nSET @r0 #0000000000000005\nDIV @a $r0\nFIN\n'], - ['long a, *b; a=5/ *b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #0000000000000005\nSET @r0 $($b)\nDIV @a $r0\nFIN\n'], - ['long a, *b; a*=*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @r0 $($b)\nMUL @a $r0\nFIN\n'], - ['long a, *b, *c; a=*b<<*c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $($b)\nSET @r0 $($c)\nSHL @a $r0\nFIN\n'], - ['long a, *b; a=~*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $($b)\nNOT @a\nFIN\n'], - ['long a, *b; a=-*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @a\nSET @r0 $($b)\nSUB @a $r0\nFIN\n'], - ['long a, *b; a=*--b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nDEC @b\nSET @a $($b)\nFIN\n'], - ['long a, *b; a=*b--;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $($b)\nDEC @b\nFIN\n'], - - ['long a, b; a=*~b;', true, ''], - ['long a, b; a=++*b;', true, ''], - ['long a, b; a=**b;', true, ''], - - // CheckOperator Binary - ['CheckOperator Binary;', null, 'div'], - ['long a, b, c; a=b+c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nADD @a $c\nFIN\n'], - ['long a, b, c; a=b-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nSUB @a $c\nFIN\n'], - ['long a, b, c; a=b*c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nMUL @a $c\nFIN\n'], - ['long a, b, c; a=b&c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nAND @a $c\nFIN\n'], - ['long a, b, c; a-=b+c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $b\nADD @r0 $c\nSUB @a $r0\nFIN\n'], - ['long a, b, c; a=b-2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nSET @r0 #0000000000000002\nSUB @a $r0\nFIN\n'], - ['long a, b; a="0"+b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #0000000000000030\nADD @a $b\nFIN\n'], - ['long a, b; a=2*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #0000000000000002\nMUL @a $b\nFIN\n'], - ['long a, b, c; a<<=b*-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @r0\nSUB @r0 $c\nMUL @r0 $b\nSHL @a $r0\nFIN\n'], - ['long a, b, c; a^=~b&c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $b\nNOT @r0\nAND @r0 $c\nXOR @a $r0\nFIN\n'], - ['long a, b, c; a^=b&~c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $c\nNOT @r0\nAND @r0 $b\nXOR @a $r0\nFIN\n'], - ['long a, b, c; a^=-b&-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @r0\nSUB @r0 $b\nCLR @r1\nSUB @r1 $c\nAND @r0 $r1\nXOR @a $r0\nFIN\n'], - ['long a, b, c; a=b&~0xff;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a #00000000000000ff\nNOT @a\nAND @a $b\nFIN\n'], - ['long a, b, c; a=~0x7fb&~0xff;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a #00000000000007fb\nNOT @a\nSET @r0 #00000000000000ff\nNOT @r0\nAND @a $r0\nFIN\n'], - ['long a, b, c; a>>=b-~c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $c\nNOT @r0\nSET @r1 $b\nSUB @r1 $r0\nSHR @a $r1\nFIN\n'], - - ['long a, b, c; a=b++-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nSUB @a $c\nINC @b\nFIN\n'], - ['long a, b, c; a=--b&c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nDEC @b\nSET @a $b\nAND @a $c\nFIN\n'], - - ['long a, b, c; a+=-b+c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @r0\nSUB @r0 $b\nADD @r0 $c\nADD @a $r0\nFIN\n'], - ['long a, b, *c; a=-b**c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @a\nSUB @a $b\nSET @r0 $($c)\nMUL @a $r0\nFIN\n'], - ['long a, b, c; a=b*-2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a #fffffffffffffffe\nMUL @a $b\nFIN\n'], - ['long a, b, c; a=-2&~b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nNOT @a\nSET @r0 #fffffffffffffffe\nAND @a $r0\nFIN\n'], - ['long a, b, c; a=b&~-c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @a\nSUB @a $c\nNOT @a\nAND @a $b\nFIN\n'], - ['long a, b, c; a=~-b&c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @a\nSUB @a $b\nNOT @a\nAND @a $c\nFIN\n'], - ['long a, b, c; a=b*-c--;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @a\nSUB @a $c\nMUL @a $b\nDEC @c\nFIN\n'], - ['long a, b, c; a=-b--*c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @a\nSUB @a $b\nMUL @a $c\nDEC @b\nFIN\n'], - ['long a, b, c; a/=b*-c--;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nCLR @r0\nSUB @r0 $c\nMUL @r0 $b\nDIV @a $r0\nDEC @c\nFIN\n'], - - ['long a, b, c; a+b=c;', true, ''], - ['long a, b, c; a-b=c;', true, ''], - ['long a, b, c; a*b=c;', true, ''], - ['long a, b, c; a&b=c;', true, ''], - ['long a, b, c; a=b*/c;', true, ''], - - // Delimiter - ['Delimiter;', null, 'div'], - ['long a, b, c, d; a=b,c=d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nSET @c $d\nFIN\n'], - ['long a, b; a,b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nFIN\n'], - ['long a, b, c, d, e, f; a=b,c=d,e=f;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n^declare f\n\nSET @a $b\nSET @c $d\nSET @e $f\nFIN\n'], - ['long a, b, c, d, e, f; a=b++,c=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n^declare f\n\nSET @a $b\nINC @b\nSET @c $b\nFIN\n'], - ['long a, b, c, d, e, f; a=b++,c=b++,d=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n^declare f\n\nSET @a $b\nINC @b\nSET @c $b\nINC @b\nSET @d $b\nFIN\n'], - ['long a; a+=1/2,a=2/2,a+=3/2,a=4/2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000001\nINC @a\nSET @a #0000000000000002\nFIN\n'], - [',;', true, ''], - [',,,,;', true, ''], - ['long a, b, c, d; a=b,,c=d;', true, ''], - - ['long a, b; a=,b;', true, ''], - - // CodeCave - ['CodeCave;', null, 'div'], - ['long a, b; a=(b);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nFIN\n'], - ['long a, b; a*=(b);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nMUL @a $b\nFIN\n'], - ['long a; a=(2);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000002\nFIN\n'], - ['long a, *b, c, d; a=*(b);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $($b)\nFIN\n'], - ['long a, *b, c, d; a=*(b+c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nADD @a $c\nSET @a $($a)\nFIN\n'], - ['long a, b, *c, d; a=*(b+c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nADD @a $c\nSET @a $($a)\nFIN\n'], - ['long a, b, *c, d; a=*(5+c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a #0000000000000005\nADD @a $c\nSET @a $($a)\nFIN\n'], - ['long *a, b, c, d; *(a+1)=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @r0 $a\nINC @r0\nSET @($r0) $b\nFIN\n'], - ['long a, b, c, d; a=(b*c)*d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nMUL @a $c\nMUL @a $d\nFIN\n'], - ['long a, b, c, d; a=(b/c)/d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nDIV @a $c\nDIV @a $d\nFIN\n'], - ['long a, b, c, d; a=~(0xFF<<8);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a #00000000000000ff\nSET @r0 #0000000000000008\nSHL @a $r0\nNOT @a\nFIN\n'], - ['long a, b, c, d; a=~(b/c)/d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nDIV @a $c\nNOT @a\nDIV @a $d\nFIN\n'], - ['long a, b, c, d; a=(b/c)/~d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nDIV @a $c\nSET @r0 $d\nNOT @r0\nDIV @a $r0\nFIN\n'], - ['long a, b, c, d; a=~(b/c/d);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nDIV @a $c\nDIV @a $d\nNOT @a\nFIN\n'], - ['long a, b, c, d, e; a=(b+c)*(d+e);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n\nSET @a $b\nADD @a $c\nSET @r0 $d\nADD @r0 $e\nMUL @a $r0\nFIN\n'], - ['long a, b, c, d, e; a=(b+c)/(d+e);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n\nSET @a $b\nADD @a $c\nSET @r0 $d\nADD @r0 $e\nDIV @a $r0\nFIN\n'], - ['long a, b, c, d, e; a%=1-((b+c)*(d+e));', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n\nSET @r0 $b\nADD @r0 $c\nSET @r1 $d\nADD @r1 $e\nMUL @r0 $r1\nSET @r1 #0000000000000001\nSUB @r1 $r0\nMOD @a $r1\nFIN\n'], - - ['long a, b, c, d; a=--(b);', true, ''], - ['long a, b, c, d; a=(b+c)++;', true, ''], - ['long a, b, c, d; a=(b)[c];', true, ''], - ['long a, b, c, d; *(a+1)=b;', true, ''], - ['long a, b, c, d; *(a+c)=b;', true, ''], - ['long a, b, c, d; a=*(b+1);', true, ''], - ['long a, b, c, d; a=*(b+c);', true, ''], - - // Arithmetic + comparisions - ['Arithmetic + comparisions;', null, 'div'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a==b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBNE $a $b :__CMP_1_sF\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a!=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBEQ $a $b :__CMP_1_sF\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=2<=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nSET @z #0000000000000002\nBGT $z $b :__CMP_1_sF\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a<2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nSET @z #0000000000000002\nBGE $a $z :__CMP_1_sF\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a>=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBLT $a $b :__CMP_1_sF\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a>b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBLE $a $b :__CMP_1_sF\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=!a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBNZ $a :__NOT_1_sF\n__NOT_1_sT:\nSET @z #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @z\n__NOT_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=!!a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBZR $a :__NOT_1_sF\n__NOT_1_sT:\nSET @z #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @z\n__NOT_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a&&b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBZR $a :__CMP_1_sF\n__AND_2_next:\nBZR $b :__CMP_1_sF\nJMP :__CMP_1_sT\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, z; z=a||b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare z\n\nBNZ $a :__CMP_1_sT\n__OR_2_next:\nBNZ $b :__CMP_1_sT\nJMP :__CMP_1_sF\n__CMP_1_sF:\nCLR @z\nJMP :__CMP_1_end\n__CMP_1_sT:\nSET @z #0000000000000001\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=2+b==c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nINC @a\nINC @a\nBNE $a $c :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=2+(b==c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBNE $b $c :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nINC @a\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=b==~c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $c\nNOT @a\nBNE $b $a :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=b==!c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBNZ $c :__NOT_2_sF\n__NOT_2_sT:\nSET @a #0000000000000001\nJMP :__NOT_2_end\n__NOT_2_sF:\nCLR @a\n__NOT_2_end:\nBNE $b $a :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=!b==c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBNZ $b :__NOT_2_sF\n__NOT_2_sT:\nSET @a #0000000000000001\nJMP :__NOT_2_end\n__NOT_2_sF:\nCLR @a\n__NOT_2_end:\nBNE $a $c :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=!b==!c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBNZ $b :__NOT_2_sF\n__NOT_2_sT:\nSET @a #0000000000000001\nJMP :__NOT_2_end\n__NOT_2_sF:\nCLR @a\n__NOT_2_end:\nBNZ $c :__NOT_3_sF\n__NOT_3_sT:\nSET @r0 #0000000000000001\nJMP :__NOT_3_end\n__NOT_3_sF:\nCLR @r0\n__NOT_3_end:\nBNE $a $r0 :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=!(b+c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nADD @a $c\nBNZ $a :__NOT_1_sF\n__NOT_1_sT:\nSET @a #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @a\n__NOT_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; a=!(b==c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBEQ $b $c :__NOT_1_sF\n__NOT_1_sT:\nSET @a #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @a\n__NOT_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d; a=!(b==c)==d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nBEQ $b $c :__NOT_2_sF\n__NOT_2_sT:\nSET @a #0000000000000001\nJMP :__NOT_2_end\n__NOT_2_sF:\nCLR @a\n__NOT_2_end:\nBNE $a $d :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d, z; z=1+((a&&b)||(c&&d));', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare z\n\nBZR $a :__OR_2_next\n__AND_3_next:\nBZR $b :__OR_2_next\nJMP :__CMP_1_sT\n__OR_2_next:\nBZR $c :__CMP_1_sF\n__AND_4_next:\nBZR $d :__CMP_1_sF\nJMP :__CMP_1_sT\nJMP :__CMP_1_sF\n__CMP_1_sF:\nCLR @z\nJMP :__CMP_1_end\n__CMP_1_sT:\nSET @z #0000000000000001\n__CMP_1_end:\nINC @z\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d, z; z=1+!((a&&b)||(c&&d));', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare z\n\nBZR $a :__OR_2_next\n__AND_3_next:\nBZR $b :__OR_2_next\nJMP :__NOT_1_sF\n__OR_2_next:\nBZR $c :__NOT_1_sT\n__AND_4_next:\nBZR $d :__NOT_1_sT\nJMP :__NOT_1_sF\nJMP :__NOT_1_sT\n__NOT_1_sT:\nSET @z #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @z\n__NOT_1_end:\nINC @z\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d; a=b+(++c==d++);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nINC @c\nBNE $c $d :__CMP_1_sF\n__CMP_1_sT:\nSET @a #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @a\n__CMP_1_end:\nADD @a $b\nINC @d\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d; a=b+(++c&&d++);', true, ''], - ['#pragma optimizationLevel 0\nlong a, b, c, d, z; z=1+((a||b)&&(c||d));', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare z\n\nBNZ $a :__AND_2_next\n__OR_3_next:\nBNZ $b :__AND_2_next\nJMP :__CMP_1_sF\n__AND_2_next:\nBNZ $c :__CMP_1_sT\n__OR_4_next:\nBNZ $d :__CMP_1_sT\nJMP :__CMP_1_sF\nJMP :__CMP_1_sT\n__CMP_1_sT:\nSET @z #0000000000000001\nJMP :__CMP_1_end\n__CMP_1_sF:\nCLR @z\n__CMP_1_end:\nINC @z\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d, z; z=1+!((a||b)&&(c||d));', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare z\n\nBNZ $a :__AND_2_next\n__OR_3_next:\nBNZ $b :__AND_2_next\nJMP :__NOT_1_sT\n__AND_2_next:\nBNZ $c :__NOT_1_sF\n__OR_4_next:\nBNZ $d :__NOT_1_sF\nJMP :__NOT_1_sT\nJMP :__NOT_1_sF\n__NOT_1_sT:\nSET @z #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @z\n__NOT_1_end:\nINC @z\nFIN\n'], - - ['long a, b; a==b;', true, ''], - ['long a, b; a!=b;', true, ''], - ['long b; 2<=b;', true, ''], - ['long a; a<2;', true, ''], - ['long a, b; a>=b;', true, ''], - ['long a, b; a>b;', true, ''], - ['long a; !a;', true, ''], - ['long a, b; a&&b;', true, ''], - ['long a, b; a||b;', true, ''], - - // Optimizations - ['Optimizations;', null, 'div'], - ['long a, b; a=b/a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @r0 $b\nDIV @r0 $a\nSET @a $r0\nFIN\n'], - ['long a, b, c; a=1+(b/(c/a));', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $c\nDIV @r0 $a\nSET @r1 $b\nDIV @r1 $r0\nINC @r1\nSET @a $r1\nFIN\n'], - - // MISC - ['MISC;', null, 'div'], - ['long a, *b; a=~-*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @a\nSET @r0 $($b)\nSUB @a $r0\nNOT @a\nFIN\n'], - ['long a, *b; a=~-~-*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @r0\nSET @a $($b)\nSUB @r0 $a\nNOT @r0\nCLR @a\nSUB @a $r0\nNOT @a\nFIN\n'], - ['long a, *b; a=~-~-*b+1;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @r0\nSET @a $($b)\nSUB @r0 $a\nNOT @r0\nCLR @a\nSUB @a $r0\nNOT @a\nINC @a\nFIN\n'], - ['long a, b, c, d, e; a=b+c/d-e;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n\nSET @a $c\nDIV @a $d\nADD @a $b\nSUB @a $e\nFIN\n'], - ['long a, b, c, d, e; a=b<>2) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 $a\nSET @r1 #0000000000000002\nSHR @r0 $r1\nBZR $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; if (a|2) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000002\nBOR @r0 $a\nBZR $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; if (a^2) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000002\nXOR @r0 $a\nBZR $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - - // UnaryOperator - ['#pragma optimizationLevel 0\nlong a; if (!a) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nBNZ $a :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; if (~a) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 $a\nNOT @r0\nBZR $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - - // SetUnaryOperators - ['#pragma optimizationLevel 0\nlong a; if (++a) { a++; }', true, ''], - ['#pragma optimizationLevel 0\nlong a; if (a++) { a++; }', true, ''], - - // Assignment SetOperator - ['#pragma optimizationLevel 0\nlong a; if (a=b) { a++; }', true, ''], - ['#pragma optimizationLevel 0\nlong a; if (a+=b) { a++; }', true, ''], - - // Comparision - ['#pragma optimizationLevel 0\nlong a, b; if (a==b) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBNE $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (a!=b) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBEQ $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (a>=b) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBLT $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (a>b) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBLE $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (a<=b) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBGT $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (a>2)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 $a\nSET @r1 #0000000000000002\nSHR @r0 $r1\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; if (!(a|2)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000002\nBOR @r0 $a\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; if (!(a^2)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000002\nXOR @r0 $a\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - - // UnaryOperator - ['#pragma optimizationLevel 0\nlong a; if (!!a) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nBZR $a :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; if (!~a) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 $a\nNOT @r0\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - - // Comparision - ['#pragma optimizationLevel 0\nlong a, b; if (!(a==b)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBEQ $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (!(a!=b)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBNE $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (!(a>=b)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBGE $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (!(a>b)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBGT $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (!(a<=b)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBLE $a $b :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; if (!(a=b && c>=d) || (e!=f && g!=h)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n^declare f\n^declare g\n^declare h\n\nBLT $a $b :__OR_2_next\n__AND_3_next:\nBLT $c $d :__OR_2_next\nJMP :__if1_start\n__OR_2_next:\nBEQ $e $f :__if1_endif\n__AND_4_next:\nBEQ $g $h :__if1_endif\nJMP :__if1_start\nJMP :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d, e, f, g, h; if ((a>=b&&c>=d)||!(e==f&&g==h)) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^declare e\n^declare f\n^declare g\n^declare h\n\nBLT $a $b :__OR_2_next\n__AND_3_next:\nBLT $c $d :__OR_2_next\nJMP :__if1_start\n__OR_2_next:\nBNE $e $f :__if1_start\n__AND_4_next:\nBNE $g $h :__if1_start\nJMP :__if1_endif\nJMP :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c, d, e, f, g, h; if ((a<=b||c0) goto label1; if (temp==0) goto label2; goto label3; label1: temp++; label2: temp++; label3: temp++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare temp\n\nSET @temp #0000000000000002\nCLR @r0\nBLE $temp $r0 :__if1_endif\n__if1_start:\nJMP :label1\n__if1_endif:\nBNZ $temp :__if2_endif\n__if2_start:\nJMP :label2\n__if2_endif:\nJMP :label3\nlabel1:\nINC @temp\nlabel2:\nINC @temp\nlabel3:\nINC @temp\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; a++; asm { PSH $a\nPOP @b } b++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nINC @a\nPSH $a\nPOP @b\nINC @b\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; a++; sleep 1;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nINC @a\nSET @r0 #0000000000000001\nSLP $r0\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; exit; a++; ', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nFIN\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 0\nhalt;', false, '^declare r0\n^declare r1\n^declare r2\n\nSTP\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; if (a) { a++; if (b) { b++; if (c) { c++; } } }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBZR $a :__if1_endif\n__if1_start:\nINC @a\nBZR $b :__if2_endif\n__if2_start:\nINC @b\nBZR $c :__if3_endif\n__if3_start:\nINC @c\n__if3_endif:\n__if2_endif:\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b, c; if (a) {\n a++;\n} else if (b) {\n b++;\n} else if (c) {\n c++;\n}', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nBZR $a :__if1_else\n__if1_start:\nINC @a\nJMP :__if1_endif\n__if1_else:\nBZR $b :__if2_else\n__if2_start:\nINC @b\nJMP :__if2_endif\n__if2_else:\nBZR $c :__if3_endif\n__if3_start:\nINC @c\n__if3_endif:\n__if2_endif:\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a, b; a=2; const b=5; a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a #0000000000000002\n^const SET @b #0000000000000005\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 0\nEmpty conditions', null, 'div'], - ['#pragma optimizationLevel 0\nlong a; if () { a++; }', true, ''], - ['#pragma optimizationLevel 0\nlong a; if () { a++; } else { b--; }', true, ''], - ['#pragma optimizationLevel 0\nlong a; while () { a++; }', true, ''], - ['#pragma optimizationLevel 0\nlong a; for (;;) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n__loop1_condition:\n__loop1_start:\nINC @a\n__loop1_continue:\nJMP :__loop1_condition\n__loop1_break:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; do { a++; } while ();', true, ''], - - // pointer Operation - ['Full tests;', null, 'div'], - ['Pointer Assignment;', null, 'div'], - [`long *pa, *pb, va, vb; -pa = pb; pa = &pb; pa = &vb; *pa= vb; -*pa= *pb; va = vb; va = *pb;`, false, '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nSET @pa $pb\nSET @pa #0000000000000004\nSET @pa #0000000000000006\nSET @($pa) $vb\nSET @r0 $($pb)\nSET @($pa) $r0\nSET @va $vb\nSET @va $($pb)\nFIN\n'], - ['long *pa, *pb, va, vb; pa=vb; pa=*pb; *pa=pb; *pa=&pb; *pa=&vb; va=pb; va=&pb; va=&vb;', true, ''], - [`#pragma warningToError false\nlong *pa, *pb, va, vb; -pa=vb; pa=*pb; *pa=pb; *pa=&pb; *pa=&vb; va=pb; va=&pb; va=&vb;`, false, '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nSET @pa $vb\nSET @pa $($pb)\nSET @($pa) $pb\nSET @r0 #0000000000000004\nSET @($pa) $r0\nSET @r0 #0000000000000006\nSET @($pa) $r0\nSET @va $pb\nSET @va #0000000000000004\nSET @va #0000000000000006\nFIN\n'], - ['long *pa, *pb, va, vb; pa+=vb;', false, '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nADD @pa $vb\nFIN\n'], - ['long *pa, *pb, va, vb; pa+=vb+1;', false, '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nSET @r0 $vb\nINC @r0\nADD @pa $r0\nFIN\n'], - ['long *pa, *pb, va, vb; pa-=vb;', false, '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nSUB @pa $vb\nFIN\n'], - ['long *pa, *pb, va, vb; pa=pa-vb;', false, '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nSET @r0 $pa\nSUB @r0 $vb\nSET @pa $r0\nFIN\n'], - ['long *pa, *pb, va, vb; va=*vb;', true, ''], - ['long *pa, *pb, va, vb; *va=vb;', true, ''], - ['long *a, *a+1=0;', true, ''], - ['long *a, *(a*3)=0;', true, ''], - - ['Pointer/Array Assignment;', null, 'div'], - ['long a[4], *b, c; *b=a[0]; a[0]=*b; b=a; *b=a[c]; a[c]=*b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @($b) $a_0\nSET @a_0 $($b)\nSET @b $a\nSET @r0 $($a + $c)\nSET @($b) $r0\nSET @r0 $($b)\nSET @($a + $c) $r0\nFIN\n'], - ['long a[4], *b, c; a=b;', true, ''], - ['long a[4], *b, c; b=&a; b=&a[0]; b=&c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @b #0000000000000003\nSET @b #0000000000000004\nSET @b #0000000000000009\nFIN\n'], - ['long a[4], *b, c; c=&a; c=&a[0]; c=&c;', true, ''], - ['#pragma warningToError false\nlong a[4], *b, c; c=&a; c=&a[0]; c=&c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c #0000000000000003\nSET @c #0000000000000004\nSET @c #0000000000000009\nFIN\n'], - - ['long *a, b, c;\n*(a+1)=b; *(a+30)=b; *(a+c)=b;\nb=*(a+1); b=*(a+30); b=*(a+c);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $a\nINC @r0\nSET @($r0) $b\nSET @r0 #000000000000001e\nADD @r0 $a\nSET @($r0) $b\nSET @r0 $a\nADD @r0 $c\nSET @($r0) $b\nSET @b $a\nINC @b\nSET @b $($b)\nSET @b #000000000000001e\nADD @b $a\nSET @b $($b)\nSET @b $a\nADD @b $c\nSET @b $($b)\nFIN\n'], - ['long *a, b, Array[4]; a=Array+2; a=Array-b; a+=7; a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare Array\n^const SET @Array #0000000000000006\n^declare Array_0\n^declare Array_1\n^declare Array_2\n^declare Array_3\n\nSET @a $Array\nINC @a\nINC @a\nSET @a $Array\nSUB @a $b\nSET @r0 #0000000000000007\nADD @a $r0\nINC @a\nFIN\n'], - ['long *a, b, Array[4]; a=Array*2;', true, ''], - // [ "", false,"" ], - - // Array - // Memtable: Arr+ Assignment, Arr+ SetOperator, - ['Array', null, 'div'], - ['long a[4]; long b; long c; a[b]=c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @($a + $b) $c\nFIN\n'], - ['long a[4]; long b; long c; a[0]=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @a_0 $b\nFIN\n'], - ['long a[4]; long b; long c; a[2]=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @a_2 $b\nFIN\n'], - ["long a[4]; a[]='aaaaaaaazzzzzzz';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n\nSET @a_0 #6161616161616161\nSET @a_1 #007a7a7a7a7a7a7a\nCLR @a_2\nCLR @a_3\nFIN\n'], - ['long a[4]; a[]=0x3333333333333333222222222222222211111111111111110000000000000000;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n\nCLR @a_0\nSET @a_1 #1111111111111111\nSET @a_2 #2222222222222222\nSET @a_3 #3333333333333333\nFIN\n'], - ['long a[4]; long b; long c; c=a[b];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c $($a + $b)\nFIN\n'], - ['long a[4]; long b; long c; c=a[0];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c $a_0\nFIN\n'], - ['long a[4]; long b; long c; c=a[3];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c $a_3\nFIN\n'], - ['long a[4]; long b; long c; a[b]+=c;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @r0 $($a + $b)\nADD @r0 $c\nSET @($a + $b) $r0\nFIN\n'], - ['long a[4]; long b; long c; a[0]-=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSUB @a_0 $b\nFIN\n'], - ['long a[4]; long b; long c; a[2]*=b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nMUL @a_2 $b\nFIN\n'], - ['long a[4]; long b; long c; c/=a[b];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @r0 $($a + $b)\nDIV @c $r0\nFIN\n'], - ['long a[4]; long b; long c; c&=a[0];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nAND @c $a_0\nFIN\n'], - ['long a[4]; long b; long c; c^=a[3];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nXOR @c $a_3\nFIN\n'], - ['long a[4]; long b; long c[4]; long d; a[b]=c[d];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n^const SET @c #000000000000000a\n^declare c_0\n^declare c_1\n^declare c_2\n^declare c_3\n^declare d\n\nSET @r0 $($c + $d)\nSET @($a + $b) $r0\nFIN\n'], - ['long a[4]; long b; long c[4]; long d; a[b]+=c[d];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n^const SET @c #000000000000000a\n^declare c_0\n^declare c_1\n^declare c_2\n^declare c_3\n^declare d\n\nSET @r0 $($a + $b)\nSET @r1 $($c + $d)\nADD @r0 $r1\nSET @($a + $b) $r0\nFIN\n'], - // Arr+ Constant, Arr+ Operator - ['long a[4]; long b; a[b]=2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n\nSET @r0 #0000000000000002\nSET @($a + $b) $r0\nFIN\n'], - ['long a[4]; a[0]=0xFF;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n\nSET @a_0 #00000000000000ff\nFIN\n'], - ['long a[4]; a[2]="Ho ho";', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n\nSET @a_2 #0000006f68206f48\nFIN\n'], - ['long a, b[4], c, d; a=b[c]/b[d];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^const SET @b #0000000000000005\n^declare b_0\n^declare b_1\n^declare b_2\n^declare b_3\n^declare c\n^declare d\n\nSET @a $($b + $c)\nSET @r0 $($b + $d)\nDIV @a $r0\nFIN\n'], - ['long a, b[4], c, d; a=b[c]<passenger='Ze'; -pcar->driver=a; -pcar->driver=*c; -pcar->driver=d[1]; -pcar->driver=d[a]; -pcar->driver=pcar->collector;\n -a=pcar->collector; -*c=pcar->collector; -d[1]=pcar->collector; -d[a]=pcar->collector;`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000b\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000002\nSET @($pcar + $r1) $r0\nSET @($pcar) $a\nSET @r0 $($c)\nSET @($pcar) $r0\nSET @($pcar) $d_1\nSET @r0 $($d + $a)\nSET @($pcar) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($pcar) $r0\nSET @r0 #0000000000000001\nSET @a $($pcar + $r0)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($c) $r0\nSET @r0 #0000000000000001\nSET @d_1 $($pcar + $r0)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n'], - - [`struct KOMBI { long driver; long collector; long passenger[4]; } ; -struct KOMBI car, *pcar; -long a, b, *c, d[2]; -pcar=&car;\n -pcar->passenger[2]='Ze'; -pcar->passenger[2]=a; -pcar->passenger[2]=*c; -pcar->passenger[2]=d[1]; -pcar->passenger[2]=d[a]; -pcar->passenger[2]=pcar->collector; -pcar->passenger[2]=pcar->passenger[1];\n -a=pcar->passenger[2]; -*c=pcar->passenger[2]; -d[1]=pcar->passenger[2]; -d[a]=pcar->passenger[2];`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare car_passenger_3\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000f\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @($pcar + $r0) $a\nSET @r0 $($c)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @($pcar + $r0) $d_1\nSET @r0 $($d + $a)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r1 #0000000000000004\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @a $($pcar + $r0)\nSET @r1 #0000000000000005\nSET @r0 $($pcar + $r1)\nSET @($c) $r0\nSET @r0 #0000000000000005\nSET @d_1 $($pcar + $r0)\nSET @r1 #0000000000000005\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n'], - - [`struct KOMBI { long driver; long collector; long passenger[4]; } ; -struct KOMBI car[2], *pcar; -long a, b, *c, d[2]; -pcar=&car[a];`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^const SET @car_0_passenger #0000000000000007\n^declare car_0_passenger_0\n^declare car_0_passenger_1\n^declare car_0_passenger_2\n^declare car_0_passenger_3\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^const SET @car_1_passenger #000000000000000e\n^declare car_1_passenger_0\n^declare car_1_passenger_1\n^declare car_1_passenger_2\n^declare car_1_passenger_3\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000017\n^declare d_0\n^declare d_1\n\nSET @r0 #0000000000000007\nMUL @r0 $a\nSET @r1 $car\nADD @r1 $r0\nSET @pcar $r1\nFIN\n'], - - [`struct KOMBI { long driver; long collector; long passenger[4]; } ; -struct KOMBI car, *pcar; -long a, b, *c, d[2]; -pcar=&car;\n -pcar->passenger[a]='Ze'; -pcar->passenger[a]=a; -pcar->passenger[a]=*c; -pcar->passenger[a]=d[1]; -pcar->passenger[a]=d[a]; -pcar->passenger[a]=pcar->collector; -pcar->passenger[a]=pcar->passenger[b];\n -a=pcar->passenger[b]; -*c=pcar->passenger[b]; -d[1]=pcar->passenger[b]; -d[a]=pcar->passenger[b];`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare car_passenger_3\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000f\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r1 #000000000000655a\nSET @($pcar + $r0) $r1\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @($pcar + $r0) $a\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r1 $($c)\nSET @($pcar + $r0) $r1\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @($pcar + $r0) $d_1\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r1 $($d + $a)\nSET @($pcar + $r0) $r1\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r2 #0000000000000001\nSET @r1 $($pcar + $r2)\nSET @($pcar + $r0) $r1\nSET @r0 $a\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r1 $b\nSET @r2 #0000000000000003\nADD @r1 $r2\nSET @r2 $($pcar + $r1)\nSET @($pcar + $r0) $r2\nSET @a $b\nSET @r0 #0000000000000003\nADD @a $r0\nSET @a $($pcar + $a)\nSET @r0 $b\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r1 $($pcar + $r0)\nSET @($c) $r1\nSET @d_1 $b\nSET @r0 #0000000000000003\nADD @d_1 $r0\nSET @d_1 $($pcar + $d_1)\nSET @r0 $b\nSET @r1 #0000000000000003\nADD @r0 $r1\nSET @r1 $($pcar + $r0)\nSET @($d + $a) $r1\nFIN\n'], - - ['struct KOMBI { long driver, collector, passenger; } *car; void * ptr; ptr = &car;', false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^declare ptr\n\nSET @ptr #0000000000000003\nFIN\n'], - - ['Logical operations with arrays and structs', null, 'div'], - ['#pragma optimizationLevel 0\nlong a[2], b; if (a[b]) { b++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare b\n\nSET @r0 $($a + $b)\nBZR $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a[2], b; if (!(a[b])) { b++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare b\n\nSET @r0 $($a + $b)\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a[2], b; if (!a[b]) { b++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare b\n\nSET @r0 $($a + $b)\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; } car; -long a, b; -if (car.driver=='Ze') { b++; } -if (a<=car.collector) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare a\n^declare b\n\nSET @r0 #000000000000655a\nBNE $car_driver $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nBGT $a $car_collector :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; } car[2]; -long a, b; -if (car[1].driver=='Ze') { b++; } -if (a<=car[0].collector) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^declare a\n^declare b\n\nSET @r0 #000000000000655a\nBNE $car_1_driver $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nBGT $a $car_0_collector :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; } car[2]; -long a, b; -if (car[b].driver=='Ze') { b++; } -if (a<=car[b].collector) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^declare a\n^declare b\n\nSET @r0 #0000000000000003\nMUL @r0 $b\nSET @r1 $($car + $r0)\nSET @r0 #000000000000655a\nBNE $r1 $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nSET @r0 #0000000000000003\nMUL @r0 $b\nINC @r0\nSET @r1 $($car + $r0)\nBGT $a $r1 :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger[3]; } car; -long a, b; -if (car.passenger[0]=='Ze') { b++; } -if (a<=car.passenger[2]) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare a\n^declare b\n\nSET @r0 #000000000000655a\nBNE $car_passenger_0 $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nBGT $a $car_passenger_2 :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger[3]; } car[2]; -long a, b; -if (car[0].passenger[0]=='Ze') { b++; } -if (a<=car[b].passenger[2]) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^const SET @car_0_passenger #0000000000000007\n^declare car_0_passenger_0\n^declare car_0_passenger_1\n^declare car_0_passenger_2\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^const SET @car_1_passenger #000000000000000d\n^declare car_1_passenger_0\n^declare car_1_passenger_1\n^declare car_1_passenger_2\n^declare a\n^declare b\n\nSET @r0 #000000000000655a\nBNE $car_0_passenger_0 $r0 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nSET @r0 #0000000000000006\nMUL @r0 $b\nSET @r1 #0000000000000003\nADD @r0 $r1\nINC @r0\nINC @r0\nSET @r1 $($car + $r0)\nBGT $a $r1 :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger[3]; } car[2]; -long a, b; -if (car[0].passenger[b]=='Ze') { b++; } -if (a<=car[b].passenger[a]) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^const SET @car_0_passenger #0000000000000007\n^declare car_0_passenger_0\n^declare car_0_passenger_1\n^declare car_0_passenger_2\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^const SET @car_1_passenger #000000000000000d\n^declare car_1_passenger_0\n^declare car_1_passenger_1\n^declare car_1_passenger_2\n^declare a\n^declare b\n\nSET @r0 $($car_0_passenger + $b)\nSET @r1 #000000000000655a\nBNE $r0 $r1 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nSET @r0 #0000000000000006\nMUL @r0 $b\nSET @r1 #0000000000000003\nADD @r0 $r1\nADD @r0 $a\nSET @r1 $($car + $r0)\nBGT $a $r1 :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - [`#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; } ; -struct KOMBI car[2], *pcar; -long a, b; -pcar=&car[1]; -if (pcar->driver=='Ze') { b++; } -if (a<=pcar->collector) { b--; }`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^declare pcar\n^declare a\n^declare b\n\nSET @pcar #0000000000000007\nSET @r0 $($pcar)\nSET @r1 #000000000000655a\nBNE $r0 $r1 :__if1_endif\n__if1_start:\nINC @b\n__if1_endif:\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nBGT $a $r0 :__if2_endif\n__if2_start:\nDEC @b\n__if2_endif:\nFIN\n'], - - // [ "", false,"" ], - - // MemTable: general - ['General', null, 'div'], - ['long a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n'], - ['long a=3;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #0000000000000003\nFIN\n'], - ['long a,b;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nFIN\n'], - ['long a,b=3;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @b #0000000000000003\nFIN\n'], - ['long * a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n'], - ['long a[3];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n\nFIN\n'], - ['long a[3]; a[0]=9;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n\nSET @a_0 #0000000000000009\nFIN\n'], - ['long a[3]; a=9;', true, ''], - ['Functions', null, 'div'], - ['#pragma optimizationLevel 0\nlong a; void main(void) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nJMP :__fn_main\n\n__fn_main:\nPCS\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; void main(void) { a++; return; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nJMP :__fn_main\n\n__fn_main:\nPCS\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; void main(void) { a++; return; a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nJMP :__fn_main\n\n__fn_main:\nPCS\nINC @a\nFIN\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 0\nlong a; void test(void) { a++; return; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n\n__fn_test:\nINC @a\nRET\n'], - ['#pragma optimizationLevel 0\nlong a; void test(void) { a++; return; a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n\n__fn_test:\nINC @a\nRET\nINC @a\nRET\n'], - ['#pragma optimizationLevel 0\nlong a; test(); void test(void) { a++; return; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nJSR :__fn_test\nFIN\n\n__fn_test:\nINC @a\nRET\n'], - ['#pragma optimizationLevel 0\nlong a; a=test(); void test(void) { a++; return; }', true, ''], - ['#pragma optimizationLevel 0\nlong a; void test2(long b) { b++; return; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test2_b\n\nFIN\n\n__fn_test2:\nPOP @test2_b\nINC @test2_b\nRET\n'], - ['#pragma optimizationLevel 0\nlong a; long test2(long b) { b++; return b; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test2_b\n\nFIN\n\n__fn_test2:\nPOP @test2_b\nINC @test2_b\nPSH $test2_b\nRET\n'], - ['#pragma optimizationLevel 0\nlong a=0; a=test2(a); long test2(long b) { b++; return b; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test2_b\n\nCLR @a\nPSH $a\nJSR :__fn_test2\nPOP @r0\nSET @a $r0\nFIN\n\n__fn_test2:\nPOP @test2_b\nINC @test2_b\nPSH $test2_b\nRET\n'], - ['#pragma optimizationLevel 0\n#pragma warningToError false\nlong a=0; test2(a); long test2(long b) { b++; return b; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test2_b\n\nCLR @a\nPSH $a\nJSR :__fn_test2\nPOP @r0\nFIN\n\n__fn_test2:\nPOP @test2_b\nINC @test2_b\nPSH $test2_b\nRET\n'], - ['#pragma optimizationLevel 0\nlong a=0; void main(void){ a++; test2(a); exit; } void test2(long b) { b++; return; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test2_b\n\nCLR @a\nJMP :__fn_main\n\n__fn_main:\nPCS\nINC @a\nPSH $a\nJSR :__fn_test2\nFIN\n\n__fn_test2:\nPOP @test2_b\nINC @test2_b\nRET\n'], - ['#pragma optimizationLevel 0\n#include APIFunctions\nlong a;Set_A1(a);', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFUN set_A1 $a\nFIN\n'], - ['#pragma optimizationLevel 0\n#include APIFunctions\nSet_A1();', true, ''], - ['#pragma optimizationLevel 0\nlong *a; a=test(); long *test(void) { long b; return &b; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test_b\n\nJSR :__fn_test\nPOP @a\nFIN\n\n__fn_test:\nSET @r0 #0000000000000004\nPSH $r0\nRET\n'], - ['long a; a=test(); long *test(void) { long b; return &b; }', true, ''], - ['long *a; a=test(); long *test(void) { long b; return b; }', true, ''], - ['struct KOMBI { long driver; long collector; long passenger; } car, car2; car = teste(); struct KOMBI teste(void){ return car; }', true, ''], - ['Declarations', null, 'div'], - ['long ,b;', true, ''], - - ['Improvements v0.3', null, ''], - [ - // Function returning struct pointer - 'struct KOMBI { long driver, collector, passenger; } *val; val = teste(); val = test2(); struct KOMBI *teste(void) { struct KOMBI tt2; return &tt2; } struct KOMBI *test2(void) { struct KOMBI *stt2; return stt2; }', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare val\n^declare teste_tt2_driver\n^declare teste_tt2_collector\n^declare teste_tt2_passenger\n^declare test2_stt2\n\nJSR :__fn_teste\nPOP @r0\nSET @val $r0\nJSR :__fn_test2\nPOP @r0\nSET @val $r0\nFIN\n\n__fn_teste:\nSET @r0 #0000000000000004\nPSH $r0\nRET\n\n__fn_test2:\nPSH $test2_stt2\nRET\n' - ], - [ - // Error check Function return pointer - 'struct KOMBI { long driver, collector, passenger; } *val; val = teste(); struct KOMBI *teste(void) { struct KOMBI tt2; return tt2; }', - true, - '' - ], - [ - // Modifier on Function -> arr on pointer return value - 'long valLong = teste()[1]; long *teste(void) { long message[4]; return message; }', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare valLong\n^declare teste_message\n^const SET @teste_message #0000000000000005\n^declare teste_message_0\n^declare teste_message_1\n^declare teste_message_2\n^declare teste_message_3\n\nJSR :__fn_teste\nPOP @valLong\nSET @r0 #0000000000000001\nSET @valLong $($valLong + $r0)\nFIN\n\n__fn_teste:\nPSH $teste_message\nRET\n' - ], - // #include APIFunctions\n long *next; void Send_Message(void) { Set_B1(-next);} - // long *a[4], b, c; c = -a[b]; - [ - // Recursion with fibbonacci - '#pragma optimizationLevel 0\nlong a; long counter = 0; a = fibbonacci(12); \nlong fibbonacci(long n) {if(n == 0){ return 0; } else if(n == 1) { return 1; } else { return (fibbonacci(n-1) + fibbonacci(n-2)); } }', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare counter\n^declare fibbonacci_n\n\nCLR @counter\nSET @a #000000000000000c\nPSH $a\nJSR :__fn_fibbonacci\nPOP @a\nFIN\n\n__fn_fibbonacci:\nPOP @fibbonacci_n\nBNZ $fibbonacci_n :__if1_else\n__if1_start:\nCLR @r0\nPSH $r0\nRET\nJMP :__if1_endif\n__if1_else:\nSET @r0 #0000000000000001\nBNE $fibbonacci_n $r0 :__if2_else\n__if2_start:\nSET @r0 #0000000000000001\nPSH $r0\nRET\nJMP :__if2_endif\n__if2_else:\nPSH $fibbonacci_n\nSET @r0 $fibbonacci_n\nDEC @r0\nPSH $r0\nJSR :__fn_fibbonacci\nPOP @r0\nPOP @fibbonacci_n\nPSH $fibbonacci_n\nPSH $r0\nSET @r1 $fibbonacci_n\nSET @r2 #0000000000000002\nSUB @r1 $r2\nPSH $r1\nJSR :__fn_fibbonacci\nPOP @r1\nPOP @r0\nPOP @fibbonacci_n\nADD @r0 $r1\nPSH $r0\nRET\n__if2_endif:\n__if1_endif:\nCLR @r0\nPSH $r0\nRET\n' - ], - [ - // void pointer assigment - 'struct KOMBI { long driver; long collector; long passenger; } *pstruct; long *plong; void * pvoid; pvoid = plong; plong = pvoid; pvoid = pstruct; pstruct = pvoid;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare pstruct\n^declare plong\n^declare pvoid\n\nSET @pvoid $plong\nSET @plong $pvoid\nSET @pvoid $pstruct\nSET @pstruct $pvoid\nFIN\n' - ], - [ - // void pointer function arguments and return - `struct KOMBI { long driver; long collector; long passenger; } *pstruct; long *plong; void * pvoid; -teste(pvoid, pvoid); teste(pvoid, pstruct); plong = ret(pvoid, plong); pstruct = ret(pvoid, plong); -void teste( long *aa, void *bb) { aa++, bb++; } -void *ret(long *aa, void *bb) { aa++; return aa; }`, - false, - '^declare r0\n^declare r1\n^declare r2\n^declare pstruct\n^declare plong\n^declare pvoid\n^declare teste_aa\n^declare teste_bb\n^declare ret_aa\n^declare ret_bb\n\nPSH $pvoid\nPSH $pvoid\nJSR :__fn_teste\nPSH $pstruct\nPSH $pvoid\nJSR :__fn_teste\nPSH $plong\nPSH $pvoid\nJSR :__fn_ret\nPOP @r0\nSET @plong $r0\nPSH $plong\nPSH $pvoid\nJSR :__fn_ret\nPOP @r0\nSET @pstruct $r0\nFIN\n\n__fn_teste:\nPOP @teste_aa\nPOP @teste_bb\nINC @teste_aa\nINC @teste_bb\nRET\n\n__fn_ret:\nPOP @ret_aa\nPOP @ret_bb\nINC @ret_aa\nPSH $ret_aa\nRET\n' - ], - [ - // return of null pointer and return of long_ptr at function returning void pointer. Assign this return value to a long_ptr - '#pragma optimizationLevel 0\nlong *plong; plong = malloc(); void *malloc(void) { if (current >=20) { return NULL; } long current++; long mem[20]; return (&mem[current]); }', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare plong\n^declare malloc_current\n^declare malloc_mem\n^const SET @malloc_mem #0000000000000006\n^declare malloc_mem_0\n^declare malloc_mem_1\n^declare malloc_mem_2\n^declare malloc_mem_3\n^declare malloc_mem_4\n^declare malloc_mem_5\n^declare malloc_mem_6\n^declare malloc_mem_7\n^declare malloc_mem_8\n^declare malloc_mem_9\n^declare malloc_mem_10\n^declare malloc_mem_11\n^declare malloc_mem_12\n^declare malloc_mem_13\n^declare malloc_mem_14\n^declare malloc_mem_15\n^declare malloc_mem_16\n^declare malloc_mem_17\n^declare malloc_mem_18\n^declare malloc_mem_19\n\nJSR :__fn_malloc\nPOP @plong\nFIN\n\n__fn_malloc:\nSET @r0 #0000000000000014\nBLT $malloc_current $r0 :__if1_endif\n__if1_start:\nCLR @r0\nPSH $r0\nRET\n__if1_endif:\nINC @malloc_current\nSET @r0 $malloc_mem\nADD @r0 $malloc_current\nPSH $r0\nRET\n' - ], - [ - // Array of pointers and double deference - 'long a, b, *c, *d[2]; c = d[1]; a = *d[1]; a++; c = d[b]; a = *d[b]; a++; d[0]=c; *d[1]=a; a++; d[b]=c; *d[b]=a;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000007\n^declare d_0\n^declare d_1\n\nSET @c $d_1\nSET @a $d_1\nSET @a $($a)\nINC @a\nSET @c $($d + $b)\nSET @a $($d + $b)\nSET @a $($a)\nINC @a\nSET @d_0 $c\nSET @r0 $d_1\nSET @($r0) $a\nINC @a\nSET @($d + $b) $c\nSET @r0 $($d + $b)\nSET @($r0) $a\nFIN\n' - ], - [ - // Muldimensional arrays inside structs - 'struct KOMBI { long driver, collector, passenger[3][3]; } car; long a, b, c; car.passenger[2][2]=c; car.passenger[a][2]=c; car.passenger[2][b]=c; car.passenger[a][b]=c; c=car.passenger[2][2]; c=car.passenger[a][2]; c=car.passenger[2][b]; c=car.passenger[a][b];', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare car_passenger_3\n^declare car_passenger_4\n^declare car_passenger_5\n^declare car_passenger_6\n^declare car_passenger_7\n^declare car_passenger_8\n^declare a\n^declare b\n^declare c\n\nSET @car_passenger_8 $c\nSET @r0 #0000000000000003\nMUL @r0 $a\nINC @r0\nINC @r0\nSET @($car_passenger + $r0) $c\nSET @r0 $b\nSET @r1 #0000000000000006\nADD @r0 $r1\nSET @($car_passenger + $r0) $c\nSET @r0 #0000000000000003\nMUL @r0 $a\nADD @r0 $b\nSET @($car_passenger + $r0) $c\nSET @c $car_passenger_8\nSET @c #0000000000000003\nMUL @c $a\nINC @c\nINC @c\nSET @c $($car_passenger + $c)\nSET @c $b\nSET @r0 #0000000000000006\nADD @c $r0\nSET @c $($car_passenger + $c)\nSET @c #0000000000000003\nMUL @c $a\nADD @c $b\nSET @c $($car_passenger + $c)\nFIN\n' - ], - [ - // Get property LENGTH of an array - 'long a, b[4], c[3][3]; struct KOMBI { long driver; long passenger[6]; } car[2]; a=b.length; a=c.length; a=car.length; a=car[1].passenger.length; a=car[a].passenger.length;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^const SET @b #0000000000000005\n^declare b_0\n^declare b_1\n^declare b_2\n^declare b_3\n^declare c\n^const SET @c #000000000000000a\n^declare c_0\n^declare c_1\n^declare c_2\n^declare c_3\n^declare c_4\n^declare c_5\n^declare c_6\n^declare c_7\n^declare c_8\n^declare car\n^const SET @car #0000000000000014\n^declare car_0_driver\n^declare car_0_passenger\n^const SET @car_0_passenger #0000000000000016\n^declare car_0_passenger_0\n^declare car_0_passenger_1\n^declare car_0_passenger_2\n^declare car_0_passenger_3\n^declare car_0_passenger_4\n^declare car_0_passenger_5\n^declare car_1_driver\n^declare car_1_passenger\n^const SET @car_1_passenger #000000000000001e\n^declare car_1_passenger_0\n^declare car_1_passenger_1\n^declare car_1_passenger_2\n^declare car_1_passenger_3\n^declare car_1_passenger_4\n^declare car_1_passenger_5\n\nSET @a #0000000000000004\nSET @a #0000000000000009\nSET @a #0000000000000002\nSET @a #0000000000000006\nSET @a #0000000000000006\nFIN\n' - ], - [ - // Get property LENGTH of an array in a struct pointer - 'long a; struct KOMBI { long driver; long passenger[6]; } *pcar; a=pcar->passenger.length;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare pcar\n\nSET @a #0000000000000006\nFIN\n' - ], - [ - // Recursive struct pointer declaration - 'struct KOMBI { long driver; long collector; struct KOMBI *next; } ; struct KOMBI car, *pcar, *pnext; pcar=&car; pnext=pcar->next->next;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_next\n^declare pcar\n^declare pnext\n\nSET @pcar #0000000000000003\nSET @r1 #0000000000000002\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000002\nSET @pnext $($r0 + $r1)\nFIN\n' - ], - [ - // Special function 'catch' - '#pragma optimizationLevel 0\n#program activationAmount 0\nlong table[20];\nvoid main (void) { const long a = 0; while (true) { table[a] = fibbonacci(a); halt; a++; } }\nlong fibbonacci(long n) { if(n == 0){ return 0; } else if(n == 1) { return 1; } else { return (fibbonacci(n-1) + fibbonacci(n-2)); } }\nvoid catch(void) { long a++; }', - false, - '^program activationAmount 0\n^declare r0\n^declare r1\n^declare r2\n^declare table\n^const SET @table #0000000000000004\n^declare table_0\n^declare table_1\n^declare table_2\n^declare table_3\n^declare table_4\n^declare table_5\n^declare table_6\n^declare table_7\n^declare table_8\n^declare table_9\n^declare table_10\n^declare table_11\n^declare table_12\n^declare table_13\n^declare table_14\n^declare table_15\n^declare table_16\n^declare table_17\n^declare table_18\n^declare table_19\n^declare main_a\n^declare fibbonacci_n\n^declare catch_a\n\nERR :__fn_catch\nJMP :__fn_main\n\n__fn_main:\nPCS\n^const SET @main_a #0000000000000000\n__loop1_continue:\n__loop1_start:\nPSH $main_a\nJSR :__fn_fibbonacci\nPOP @r0\nSET @($table + $main_a) $r0\nSTP\nINC @main_a\nJMP :__loop1_continue\n__loop1_break:\nFIN\n\n__fn_fibbonacci:\nPOP @fibbonacci_n\nBNZ $fibbonacci_n :__if2_else\n__if2_start:\nCLR @r0\nPSH $r0\nRET\nJMP :__if2_endif\n__if2_else:\nSET @r0 #0000000000000001\nBNE $fibbonacci_n $r0 :__if3_else\n__if3_start:\nSET @r0 #0000000000000001\nPSH $r0\nRET\nJMP :__if3_endif\n__if3_else:\nPSH $fibbonacci_n\nSET @r0 $fibbonacci_n\nDEC @r0\nPSH $r0\nJSR :__fn_fibbonacci\nPOP @r0\nPOP @fibbonacci_n\nPSH $fibbonacci_n\nPSH $r0\nSET @r1 $fibbonacci_n\nSET @r2 #0000000000000002\nSUB @r1 $r2\nPSH $r1\nJSR :__fn_fibbonacci\nPOP @r1\nPOP @r0\nPOP @fibbonacci_n\nADD @r0 $r1\nPSH $r0\nRET\n__if3_endif:\n__if2_endif:\nCLR @r0\nPSH $r0\nRET\n\n__fn_catch:\nPCS\nINC @catch_a\nFIN\n' - ], - [ - // Special function 'catch': no main function - '#pragma optimizationLevel 0\nlong b, a = 0; while (true) { a++; } void catch(void) { long a++; }', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare b\n^declare a\n^declare catch_a\n\nERR :__fn_catch\nCLR @a\n__loop1_continue:\n__loop1_start:\nINC @a\nJMP :__loop1_continue\n__loop1_break:\nFIN\n\n__fn_catch:\nPCS\nINC @catch_a\nFIN\n' - ], - [ - // 'catch' with return statement - '#pragma optimizationLevel 0\nlong b, a = 0; void catch(void) { if (a) return; a++; }', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare b\n^declare a\n\nERR :__fn_catch\nCLR @a\nFIN\n\n__fn_catch:\nPCS\nBZR $a :__if1_endif\n__if1_start:\nFIN\n__if1_endif:\nINC @a\nFIN\n' - ], - [ - // Optimization with const nX variables - '#pragma optimizationLevel 0\nconst long n233 = 233; long a, b[2]; b[a]=233; b[0]=233; while (a<233) { a++; };', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare n233\n^declare a\n^declare b\n^const SET @b #0000000000000006\n^declare b_0\n^declare b_1\n\n^const SET @n233 #00000000000000e9\nSET @($b + $a) $n233\nSET @b_0 $n233\n__loop1_continue:\nBGE $a $n233 :__loop1_break\n__loop1_start:\nINC @a\nJMP :__loop1_continue\n__loop1_break:\nFIN\n' - ], - [ - // Optimization with const nX variables - 'const long n2 = 2; struct KOMBI { long driver; long collector; long passenger; } *pcar; pcar->passenger="Ze";', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare n2\n^declare pcar\n\n^const SET @n2 #0000000000000002\nSET @r0 #000000000000655a\nSET @($pcar + $n2) $r0\nFIN\n' - ], - [ - // Macro codeStackPages test - '#pragma optimizationLevel 0\n#program codeStackPages 10 \nlong a; void test(void) { a++; return; a++; }', - false, - '^program codeStackPages 10\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n\n__fn_test:\nINC @a\nRET\nINC @a\nRET\n' - ], - [ - // Macro userStackPages test - '#pragma optimizationLevel 0\n#program codeStackPages 0 \n#program userStackPages 5\n long a; void test(long aa) { a++; return; a++; }', - false, - '^program userStackPages 5\n^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test_aa\n\nFIN\n\n__fn_test:\nPOP @test_aa\nINC @a\nRET\nINC @a\nRET\n' - ], - [ - // Macro codeStackPages error test - '#program codeStackPages a\n#program userStackPages 0\nlong a; void test(void) { a++; return; a++; }', - true, - '' - ], - [ - // Macro outputSourceLineNumber test - '#pragma outputSourceLineNumber\nlong a=5;\nif (a==6){\na--;\n}\n#pragma optimizationLevel 0\n', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n^comment line 3\nSET @a #0000000000000005\n^comment line 4\nSET @r0 #0000000000000006\nBNE $a $r0 :__if1_endif\n__if1_start:\n^comment line 5\nDEC @a\n__if1_endif:\nFIN\n' - ], - /* - [ - // C - '', - false, - '' - ], - */ - - // optimizationLevel 3 - ['optimizationLevel 3', null, 'div'], - ['#pragma optimizationLevel 3\nlong a,b; for (a=0;a<10;a++) { b++; } b--;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nCLR @a\n__loop1_condition:\nSET @r0 #000000000000000a\nBGE $a $r0 :__loop1_break\nINC @b\nINC @a\nJMP :__loop1_condition\n__loop1_break:\nDEC @b\nFIN\n'], - ['#pragma optimizationLevel 3\nlong a,b; while (b) {a++; while (1) { if (a) break; } } a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\n__loop1_continue:\nBZR $b :__loop1_break\nINC @a\n__loop2_continue:\nBNZ $a :__loop1_continue\nJMP :__loop2_continue\n__loop1_break:\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 3\nlong a,b; if (!b) {a++; } b++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBNZ $b :__if1_endif\nINC @a\n__if1_endif:\nINC @b\nFIN\n'], - ['#pragma optimizationLevel 3\nlong a,b; void main (void) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\n\nPCS\nINC @a\nFIN\n'], - ['#pragma optimizationLevel 3\nlong a,b; if (!b) {a++; } else { b++;} ', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBNZ $b :__if1_else\nINC @a\nFIN\n__if1_else:\nINC @b\nFIN\n'], - ['#pragma optimizationLevel 3\nlong a,b; test(); void test (void) { if (a) a++; else b++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test\nFIN\n\n__fn_test:\nBZR $a :__if1_else\nINC @a\nRET\n__if1_else:\nINC @b\nRET\n'], - ['#pragma optimizationLevel 3\nlong a,b; test(); exit; a++; void test (void) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test\nFIN\n\n__fn_test:\nINC @a\nRET\n'], - ['#pragma optimizationLevel 3\nlong a,b; test(); void test (void) { return; a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test\nFIN\n\n__fn_test:\nRET\n'], - ['#pragma optimizationLevel 3\nlong a,b; test(); void test (void) { if (a) a++; else b++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test\nFIN\n\n__fn_test:\nBZR $a :__if1_else\nINC @a\nRET\n__if1_else:\nINC @b\nRET\n'], - ['#pragma optimizationLevel 3\nlong a, b, c, d; a=(b*c)*d;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @a $b\nMUL @a $c\nMUL @a $d\nFIN\n'], - ['#pragma optimizationLevel 3\nlong a[4][2], *b, c,d; b=&a[c][d];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n^declare d\n\nSET @r0 #0000000000000002\nMUL @r0 $c\nADD @r0 $d\nSET @b $a\nADD @b $r0\nFIN\n'], - - ['#pragma optimizationLevel 3\n long a; a=0; void test(void){ a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFIN\n\n'], - [`#pragma optimizationLevel 3\nstruct KOMBI { long driver; long collector; long passenger; } ;struct KOMBI car, *pcar;long a, b, *c, d[2],z;pcar=&car; -pcar->passenger='Ze'; -pcar->driver=a; -b+=-a; -a=0; -d[a]=5; -for (a=0;a<10;a++) d[a]=1;\n -pcar->driver=*c;pcar->driver=d[1];pcar->driver=d[a];pcar->driver=pcar->collector; -a=pcar->collector;z++;*c=pcar->driver;d[1]=pcar->collector;d[a]=pcar->collector;`, false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000b\n^declare d_0\n^declare d_1\n^declare z\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000002\nSET @($pcar + $r1) $r0\nSET @($pcar) $a\nCLR @r0\nSUB @r0 $a\nADD @b $r0\nSET @r0 #0000000000000005\nSET @($d) $r0\nCLR @a\n__loop1_condition:\nSET @r0 #000000000000000a\nBGE $a $r0 :__loop1_break\nSET @r0 #0000000000000001\nSET @($d + $a) $r0\nINC @a\nJMP :__loop1_condition\n__loop1_break:\nSET @r0 $($c)\nSET @($pcar) $r0\nSET @($pcar) $d_1\nSET @r0 $($d + $a)\nSET @($pcar) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($pcar) $r0\nSET @r0 #0000000000000001\nSET @a $($pcar + $r0)\nINC @z\nSET @r0 $($pcar)\nSET @($c) $r0\nSET @r0 #0000000000000001\nSET @d_1 $($pcar + $r0)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n'], - ['#pragma optimizationLevel 3\n long d[2]; d[1]=d[1]+1;', false, '^declare r0\n^declare r1\n^declare r2\n^declare d\n^const SET @d #0000000000000004\n^declare d_0\n^declare d_1\n\nINC @d_1\nFIN\n'], - [`#pragma optimizationLevel 3\n#pragma maxConstVars 3\nstruct KOMBI { long driver; long collector; long passenger; } ;struct KOMBI car, *pcar;long a, b, *c, d[2],z;pcar=&car; -pcar->passenger='Ze'; -pcar->driver=a; -b+=-a; -a=0; -d[a]=5; -for (a=0;a<10;a++) d[a]=1;\n -pcar->driver=*c;pcar->driver=d[1];pcar->driver=d[a];pcar->driver=pcar->collector; -a=pcar->collector;z++;*c=pcar->driver;d[1]=pcar->collector;d[a]=pcar->collector;`, false, '^declare r0\n^declare r1\n^declare r2\n^declare n1\n^const SET @n1 #0000000000000001\n^declare n2\n^const SET @n2 #0000000000000002\n^declare n3\n^const SET @n3 #0000000000000003\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000e\n^declare d_0\n^declare d_1\n^declare z\n\nSET @pcar #0000000000000006\nSET @r0 #000000000000655a\nSET @($pcar + $n2) $r0\nSET @($pcar) $a\nCLR @r0\nSUB @r0 $a\nADD @b $r0\nSET @r0 #0000000000000005\nSET @($d) $r0\nCLR @a\n__loop1_condition:\nSET @r0 #000000000000000a\nBGE $a $r0 :__loop1_break\nSET @($d + $a) $n1\nINC @a\nJMP :__loop1_condition\n__loop1_break:\nSET @r0 $($c)\nSET @($pcar) $r0\nSET @($pcar) $d_1\nSET @r0 $($d + $a)\nSET @($pcar) $r0\nSET @r0 $($pcar + $n1)\nSET @($pcar) $r0\nSET @a $($pcar + $n1)\nINC @z\nSET @r0 $($pcar)\nSET @($c) $r0\nSET @d_1 $($pcar + $n1)\nSET @r0 $($pcar + $n1)\nSET @($d + $a) $r0\nFIN\n'], - ['#pragma optimizationLevel 3\n#pragma maxConstVars 3\nlong a, b, c; teste(a, 2); void teste(long aa, long bb) { aa=bb;} ', false, '^declare r0\n^declare r1\n^declare r2\n^declare n1\n^const SET @n1 #0000000000000001\n^declare n2\n^const SET @n2 #0000000000000002\n^declare n3\n^const SET @n3 #0000000000000003\n^declare a\n^declare b\n^declare c\n^declare teste_aa\n^declare teste_bb\n\nPSH $n2\nPSH $a\nJSR :__fn_teste\nFIN\n\n__fn_teste:\nPOP @teste_aa\nPOP @teste_bb\nSET @teste_aa $teste_bb\nRET\n'], - ['#pragma optimizationLevel 3\n#pragma maxConstVars 3\nsleep 1;', false, '^declare r0\n^declare r1\n^declare r2\n^declare n1\n^const SET @n1 #0000000000000001\n^declare n2\n^const SET @n2 #0000000000000002\n^declare n3\n^const SET @n3 #0000000000000003\n\nSLP $n1\nFIN\n'], - ['#pragma optimizationLevel 3\n long a,b; if ( a==4 && (b || a )) { a++; a=4;} b++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @r0 #0000000000000004\nBNE $a $r0 :__if1_endif\nBNZ $b :__if1_start\nBZR $a :__if1_endif\n__if1_start:\nINC @a\nSET @a #0000000000000004\n__if1_endif:\nINC @b\nFIN\n'], - ['#pragma optimizationLevel 3\n long a,b, c; if ( a==4 && (b || a>c )) { a++; a=4; } b++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 #0000000000000004\nBNE $a $r0 :__if1_endif\nBNZ $b :__if1_start\nBLE $a $c :__if1_endif\n__if1_start:\nINC @a\nSET @a #0000000000000004\n__if1_endif:\nINC @b\nFIN\n'], - ['#pragma optimizationLevel 3\n long a; a=~a;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nNOT @a\nFIN\n'], - ['#pragma optimizationLevel 3\n long a, b; tt(teste(b)); long teste(long c){ return ++c; } void tt(long d){ d++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare teste_c\n^declare tt_d\n\nPSH $b\nJSR :__fn_teste\nJSR :__fn_tt\nFIN\n\n__fn_teste:\nPOP @teste_c\nINC @teste_c\nPSH $teste_c\nRET\n\n__fn_tt:\nPOP @tt_d\nINC @tt_d\nRET\n'], - ['#pragma optimizationLevel 3\n long a, b; /* No opt: interference with reuseVariable */ a=teste(teste(b)); tt(a); long teste(long c){ return ++c; } void tt(long d){ d++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare teste_c\n^declare tt_d\n\nPSH $b\nJSR :__fn_teste\nPOP @a\nPSH $a\nJSR :__fn_teste\nPOP @a\nPSH $a\nJSR :__fn_tt\nFIN\n\n__fn_teste:\nPOP @teste_c\nINC @teste_c\nPSH $teste_c\nRET\n\n__fn_tt:\nPOP @tt_d\nINC @tt_d\nRET\n'], - // [ "", false, "" ], - - // const keyword - ['const keyword', null, 'div'], - ['struct KOMBI { long driver; long collector; long passenger[4]; } car[2]; long a, b, *c, d[2];\nconst a=353; const d[1]=354; const car[1].driver=355; const car[0].passenger[1]=356;', false, '^declare r0\n^declare r1\n^declare r2\n^declare car\n^const SET @car #0000000000000004\n^declare car_0_driver\n^declare car_0_collector\n^declare car_0_passenger\n^const SET @car_0_passenger #0000000000000007\n^declare car_0_passenger_0\n^declare car_0_passenger_1\n^declare car_0_passenger_2\n^declare car_0_passenger_3\n^declare car_1_driver\n^declare car_1_collector\n^declare car_1_passenger\n^const SET @car_1_passenger #000000000000000e\n^declare car_1_passenger_0\n^declare car_1_passenger_1\n^declare car_1_passenger_2\n^declare car_1_passenger_3\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000016\n^declare d_0\n^declare d_1\n\n^const SET @a #0000000000000161\n^const SET @d_1 #0000000000000162\n^const SET @car_1_driver #0000000000000163\n^const SET @car_0_passenger_1 #0000000000000164\nFIN\n'], - ['long a, b, *c, d[2]; a++; const long e=5; a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000007\n^declare d_0\n^declare d_1\n^declare e\n\nINC @a\n^const SET @e #0000000000000005\nINC @a\nFIN\n'], - ['long a, b, *c, d[2]; a++; const long e=5; a++; e++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000007\n^declare d_0\n^declare d_1\n^declare e\n\nINC @a\n^const SET @e #0000000000000005\nINC @a\nINC @e\nFIN\n'], - ['long a, b, *c, d[2]; a++; const long e=5; const a=2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000007\n^declare d_0\n^declare d_1\n^declare e\n\nINC @a\n^const SET @e #0000000000000005\n^const SET @a #0000000000000002\nFIN\n'], - ['long a, b, *c, d[2]; a++; const b=3+3+4;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000007\n^declare d_0\n^declare d_1\n\nINC @a\n^const SET @b #000000000000000a\nFIN\n'], - ['long a, b, *c, d[2]; const d=&a;', true, ''], - ['long a, b, *c, d[2]; const long e=3; a++; const e=4;', true, ''], - ['long a, b, *c, d[2]; a++; const b=3+3+4;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #0000000000000007\n^declare d_0\n^declare d_1\n\nINC @a\n^const SET @b #000000000000000a\nFIN\n'], - // when const declaration in multilong assigment, change CLR to SET #0 - ["long a[3]; const a[]='alow'; a[]='tchau';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n\n^const SET @a_0 #00000000776f6c61\n^const SET @a_1 #0000000000000000\n^const SET @a_2 #0000000000000000\nSET @a_0 #0000007561686374\nCLR @a_1\nCLR @a_2\nFIN\n'], - // After above optimizations, this code was being executed wrong - ['long a, b[5]; b[]=&a;', true, ''], - // [ "", false, "" ], - - // program macro - ['macro program', null, 'div'], - ['#program name tEst2\n long a; a++;', false, '^program name tEst2\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n'], - ['#program description test teste tesssttt\n long a; a++;', false, '^program description test teste tesssttt\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n'], - ['#program activationAmount 100000\n long a; a++;', false, '^program activationAmount 100000\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n'], - ['#program name test-2\n long a; a++;', true, ''], - ['#program name test2 d\n long a; a++;', true, ''], - ['#program activationAmount 0xff\n long a; a++;', true, ''], - // allow _ in activationAmount - ['#program activationAmount 5_0000_0000', false, '^program activationAmount 500000000\n^declare r0\n^declare r1\n^declare r2\n\nFIN\n'], - // [ "", false, "" ], - - // define macro - ['macro define', null, 'div'], - ['#define MAX 4\nlong a; a=MAX; long MAXimus=2;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare MAXimus\n\nSET @a #0000000000000004\nSET @MAXimus #0000000000000002\nFIN\n'], - ['#define MAX 4\n long a; a=MAX;\n #define MAX 2\n long MAXimus=MAX;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare MAXimus\n\nSET @a #0000000000000004\nSET @MAXimus #0000000000000002\nFIN\n'], - ['#define MAX 4\n long a; a=MAX;\n #define MAX \n long MAXimus=MAX;', true, ''], - ['#define 444 4\nlong a; a=444;\n #undef 444\nlong MAXimus=444;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare MAXimus\n\nSET @a #0000000000000004\nSET @MAXimus #00000000000001bc\nFIN\n'], - ['#pragma optimizationLevel 0\n#define MAX 4\n#define MAX1 (MAX + 1)\n long a; if (a > MAX1) a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000005\nBLE $a $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - ['#pragma optimizationLevel 0\n#define MAX 4\n#define MAX1 (MAX + 1)\n#undef MAX\n long a; if (a > MAX1) a++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #0000000000000005\nBLE $a $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - // [ "", false, "" ], - - // ifdef macro - [ - 'macro ifdef', - null, - 'div' - ], - [ - '#define debug\n#ifdef debug\n#pragma maxAuxVars 1\n#endif\nlong a; a++;', - false, - '^declare r0\n^declare a\n\nINC @a\nFIN\n' - ], - [ - '#ifdef debug\n#pragma maxAuxVars 1\n#endif\nlong a; a++;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nINC @a\nFIN\n' - ], - [ - '#ifdef debug\n#pragma maxAuxVars 1\n#else\n#pragma maxAuxVars 5\n#endif\nlong a; a++;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare r3\n^declare r4\n^declare a\n\nINC @a\nFIN\n' - ], - [ - '#define A1\n#define A2\n\n#ifdef A1\nlong a1;\n# ifdef A2\nlong a2;\n# endif\n#endif\n\n#ifdef A1\na1++;\n#endif\n\n#ifdef A2\na2++;\n#endif', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a1\n^declare a2\n\nINC @a1\nINC @a2\nFIN\n' - ], - [ - '#define A1\n\n#ifdef A1\nlong a1;\n# ifdef A2\nlong a2;\n# endif\n#endif\n\n#ifdef A1\na1++;\n#endif\n\n#ifdef A2\na2++;\n#endif', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a1\n\nINC @a1\nFIN\n' - ], - [ - '#ifdef A1\nlong a1;\n# ifdef A2\nlong a2;\n# endif\n#endif\n\n#ifdef A1\na1++;\n#endif\n\n#ifdef A2\na2++;\n#endif', - false, - '^declare r0\n^declare r1\n^declare r2\n\nFIN\n' - ], - [ - '#define A2\n\n#ifdef A1\nlong a1;\n# ifdef A2\nlong a2;\n# endif\n#endif\n\n#ifdef A1\na1++;\n#endif\n\n#ifdef A2\na2++;\n#endif', - true, - '' - ], - - // bugfixes - ['Bug fixes', null, 'div'], - // bug 1, goto failed with undeclared variable - ['#pragma optimizationLevel 0\nvoid teste(long ret) { long temp = 2; goto newlabel; ret = temp; newlabel: temp++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare teste_ret\n^declare teste_temp\n\nFIN\n\n__fn_teste:\nPOP @teste_ret\nSET @teste_temp #0000000000000002\nJMP :newlabel\nSET @teste_ret $teste_temp\nnewlabel:\nINC @teste_temp\nRET\n'], - // bug 2, failed when declaring pointer on function declaration - ['#pragma optimizationLevel 0\nvoid teste(long * ret) { long temp = 2; goto newlabel; ret[temp] = temp; newlabel: temp++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare teste_ret\n^declare teste_temp\n\nFIN\n\n__fn_teste:\nPOP @teste_ret\nSET @teste_temp #0000000000000002\nJMP :newlabel\nSET @($teste_ret + $teste_temp) $teste_temp\nnewlabel:\nINC @teste_temp\nRET\n'], - ['#pragma optimizationLevel 0\nvoid teste(long * ret) { long temp = 2; goto newlabel; *(ret+temp) = temp; newlabel: temp++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare teste_ret\n^declare teste_temp\n\nFIN\n\n__fn_teste:\nPOP @teste_ret\nSET @teste_temp #0000000000000002\nJMP :newlabel\nSET @r0 $teste_ret\nADD @r0 $teste_temp\nSET @($r0) $teste_temp\nnewlabel:\nINC @teste_temp\nRET\n'], - // bug 3, ReuseAssignedVar not working inside a function. - ["#pragma optimizationLevel 0\n#pragma maxAuxVars 2\nlong itoa(long val) {\n long ret, temp;\n if (val >= 0 && val <= 99999999) { ret = (ret << 8) + temp; return ret; }\n return '#error';\n}", false, '^declare r0\n^declare r1\n^declare itoa_val\n^declare itoa_ret\n^declare itoa_temp\n\nFIN\n\n__fn_itoa:\nPOP @itoa_val\nCLR @r0\nBLT $itoa_val $r0 :__if1_endif\n__AND_2_next:\nSET @r0 #0000000005f5e0ff\nBGT $itoa_val $r0 :__if1_endif\nJMP :__if1_start\n__if1_start:\nSET @r0 $itoa_ret\nSET @r1 #0000000000000008\nSHL @r0 $r1\nADD @r0 $itoa_temp\nSET @itoa_ret $r0\nPSH $itoa_ret\nRET\n__if1_endif:\nSET @r0 #0000726f72726523\nPSH $r0\nRET\n'], - // bug 4, Double declaration causing array pointer to point wrong location. - ['long a=0; long b; a++; long a=3;', true, ''], - ['long a=0; long b; a++; void test(void) { a++; } long tt(void) { a++;} long test(void) {a++; return a; }', true, ''], - ['long a=0; long b; a++; void test(void) { a++; } long tt(void) { a++;} long test(void) {a++; return a; }', true, ''], - ['#pragma optimizationLevel 0\nlong a=0; void Get_B1(void) { a++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFIN\n\n__fn_Get_B1:\nINC @a\nRET\n'], - ['#include APIFunctions\nlong a=0; void Get_B1(void) { a++; }', true, ''], - ['long a=0; mylabel: a++; void temp(void) { a++; mylabel: a++; }', true, ''], - // bug 5, reuseAssignedVar not working inside functions. - ['#pragma optimizationLevel 0\nvoid test(void) { long t, a; t = a+1; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare test_t\n^declare test_a\n\nFIN\n\n__fn_test:\nSET @test_t $test_a\nINC @test_t\nRET\n'], - // bug 6, removed warning when function returning long had no assignment. (removed failed case from other testcase - // bug 7, array type definition not found when declaring array inside functions. - ['#pragma optimizationLevel 0\nvoid test(void) { long t[2], a; t[a] = 1; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare test_t\n^const SET @test_t #0000000000000004\n^declare test_t_0\n^declare test_t_1\n^declare test_a\n\nFIN\n\n__fn_test:\nSET @r0 #0000000000000001\nSET @($test_t + $test_a) $r0\nRET\n'], - // bug 8, wrong order of stack for function call - ['long ga, gb, gc; test(ga, gb, gc); void test(long a, long b, long c) { a+=b+c; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare ga\n^declare gb\n^declare gc\n^declare test_a\n^declare test_b\n^declare test_c\n\nPSH $gc\nPSH $gb\nPSH $ga\nJSR :__fn_test\nFIN\n\n__fn_test:\nPOP @test_a\nPOP @test_b\nPOP @test_c\nSET @r0 $test_b\nADD @r0 $test_c\nADD @test_a $r0\nRET\n'], - // optimization: array with constant index now used for reuseAssignedVar - ['long a[2], b; a[1]=b+1;', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare b\n\nSET @a_1 $b\nINC @a_1\nFIN\n'], - // Support for array notation on pointer variable. - ['#pragma optimizationLevel 0\nlong b; void teste(long * poper) { poper[3]=0; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare b\n^declare teste_poper\n\nFIN\n\n__fn_teste:\nPOP @teste_poper\nCLR @r0\nSET @r1 #0000000000000003\nSET @($teste_poper + $r1) $r0\nRET\n'], - // Support for check variable types on function calls - ['long a, b; teste(a, b); void teste(long *fa, long fb) { fb++; }', true, ''], - ['long * a, b; teste(a, b); void teste(long *fa, long fb) { fb++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare teste_fa\n^declare teste_fb\n\nPSH $b\nPSH $a\nJSR :__fn_teste\nFIN\n\n__fn_teste:\nPOP @teste_fa\nPOP @teste_fb\nINC @teste_fb\nRET\n'], - ['long * a, b; teste(a, *a); void teste(long *fa, long fb) { fb++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare teste_fa\n^declare teste_fb\n\nSET @r0 $($a)\nPSH $r0\nPSH $a\nJSR :__fn_teste\nFIN\n\n__fn_teste:\nPOP @teste_fa\nPOP @teste_fb\nINC @teste_fb\nRET\n'], - ['long * a, b; teste(&b, b); void teste(long *fa, long fb) { fb++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare teste_fa\n^declare teste_fb\n\nPSH $b\nSET @r0 #0000000000000004\nPSH $r0\nJSR :__fn_teste\nFIN\n\n__fn_teste:\nPOP @teste_fa\nPOP @teste_fb\nINC @teste_fb\nRET\n'], - ["struct KOMBI { long driver; long collector; long passenger; } ;struct KOMBI car, *pcar;long a, b;pcar=&car;\n teste(car);\n void teste(struct KOMBI * value) { value->driver = 'Zé'; }", true, ''], - ["struct KOMBI { long driver; long collector; long passenger; } ;struct KOMBI car, *pcar;long a, b;pcar=&car;\n teste(pcar);\n void teste(struct KOMBI * value) { value->driver = 'Zé'; }", false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare pcar\n^declare a\n^declare b\n^declare teste_value\n\nSET @pcar #0000000000000003\nPSH $pcar\nJSR :__fn_teste\nFIN\n\n__fn_teste:\nPOP @teste_value\nSET @r0 #0000000000a9c35a\nSET @($teste_value) $r0\nRET\n'], - // Support for check variable types on API Function calls - ['#include APIFunctions\nlong * a;Set_A1(a);', true, ''], - // Support SetUnaryOperator in struct members, but not if it is an array - ['struct KOMBI { long driver; long collector; long passenger[4]; } car; long a, b; ++car.driver; a=car.collector++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare car_passenger_3\n^declare a\n^declare b\n\nINC @car_driver\nSET @a $car_collector\nINC @car_collector\nFIN\n'], - ['struct KOMBI { long driver; long collector; long passenger[4]; } car; long a, b; ++car.passenger[a]; ', true, ''], - // bug 9, missing comma before if, while and for keywords lead to no error and statement being ignored. - ['#pragma optimizationLevel 0\nlong a, b; test2() if (a) a++; long test2(void) { b++; return b; }', true, ''], - ['#pragma optimizationLevel 0\nlong a, b; test2(); if (a) a++; long test2(void) { b++; return b; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test2\nPOP @r0\nBZR $a :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n\n__fn_test2:\nINC @b\nPSH $b\nRET\n'], - // bug 10, functions calls destroying content of registers. Implemented saving them in user stack - ["long a[5], b, c; b=atoi(c); a[b+1]=atoi('2'); a[b+1]=(b*2)/atoi('2'); long atoi(long val){return val+1;}", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare b\n^declare c\n^declare atoi_val\n\nPSH $c\nJSR :__fn_atoi\nPOP @b\nSET @r0 $b\nINC @r0\nPSH $r0\nSET @r1 #0000000000000032\nPSH $r1\nJSR :__fn_atoi\nPOP @r1\nPOP @r0\nSET @($a + $r0) $r1\nSET @r0 $b\nINC @r0\nSET @r1 #0000000000000002\nMUL @r1 $b\nPSH $r1\nPSH $r0\nSET @r2 #0000000000000032\nPSH $r2\nJSR :__fn_atoi\nPOP @r2\nPOP @r0\nPOP @r1\nDIV @r1 $r2\nSET @($a + $r0) $r1\nFIN\n\n__fn_atoi:\nPOP @atoi_val\nSET @r0 $atoi_val\nINC @r0\nPSH $r0\nRET\n'], - // bug 11, function calls inside array brackets lead to error. - ['long a[5], b, c; b=a[atoi("2")+1]; long atoi(long val){ return val+1;}', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare b\n^declare c\n^declare atoi_val\n\nSET @b #0000000000000032\nPSH $b\nJSR :__fn_atoi\nPOP @b\nINC @b\nSET @b $($a + $b)\nFIN\n\n__fn_atoi:\nPOP @atoi_val\nSET @r0 $atoi_val\nINC @r0\nPSH $r0\nRET\n'], - // bug 13, optimization deleting assembly compiler directives - ['#pragma optimizationLevel 3\nwhile (1) halt; const long n8=8, n10=10, n0xff=0xff; long atoi(long val) { return 3; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare n8\n^declare n10\n^declare n0xff\n^declare atoi_val\n\n__loop1_continue:\nSTP\nJMP :__loop1_continue\n^const SET @n8 #0000000000000008\n^const SET @n10 #000000000000000a\n^const SET @n0xff #00000000000000ff\n\n'], - // bug 14, (more) optimization deleting assembly compiler directives - ['#pragma optimizationLevel 3\n teste(); exit; const long n0xff=0xff; void teste(void) { const long b=5; b++; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare n0xff\n^declare teste_b\n\nJSR :__fn_teste\nFIN\n^const SET @n0xff #00000000000000ff\n\n__fn_teste:\n^const SET @teste_b #0000000000000005\nINC @teste_b\nRET\n'], - // bug 15, Need to be more restrictive on optimizationLevel 3 for PSH and POP - ['#pragma optimizationLevel 3\n long a, b; a=b;insertPlayer(a); void insertPlayer(long address) { long id; id=(address >> 27); }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare insertPlayer_address\n^declare insertPlayer_id\n\nSET @a $b\nPSH $a\nJSR :__fn_insertPlayer\nFIN\n\n__fn_insertPlayer:\nPOP @insertPlayer_address\nSET @insertPlayer_id $insertPlayer_address\nSET @r0 #000000000000001b\nSHR @insertPlayer_id $r0\nRET\n'], - // bug 16, Could not return or sleep with array and variable index - ['long a, slot[4]; sleep slot[a];', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare slot\n^const SET @slot #0000000000000005\n^declare slot_0\n^declare slot_1\n^declare slot_2\n^declare slot_3\n\nSET @r0 $($slot + $a)\nSLP $r0\nFIN\n'], - // bug 17 Could not start program with function - ['XOR_A_with_B();\n#include APIFunctions', false, '^declare r0\n^declare r1\n^declare r2\n\nFUN XOR_A_with_B\nFIN\n'], - // bug 18 Fix infinite recursion loop with wrong code - ['Send_To_Address_In_B(sendEachBlockNQT) sleep SLP_BLOCKS;', true, ''], - // bug19 Optimization creating wrong code. Removed optimization on double SET instruction - ['#pragma optimizationLevel 3\nlong _idx, uCount; _idx = ~(_idx+uCount); uCount = _idx; _idx++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare _idx\n^declare uCount\n\nSET @r0 $_idx\nADD @r0 $uCount\nNOT @r0\nSET @_idx $r0\nSET @uCount $_idx\nINC @_idx\nFIN\n'], - // bug 20 Fixes some wrong translation of RS-accounts - ["long a='S-D3HS-T6ML-SJHU-2R5R2';", false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @a #005c77c9272585f8\nFIN\n'], - // bug 21 Memory was not assigned when declaring struct after a struct pointer - ['#pragma optimizationLevel 0\nstruct KOMBI { long driver; long collector; long passenger; }; void teste(void) { struct KOMBI tt2, *stru, tt, *stru2; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare teste_tt2_driver\n^declare teste_tt2_collector\n^declare teste_tt2_passenger\n^declare teste_stru\n^declare teste_tt_driver\n^declare teste_tt_collector\n^declare teste_tt_passenger\n^declare teste_stru2\n\nFIN\n\n__fn_teste:\nRET\n'], - // bug 22 Function/API Functions on conditional not being evaluated - ['#pragma optimizationLevel 0\nlong a=0; if (test2(a)){ a++; } long test2(long b) { b++; return b; }', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test2_b\n\nCLR @a\nPSH $a\nJSR :__fn_test2\nPOP @r0\nBZR $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n\n__fn_test2:\nPOP @test2_b\nINC @test2_b\nPSH $test2_b\nRET\n'], - ['#pragma optimizationLevel 0\n#include APIFunctions\n long a=0; if (Get_A1()){ a++;} ', false, '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @a\nFUN @r0 get_A1\nBZR $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n'], - // bug 23 Parser trying to get property of undefined variable - ['long a, b; *a + 1 = b', true, ''], - // bug 24 Wrong code being sucessfull compiled: ASM and Label disregarding information before them. - ['void teste(long ret) { long temp = 2; if (temp==2){ goto div_end: } ret = temp; div_end: temp++; }', true, ''], - ['long a, b; a++; long c, asm { PSH $a\nPOP @b } b++;', true, ''], - // bug 25 Incompatibility with const keyword and optimization for contants values - ['#pragma maxConstVars 3\nconst long a = 1;const long n256 = 256;const long ac = 256;long ad = 256, ae = ac;', false, '^declare r0\n^declare r1\n^declare r2\n^declare n1\n^const SET @n1 #0000000000000001\n^declare n2\n^const SET @n2 #0000000000000002\n^declare n3\n^const SET @n3 #0000000000000003\n^declare a\n^declare n256\n^declare ac\n^declare ad\n^declare ae\n\n^const SET @a #0000000000000001\n^const SET @n256 #0000000000000100\n^const SET @ac #0000000000000100\nSET @ad $n256\nSET @ae $ac\nFIN\n'], - // bug 26 Keyword substring in variable name causing error - ['long doing; doing++;', false, '^declare r0\n^declare r1\n^declare r2\n^declare doing\n\nINC @doing\nFIN\n'], - // [ "", false, "" ], - ['End of tests!', null, ''] -] - -// params: asmcode, expect error?, bytecode, bytedata -export const bytecodeTests: AssemblyTestType[] = [ - [ - 'FIN\n', - false, - '28', - '' - ], - [ - 'SET @a #0000000000000100\nSET @b $a\nCLR @b\nINC @b\nDEC @a\nADD @a $b\nSUB @a $b\nMUL @a $b\nDIV @a $b\nBOR @a $b\nAND @a $b\nXOR @a $b\nSET @a $b\nNOT @a\nSET @a $($b)\nSET @a $c\nADD @a $b\nSET @a $($b + $c)\nPSH $b\nJSR :__fn_teste\nPOP @a\nSET @($a) $b\nSET @($a + $b) $c\nMOD @a $b\nSHL @a $b\nSHR @a $b\nSLP $a\nJMP :__fn_main\n\n__fn_teste:\nPOP @teste_d\nSET @r0 $teste_d\nINC @r0\nPSH $r0\nRET\n\n__fn_main:\nPCS\nINC @a\nFIN', - false, - '010000000000010000000000000201000000000000000301000000040100000005000000000600000000010000000700000000010000000800000000010000000900000000010000000a00000000010000000b00000000010000000c00000000010000000200000000010000000d000000000e00000000010000000200000000020000000600000000010000000f000000000100000002000000100100000012e400000011000000001400000000010000001500000000010000000200000016000000000100000017000000000100000018000000000100000025000000001afd0000001103000000020400000003000000040400000010040000001330040000000028', - '' - ], - [ - 'BZR $a :__if1_endif\nINC @b\n__if1_endif:\nBNZ $a :__if2_endif\nINC @b\n__if2_endif:\nBLE $a $b :__if3_endif\nINC @b\n__if3_endif:\nBGE $a $b :__if4_endif\nINC @b\n__if4_endif:\nBLT $a $b :__if5_endif\nINC @b\n__if5_endif:\nBGT $a $b :__if6_endif\nINC @b\n__if6_endif:\nBNE $a $b :__if7_endif\nINC @b\n__if7_endif:\nBEQ $a $b :__if8_endif\nINC @b\n__if8_endif:\nFIN\n', - false, - '1b000000000b04010000001e000000000b04010000002200000000010000000f04010000002100000000010000000f04010000002000000000010000000f04010000001f00000000010000000f04010000002400000000010000000f04010000002300000000010000000f040100000028', - '' - ], - [ - 'BZR $a :__if1_endif\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\n__if1_endif:\nINC @b\nFIN\n', - false, - '1e000000000b1a8d00000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000040100000028', - '' - ], - [ - '__loop1_continue:\nBZR $a :__loop1_break\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nJMP :__loop1_continue\n__loop1_break:\nINC @b\nFIN\n', - false, - '1e000000000b1a850000000100000000010000000000000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000001a00000000040100000028', - '' - ], - [ - '__loop1_continue:\nSET @a #0000000000000001\nBNZ $a :__loop1_continue\n__loop1_break:\nINC @b\nFIN', - false, - '010000000001000000000000001e00000000f3040100000028', - '' - ], - [ - '__loop1_continue:\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nSET @a #0000000000000001\nBNZ $a :__loop1_continue\n__loop1_break:\nINC @b\nFIN', - false, - '010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000000100000000010000000000000001000000000100000000000000010000000001000000000000001b000000000b1a00000000040100000028', - '' - ], - [ - 'FUN clear_A_B\nFUN set_A1 $a\nFUN set_A1_A2 $a $b\nFUN @a check_A_equals_B\nFUN @a add_Minutes_to_Timestamp $b $c\nFIN\n', - false, - '3222013310010000000034140100000000010000003527010000000037060400000000010000000200000028', - '' - ], - [ - 'SET @a #0000000000000005\nSET @b #0000000000000004\n^const SET @c #9887766554433221\nINC @a\nFIN\n', - false, - '0100000000050000000000000001010000000400000000000000040000000028', - '000000000000000000000000000000002132435465768798' - ], - [ - '^declare r0\n^declare a\n^declare b\n^declare c\n\n^const SET @c #9887766554433221\nSET @a #0000000000000005\nSET @b #0000000000000004\nINC @a\nFIN\n', - false, - '0101000000050000000000000001020000000400000000000000040100000028', - '0000000000000000000000000000000000000000000000002132435465768798' - ], - [ - '^declare r0\n^declare a\n^declare b\n^declare c\n\n^const SET @c #9887766554433221\n^const SET @a #000000000000fafe\nSET @b #0000000000000004\nINC @a\nFIN\n', - false, - '01020000000400000000000000040100000028', - '0000000000000000fefa00000000000000000000000000002132435465768798' - ], - [ - 'FIZ $a\nSTZ $a\nERR :__error\nINC @a\nNOP\nNOP\n__error:\nDEC @a', - false, - '260000000027000000002b1600000004000000007f7f0500000000', - '' - ], - // BUG 12: bug when changing branch with offset overflow (this code causes error on v0.1) - [ - 'BNE $var1 $var15 :lab_aa6\nBNE $var1 $var15 :lab_de2\nlab_aa6:\nSET @var02 #2065726120756f59\nSET @var02 #2065726120756f59\nSET @var02 #2065726120756f59\nSET @var02 #656e776f20746f6e\nSET @var02 #65746920666f2072\nSET @var02 #0000000000002e6d\nFIN\nlab_af3:\nSET @var02 #65746920666f2072\nSET @var02 #65746920666f2072\nSET @var02 #65746920666f2072\nlab_de2:\nFIN\n', - false, - '240000000001000000192300000000010000000f1a8f0000000102000000596f7520617265200102000000596f7520617265200102000000596f75206172652001020000006e6f74206f776e65010200000072206f662069746501020000006d2e00000000000028010200000072206f6620697465010200000072206f6620697465010200000072206f662069746528', - '' - ] - /* [ "", - false, - "", - "" ], -*/ - -] - -// params: asmcode, expect error?, bytecode, bytedata -export const jestBytecodeTests: AssemblyTestType[] = [ - [ - // ok test (ok - ok) - 'FIN\n', - false, - '28', - '' - ], - [ - // ok test (fail - fail) - 'FINest\n', - true, - '', - '' - ], - [ - // fail test (ok - fail) - 'FIN\n', - true, - '', - '' - ], - [ - // fail test (fail - ok) - 'FINest\n', - false, - '28', - '' - ] -] - -export const jestTests: CTestType [] = [ - [ - // ok test (ok - ok) - 'long a, b; a=b;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nFIN\n' - ], - [ - // ok test (fail - fail) - 'long a, b; a=c;', - true, - '' - ], - [ - // fail test (ok - fail) - 'long a, b; a=b;', - true, - '' - ], - [ - // fail test (fail - ok) - 'long a, b; a=c;', - false, - '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nFIN\n' - ] -] diff --git a/dev/src/testcases.ts b/dev/src/testcases.ts deleted file mode 100644 index 521a6a6..0000000 --- a/dev/src/testcases.ts +++ /dev/null @@ -1,108 +0,0 @@ -// Author: Rui Deleterium -// Project: https://github.com/deleterium/SmartC -// License: BSD 3-Clause License - -import { SmartC } from './SmartC/smartc' -import { tests, bytecodeTests, jestTests, jestBytecodeTests } from './templateTests' - -export type CTestType = [string, boolean|null, string] -export type AssemblyTestType = [ string, boolean, string, string] - -export function runTestCases (jestTest: boolean = false) : string { - let itemPass = 0 - let itemFail = 0 - let subItemCount = 0 - - function runTestCasesMain () { - if (jestTest) { - jestTests.forEach(processOneCTest) - jestBytecodeTests.forEach(processOneAssemblyTest) - if (itemPass !== 4) { - return 'Browser test testcases failed.' - } - return 'Test tescases ok!' - } - const AssemblyResultTable = bytecodeTests.map(processOneAssemblyTest) - const CResultTable = tests.map(processOneCTest) - - return `Tests completed: ${itemPass} Passed; ${itemFail} Failed.\n\n` + - '

Assembly tests

' + - AssemblyResultTable.join('\n') + - '

Full tests

' + - CResultTable.join('\n') - } - - function processOneAssemblyTest (currentByteTest: AssemblyTestType, idx: number) { - let testFailed = true - let testMessageA = '' - let testMessageB = '' - let testError = '' - try { - const asmCompiler = new SmartC({ - language: 'Assembly', - sourceCode: currentByteTest[0] - }) - asmCompiler.compile() - testMessageA = asmCompiler.getMachineCode().ByteCode - testMessageB = asmCompiler.getMachineCode().ByteData - testFailed = false - } catch (e: any) { - testError = e - } - if (currentByteTest[1] === testFailed && - testMessageA === currentByteTest[2] && - testMessageB === currentByteTest[3]) { - itemPass++ - return `Pass! (${idx})` - } - itemFail++ - return "Fail..." + - `Code: ${encodedStr(currentByteTest[0])}\n` + - `GOT: ${testMessageA}\n` + - `Error: ${testError}` - } - - function processOneCTest (currentTest: CTestType) { - if (currentTest[1] === null) { - subItemCount = 0 - return `

${currentTest[0]}

` - } - let testFailed = true - let testMessage = '' - let testError = '' - subItemCount++ - try { - const cCompiler = new SmartC({ - language: 'C', - sourceCode: `#pragma version dev\n${currentTest[0]}` - }) - cCompiler.compile() - testMessage = cCompiler.getAssemblyCode() - testFailed = false - } catch (e: any) { - testError = e.message - } - if (currentTest[1] === testFailed && testMessage === currentTest[2]) { - itemPass++ - let retString = `Pass! (${subItemCount})` + - `Code: ${encodedStr(currentTest[0])}` - if (testError.length > 0) { - retString += `\n${testError}` - } - return retString - } - itemFail++ - return `Fail... (${subItemCount})` + - `Code: ${encodedStr(currentTest[0])} Expected:\n${currentTest[2]}\n` + - `GOT output: ${testMessage}\n` + - `GOT error: ${testError}` - } - - function encodedStr (rawStr: string) { - return rawStr.replace(/[\u00A0-\u9999<>&]/g, function (i) { - return '&#' + i.charCodeAt(0) + ';' - }) - } - - return runTestCasesMain() -} diff --git a/dev/style.css b/dev/style.css deleted file mode 100644 index 246fa67..0000000 --- a/dev/style.css +++ /dev/null @@ -1,263 +0,0 @@ -/* GENERAL config */ -* { - box-sizing: border-box; -} - -body { - margin: 0; - padding: 0; - font-family: sans-serif; - background: url('./assets/SmartC-Watermark.png') no-repeat fixed bottom right, radial-gradient(#e8f3ff, #EAF0F6) no-repeat fixed; - background-size: contain; - display: grid; - grid-gap: 1em; -} - -header { - padding: 1vh; - color: white; - margin: 0 0 3vh 0; - text-align: center; - box-shadow: -5px 3px 5px #021851, 5px 3px 5px #021851; - font-size: xx-large; -} - -fieldset { - border: solid 1px #888; - padding: 1em; - margin: 0em 1em; - border-radius: 2vh; - box-shadow: 0px 0px 10px #888; - z-index: 0; -} - -legend, .tooltip { - background-color: #3a3a6690; - color: #fff; - padding: 3px 6px; - border: 0.2vh solid #666; - transition: all ease 0.3s; - border-radius: 4px; - box-shadow: 0px 0px 10px #888; -} -legend:hover { - background-color: rgb(58, 58, 102); -} -legend { - cursor: pointer; -} - -#deployment_iframe { - border: 1px solid #114; - width: 97%; - height: 33vh; -} - -pre { - padding: 0; - margin: 0; - min-height: 50px; - font-family: "Lucida Console", "Courier New", monospace; - white-space: pre-wrap; - word-wrap: anywhere; - max-width: 100%; -} - -/* Buttons */ -.btn_class { - padding: 0.5em; - font-size: 100%; - text-align: center; - background: #fff; - transition: all ease 0.3s; - border: solid 1px #888; - box-shadow: 0px 0px 10px #888; - border-radius: 1vh; - margin: 0; -} - -#source_is_c:checked ~ #bt1 { background: #ccf; } -#debug:checked ~ #bt2 { background: #fdd; } -label:hover { background: #ddf; } -#debug:hover ~ #bt2 { background: #fcc; } -#test:hover { background: #fdd; } -.btn_class:hover { background: #dfd; box-shadow: 0px 0px 5px #aaa;} -.btn_class:active { box-shadow: 0px 0px 2px #aaa;} - -/* CLASSES and IDs configs */ -.tooltip { - position: sticky; - white-space: nowrap; - display: inline; - bottom: 1%; - left: 100%; -} - -#source-code { - resize: none; - overflow-y: hidden; - overflow-x: auto; - outline: none; - background: #fafbfc; - padding: 1em 1em 1em calc(1em + 4ch); -} -#color_code { - position: absolute; - top: 0px; - left: 0px; - z-index: -1; - background: #fafbfca0; - padding: 1em; -} -#source-code, #color_code { - border: 1px black solid; - border-radius: 5px; - font-size: 100%; - color: #114; - margin: 0; - font-family: "Lucida Console", "Courier New", monospace; - width: 100%; -} - -.transp { - opacity: 0; - transition: opacity ease 3s; -} -.opaque { - opacity: 1; - transition: opacity ease 0.2s; -} - -.asmInstruction { - color: mediumblue -} -.asmVariable { - color: purple; -} -.asmComment { - color: darkgreen; -} -.asmDirective { - color: brown; - font-weight: bold; -} -.asmLabel { - color: sienna; -} -.asmNumber { - color: red; -} -.asmError { - background-color: pink; -} - -::selection { - color: #114; - background: rgb(202, 202, 238); -} - -.msg_failure { - font-weight: bold; - color: red; -} -.msg_success { - font-weight: bold; - color: green; -} - -/* general lay-out */ -.table { - width: 100%; - display: table; -} -.div_row { - display: table-row; -} -.div_cell { - display: table-cell; - width: 50%; - vertical-align: middle; -} -.div_cell_b { - display: table-cell; -} -.div_cell_a { - display: table-cell; - color: #888; - width: 4ch; -} - -/*Grid for page (desktop) */ -@media only screen and (min-width: 960px) { - .gdrow1 { grid-row-start: 1; } - .gdrow2 { grid-row-start: 2; } - .gdrow3 { grid-row-start: 3; } - .gdrow4 { grid-row-start: 4; } - .gdcol1 { grid-column-start: 1; } - .gdcol2 { grid-column-start: 2; } - .gdcol12 { grid-column-start: 1; grid-column-end: 3; } - .headerDesktop { - background: url('./assets/whiteLogo.png') no-repeat, #021851; - background-size: contain; - } -} - -/*Grid for page (mobile) */ -@media only screen and (max-width: 960px) { - .gmrow1 { grid-row-start: 1; } - .gmrow2 { grid-row-start: 2; } - .gmrow3 { grid-row-start: 3; } - .gmrow4 { grid-row-start: 4; } - .gmrow5 { grid-row-start: 5; } - .gmrow6 { grid-row-start: 6; } - .headerMobile { background: #021851; } -} - -/*Grid for buttons */ -.grow1 { grid-row-start: 1; } -.grow2 { grid-row-start: 2; } -.gcol1 { grid-column-start: 1; } -.gcol2 { grid-column-start: 2; } -.gcol3 { grid-column-start: 3; } -.gcol4 { grid-column-start: 4; } -.gcol12 { grid-column-start: 1; grid-column-end: 3;} - -.div_window_source { - padding: 0px; - position: relative; -} -.div_window_normal { - padding: 1vh; -} -.div_window_grid { - padding: 1vh; - display: grid; - grid-gap: 1em; - /* justify-content: center; */ -} - -.inc_height { min-height: 150px; } - -.winbox { - background: linear-gradient(90deg, #228, #114); - border-radius: 12px 12px 0 0; - box-shadow: 0px 0px 10px #888, -} - -.winbox.min { - border-radius: 0; -} - -.wb-body { - /* the width of window border: */ - margin: 4px; - background: linear-gradient(to right, #EAF0F6, #e8f3ff); -} - -.wb-title { - font-size: 13px; - text-transform: uppercase; - font-weight: 600; -} - -.wb-full { display: none } From c3a1e99343d7b637401d30bcf02fa1af8903b0f3 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 15 May 2022 10:40:55 -0300 Subject: [PATCH 025/112] Moving around --- dev/.eslintrc.js => .eslintrc.js | 0 .gitignore | 7 +++---- dev/esbuild.config.js => esbuild.config.js | 0 dev/jest.config.js => jest.config.js | 0 dev/package-lock.json => package-lock.json | 0 dev/package.json => package.json | 0 {dev/src/SmartC => src}/__tests__/arithmetics.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/arithmetics.b.spec.ts | 0 {dev/src/SmartC => src}/__tests__/arithmetics.c.spec.ts | 0 {dev/src/SmartC => src}/__tests__/arithmetics.d.spec.ts | 0 {dev/src/SmartC => src}/__tests__/arithmetics.e.spec.ts | 0 {dev/src/SmartC => src}/__tests__/arrays.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/arrays.b.spec.ts | 0 {dev/src/SmartC => src}/__tests__/assembly.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/bugfixes.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/functions.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/functions.b.spec.ts | 0 {dev/src/SmartC => src}/__tests__/keywords.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/keywords.b.spec.ts | 0 {dev/src/SmartC => src}/__tests__/logics.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/logics.b.spec.ts | 0 {dev/src/SmartC => src}/__tests__/logics.c.spec.ts | 0 {dev/src/SmartC => src}/__tests__/logics.d.spec.ts | 0 {dev/src/SmartC => src}/__tests__/macros.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/macros.b.spec.ts | 0 {dev/src/SmartC => src}/__tests__/misc.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/optimizations.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/pointers.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/smartc.spec.ts | 0 {dev/src/SmartC => src}/__tests__/structs.a.spec.ts | 0 {dev/src/SmartC => src}/__tests__/structs.b.spec.ts | 0 {dev/src/SmartC => src}/assembler/assembler.ts | 0 {dev/src/SmartC => src}/assembler/hashMachineCode.ts | 0 .../SmartC => src}/codeGenerator/__tests__/utils.spec.ts | 0 .../codeGenerator/assemblyProcessor/assignmentToAsm.ts | 0 .../codeGenerator/assemblyProcessor/comparisionToAsm.ts | 0 .../codeGenerator/assemblyProcessor/createInstruction.ts | 0 .../codeGenerator/assemblyProcessor/keywordToAsm.ts | 0 .../codeGenerator/assemblyProcessor/operatorToAsm.ts | 0 .../codeGenerator/assemblyProcessor/optimizer.ts | 0 .../codeGenerator/astProcessor/binaryAsnProcessor.ts | 0 .../codeGenerator/astProcessor/endAsnProcessor.ts | 0 .../codeGenerator/astProcessor/exceptionAsnProcessor.ts | 0 .../codeGenerator/astProcessor/functionSolver.ts | 0 .../SmartC => src}/codeGenerator/astProcessor/genCode.ts | 0 .../codeGenerator/astProcessor/lookupAsnProcessor.ts | 0 .../codeGenerator/astProcessor/setupGenCode.ts | 0 .../codeGenerator/astProcessor/switchAsnProcessor.ts | 0 .../codeGenerator/astProcessor/unaryAsnProcessor.ts | 0 {dev/src/SmartC => src}/codeGenerator/codeGenerator.ts | 0 .../src/SmartC => src}/codeGenerator/codeGeneratorTypes.ts | 0 {dev/src/SmartC => src}/codeGenerator/utils.ts | 0 {dev/src/SmartC => src}/parser/parser.ts | 0 .../preprocessor/__tests__/preprocessor.spec.ts | 0 {dev/src/SmartC => src}/preprocessor/preprocessor.ts | 0 .../SmartC => src}/repository/__tests__/repository.spec.ts | 0 {dev/src/SmartC => src}/repository/repository.ts | 0 {dev/src/SmartC => src}/shaper/memoryProcessor.ts | 0 {dev/src/SmartC => src}/shaper/sentencesProcessor.ts | 0 {dev/src/SmartC => src}/shaper/shaper.ts | 0 {dev/src/SmartC => src}/shaper/shaperTypes.ts | 0 {dev/src/SmartC => src}/shaper/templates.ts | 0 {dev/src/SmartC => src}/smartc.ts | 0 {dev/src/SmartC => src}/syntaxProcessor/createTree.ts | 0 {dev/src/SmartC => src}/syntaxProcessor/syntaxProcessor.ts | 0 {dev/src/SmartC => src}/tokenizer/tokenizer.ts | 0 {dev/src/SmartC => src}/typings/contractTypes.ts | 0 {dev/src/SmartC => src}/typings/syntaxTypes.ts | 0 dev/tsconfig.json => tsconfig.json | 0 69 files changed, 3 insertions(+), 4 deletions(-) rename dev/.eslintrc.js => .eslintrc.js (100%) rename dev/esbuild.config.js => esbuild.config.js (100%) rename dev/jest.config.js => jest.config.js (100%) rename dev/package-lock.json => package-lock.json (100%) rename dev/package.json => package.json (100%) rename {dev/src/SmartC => src}/__tests__/arithmetics.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/arithmetics.b.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/arithmetics.c.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/arithmetics.d.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/arithmetics.e.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/arrays.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/arrays.b.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/assembly.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/bugfixes.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/functions.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/functions.b.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/keywords.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/keywords.b.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/logics.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/logics.b.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/logics.c.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/logics.d.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/macros.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/macros.b.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/misc.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/optimizations.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/pointers.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/smartc.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/structs.a.spec.ts (100%) rename {dev/src/SmartC => src}/__tests__/structs.b.spec.ts (100%) rename {dev/src/SmartC => src}/assembler/assembler.ts (100%) rename {dev/src/SmartC => src}/assembler/hashMachineCode.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/__tests__/utils.spec.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/assemblyProcessor/assignmentToAsm.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/assemblyProcessor/comparisionToAsm.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/assemblyProcessor/createInstruction.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/assemblyProcessor/keywordToAsm.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/assemblyProcessor/operatorToAsm.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/assemblyProcessor/optimizer.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/binaryAsnProcessor.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/endAsnProcessor.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/exceptionAsnProcessor.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/functionSolver.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/genCode.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/lookupAsnProcessor.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/setupGenCode.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/switchAsnProcessor.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/astProcessor/unaryAsnProcessor.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/codeGenerator.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/codeGeneratorTypes.ts (100%) rename {dev/src/SmartC => src}/codeGenerator/utils.ts (100%) rename {dev/src/SmartC => src}/parser/parser.ts (100%) rename {dev/src/SmartC => src}/preprocessor/__tests__/preprocessor.spec.ts (100%) rename {dev/src/SmartC => src}/preprocessor/preprocessor.ts (100%) rename {dev/src/SmartC => src}/repository/__tests__/repository.spec.ts (100%) rename {dev/src/SmartC => src}/repository/repository.ts (100%) rename {dev/src/SmartC => src}/shaper/memoryProcessor.ts (100%) rename {dev/src/SmartC => src}/shaper/sentencesProcessor.ts (100%) rename {dev/src/SmartC => src}/shaper/shaper.ts (100%) rename {dev/src/SmartC => src}/shaper/shaperTypes.ts (100%) rename {dev/src/SmartC => src}/shaper/templates.ts (100%) rename {dev/src/SmartC => src}/smartc.ts (100%) rename {dev/src/SmartC => src}/syntaxProcessor/createTree.ts (100%) rename {dev/src/SmartC => src}/syntaxProcessor/syntaxProcessor.ts (100%) rename {dev/src/SmartC => src}/tokenizer/tokenizer.ts (100%) rename {dev/src/SmartC => src}/typings/contractTypes.ts (100%) rename {dev/src/SmartC => src}/typings/syntaxTypes.ts (100%) rename dev/tsconfig.json => tsconfig.json (100%) diff --git a/dev/.eslintrc.js b/.eslintrc.js similarity index 100% rename from dev/.eslintrc.js rename to .eslintrc.js diff --git a/.gitignore b/.gitignore index f85b299..abe2ff6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -dev/node_modules/* -dev/lib -dev/coverage -stable +node_modules/* +dist +coverage diff --git a/dev/esbuild.config.js b/esbuild.config.js similarity index 100% rename from dev/esbuild.config.js rename to esbuild.config.js diff --git a/dev/jest.config.js b/jest.config.js similarity index 100% rename from dev/jest.config.js rename to jest.config.js diff --git a/dev/package-lock.json b/package-lock.json similarity index 100% rename from dev/package-lock.json rename to package-lock.json diff --git a/dev/package.json b/package.json similarity index 100% rename from dev/package.json rename to package.json diff --git a/dev/src/SmartC/__tests__/arithmetics.a.spec.ts b/src/__tests__/arithmetics.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arithmetics.a.spec.ts rename to src/__tests__/arithmetics.a.spec.ts diff --git a/dev/src/SmartC/__tests__/arithmetics.b.spec.ts b/src/__tests__/arithmetics.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arithmetics.b.spec.ts rename to src/__tests__/arithmetics.b.spec.ts diff --git a/dev/src/SmartC/__tests__/arithmetics.c.spec.ts b/src/__tests__/arithmetics.c.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arithmetics.c.spec.ts rename to src/__tests__/arithmetics.c.spec.ts diff --git a/dev/src/SmartC/__tests__/arithmetics.d.spec.ts b/src/__tests__/arithmetics.d.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arithmetics.d.spec.ts rename to src/__tests__/arithmetics.d.spec.ts diff --git a/dev/src/SmartC/__tests__/arithmetics.e.spec.ts b/src/__tests__/arithmetics.e.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arithmetics.e.spec.ts rename to src/__tests__/arithmetics.e.spec.ts diff --git a/dev/src/SmartC/__tests__/arrays.a.spec.ts b/src/__tests__/arrays.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arrays.a.spec.ts rename to src/__tests__/arrays.a.spec.ts diff --git a/dev/src/SmartC/__tests__/arrays.b.spec.ts b/src/__tests__/arrays.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/arrays.b.spec.ts rename to src/__tests__/arrays.b.spec.ts diff --git a/dev/src/SmartC/__tests__/assembly.a.spec.ts b/src/__tests__/assembly.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/assembly.a.spec.ts rename to src/__tests__/assembly.a.spec.ts diff --git a/dev/src/SmartC/__tests__/bugfixes.a.spec.ts b/src/__tests__/bugfixes.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/bugfixes.a.spec.ts rename to src/__tests__/bugfixes.a.spec.ts diff --git a/dev/src/SmartC/__tests__/functions.a.spec.ts b/src/__tests__/functions.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/functions.a.spec.ts rename to src/__tests__/functions.a.spec.ts diff --git a/dev/src/SmartC/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/functions.b.spec.ts rename to src/__tests__/functions.b.spec.ts diff --git a/dev/src/SmartC/__tests__/keywords.a.spec.ts b/src/__tests__/keywords.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/keywords.a.spec.ts rename to src/__tests__/keywords.a.spec.ts diff --git a/dev/src/SmartC/__tests__/keywords.b.spec.ts b/src/__tests__/keywords.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/keywords.b.spec.ts rename to src/__tests__/keywords.b.spec.ts diff --git a/dev/src/SmartC/__tests__/logics.a.spec.ts b/src/__tests__/logics.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/logics.a.spec.ts rename to src/__tests__/logics.a.spec.ts diff --git a/dev/src/SmartC/__tests__/logics.b.spec.ts b/src/__tests__/logics.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/logics.b.spec.ts rename to src/__tests__/logics.b.spec.ts diff --git a/dev/src/SmartC/__tests__/logics.c.spec.ts b/src/__tests__/logics.c.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/logics.c.spec.ts rename to src/__tests__/logics.c.spec.ts diff --git a/dev/src/SmartC/__tests__/logics.d.spec.ts b/src/__tests__/logics.d.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/logics.d.spec.ts rename to src/__tests__/logics.d.spec.ts diff --git a/dev/src/SmartC/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/macros.a.spec.ts rename to src/__tests__/macros.a.spec.ts diff --git a/dev/src/SmartC/__tests__/macros.b.spec.ts b/src/__tests__/macros.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/macros.b.spec.ts rename to src/__tests__/macros.b.spec.ts diff --git a/dev/src/SmartC/__tests__/misc.a.spec.ts b/src/__tests__/misc.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/misc.a.spec.ts rename to src/__tests__/misc.a.spec.ts diff --git a/dev/src/SmartC/__tests__/optimizations.a.spec.ts b/src/__tests__/optimizations.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/optimizations.a.spec.ts rename to src/__tests__/optimizations.a.spec.ts diff --git a/dev/src/SmartC/__tests__/pointers.a.spec.ts b/src/__tests__/pointers.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/pointers.a.spec.ts rename to src/__tests__/pointers.a.spec.ts diff --git a/dev/src/SmartC/__tests__/smartc.spec.ts b/src/__tests__/smartc.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/smartc.spec.ts rename to src/__tests__/smartc.spec.ts diff --git a/dev/src/SmartC/__tests__/structs.a.spec.ts b/src/__tests__/structs.a.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/structs.a.spec.ts rename to src/__tests__/structs.a.spec.ts diff --git a/dev/src/SmartC/__tests__/structs.b.spec.ts b/src/__tests__/structs.b.spec.ts similarity index 100% rename from dev/src/SmartC/__tests__/structs.b.spec.ts rename to src/__tests__/structs.b.spec.ts diff --git a/dev/src/SmartC/assembler/assembler.ts b/src/assembler/assembler.ts similarity index 100% rename from dev/src/SmartC/assembler/assembler.ts rename to src/assembler/assembler.ts diff --git a/dev/src/SmartC/assembler/hashMachineCode.ts b/src/assembler/hashMachineCode.ts similarity index 100% rename from dev/src/SmartC/assembler/hashMachineCode.ts rename to src/assembler/hashMachineCode.ts diff --git a/dev/src/SmartC/codeGenerator/__tests__/utils.spec.ts b/src/codeGenerator/__tests__/utils.spec.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/__tests__/utils.spec.ts rename to src/codeGenerator/__tests__/utils.spec.ts diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/assignmentToAsm.ts b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/assemblyProcessor/assignmentToAsm.ts rename to src/codeGenerator/assemblyProcessor/assignmentToAsm.ts diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/comparisionToAsm.ts b/src/codeGenerator/assemblyProcessor/comparisionToAsm.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/assemblyProcessor/comparisionToAsm.ts rename to src/codeGenerator/assemblyProcessor/comparisionToAsm.ts diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/assemblyProcessor/createInstruction.ts rename to src/codeGenerator/assemblyProcessor/createInstruction.ts diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts b/src/codeGenerator/assemblyProcessor/keywordToAsm.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/assemblyProcessor/keywordToAsm.ts rename to src/codeGenerator/assemblyProcessor/keywordToAsm.ts diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/operatorToAsm.ts b/src/codeGenerator/assemblyProcessor/operatorToAsm.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/assemblyProcessor/operatorToAsm.ts rename to src/codeGenerator/assemblyProcessor/operatorToAsm.ts diff --git a/dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts b/src/codeGenerator/assemblyProcessor/optimizer.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/assemblyProcessor/optimizer.ts rename to src/codeGenerator/assemblyProcessor/optimizer.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/binaryAsnProcessor.ts rename to src/codeGenerator/astProcessor/binaryAsnProcessor.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts b/src/codeGenerator/astProcessor/endAsnProcessor.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/endAsnProcessor.ts rename to src/codeGenerator/astProcessor/endAsnProcessor.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/exceptionAsnProcessor.ts b/src/codeGenerator/astProcessor/exceptionAsnProcessor.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/exceptionAsnProcessor.ts rename to src/codeGenerator/astProcessor/exceptionAsnProcessor.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/functionSolver.ts b/src/codeGenerator/astProcessor/functionSolver.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/functionSolver.ts rename to src/codeGenerator/astProcessor/functionSolver.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/genCode.ts b/src/codeGenerator/astProcessor/genCode.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/genCode.ts rename to src/codeGenerator/astProcessor/genCode.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/lookupAsnProcessor.ts b/src/codeGenerator/astProcessor/lookupAsnProcessor.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/lookupAsnProcessor.ts rename to src/codeGenerator/astProcessor/lookupAsnProcessor.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/setupGenCode.ts rename to src/codeGenerator/astProcessor/setupGenCode.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/switchAsnProcessor.ts b/src/codeGenerator/astProcessor/switchAsnProcessor.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/switchAsnProcessor.ts rename to src/codeGenerator/astProcessor/switchAsnProcessor.ts diff --git a/dev/src/SmartC/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/astProcessor/unaryAsnProcessor.ts rename to src/codeGenerator/astProcessor/unaryAsnProcessor.ts diff --git a/dev/src/SmartC/codeGenerator/codeGenerator.ts b/src/codeGenerator/codeGenerator.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/codeGenerator.ts rename to src/codeGenerator/codeGenerator.ts diff --git a/dev/src/SmartC/codeGenerator/codeGeneratorTypes.ts b/src/codeGenerator/codeGeneratorTypes.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/codeGeneratorTypes.ts rename to src/codeGenerator/codeGeneratorTypes.ts diff --git a/dev/src/SmartC/codeGenerator/utils.ts b/src/codeGenerator/utils.ts similarity index 100% rename from dev/src/SmartC/codeGenerator/utils.ts rename to src/codeGenerator/utils.ts diff --git a/dev/src/SmartC/parser/parser.ts b/src/parser/parser.ts similarity index 100% rename from dev/src/SmartC/parser/parser.ts rename to src/parser/parser.ts diff --git a/dev/src/SmartC/preprocessor/__tests__/preprocessor.spec.ts b/src/preprocessor/__tests__/preprocessor.spec.ts similarity index 100% rename from dev/src/SmartC/preprocessor/__tests__/preprocessor.spec.ts rename to src/preprocessor/__tests__/preprocessor.spec.ts diff --git a/dev/src/SmartC/preprocessor/preprocessor.ts b/src/preprocessor/preprocessor.ts similarity index 100% rename from dev/src/SmartC/preprocessor/preprocessor.ts rename to src/preprocessor/preprocessor.ts diff --git a/dev/src/SmartC/repository/__tests__/repository.spec.ts b/src/repository/__tests__/repository.spec.ts similarity index 100% rename from dev/src/SmartC/repository/__tests__/repository.spec.ts rename to src/repository/__tests__/repository.spec.ts diff --git a/dev/src/SmartC/repository/repository.ts b/src/repository/repository.ts similarity index 100% rename from dev/src/SmartC/repository/repository.ts rename to src/repository/repository.ts diff --git a/dev/src/SmartC/shaper/memoryProcessor.ts b/src/shaper/memoryProcessor.ts similarity index 100% rename from dev/src/SmartC/shaper/memoryProcessor.ts rename to src/shaper/memoryProcessor.ts diff --git a/dev/src/SmartC/shaper/sentencesProcessor.ts b/src/shaper/sentencesProcessor.ts similarity index 100% rename from dev/src/SmartC/shaper/sentencesProcessor.ts rename to src/shaper/sentencesProcessor.ts diff --git a/dev/src/SmartC/shaper/shaper.ts b/src/shaper/shaper.ts similarity index 100% rename from dev/src/SmartC/shaper/shaper.ts rename to src/shaper/shaper.ts diff --git a/dev/src/SmartC/shaper/shaperTypes.ts b/src/shaper/shaperTypes.ts similarity index 100% rename from dev/src/SmartC/shaper/shaperTypes.ts rename to src/shaper/shaperTypes.ts diff --git a/dev/src/SmartC/shaper/templates.ts b/src/shaper/templates.ts similarity index 100% rename from dev/src/SmartC/shaper/templates.ts rename to src/shaper/templates.ts diff --git a/dev/src/SmartC/smartc.ts b/src/smartc.ts similarity index 100% rename from dev/src/SmartC/smartc.ts rename to src/smartc.ts diff --git a/dev/src/SmartC/syntaxProcessor/createTree.ts b/src/syntaxProcessor/createTree.ts similarity index 100% rename from dev/src/SmartC/syntaxProcessor/createTree.ts rename to src/syntaxProcessor/createTree.ts diff --git a/dev/src/SmartC/syntaxProcessor/syntaxProcessor.ts b/src/syntaxProcessor/syntaxProcessor.ts similarity index 100% rename from dev/src/SmartC/syntaxProcessor/syntaxProcessor.ts rename to src/syntaxProcessor/syntaxProcessor.ts diff --git a/dev/src/SmartC/tokenizer/tokenizer.ts b/src/tokenizer/tokenizer.ts similarity index 100% rename from dev/src/SmartC/tokenizer/tokenizer.ts rename to src/tokenizer/tokenizer.ts diff --git a/dev/src/SmartC/typings/contractTypes.ts b/src/typings/contractTypes.ts similarity index 100% rename from dev/src/SmartC/typings/contractTypes.ts rename to src/typings/contractTypes.ts diff --git a/dev/src/SmartC/typings/syntaxTypes.ts b/src/typings/syntaxTypes.ts similarity index 100% rename from dev/src/SmartC/typings/syntaxTypes.ts rename to src/typings/syntaxTypes.ts diff --git a/dev/tsconfig.json b/tsconfig.json similarity index 100% rename from dev/tsconfig.json rename to tsconfig.json From 083000f8ba2d63b789ba9618380b00d427a2222a Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 15 May 2022 11:27:22 -0300 Subject: [PATCH 026/112] Changes regarding the moved files Preparing README for npm package --- .github/workflows/build.yaml | 4 +-- README.md | 57 +++++++++++++++++++++++++++++++----- esbuild.config.js | 42 ++++++++++++-------------- jest.config.js | 6 ++-- package.json | 26 +++++----------- sonar-project.properties | 4 +-- tsconfig.json | 12 +++++--- 7 files changed, 90 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e5f9316..eb371b9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,13 +17,13 @@ jobs: node-version: 14 - name: Run SmartC Tests - working-directory: ./dev + working-directory: ./ run: | npm ci npm run test:ci - name: fix code coverage paths - working-directory: ./dev/coverage + working-directory: ./coverage run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' lcov.info - name: SonarCloud Scan diff --git a/README.md b/README.md index 8a5b560..fe58dd9 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,57 @@ ## Objective To empower developers, allowing them to create complex and highly optimized smart contracts. -## Usage -[Run on gitpages](https://deleterium.github.io/SmartC/stable/index.html) the latest stable version. -Optionally run the development version at [Vercel](https://smart-c.vercel.app) or choose a previous compiler version at [https://deleterium.info/SmartC/](https://deleterium.info/SmartC/). -After compiling, information to create the Smart Contract is presented and it is possible to deploy the contract on your own local node. +# Setup +This library can be obtained through npm: +``` +npm install smartc-signum-compiler +``` + +# Usage +## Node +```ts +import SmartC from 'smartc-signum-compiler'; + +// Example: Simple compilation test +try { + const startUpTest = new SmartC({ + language: 'C', + sourceCode: '#pragma maxAuxVars 1\nlong a, b, c; a=b/~c;' + }) + startUpTest.compile() + const assemblyText = startUpTest.getAssemblyCode() + const machineObject = startUpTest.getMachineCode() + // Do something +} catch (e) { + return "Compilation error: " + e.message +} +``` + +## Browser +Your javascript file must be imported as module in the html. +```ts +import SmartC from 'https://cdn.jsdelivr.net/npm/smartc-assembly-highlight@1.0.0/dist/smartc.min.js'; + +// Example: Simple compilation test +try { + const startUpTest = new SmartC({ + language: 'C', + sourceCode: '#pragma maxAuxVars 1\nlong a, b, c; a=b/~c;' + }) + startUpTest.compile() + const assemblyText = startUpTest.getAssemblyCode() + const machineObject = startUpTest.getMachineCode() + // Do something +} catch (e) { + return "Compilation error: " + e.message +} +``` + +## Web User Interface +To be done ## Documentation / FAQ / Lessons -Detailed technical information about the project can be found in compiler's page. -After opening the desired version, click the **Help** button. -A window will open with all avaliable documentation for that specific release. -Check also [SmartC playlist on Youtube](https://www.youtube.com/playlist?list=PLyu0NNtb1eg3Gcg2JCrOle8MjtuFPb-Gi), with videos for starting, simulating and deploying a smart contract. +Docs files can be found in this repo, at `doc` folder. ## Changelog Find [here](https://deleterium.github.io/SmartC/CHANGELOG) major upgrades between releases. diff --git a/esbuild.config.js b/esbuild.config.js index c8a1cb9..20cd4da 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -1,27 +1,23 @@ const esbuild = require('esbuild') -let config - -if (process.env.TARGET === 'dev') { - config = { - entryPoints: ['./src/index.js'], - outfile: 'lib/index.js', - bundle: true, - minify: false, - platform: 'browser', - sourcemap: 'inline', - target: 'es2020' - } -} else { - config = { - entryPoints: ['./src/index.js'], - outfile: 'lib/index.js', - bundle: true, - minify: true, - platform: 'browser', - sourcemap: false, - target: 'es2020' - } +const configDev = { + entryPoints: ['./src/smartc.js'], + outfile: 'dist/smartc.dev.js', + bundle: true, + minify: false, + platform: 'browser', + sourcemap: 'inline', + target: 'es2020' +} +const configMin = { + entryPoints: ['./src/smartc.js'], + outfile: 'dist/smartc.min.js', + bundle: true, + minify: true, + platform: 'browser', + sourcemap: false, + target: 'es2020' } -esbuild.build(config).catch(() => process.exit(1)) +esbuild.build(configDev).catch(() => process.exit(1)) +esbuild.build(configMin).catch(() => process.exit(1)) diff --git a/jest.config.js b/jest.config.js index c17bdc6..8b3c161 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,7 @@ module.exports = { } }, collectCoverageFrom: [ - '**/src/**/*.ts', + 'src/**/*.ts', '!**/e2e/**' ], transform: { @@ -17,9 +17,7 @@ module.exports = { testPathIgnorePatterns: [ 'helpers', '.*\\.e2e\\.ts$', - 'out', - 'lib', - '3rd-party', + 'dist', 'node_modules' ], verbose: true diff --git a/package.json b/package.json index 2daff63..b8d8222 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,10 @@ { - "name": "smartc", - "version": "0.4.0", + "name": "smartc-signum-compiler", + "version": "1.0.0", "description": "C Compiler for smart contracts on Signum network", - "main": "index.js", + "main": "dist/smartc.js", + "types": "dist/smartc.d.ts", + "files": ["dist"], "repository": { "type": "git", "url": "git+https://github.com/deleterium/SmartC.git" @@ -12,7 +14,7 @@ "compiler", "blockchain", "c", - "typescript" + "signum" ], "author": "Rui Deleterium", "private": true, @@ -22,19 +24,10 @@ }, "homepage": "https://github.com/deleterium/SmartC#readme", "scripts": { - "dev": "TARGET=dev node esbuild.config.js", - "lint": "npx eslint './src/**/*' && npx tsc", + "lint": "npx eslint './src/**/*'", "test": "npx jest", "test:ci": "npx jest --coverage", - "build": "npm run lint && node esbuild.config.js", - "build:stable": "npm run build && rm -Rf ../stable||: && mkdir ../stable && cp -R ./lib ./assets index.html style.css ./3rd-party ../stable/ && npm run build:docs && echo 'Sucess'", - "start": "npx light-server -s . -p 7000 --no-reload", - "build:docs": "rm -Rf ../stable/htmlDocs||: && npx markdown-folder-to-html ../docs && mv ../_docs ../stable/htmlDocs && ln -s ./README.html ../stable/htmlDocs/index.html && rm ../stable/htmlDocs/contents.json" - }, - "eslintConfig": { - "env": { - "browser": true - } + "build": "npm run lint && node esbuild.config.js && npx tsc" }, "devDependencies": { "@types/jest": "^27.0.2", @@ -47,9 +40,6 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", "jest": "^27.3.1", - "light-server": "^2.9.1", - "markdown-folder-to-html": "^2.4.0", - "smartc-assembly-highlight": "^1.0.2", "ts-jest": "^27.0.7", "typescript": "^4.3.5" } diff --git a/sonar-project.properties b/sonar-project.properties index 64c941d..918a715 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,10 +2,10 @@ sonar.projectKey=deleterium_SmartC sonar.organization=deleterium sonar.sources=. -sonar.javascript.lcov.reportPaths=dev/coverage/lcov.info +sonar.javascript.lcov.reportPaths=coverage/lcov.info sonar.test.inclusions=**/*.spec.ts sonar.cpd.exclusions=**/*template* -sonar.coverage.exclusions=**/*config.js,dev/src/index.js +sonar.coverage.exclusions=**/*config.js sonar.c.file.suffixes=- # This is the name and version displayed in the SonarCloud UI. #sonar.projectName=SmartC diff --git a/tsconfig.json b/tsconfig.json index 5e96f2a..835f696 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,16 +10,16 @@ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ //"sourceMap": true, /* Generates corresponding '.map' file. */ //"outFile": "", /* Concatenate and emit output to single file. */ - //"outDir": "./out", /* Redirect output structure to the directory. */ + "outDir": "./dist", /* Redirect output structure to the directory. */ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ - "noEmit": true, /* Do not emit outputs. */ + // "noEmit": true, /* Do not emit outputs. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ @@ -68,5 +68,9 @@ /* Advanced Options */ "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } + }, + "exclude": [ + "**/*.spec.ts", + "dist/**/*" + ] } From 631ed30b4a0572c19edbed84c731cbb3e286cf4a Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 15 May 2022 15:21:17 -0300 Subject: [PATCH 027/112] Fix jest testcases --- README.md | 4 ++-- package.json | 6 +++--- src/__tests__/macros.a.spec.ts | 7 ------- src/shaper/shaper.ts | 4 ++++ 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fe58dd9..95dbc3d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ npm install smartc-signum-compiler # Usage ## Node ```ts -import SmartC from 'smartc-signum-compiler'; +import { SmartC } from 'smartc-signum-compiler'; // Example: Simple compilation test try { @@ -38,7 +38,7 @@ try { ## Browser Your javascript file must be imported as module in the html. ```ts -import SmartC from 'https://cdn.jsdelivr.net/npm/smartc-assembly-highlight@1.0.0/dist/smartc.min.js'; +import { SmartC } from 'https://cdn.jsdelivr.net/npm/smartc-assembly-highlight@1.0.0/dist/smartc.min.js'; // Example: Simple compilation test try { diff --git a/package.json b/package.json index b8d8222..d847dcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "1.0.0", + "version": "1.0.1", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", @@ -25,8 +25,8 @@ "homepage": "https://github.com/deleterium/SmartC#readme", "scripts": { "lint": "npx eslint './src/**/*'", - "test": "npx jest", - "test:ci": "npx jest --coverage", + "test": "JEST=true npx jest", + "test:ci": "JEST=true npx jest --coverage", "build": "npm run lint && node esbuild.config.js && npx tsc" }, "devDependencies": { diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index b84b4ed..502e31f 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -206,13 +206,6 @@ describe('#pragma', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) - test('should throw: expecting other compiler version', () => { - expect(() => { - const code = '#pragma version abcd\nlong a;' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^This compiler is version/) - }) test('should throw: maxAuxVars invalid parameter', () => { expect(() => { const code = '#pragma maxAuxVars a\nlong a;' diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 68a8510..79887a7 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -262,6 +262,10 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { * @throws {Error} if not pass rules checks. */ function checkCompilerVersion () : void { + if (process !== undefined && process.env.JEST === 'true') { + // avoid this check during jest tests + return + } if (Program.Config.sourcecodeVersion === '') { if (!Program.Config.compilerVersion.includes('dev')) { throw new Error('Compiler version not set.' + From aca5692f69bba4e11c4dadf73624fe6b7313fd58 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 15 May 2022 15:58:13 -0300 Subject: [PATCH 028/112] Fix browser error --- package.json | 2 +- src/shaper/shaper.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d847dcc..44fea35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "1.0.1", + "version": "1.0.2", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 79887a7..50eeedf 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -262,10 +262,14 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { * @throws {Error} if not pass rules checks. */ function checkCompilerVersion () : void { - if (process !== undefined && process.env.JEST === 'true') { - // avoid this check during jest tests - return + try { + if (process.env.JEST === 'true') { + return + } + } catch (err) { + // On browser, continue } + // Running on browser OR Runing on node, but it is not jest if (Program.Config.sourcecodeVersion === '') { if (!Program.Config.compilerVersion.includes('dev')) { throw new Error('Compiler version not set.' + From d2cd96605034c8d7c7c7a12dc5fc7b2db0267ed2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 18 May 2022 16:44:17 -0300 Subject: [PATCH 029/112] Updated README for webpage --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 95dbc3d..ff04219 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ try { ``` ## Web User Interface -To be done +A web user interface is available at https://github.com/deleterium/smartc-web-ui It is possible to use the latest stable version at https://smartc-web-ui.vercel.app/ ## Documentation / FAQ / Lessons Docs files can be found in this repo, at `doc` folder. From 138df77dcc6768f501ff928f32af05c1fcaea72b Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 19 May 2022 12:18:10 -0300 Subject: [PATCH 030/112] Testcase: all API functions atv2 --- src/__tests__/assembly.a.spec.ts | 9 +++++++++ src/__tests__/functions.b.spec.ts | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/__tests__/assembly.a.spec.ts b/src/__tests__/assembly.a.spec.ts index c179f26..22c7112 100644 --- a/src/__tests__/assembly.a.spec.ts +++ b/src/__tests__/assembly.a.spec.ts @@ -17,6 +17,15 @@ describe('Assembly compilation:', () => { expect(result.ByteCode).toBe(MachineCode) expect(result.ByteData).toBe(MachineData) }) + it('should compile: all api functions (atv2)', () => { + const code = '^program name AllApiCodes\n^program description All Api Codes for AT version 2\n^program activationAmount 1000000000\n^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nFUN @a get_A1\nFUN @a get_A2\nFUN @a get_A3\nFUN @a get_A4\nFUN @b get_B1\nFUN @b get_B2\nFUN @b get_B3\nFUN @b get_B4\nFUN set_A1 $c\nFUN set_A2 $c\nFUN set_A3 $c\nFUN set_A4 $c\nFUN set_A1_A2 $a $b\nFUN set_A3_A4 $a $b\nFUN set_B1 $c\nFUN set_B2 $c\nFUN set_B3 $c\nFUN set_B4 $c\nFUN set_B1_B2 $a $b\nFUN set_B3_B4 $a $b\nFUN clear_A\nFUN clear_B\nFUN clear_A_B\nFUN copy_A_From_B\nFUN copy_B_From_A\nFUN @a check_A_Is_Zero\nFUN @b check_B_Is_Zero\nFUN @a check_A_equals_B\nFUN swap_A_and_B\nFUN OR_A_with_B\nFUN OR_B_with_A\nFUN AND_A_with_B\nFUN AND_B_with_A\nFUN XOR_A_with_B\nFUN XOR_B_with_A\nFUN add_A_to_B\nFUN add_B_to_A\nFUN sub_A_from_B\nFUN sub_B_from_A\nFUN mul_A_by_B\nFUN mul_B_by_A\nFUN div_A_by_B\nFUN div_B_by_A\nFUN MD5_A_to_B\nFUN @a check_MD5_A_with_B\nFUN HASH160_A_to_B\nFUN @a check_HASH160_A_with_B\nFUN SHA256_A_to_B\nFUN @a check_SHA256_A_with_B\nFUN @a get_Block_Timestamp\nFUN @a get_Creation_Timestamp\nFUN @a get_Last_Block_Timestamp\nFUN put_Last_Block_Hash_In_A\nFUN A_to_Tx_after_Timestamp $c\nFUN @a get_Type_for_Tx_in_A\nFUN @a get_Amount_for_Tx_in_A\nFUN @a get_Timestamp_for_Tx_in_A\nFUN @a get_Ticket_Id_for_Tx_in_A\nFUN message_from_Tx_in_A_to_B\nFUN B_to_Address_of_Tx_in_A\nFUN B_to_Address_of_Creator\nFUN @a get_Current_Balance\nFUN @a get_Previous_Balance\nFUN send_to_Address_in_B $c\nFUN send_All_to_Address_in_B\nFUN send_Old_to_Address_in_B\nFUN send_A_to_Address_in_B\nFUN @a add_Minutes_to_Timestamp $c $d\nFIN\n' + const MachineCode = '3500010300000035010103000000350201030000003503010300000035040104000000350501040000003506010400000035070104000000331001050000003311010500000033120105000000331301050000003414010300000004000000341501030000000400000033160105000000331701050000003318010500000033190105000000341a010300000004000000341b010300000004000000322001322101322201322301322401352501030000003526010400000035270103000000322801322901322a01322b01322c01322d01322e013240013241013242013243013244013245013246013247013200023501020300000032020235030203000000320402350502030000003500030300000035010303000000350203030000003203033304030500000035050303000000350603030000003507030300000035080303000000320903320a03320b0335000403000000350104030000003302040500000032030432040432050437060403000000050000000600000028' + const MachineData = '' + const result = new SmartC({ language: 'Assembly', sourceCode: code }).compile().getMachineCode() + expect(result.ByteCode).toBe(MachineCode) + expect(result.ByteData).toBe(MachineData) + }) + it('should compile: rare opCodes ', () => { const code = 'FIZ $a\nSTZ $a\nERR :__error\nINC @a\nNOP\nNOP\n__error:\nDEC @a' const MachineCode = '260000000027000000002b1600000004000000007f7f0500000000' diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index b36e82f..cd5edbb 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -8,6 +8,13 @@ describe('API functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: all API (atv2)', () => { + const code = '#include APIFunctions\nlong a, b, c, d;\n\n// Get/Set functions for “pseudo registers” \na = Get_A1();\na = Get_A2();\na = Get_A3();\na = Get_A4();\nb = Get_B1();\nb = Get_B2();\nb = Get_B3();\nb = Get_B4();\nSet_A1(c);\nSet_A2(c);\nSet_A3(c);\nSet_A4(c);\nSet_A1_A2(a, b);\nSet_A3_A4(a, b);\nSet_B1(c);\nSet_B2(c);\nSet_B3(c);\nSet_B4(c);\nSet_B1_B2(a, b);\nSet_B3_B4(a, b);\nClear_A();\nClear_B();\nClear_A_And_B();\nCopy_A_From_B();\nCopy_B_From_A();\na = Check_A_Is_Zero();\nb = Check_B_Is_Zero();\na = Check_A_Equals_B();\nSwap_A_and_B();\nOR_A_with_B();\nOR_B_with_A();\nAND_A_with_B();\nAND_B_with_A();\nXOR_A_with_B();\nXOR_B_with_A();\nAdd_A_To_B();\nAdd_B_To_A();\nSub_A_From_B();\nSub_B_From_A();\nMul_A_By_B();\nMul_B_By_A();\nDiv_A_By_B();\nDiv_B_By_A();\n\n// Functions that perform hash operations\nMD5_A_To_B();\na = Check_MD5_A_With_B();\nHASH160_A_To_B();\na = Check_HASH160_A_With_B();\nSHA256_A_To_B();\na = Check_SHA256_A_With_B();\n\n// Generic functions that get block and tx info\na = Get_Block_Timestamp();\na = Get_Creation_Timestamp();\na = Get_Last_Block_Timestamp();\nPut_Last_Block_Hash_In_A();\nA_To_Tx_After_Timestamp(c);\na = Get_Type_For_Tx_In_A();\na = Get_Amount_For_Tx_In_A();\na = Get_Timestamp_For_Tx_In_A();\na = Get_Random_Id_For_Tx_In_A();\nMessage_From_Tx_In_A_To_B();\nB_To_Address_Of_Tx_In_A();\nB_To_Address_Of_Creator();\n\n// Generic functions that check balances and perform ops\na = Get_Current_Balance();\na = Get_Previous_Balance();\nSend_To_Address_In_B(c);\nSend_All_To_Address_In_B();\nSend_Old_To_Address_In_B();\nSend_A_To_Address_In_B();\na = Add_Minutes_To_Timestamp(c, d);\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nFUN @a get_A1\nFUN @a get_A2\nFUN @a get_A3\nFUN @a get_A4\nFUN @b get_B1\nFUN @b get_B2\nFUN @b get_B3\nFUN @b get_B4\nFUN set_A1 $c\nFUN set_A2 $c\nFUN set_A3 $c\nFUN set_A4 $c\nFUN set_A1_A2 $a $b\nFUN set_A3_A4 $a $b\nFUN set_B1 $c\nFUN set_B2 $c\nFUN set_B3 $c\nFUN set_B4 $c\nFUN set_B1_B2 $a $b\nFUN set_B3_B4 $a $b\nFUN clear_A\nFUN clear_B\nFUN clear_A_B\nFUN copy_A_From_B\nFUN copy_B_From_A\nFUN @a check_A_Is_Zero\nFUN @b check_B_Is_Zero\nFUN @a check_A_equals_B\nFUN swap_A_and_B\nFUN OR_A_with_B\nFUN OR_B_with_A\nFUN AND_A_with_B\nFUN AND_B_with_A\nFUN XOR_A_with_B\nFUN XOR_B_with_A\nFUN add_A_to_B\nFUN add_B_to_A\nFUN sub_A_from_B\nFUN sub_B_from_A\nFUN mul_A_by_B\nFUN mul_B_by_A\nFUN div_A_by_B\nFUN div_B_by_A\nFUN MD5_A_to_B\nFUN @a check_MD5_A_with_B\nFUN HASH160_A_to_B\nFUN @a check_HASH160_A_with_B\nFUN SHA256_A_to_B\nFUN @a check_SHA256_A_with_B\nFUN @a get_Block_Timestamp\nFUN @a get_Creation_Timestamp\nFUN @a get_Last_Block_Timestamp\nFUN put_Last_Block_Hash_In_A\nFUN A_to_Tx_after_Timestamp $c\nFUN @a get_Type_for_Tx_in_A\nFUN @a get_Amount_for_Tx_in_A\nFUN @a get_Timestamp_for_Tx_in_A\nFUN @a get_Ticket_Id_for_Tx_in_A\nFUN message_from_Tx_in_A_to_B\nFUN B_to_Address_of_Tx_in_A\nFUN B_to_Address_of_Creator\nFUN @a get_Current_Balance\nFUN @a get_Previous_Balance\nFUN send_to_Address_in_B $c\nFUN send_All_to_Address_in_B\nFUN send_Old_to_Address_in_B\nFUN send_A_to_Address_in_B\nFUN @a add_Minutes_to_Timestamp $c $d\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) test('should throw: missing argument', () => { expect(() => { const code = '#pragma optimizationLevel 0\n#include APIFunctions\nSet_A1();' From 3e2757653edd0448903f0d58f90430d1516601db Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 19 May 2022 21:19:42 -0300 Subject: [PATCH 031/112] Changes for browser use (cherry picked from commit 81a6c8f66c1fe0da06e11b81d990138e5f845f48) --- README.md | 9 ++++++--- package.json | 2 +- src/smartc.ts | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ff04219..a65fa5c 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,13 @@ try { ``` ## Browser -Your javascript file must be imported as module in the html. -```ts -import { SmartC } from 'https://cdn.jsdelivr.net/npm/smartc-assembly-highlight@1.0.0/dist/smartc.min.js'; +Import the minified javascript file. SmartC will be imported as global. +```html + +``` +Then in your javascript file, just use it: +```js // Example: Simple compilation test try { const startUpTest = new SmartC({ diff --git a/package.json b/package.json index 44fea35..45bc438 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "1.0.2", + "version": "1.0.3", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", diff --git a/src/smartc.ts b/src/smartc.ts index 108770c..289da00 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -134,3 +134,8 @@ export class SmartC { return this.Program.Config.compilerVersion } } + +if (typeof window !== 'undefined' && typeof window.document !== 'undefined') { + // @ts-ignore: Browser only + window.SmartC = SmartC +} From 81595c5c0777aa075e9cdafadbbabc15d13577e1 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 19 May 2022 22:15:07 -0300 Subject: [PATCH 032/112] Adding Get_Asset_Circulating and B_To_Assets_Of_Tx_In_A --- src/__tests__/assembly.a.spec.ts | 1 - src/__tests__/functions.b.spec.ts | 7 +++++++ src/shaper/templates.ts | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/__tests__/assembly.a.spec.ts b/src/__tests__/assembly.a.spec.ts index 22c7112..dc3f211 100644 --- a/src/__tests__/assembly.a.spec.ts +++ b/src/__tests__/assembly.a.spec.ts @@ -25,7 +25,6 @@ describe('Assembly compilation:', () => { expect(result.ByteCode).toBe(MachineCode) expect(result.ByteData).toBe(MachineData) }) - it('should compile: rare opCodes ', () => { const code = 'FIZ $a\nSTZ $a\nERR :__error\nINC @a\nNOP\nNOP\n__error:\nDEC @a' const MachineCode = '260000000027000000002b1600000004000000007f7f0500000000' diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index cd5edbb..a9c2c6a 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -15,6 +15,13 @@ describe('API functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: all new API (atv3)', () => { + const code = '#include APIFunctions\nlong a;\na = Check_Sig_B_With_A();\na = Get_Code_Hash_Id();\na = Get_Activation_Fee();\nPut_Last_Block_GSig_In_A();\nSet_Map_Value_Keys_In_A();\na = Get_Map_Value_Keys_In_A();\na = Issue_Asset();\nMint_Asset();\nDistribute_To_Asset_Holders();\na = Get_Asset_Holders_Count();\na = Get_Asset_Circulating();\nB_To_Assets_Of_Tx_In_A();\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFUN @a Check_Sig_B_With_A\nFUN @a Get_Code_Hash_Id\nFUN @a Get_Activation_Fee\nFUN Put_Last_Block_GSig_In_A\nFUN Set_Map_Value_Keys_In_A\nFUN @a Get_Map_Value_Keys_In_A\nFUN @a Issue_Asset\nFUN Mint_Asset\nFUN Distribute_To_Asset_Holders\nFUN @a Get_Asset_Holders_Count\nFUN @a Get_Asset_Circulating\nFUN B_To_Assets_Of_Tx_In_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) test('should throw: missing argument', () => { expect(() => { const code = '#pragma optimizationLevel 0\n#include APIFunctions\nSet_A1();' diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 70cedd6..0540fd6 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -838,6 +838,13 @@ export const APITableTemplate: SC_FUNCTION[] = [ sentences: [], name: 'Get_Code_Hash_Id' }, + { + argsMemObj: [], + asmName: 'B_To_Assets_Of_Tx_In_A', + declaration: 'void', + sentences: [], + name: 'B_To_Assets_Of_Tx_In_A' + }, { argsMemObj: [], asmName: 'Get_Map_Value_Keys_In_A', @@ -893,5 +900,12 @@ export const APITableTemplate: SC_FUNCTION[] = [ declaration: 'void', sentences: [], name: 'Put_Last_Block_GSig_In_A' + }, + { + argsMemObj: [], + asmName: 'Get_Asset_Circulating', + declaration: 'long', + sentences: [], + name: 'Get_Asset_Circulating' } ] From a68d270d0eb24101f54eb4321f65486db45021d2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 19 May 2022 22:18:15 -0300 Subject: [PATCH 033/112] Chore package-lock --- package-lock.json | 2209 ++++++--------------------------------------- 1 file changed, 297 insertions(+), 1912 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2d10e43..7ef384c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "smartc", - "version": "0.4.0", + "name": "smartc-signum-compiler", + "version": "1.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "smartc", - "version": "0.4.0", + "name": "smartc-signum-compiler", + "version": "1.0.3", "license": "BSD-3-Clause", "devDependencies": { "@types/jest": "^27.0.2", @@ -19,9 +19,6 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", "jest": "^27.3.1", - "light-server": "^2.9.1", - "markdown-folder-to-html": "^2.4.0", - "smartc-assembly-highlight": "^1.0.2", "ts-jest": "^27.0.7", "typescript": "^4.3.5" } @@ -58,21 +55,21 @@ } }, "node_modules/@babel/core": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.10.tgz", - "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.0.tgz", + "integrity": "sha512-Xyw74OlJwDijToNi0+6BBI5mLLR5+5R3bcSH80LXzjzEGEUlvNzujEE71BaD/ApEZHAvFI/Mlmp4M5lIkdeeWw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.10", + "@babel/generator": "^7.18.0", "@babel/helper-compilation-targets": "^7.17.10", - "@babel/helper-module-transforms": "^7.17.7", - "@babel/helpers": "^7.17.9", - "@babel/parser": "^7.17.10", + "@babel/helper-module-transforms": "^7.18.0", + "@babel/helpers": "^7.18.0", + "@babel/parser": "^7.18.0", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.10", - "@babel/types": "^7.17.10", + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -109,19 +106,33 @@ } }, "node_modules/@babel/generator": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", - "integrity": "sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.0.tgz", + "integrity": "sha512-81YO9gGx6voPXlvYdZBliFXAZU8vZ9AZ6z+CjlmcnaeOcYSFbMTpdeDUO9xD9dh/68Vq03I8ZspfUTPfitcDHg==", "dev": true, "dependencies": { - "@babel/types": "^7.17.10", - "@jridgewell/gen-mapping": "^0.1.0", + "@babel/types": "^7.18.0", + "@jridgewell/gen-mapping": "^0.3.0", "jsesc": "^2.5.1" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz", + "integrity": "sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/helper-compilation-targets": { "version": "7.17.10", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.10.tgz", @@ -199,9 +210,9 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", - "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.0.tgz", + "integrity": "sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.16.7", @@ -210,17 +221,17 @@ "@babel/helper-split-export-declaration": "^7.16.7", "@babel/helper-validator-identifier": "^7.16.7", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.3", - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "version": "7.17.12", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz", + "integrity": "sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA==", "dev": true, "engines": { "node": ">=6.9.0" @@ -269,23 +280,23 @@ } }, "node_modules/@babel/helpers": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.9.tgz", - "integrity": "sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.0.tgz", + "integrity": "sha512-AE+HMYhmlMIbho9nbvicHyxFwhrO+xhKB6AhRxzl8w46Yj0VXTZjEsAoBVC7rB2I0jzX+yWyVybnO08qkfx6kg==", "dev": true, "dependencies": { "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.9", - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", - "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "version": "7.17.12", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", + "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.16.7", @@ -368,9 +379,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.10.tgz", - "integrity": "sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.0.tgz", + "integrity": "sha512-AqDccGC+m5O/iUStSJy3DGRIUFu7WbY/CppZYwrEUB4N0tZlnI8CSTsgL7v5fHVFmUbRv2sd+yy27o8Ydt4MGg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -527,12 +538,12 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.10.tgz", - "integrity": "sha512-xJefea1DWXW09pW4Tm9bjwVlPDyYA2it3fWlmEjpYz6alPvTUjL0EOzNzI/FEOyI3r4/J7uVH5UqKgl1TQ5hqQ==", + "version": "7.17.12", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.12.tgz", + "integrity": "sha512-TYY0SXFiO31YXtNg3HtFwNJHjLsAyIIhAhNWkQ5whPPS7HWUFlg9z0Ta4qAQNjQbP1wsSt/oKkmZ/4/WWdMUpw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.17.12" }, "engines": { "node": ">=6.9.0" @@ -568,19 +579,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.10.tgz", - "integrity": "sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.0.tgz", + "integrity": "sha512-oNOO4vaoIQoGjDQ84LgtF/IAlxlyqL4TUuoQ7xLkQETFaHkY1F7yazhB4Kt3VcZGL0ZF/jhrEpnXqUb0M7V3sw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.10", + "@babel/generator": "^7.18.0", "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-function-name": "^7.17.9", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.17.10", - "@babel/types": "^7.17.10", + "@babel/parser": "^7.18.0", + "@babel/types": "^7.18.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -610,9 +621,9 @@ } }, "node_modules/@babel/types": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", - "integrity": "sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.0.tgz", + "integrity": "sha512-vhAmLPAiC8j9K2GnsnLPCIH5wCrPpYIVBCWRBFDCB7Y/BXLqi/O+1RSTTM2bsmg6U/551+FCf9PNPxjABmxHTw==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.16.7", @@ -1035,33 +1046,33 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", - "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", - "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.1.tgz", + "integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.12", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", - "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz", + "integrity": "sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", @@ -1205,9 +1216,9 @@ } }, "node_modules/@types/jest": { - "version": "27.5.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz", - "integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.1.tgz", + "integrity": "sha512-fUy7YRpT+rHXto1YlL+J9rs0uLGyiqVt3ZOTQR+4ROc47yNl8WLdVLgUloBRhOxP1PZvguHl44T3H0wAWxahYQ==", "dev": true, "dependencies": { "jest-matcher-utils": "^27.0.0", @@ -1223,19 +1234,19 @@ "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "node_modules/@types/node": { - "version": "17.0.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz", - "integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==", + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", + "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==", "dev": true }, "node_modules/@types/prettier": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.0.tgz", - "integrity": "sha512-G/AdOadiZhnJp0jXCaBQU449W2h716OW/EoXeYkCytxKL06X1WCXB4DZpp8TpZ8eyIJVS1cw4lrlkkSYU21cDw==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.1.tgz", + "integrity": "sha512-XFjFHmaLVifrAKaZ+EKghFHtHSUonyw8P2Qmy2/+osBnrKbH9UYtlK10zg8/kCt47MFilll/DEDKy3DHfJ0URw==", "dev": true }, "node_modules/@types/stack-utils": { @@ -1422,19 +1433,6 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dev": true, - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -1504,9 +1502,9 @@ } }, "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, "engines": { "node": ">=6" @@ -1643,7 +1641,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, "node_modules/babel-jest": { @@ -1744,24 +1742,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/basic-auth": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", - "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", - "dev": true, - "dependencies": { - "safe-buffer": "5.1.2" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", - "dev": true - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1878,9 +1858,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001336", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", - "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", + "version": "1.0.30001341", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz", + "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==", "dev": true, "funding": [ { @@ -1919,9 +1899,9 @@ } }, "node_modules/ci-info": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", - "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.1.tgz", + "integrity": "sha512-SXgeMX9VwDe7iFFaEWkA5AstuER9YKqy4EhHqr4DVqkwmD9rpVimkMKWHdjn30Ja45txyjhSn63lVX69eVCckg==", "dev": true }, "node_modules/cjs-module-lexer": { @@ -1987,90 +1967,12 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "node_modules/connect": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", - "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", - "dev": true, - "dependencies": { - "debug": "2.6.9", - "finalhandler": "1.1.2", - "parseurl": "~1.3.3", - "utils-merge": "1.0.1" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/connect-history-api-fallback": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", - "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", - "dev": true, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/connect-injector": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/connect-injector/-/connect-injector-0.4.4.tgz", - "integrity": "sha1-qBlZwx7PXKoPPcwyXCjtkLgwqpA=", - "dev": true, - "dependencies": { - "debug": "^2.0.0", - "q": "^1.0.1", - "stream-buffers": "^0.2.3", - "uberproto": "^1.1.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/connect-injector/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/connect-injector/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "node_modules/connect/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/connect/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -2080,12 +1982,6 @@ "safe-buffer": "~5.1.1" } }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2207,21 +2103,6 @@ "node": ">=0.4.0" } }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", - "dev": true - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2231,12 +2112,6 @@ "node": ">=8" } }, - "node_modules/detect-node": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", - "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "dev": true - }, "node_modules/diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -2291,16 +2166,10 @@ "node": ">=8" } }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, "node_modules/electron-to-chromium": { - "version": "1.4.134", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.134.tgz", - "integrity": "sha512-OdD7M2no4Mi8PopfvoOuNcwYDJ2mNFxaBfurA6okG3fLBaMcFah9S+si84FhX+FIWLKkdaiHfl4A+5ep/gOVrg==", + "version": "1.4.137", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.137.tgz", + "integrity": "sha512-0Rcpald12O11BUogJagX3HsCN3FE83DSqWjgXoHo5a72KUKMSfI39XBgJpgNNxS9fuGzytaFjE06kZkiVFy2qA==", "dev": true }, "node_modules/emittery": { @@ -2321,15 +2190,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -2342,12 +2202,6 @@ "node": ">=8.6" } }, - "node_modules/entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -2358,17 +2212,19 @@ } }, "node_modules/es-abstract": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", - "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.1", "get-symbol-description": "^1.0.0", "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", @@ -2380,9 +2236,10 @@ "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2676,12 +2533,6 @@ "node": ">=6" } }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -3231,21 +3082,6 @@ "node": ">=0.10.0" } }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true - }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -3369,39 +3205,6 @@ "node": ">=8" } }, - "node_modules/finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dev": true, - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -3433,26 +3236,6 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, - "node_modules/follow-redirects": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz", - "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -3467,15 +3250,6 @@ "node": ">= 6" } }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3502,22 +3276,37 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "node_modules/gaze": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", - "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, - "dependencies": { - "globule": "^1.0.0" - }, - "engines": { - "node": ">= 4.0.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gensync": { @@ -3590,15 +3379,15 @@ } }, "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -3622,9 +3411,9 @@ } }, "node_modules/globals": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", - "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3656,64 +3445,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globule": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz", - "integrity": "sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg==", - "dev": true, - "dependencies": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/globule/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/globule/node_modules/minimatch": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", - "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "node_modules/handle-thing": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", - "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3783,42 +3520,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, - "node_modules/hpack.js/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/hpack.js/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -3837,68 +3538,18 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", - "dev": true - }, - "node_modules/http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", "dev": true, "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" }, "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-errors/node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-errors/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "node_modules/http-proxy": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", - "dev": true, - "dependencies": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" + "node": ">= 6" } }, "node_modules/https-proxy-agent": { @@ -4018,15 +3669,6 @@ "node": ">= 0.4" } }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -4269,12 +3911,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -5131,46 +4767,12 @@ "node": ">= 0.8.0" } }, - "node_modules/light-server": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/light-server/-/light-server-2.9.1.tgz", - "integrity": "sha512-8uerqP4ffFbTJZ2QGR1225TqZUWEFkl/kGnJ+vRGiaqnLr6pFj8XLFGyO1XgO8ib9NQKxd7gsq3pEYN3AB+Q2g==", - "dev": true, - "dependencies": { - "commander": "^6.0.0", - "connect": "^3.7.0", - "connect-history-api-fallback": "^1.6.0", - "connect-injector": "^0.4.4", - "gaze": "^1.1.3", - "http-proxy": "^1.18.1", - "morgan": "~1.10.0", - "opener": "^1.5.1", - "parseurl": "^1.3.3", - "serve-index": "^1.9.1", - "serve-static": "~1.14.1", - "spdy": "^4.0.2", - "strip-json-comments": "^3.1.1", - "ws": "^7.3.1" - }, - "bin": { - "light-server": "bin/light-server" - } - }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", - "dev": true, - "dependencies": { - "uc.micro": "^1.0.1" - } - }, "node_modules/locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -5259,51 +4861,6 @@ "tmpl": "1.0.5" } }, - "node_modules/markdown-folder-to-html": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/markdown-folder-to-html/-/markdown-folder-to-html-2.4.0.tgz", - "integrity": "sha512-oaxyYSxiigSnKGH8ZdKAmR8uIzU9eXSY3hflOAdMZeLJZGDjiio1cnDIHzdSNbhtJHiLNxsCJ0ncePE4dR4QtQ==", - "dev": true, - "dependencies": { - "markdown-it": "^8.4.2", - "markdown-it-anchor": "^5.2.4", - "shelljs": "^0.8.3" - }, - "bin": { - "markdown-folder-to-html": "cli.js" - } - }, - "node_modules/markdown-it": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", - "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "entities": "~1.1.1", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, - "node_modules/markdown-it-anchor": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz", - "integrity": "sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA==", - "dev": true, - "peerDependencies": { - "markdown-it": "*" - } - }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", - "dev": true - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -5332,18 +4889,6 @@ "node": ">=8.6" } }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -5374,12 +4919,6 @@ "node": ">=6" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -5398,37 +4937,6 @@ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, - "node_modules/morgan": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", - "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", - "dev": true, - "dependencies": { - "basic-auth": "~2.0.1", - "debug": "2.6.9", - "depd": "~2.0.0", - "on-finished": "~2.3.0", - "on-headers": "~1.0.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/morgan/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/morgan/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -5441,15 +4949,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5542,33 +5041,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true - }, - "node_modules/on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5593,15 +5065,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/opener": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", - "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", - "dev": true, - "bin": { - "opener": "bin/opener-bin.js" - } - }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -5688,15 +5151,6 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -5883,12 +5337,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -5926,16 +5374,6 @@ "node": ">=6" } }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", - "dev": true, - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -5956,45 +5394,27 @@ } ] }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "node_modules/regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" }, "engines": { - "node": ">= 6" - } - }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "dependencies": { - "resolve": "^1.1.6" + "node": ">= 0.4" }, - "engines": { - "node": ">= 0.10" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/regexpp": { @@ -6027,12 +5447,6 @@ "node": ">=0.10.0" } }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -6161,12 +5575,6 @@ "node": ">=10" } }, - "node_modules/select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", - "dev": true - }, "node_modules/semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -6182,136 +5590,6 @@ "node": ">=10" } }, - "node_modules/send": { - "version": "0.17.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", - "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", - "dev": true, - "dependencies": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "1.8.1", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "node_modules/send/node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/send/node_modules/http-errors": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", - "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", - "dev": true, - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/send/node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - }, - "node_modules/serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", - "dev": true, - "dependencies": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-index/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/serve-index/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "node_modules/serve-static": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", - "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", - "dev": true, - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6333,23 +5611,6 @@ "node": ">=8" } }, - "node_modules/shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "dev": true, - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -6402,12 +5663,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/smartc-assembly-highlight": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/smartc-assembly-highlight/-/smartc-assembly-highlight-1.0.2.tgz", - "integrity": "sha512-j2vJO0XEnaRtO57WGixL4ofrNvoWv3BZF3ezkLAzJdeDU6AKSu6CR9C0Cc6MN38tNN9J1lUknDrZdvuVMRJsKg==", - "dev": true - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -6427,36 +5682,6 @@ "source-map": "^0.6.0" } }, - "node_modules/spdy": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", - "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", - "dev": true, - "dependencies": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/spdy-transport": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", - "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", - "dev": true, - "dependencies": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" - } - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -6484,53 +5709,6 @@ "node": ">=8" } }, - "node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/stream-buffers": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-0.2.6.tgz", - "integrity": "sha1-GBwI1bs2kARfaUAbmuanoM8zE/w=", - "dev": true, - "engines": { - "node": ">= 0.3.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -6778,15 +5956,6 @@ "node": ">=8.0" } }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, "node_modules/tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -6814,9 +5983,9 @@ } }, "node_modules/ts-jest": { - "version": "27.1.4", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.4.tgz", - "integrity": "sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==", + "version": "27.1.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz", + "integrity": "sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA==", "dev": true, "dependencies": { "bs-logger": "0.x", @@ -6965,21 +6134,6 @@ "node": ">=4.2.0" } }, - "node_modules/uberproto": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/uberproto/-/uberproto-1.2.0.tgz", - "integrity": "sha1-YdTqsCT5CcTm6lK+hnxIlKS+63Y=", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -7004,15 +6158,6 @@ "node": ">= 4.0.0" } }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -7022,21 +6167,6 @@ "punycode": "^2.1.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -7096,15 +6226,6 @@ "makeerror": "1.0.12" } }, - "node_modules/wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "dev": true, - "dependencies": { - "minimalistic-assert": "^1.0.0" - } - }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -7321,21 +6442,21 @@ "dev": true }, "@babel/core": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.10.tgz", - "integrity": "sha512-liKoppandF3ZcBnIYFjfSDHZLKdLHGJRkoWtG8zQyGJBQfIYobpnVGI5+pLBNtS6psFLDzyq8+h5HiVljW9PNA==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.0.tgz", + "integrity": "sha512-Xyw74OlJwDijToNi0+6BBI5mLLR5+5R3bcSH80LXzjzEGEUlvNzujEE71BaD/ApEZHAvFI/Mlmp4M5lIkdeeWw==", "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.10", + "@babel/generator": "^7.18.0", "@babel/helper-compilation-targets": "^7.17.10", - "@babel/helper-module-transforms": "^7.17.7", - "@babel/helpers": "^7.17.9", - "@babel/parser": "^7.17.10", + "@babel/helper-module-transforms": "^7.18.0", + "@babel/helpers": "^7.18.0", + "@babel/parser": "^7.18.0", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.10", - "@babel/types": "^7.17.10", + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -7361,14 +6482,27 @@ } }, "@babel/generator": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.10.tgz", - "integrity": "sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.0.tgz", + "integrity": "sha512-81YO9gGx6voPXlvYdZBliFXAZU8vZ9AZ6z+CjlmcnaeOcYSFbMTpdeDUO9xD9dh/68Vq03I8ZspfUTPfitcDHg==", "dev": true, "requires": { - "@babel/types": "^7.17.10", - "@jridgewell/gen-mapping": "^0.1.0", + "@babel/types": "^7.18.0", + "@jridgewell/gen-mapping": "^0.3.0", "jsesc": "^2.5.1" + }, + "dependencies": { + "@jridgewell/gen-mapping": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz", + "integrity": "sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + } } }, "@babel/helper-compilation-targets": { @@ -7429,9 +6563,9 @@ } }, "@babel/helper-module-transforms": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", - "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.0.tgz", + "integrity": "sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.16.7", @@ -7440,14 +6574,14 @@ "@babel/helper-split-export-declaration": "^7.16.7", "@babel/helper-validator-identifier": "^7.16.7", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.3", - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0" } }, "@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "version": "7.17.12", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz", + "integrity": "sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA==", "dev": true }, "@babel/helper-simple-access": { @@ -7481,20 +6615,20 @@ "dev": true }, "@babel/helpers": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.9.tgz", - "integrity": "sha512-cPCt915ShDWUEzEp3+UNRktO2n6v49l5RSnG9M5pS24hA+2FAc5si+Pn1i4VVbQQ+jh+bIZhPFQOJOzbrOYY1Q==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.0.tgz", + "integrity": "sha512-AE+HMYhmlMIbho9nbvicHyxFwhrO+xhKB6AhRxzl8w46Yj0VXTZjEsAoBVC7rB2I0jzX+yWyVybnO08qkfx6kg==", "dev": true, "requires": { "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.9", - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.18.0", + "@babel/types": "^7.18.0" } }, "@babel/highlight": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", - "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "version": "7.17.12", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", + "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.16.7", @@ -7561,9 +6695,9 @@ } }, "@babel/parser": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.10.tgz", - "integrity": "sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.0.tgz", + "integrity": "sha512-AqDccGC+m5O/iUStSJy3DGRIUFu7WbY/CppZYwrEUB4N0tZlnI8CSTsgL7v5fHVFmUbRv2sd+yy27o8Ydt4MGg==", "dev": true }, "@babel/plugin-syntax-async-generators": { @@ -7675,12 +6809,12 @@ } }, "@babel/plugin-syntax-typescript": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.10.tgz", - "integrity": "sha512-xJefea1DWXW09pW4Tm9bjwVlPDyYA2it3fWlmEjpYz6alPvTUjL0EOzNzI/FEOyI3r4/J7uVH5UqKgl1TQ5hqQ==", + "version": "7.17.12", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.12.tgz", + "integrity": "sha512-TYY0SXFiO31YXtNg3HtFwNJHjLsAyIIhAhNWkQ5whPPS7HWUFlg9z0Ta4qAQNjQbP1wsSt/oKkmZ/4/WWdMUpw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.17.12" } }, "@babel/template": { @@ -7706,19 +6840,19 @@ } }, "@babel/traverse": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.10.tgz", - "integrity": "sha512-VmbrTHQteIdUUQNTb+zE12SHS/xQVIShmBPhlNP12hD5poF2pbITW1Z4172d03HegaQWhLffdkRJYtAzp0AGcw==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.0.tgz", + "integrity": "sha512-oNOO4vaoIQoGjDQ84LgtF/IAlxlyqL4TUuoQ7xLkQETFaHkY1F7yazhB4Kt3VcZGL0ZF/jhrEpnXqUb0M7V3sw==", "dev": true, "requires": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.10", + "@babel/generator": "^7.18.0", "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-function-name": "^7.17.9", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.17.10", - "@babel/types": "^7.17.10", + "@babel/parser": "^7.18.0", + "@babel/types": "^7.18.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -7741,9 +6875,9 @@ } }, "@babel/types": { - "version": "7.17.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.10.tgz", - "integrity": "sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.0.tgz", + "integrity": "sha512-vhAmLPAiC8j9K2GnsnLPCIH5wCrPpYIVBCWRBFDCB7Y/BXLqi/O+1RSTTM2bsmg6U/551+FCf9PNPxjABmxHTw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.16.7", @@ -8076,27 +7210,27 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", - "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", "dev": true }, "@jridgewell/set-array": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", - "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.1.tgz", + "integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.12", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", - "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz", + "integrity": "sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", @@ -8228,9 +7362,9 @@ } }, "@types/jest": { - "version": "27.5.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz", - "integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==", + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.1.tgz", + "integrity": "sha512-fUy7YRpT+rHXto1YlL+J9rs0uLGyiqVt3ZOTQR+4ROc47yNl8WLdVLgUloBRhOxP1PZvguHl44T3H0wAWxahYQ==", "dev": true, "requires": { "jest-matcher-utils": "^27.0.0", @@ -8246,19 +7380,19 @@ "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "@types/node": { - "version": "17.0.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz", - "integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==", + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", + "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==", "dev": true }, "@types/prettier": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.0.tgz", - "integrity": "sha512-G/AdOadiZhnJp0jXCaBQU449W2h716OW/EoXeYkCytxKL06X1WCXB4DZpp8TpZ8eyIJVS1cw4lrlkkSYU21cDw==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.1.tgz", + "integrity": "sha512-XFjFHmaLVifrAKaZ+EKghFHtHSUonyw8P2Qmy2/+osBnrKbH9UYtlK10zg8/kCt47MFilll/DEDKy3DHfJ0URw==", "dev": true }, "@types/stack-utils": { @@ -8371,16 +7505,6 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, - "accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dev": true, - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -8432,9 +7556,9 @@ } }, "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true }, "ansi-escapes": { @@ -8528,7 +7652,7 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, "babel-jest": { @@ -8608,21 +7732,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "basic-auth": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", - "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", - "dev": true, - "requires": { - "safe-buffer": "5.1.2" - } - }, - "batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", - "dev": true - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -8708,9 +7817,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001336", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", - "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", + "version": "1.0.30001341", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz", + "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==", "dev": true }, "chalk": { @@ -8730,9 +7839,9 @@ "dev": true }, "ci-info": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", - "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.1.tgz", + "integrity": "sha512-SXgeMX9VwDe7iFFaEWkA5AstuER9YKqy4EhHqr4DVqkwmD9rpVimkMKWHdjn30Ja45txyjhSn63lVX69eVCckg==", "dev": true }, "cjs-module-lexer": { @@ -8788,82 +7897,12 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "connect": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", - "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", - "dev": true, - "requires": { - "debug": "2.6.9", - "finalhandler": "1.1.2", - "parseurl": "~1.3.3", - "utils-merge": "1.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "connect-history-api-fallback": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", - "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", - "dev": true - }, - "connect-injector": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/connect-injector/-/connect-injector-0.4.4.tgz", - "integrity": "sha1-qBlZwx7PXKoPPcwyXCjtkLgwqpA=", - "dev": true, - "requires": { - "debug": "^2.0.0", - "q": "^1.0.1", - "stream-buffers": "^0.2.3", - "uberproto": "^1.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, "convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -8873,12 +7912,6 @@ "safe-buffer": "~5.1.1" } }, - "core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -8973,30 +8006,12 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "dev": true - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", - "dev": true - }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true }, - "detect-node": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", - "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "dev": true - }, "diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -9038,16 +8053,10 @@ } } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, "electron-to-chromium": { - "version": "1.4.134", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.134.tgz", - "integrity": "sha512-OdD7M2no4Mi8PopfvoOuNcwYDJ2mNFxaBfurA6okG3fLBaMcFah9S+si84FhX+FIWLKkdaiHfl4A+5ep/gOVrg==", + "version": "1.4.137", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.137.tgz", + "integrity": "sha512-0Rcpald12O11BUogJagX3HsCN3FE83DSqWjgXoHo5a72KUKMSfI39XBgJpgNNxS9fuGzytaFjE06kZkiVFy2qA==", "dev": true }, "emittery": { @@ -9062,12 +8071,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true - }, "enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -9077,12 +8080,6 @@ "ansi-colors": "^4.1.1" } }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -9093,17 +8090,19 @@ } }, "es-abstract": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", - "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.1", "get-symbol-description": "^1.0.0", "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", @@ -9115,9 +8114,10 @@ "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" } }, "es-shim-unscopables": { @@ -9290,12 +8290,6 @@ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -9698,18 +8692,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true - }, - "eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true - }, "execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -9812,38 +8794,6 @@ "to-regex-range": "^5.0.1" } }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -9869,12 +8819,6 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, - "follow-redirects": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz", - "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", - "dev": true - }, "form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -9886,12 +8830,6 @@ "mime-types": "^2.1.12" } }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "dev": true - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -9911,20 +8849,29 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "gaze": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", - "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", - "dev": true, - "requires": { - "globule": "^1.0.0" - } + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true }, "gensync": { "version": "1.0.0-beta.2", @@ -9972,15 +8919,15 @@ } }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -9995,9 +8942,9 @@ } }, "globals": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", - "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -10017,54 +8964,12 @@ "slash": "^3.0.0" } }, - "globule": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz", - "integrity": "sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg==", - "dev": true, - "requires": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "dependencies": { - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "minimatch": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", - "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } - } - }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "handle-thing": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", - "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -10110,44 +9015,6 @@ "has-symbols": "^1.0.2" } }, - "hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -10163,49 +9030,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", - "dev": true - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - }, - "dependencies": { - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - } - } - }, - "http-proxy": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", - "dev": true, - "requires": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - } - }, "http-proxy-agent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", @@ -10301,12 +9125,6 @@ "side-channel": "^1.0.4" } }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "dev": true - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -10468,12 +9286,6 @@ "call-bind": "^1.0.2" } }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -11140,43 +9952,12 @@ "type-check": "~0.4.0" } }, - "light-server": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/light-server/-/light-server-2.9.1.tgz", - "integrity": "sha512-8uerqP4ffFbTJZ2QGR1225TqZUWEFkl/kGnJ+vRGiaqnLr6pFj8XLFGyO1XgO8ib9NQKxd7gsq3pEYN3AB+Q2g==", - "dev": true, - "requires": { - "commander": "^6.0.0", - "connect": "^3.7.0", - "connect-history-api-fallback": "^1.6.0", - "connect-injector": "^0.4.4", - "gaze": "^1.1.3", - "http-proxy": "^1.18.1", - "morgan": "~1.10.0", - "opener": "^1.5.1", - "parseurl": "^1.3.3", - "serve-index": "^1.9.1", - "serve-static": "~1.14.1", - "spdy": "^4.0.2", - "strip-json-comments": "^3.1.1", - "ws": "^7.3.1" - } - }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", - "dev": true, - "requires": { - "uc.micro": "^1.0.1" - } - }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -11252,43 +10033,6 @@ "tmpl": "1.0.5" } }, - "markdown-folder-to-html": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/markdown-folder-to-html/-/markdown-folder-to-html-2.4.0.tgz", - "integrity": "sha512-oaxyYSxiigSnKGH8ZdKAmR8uIzU9eXSY3hflOAdMZeLJZGDjiio1cnDIHzdSNbhtJHiLNxsCJ0ncePE4dR4QtQ==", - "dev": true, - "requires": { - "markdown-it": "^8.4.2", - "markdown-it-anchor": "^5.2.4", - "shelljs": "^0.8.3" - } - }, - "markdown-it": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", - "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "entities": "~1.1.1", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - } - }, - "markdown-it-anchor": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz", - "integrity": "sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA==", - "dev": true, - "requires": {} - }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", - "dev": true - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -11311,12 +10055,6 @@ "picomatch": "^2.3.1" } }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true - }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -11338,12 +10076,6 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -11359,36 +10091,6 @@ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, - "morgan": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", - "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", - "dev": true, - "requires": { - "basic-auth": "~2.0.1", - "debug": "2.6.9", - "depd": "~2.0.0", - "on-finished": "~2.3.0", - "on-headers": "~1.0.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -11401,12 +10103,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "dev": true - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -11475,27 +10171,6 @@ "es-abstract": "^1.19.1" } }, - "obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -11514,12 +10189,6 @@ "mimic-fn": "^2.1.0" } }, - "opener": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", - "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", - "dev": true - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -11585,12 +10254,6 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -11724,12 +10387,6 @@ } } }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -11758,48 +10415,27 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, - "q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", - "dev": true - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true - }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, "requires": { - "resolve": "^1.1.6" + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" } }, "regexpp": { @@ -11820,12 +10456,6 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -11911,12 +10541,6 @@ "xmlchars": "^2.2.0" } }, - "select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", - "dev": true - }, "semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -11926,127 +10550,6 @@ "lru-cache": "^6.0.0" } }, - "send": { - "version": "0.17.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", - "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", - "dev": true, - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "1.8.1", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, - "http-errors": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", - "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.1" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - } - } - }, - "serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", - "dev": true, - "requires": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "serve-static": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", - "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", - "dev": true, - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.2" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true - }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -12062,17 +10565,6 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, "side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -12113,12 +10605,6 @@ "is-fullwidth-code-point": "^3.0.0" } }, - "smartc-assembly-highlight": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/smartc-assembly-highlight/-/smartc-assembly-highlight-1.0.2.tgz", - "integrity": "sha512-j2vJO0XEnaRtO57WGixL4ofrNvoWv3BZF3ezkLAzJdeDU6AKSu6CR9C0Cc6MN38tNN9J1lUknDrZdvuVMRJsKg==", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -12135,33 +10621,6 @@ "source-map": "^0.6.0" } }, - "spdy": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", - "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - } - }, - "spdy-transport": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", - "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -12185,35 +10644,6 @@ } } }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "dev": true - }, - "stream-buffers": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-0.2.6.tgz", - "integrity": "sha1-GBwI1bs2kARfaUAbmuanoM8zE/w=", - "dev": true - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - } - } - }, "string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -12402,12 +10832,6 @@ "is-number": "^7.0.0" } }, - "toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "dev": true - }, "tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -12429,9 +10853,9 @@ } }, "ts-jest": { - "version": "27.1.4", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.4.tgz", - "integrity": "sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==", + "version": "27.1.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz", + "integrity": "sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA==", "dev": true, "requires": { "bs-logger": "0.x", @@ -12524,18 +10948,6 @@ "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true }, - "uberproto": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/uberproto/-/uberproto-1.2.0.tgz", - "integrity": "sha1-YdTqsCT5CcTm6lK+hnxIlKS+63Y=", - "dev": true - }, - "uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, "unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -12554,12 +10966,6 @@ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true - }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -12569,18 +10975,6 @@ "punycode": "^2.1.0" } }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true - }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -12633,15 +11027,6 @@ "makeerror": "1.0.12" } }, - "wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "dev": true, - "requires": { - "minimalistic-assert": "^1.0.0" - } - }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", From 2a9968f37272c5a106636f956ebc433018999c93 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 21 May 2022 09:49:22 -0300 Subject: [PATCH 034/112] Adding simple debug webpage --- debug.html | 93 +++ package-lock.json | 1573 ++++++++++++++++++++++++++++++++++++++++++++- package.json | 6 +- 3 files changed, 1644 insertions(+), 28 deletions(-) create mode 100644 debug.html diff --git a/debug.html b/debug.html new file mode 100644 index 0000000..f7d7559 --- /dev/null +++ b/debug.html @@ -0,0 +1,93 @@ + + + + + + + + + Simple debugger page + + + + +
Simple debugger page
+

Use this page to debug or inspect SmartC process, using a browser.

+
+ + +

+    

+    

+    
+ + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7ef384c..1aaa223 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", "jest": "^27.3.1", + "light-server": "^2.9.1", "ts-jest": "^27.0.7", "typescript": "^4.3.5" } @@ -1433,6 +1434,19 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -1742,6 +1756,24 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dev": true, + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1967,12 +1999,90 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "node_modules/connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/connect-injector": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/connect-injector/-/connect-injector-0.4.4.tgz", + "integrity": "sha1-qBlZwx7PXKoPPcwyXCjtkLgwqpA=", + "dev": true, + "dependencies": { + "debug": "^2.0.0", + "q": "^1.0.1", + "stream-buffers": "^0.2.3", + "uberproto": "^1.1.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/connect-injector/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/connect-injector/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/connect/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/connect/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -1982,6 +2092,12 @@ "safe-buffer": "~5.1.1" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2103,6 +2219,21 @@ "node": ">=0.4.0" } }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2112,6 +2243,12 @@ "node": ">=8" } }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true + }, "node_modules/diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -2166,6 +2303,12 @@ "node": ">=8" } }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, "node_modules/electron-to-chromium": { "version": "1.4.137", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.137.tgz", @@ -2190,6 +2333,15 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -2533,6 +2685,12 @@ "node": ">=6" } }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -3082,6 +3240,21 @@ "node": ">=0.10.0" } }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -3205,6 +3378,39 @@ "node": ">=8" } }, + "node_modules/finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "node_modules/find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -3236,6 +3442,26 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz", + "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -3250,6 +3476,15 @@ "node": ">= 6" } }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3309,6 +3544,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gaze": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "dev": true, + "dependencies": { + "globule": "^1.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3445,12 +3692,64 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globule": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz", + "integrity": "sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg==", + "dev": true, + "dependencies": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/globule/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globule/node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "node_modules/handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3520,6 +3819,42 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -3538,6 +3873,56 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-errors/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-errors/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/http-proxy-agent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", @@ -3911,6 +4296,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4767,6 +5158,31 @@ "node": ">= 0.8.0" } }, + "node_modules/light-server": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/light-server/-/light-server-2.9.1.tgz", + "integrity": "sha512-8uerqP4ffFbTJZ2QGR1225TqZUWEFkl/kGnJ+vRGiaqnLr6pFj8XLFGyO1XgO8ib9NQKxd7gsq3pEYN3AB+Q2g==", + "dev": true, + "dependencies": { + "commander": "^6.0.0", + "connect": "^3.7.0", + "connect-history-api-fallback": "^1.6.0", + "connect-injector": "^0.4.4", + "gaze": "^1.1.3", + "http-proxy": "^1.18.1", + "morgan": "~1.10.0", + "opener": "^1.5.1", + "parseurl": "^1.3.3", + "serve-index": "^1.9.1", + "serve-static": "~1.14.1", + "spdy": "^4.0.2", + "strip-json-comments": "^3.1.1", + "ws": "^7.3.1" + }, + "bin": { + "light-server": "bin/light-server" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -4889,6 +5305,18 @@ "node": ">=8.6" } }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -4919,6 +5347,12 @@ "node": ">=6" } }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -4937,17 +5371,57 @@ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true + "node_modules/morgan": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", + "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", + "dev": true, + "dependencies": { + "basic-auth": "~2.0.1", + "debug": "2.6.9", + "depd": "~2.0.0", + "on-finished": "~2.3.0", + "on-headers": "~1.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/morgan/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/morgan/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } }, "node_modules/node-int64": { "version": "0.4.0", @@ -5041,6 +5515,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5065,6 +5566,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -5151,6 +5661,15 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -5337,6 +5856,12 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -5374,6 +5899,16 @@ "node": ">=6" } }, + "node_modules/q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true, + "engines": { + "node": ">=0.6.0", + "teleport": ">=0.2.0" + } + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -5394,12 +5929,35 @@ } ] }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/regexp.prototype.flags": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", @@ -5447,6 +6005,12 @@ "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -5575,6 +6139,12 @@ "node": ">=10" } }, + "node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, "node_modules/semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -5590,6 +6160,136 @@ "node": ">=10" } }, + "node_modules/send": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "1.8.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/send/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/send/node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dev": true, + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/send/node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "node_modules/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "dependencies": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/serve-static": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", + "dev": true, + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5682,6 +6382,36 @@ "source-map": "^0.6.0" } }, + "node_modules/spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -5709,6 +6439,53 @@ "node": ">=8" } }, + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/stream-buffers": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-0.2.6.tgz", + "integrity": "sha1-GBwI1bs2kARfaUAbmuanoM8zE/w=", + "dev": true, + "engines": { + "node": ">= 0.3.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -5956,6 +6733,15 @@ "node": ">=8.0" } }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, "node_modules/tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -6134,6 +6920,15 @@ "node": ">=4.2.0" } }, + "node_modules/uberproto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/uberproto/-/uberproto-1.2.0.tgz", + "integrity": "sha1-YdTqsCT5CcTm6lK+hnxIlKS+63Y=", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -6158,6 +6953,15 @@ "node": ">= 4.0.0" } }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -6167,6 +6971,21 @@ "punycode": "^2.1.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -6226,6 +7045,15 @@ "makeerror": "1.0.12" } }, + "node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -7505,6 +8333,16 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -7732,6 +8570,21 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", + "dev": true + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -7897,30 +8750,106 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", "dev": true, "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true + }, + "connect-injector": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/connect-injector/-/connect-injector-0.4.4.tgz", + "integrity": "sha1-qBlZwx7PXKoPPcwyXCjtkLgwqpA=", + "dev": true, + "requires": { + "debug": "^2.0.0", + "q": "^1.0.1", + "stream-buffers": "^0.2.3", + "uberproto": "^1.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, "cssom": { @@ -8006,12 +8935,30 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true }, + "detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true + }, "diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -8053,6 +9000,12 @@ } } }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, "electron-to-chromium": { "version": "1.4.137", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.137.tgz", @@ -8071,6 +9024,12 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, "enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -8290,6 +9249,12 @@ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -8692,6 +9657,18 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, "execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -8794,6 +9771,38 @@ "to-regex-range": "^5.0.1" } }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -8819,6 +9828,12 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, + "follow-redirects": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz", + "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", + "dev": true + }, "form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -8830,6 +9845,12 @@ "mime-types": "^2.1.12" } }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -8873,6 +9894,15 @@ "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true }, + "gaze": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "dev": true, + "requires": { + "globule": "^1.0.0" + } + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -8964,12 +9994,54 @@ "slash": "^3.0.0" } }, + "globule": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz", + "integrity": "sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg==", + "dev": true, + "requires": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + }, + "dependencies": { + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -9015,6 +10087,44 @@ "has-symbols": "^1.0.2" } }, + "hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -9030,6 +10140,49 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "requires": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, "http-proxy-agent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", @@ -9286,6 +10439,12 @@ "call-bind": "^1.0.2" } }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -9952,6 +11111,28 @@ "type-check": "~0.4.0" } }, + "light-server": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/light-server/-/light-server-2.9.1.tgz", + "integrity": "sha512-8uerqP4ffFbTJZ2QGR1225TqZUWEFkl/kGnJ+vRGiaqnLr6pFj8XLFGyO1XgO8ib9NQKxd7gsq3pEYN3AB+Q2g==", + "dev": true, + "requires": { + "commander": "^6.0.0", + "connect": "^3.7.0", + "connect-history-api-fallback": "^1.6.0", + "connect-injector": "^0.4.4", + "gaze": "^1.1.3", + "http-proxy": "^1.18.1", + "morgan": "~1.10.0", + "opener": "^1.5.1", + "parseurl": "^1.3.3", + "serve-index": "^1.9.1", + "serve-static": "~1.14.1", + "spdy": "^4.0.2", + "strip-json-comments": "^3.1.1", + "ws": "^7.3.1" + } + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -10055,6 +11236,12 @@ "picomatch": "^2.3.1" } }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -10076,6 +11263,12 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -10091,6 +11284,36 @@ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, + "morgan": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", + "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", + "dev": true, + "requires": { + "basic-auth": "~2.0.1", + "debug": "2.6.9", + "depd": "~2.0.0", + "on-finished": "~2.3.0", + "on-headers": "~1.0.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -10103,6 +11326,12 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -10171,6 +11400,27 @@ "es-abstract": "^1.19.1" } }, + "obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -10189,6 +11439,12 @@ "mimic-fn": "^2.1.0" } }, + "opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true + }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -10254,6 +11510,12 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true + }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -10387,6 +11649,12 @@ } } }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -10415,18 +11683,41 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "regexp.prototype.flags": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", @@ -10456,6 +11747,12 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -10541,6 +11838,12 @@ "xmlchars": "^2.2.0" } }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, "semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -10550,6 +11853,127 @@ "lru-cache": "^6.0.0" } }, + "send": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "1.8.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + } + } + }, + "serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "serve-static": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", + "dev": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.2" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -10621,6 +12045,33 @@ "source-map": "^0.6.0" } }, + "spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + } + }, + "spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -10644,6 +12095,35 @@ } } }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + }, + "stream-buffers": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-0.2.6.tgz", + "integrity": "sha1-GBwI1bs2kARfaUAbmuanoM8zE/w=", + "dev": true + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, "string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -10832,6 +12312,12 @@ "is-number": "^7.0.0" } }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true + }, "tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -10948,6 +12434,12 @@ "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true }, + "uberproto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/uberproto/-/uberproto-1.2.0.tgz", + "integrity": "sha1-YdTqsCT5CcTm6lK+hnxIlKS+63Y=", + "dev": true + }, "unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -10966,6 +12458,12 @@ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -10975,6 +12473,18 @@ "punycode": "^2.1.0" } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -11027,6 +12537,15 @@ "makeerror": "1.0.12" } }, + "wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/package.json b/package.json index 45bc438..fdd62a3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", - "files": ["dist"], + "files": [ + "dist" + ], "repository": { "type": "git", "url": "git+https://github.com/deleterium/SmartC.git" @@ -27,6 +29,7 @@ "lint": "npx eslint './src/**/*'", "test": "JEST=true npx jest", "test:ci": "JEST=true npx jest --coverage", + "debug": "node esbuild.config.js && npx light-server -s . -p 7002 --no-reload --historyindex '/debug.html'", "build": "npm run lint && node esbuild.config.js && npx tsc" }, "devDependencies": { @@ -40,6 +43,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", "jest": "^27.3.1", + "light-server": "^2.9.1", "ts-jest": "^27.0.7", "typescript": "^4.3.5" } From 9027030d2b173e31c9059856c4b073df78c8d245 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 21 May 2022 09:50:34 -0300 Subject: [PATCH 035/112] Bump next version --- README.md | 2 ++ package.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a65fa5c..f24fc0e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ This library can be obtained through npm: npm install smartc-signum-compiler ``` +The development version is released under tag `@next` and will be released as version 2.0. + # Usage ## Node ```ts diff --git a/package.json b/package.json index fdd62a3..e881753 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "1.0.3", + "version": "2.0.0-rc1", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", @@ -19,7 +19,7 @@ "signum" ], "author": "Rui Deleterium", - "private": true, + "private": false, "license": "BSD-3-Clause", "bugs": { "url": "https://github.com/deleterium/SmartC/issues" From 8453532a0e40d64e2679695905fc31a2cb91dd8a Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 22 May 2022 14:47:09 -0300 Subject: [PATCH 036/112] Chore updating dependencies versions --- package-lock.json | 162 +++++++++++++++++++++++++++++----------------- package.json | 18 +++--- 2 files changed, 113 insertions(+), 67 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1aaa223..19a4270 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,27 +1,27 @@ { "name": "smartc-signum-compiler", - "version": "1.0.3", + "version": "2.0.0-rc1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "smartc-signum-compiler", - "version": "1.0.3", + "version": "2.0.0-rc1", "license": "BSD-3-Clause", "devDependencies": { - "@types/jest": "^27.0.2", - "@typescript-eslint/eslint-plugin": "^4.29.1", - "@typescript-eslint/parser": "^4.29.1", - "esbuild": "^0.13.8", + "@types/jest": "^27.5.1", + "@typescript-eslint/eslint-plugin": "^4.33.0", + "@typescript-eslint/parser": "^4.33.0", + "esbuild": "^0.13.15", "eslint": "^7.32.0", "eslint-config-standard": "^16.0.3", - "eslint-plugin-import": "^2.24.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "jest": "^27.3.1", + "eslint-plugin-promise": "^5.2.0", + "jest": "^27.5.1", "light-server": "^2.9.1", - "ts-jest": "^27.0.7", - "typescript": "^4.3.5" + "ts-jest": "^27.1.5", + "typescript": "^4.4.4" } }, "node_modules/@ampproject/remapping": { @@ -1327,6 +1327,33 @@ "eslint": "*" } }, + "node_modules/@typescript-eslint/experimental-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@typescript-eslint/parser": { "version": "4.33.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", @@ -1354,28 +1381,42 @@ } } }, - "node_modules/@typescript-eslint/scope-manager": { + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", - "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", "dev": true, "dependencies": { "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0" + "@typescript-eslint/visitor-keys": "4.33.0", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^10.12.0 || >=12.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@typescript-eslint/types": { + "node_modules/@typescript-eslint/scope-manager": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", - "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", + "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0" + }, "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, @@ -1384,31 +1425,17 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/typescript-estree": { + "node_modules/@typescript-eslint/types": { "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", - "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", + "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", "dev": true, - "dependencies": { - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0", - "debug": "^4.3.1", - "globby": "^11.0.3", - "is-glob": "^4.0.1", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } } }, "node_modules/@typescript-eslint/visitor-keys": { @@ -6908,9 +6935,9 @@ } }, "node_modules/typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -8272,6 +8299,23 @@ "@typescript-eslint/typescript-estree": "4.33.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" + }, + "dependencies": { + "@typescript-eslint/typescript-estree": { + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + } } }, "@typescript-eslint/parser": { @@ -8284,6 +8328,23 @@ "@typescript-eslint/types": "4.33.0", "@typescript-eslint/typescript-estree": "4.33.0", "debug": "^4.3.1" + }, + "dependencies": { + "@typescript-eslint/typescript-estree": { + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + } } }, "@typescript-eslint/scope-manager": { @@ -8302,21 +8363,6 @@ "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", "dev": true }, - "@typescript-eslint/typescript-estree": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", - "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0", - "debug": "^4.3.1", - "globby": "^11.0.3", - "is-glob": "^4.0.1", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - } - }, "@typescript-eslint/visitor-keys": { "version": "4.33.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", @@ -12429,9 +12475,9 @@ } }, "typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true }, "uberproto": { diff --git a/package.json b/package.json index e881753..93b1915 100644 --- a/package.json +++ b/package.json @@ -33,18 +33,18 @@ "build": "npm run lint && node esbuild.config.js && npx tsc" }, "devDependencies": { - "@types/jest": "^27.0.2", - "@typescript-eslint/eslint-plugin": "^4.29.1", - "@typescript-eslint/parser": "^4.29.1", - "esbuild": "^0.13.8", + "@types/jest": "^27.5.1", + "@typescript-eslint/eslint-plugin": "^4.33.0", + "@typescript-eslint/parser": "^4.33.0", + "esbuild": "^0.13.15", "eslint": "^7.32.0", "eslint-config-standard": "^16.0.3", - "eslint-plugin-import": "^2.24.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "jest": "^27.3.1", + "eslint-plugin-promise": "^5.2.0", + "jest": "^27.5.1", "light-server": "^2.9.1", - "ts-jest": "^27.0.7", - "typescript": "^4.3.5" + "ts-jest": "^27.1.5", + "typescript": "^4.4.4" } } From 54a6c739eec169fd93287b874f6f077989a67c0b Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 22 May 2022 14:52:31 -0300 Subject: [PATCH 037/112] Feat define MACRO --- .../__tests__/preprocessor.spec.ts | 34 ++++++ src/preprocessor/preprocessor.ts | 113 +++++++++++++++--- 2 files changed, 130 insertions(+), 17 deletions(-) diff --git a/src/preprocessor/__tests__/preprocessor.spec.ts b/src/preprocessor/__tests__/preprocessor.spec.ts index 9fd16e4..820fa69 100644 --- a/src/preprocessor/__tests__/preprocessor.spec.ts +++ b/src/preprocessor/__tests__/preprocessor.spec.ts @@ -32,6 +32,22 @@ describe('preprocessor right tests', () => { expect(preprocessor(code)).toBe(result) }) + it('#define macro (simple)', () => { + const code = '#define DEF(top, bottom) (((top) << 8) | (bottom))\nlong a,b,c;\na = DEF(b, c);\n' + const result = '\nlong a,b,c;\na = (((b) << 8) | (c));\n' + expect(preprocessor(code)).toBe(result) + }) + it('#define macro (complex)', () => { + const code = '#define DEF(top, bottom) (((top) << 8) | (bottom))\nlong a,b,c;\na = DEF(mdv(a,b, c), c) + DEF(22, 25);\n' + const result = '\nlong a,b,c;\na = (((mdv(a,b, c)) << 8) | (c)) + (((22) << 8) | (25));\n' + expect(preprocessor(code)).toBe(result) + }) + it('#define macro (with define constant)', () => { + const code = '#define ONE n1\n#define DEF(top, bottom) (((top) << 8) | (bottom + ONE))\n#undef ONE\nlong a,b,c;\na = DEF(mdv(a,b, c), c);\n' + const result = '\n\n\nlong a,b,c;\na = (((mdv(a,b, c)) << 8) | (c + n1));\n' + expect(preprocessor(code)).toBe(result) + }) + it('#ifdef test', () => { const code = '#define debug\n#ifdef debug\n#pragma maxAuxVars 1\n#endif\nlong a; a++;' const result = '\n\n#pragma maxAuxVars 1\n\nlong a; a++;' @@ -139,4 +155,22 @@ describe('preprocessor wrong code', () => { preprocessor(code) }).toThrowError(/^At line/) }) + test('wrong number of macro arguments', () => { + expect(() => { + const code = '#define DEF(top) ((top) << 8))\nlong a,b,c,n1;\na = DEF(b, c);' + preprocessor(code) + }).toThrowError(/^At line/) + }) + test('error parsing macro arguments', () => { + expect(() => { + const code = '#define DEF(top) ((top) << 8)\nlong a,b,c,n1;\na = DEF(b();' + preprocessor(code) + }).toThrowError(/^At line/) + }) + test('macro redefinition', () => { + expect(() => { + const code = '#define DEF(top) ((top) << 8)\n#define DEF(top, bottom) ((top) << 8) | (bottom))\nlong a,b,c,n1;\na = DEF(b);' + preprocessor(code) + }).toThrowError(/^At line/) + }) }) diff --git a/src/preprocessor/preprocessor.ts b/src/preprocessor/preprocessor.ts index 471b654..792a43f 100644 --- a/src/preprocessor/preprocessor.ts +++ b/src/preprocessor/preprocessor.ts @@ -2,7 +2,7 @@ import { assertNotEqual } from '../repository/repository' type PREPROCESSOR_RULE = { regex: RegExp - type: 'DEFINE_NULL' | 'DEFINE_VAL' | 'UNDEF' | 'IFDEF' | 'IFNDEF' | 'ELSE' | 'ENDIF' | 'MATCHES_ALL' + type: 'DEFINE_NULL' | 'DEFINE_MACRO' | 'DEFINE_VAL' | 'UNDEF' | 'IFDEF' | 'IFNDEF' | 'ELSE' | 'ENDIF' | 'MATCHES_REMAINING' } type IF_INFO = { active: boolean @@ -10,7 +10,9 @@ type IF_INFO = { } type REPLACEMENTS = { cname: string + regex: RegExp value: string + macro?: string } type PROCESSED_RULE = { Code: PREPROCESSOR_RULE @@ -26,19 +28,20 @@ export default function preprocessor (sourcecode: string) : string { const preprocessorCodes: PREPROCESSOR_RULE[] = [ // Regex order is important! { regex: /^\s*#\s*define\s+(\w+)\s*$/, type: 'DEFINE_NULL' }, + { regex: /^\s*#\s*define\s+(\w+)\s*(\([^)]+\))\s*(\(.+\))\s*$/, type: 'DEFINE_MACRO' }, { regex: /^\s*#\s*define\s+(\w+\b)(.+)$/, type: 'DEFINE_VAL' }, { regex: /^\s*#\s*undef\s+(\w+)\s*$/, type: 'UNDEF' }, { regex: /^\s*#\s*ifdef\s+(\w+)\s*$/, type: 'IFDEF' }, { regex: /^\s*#\s*ifndef\s+(\w+)\s*$/, type: 'IFNDEF' }, { regex: /^\s*#\s*else\s*$/, type: 'ELSE' }, { regex: /^\s*#\s*endif\s*$/, type: 'ENDIF' }, - { regex: /^[\s\S]*$/, type: 'MATCHES_ALL' } + { regex: /^[\s\S]*$/, type: 'MATCHES_REMAINING' } ] let preprocessorReplacements: REPLACEMENTS[] = [ - { cname: 'true', value: '1' }, - { cname: 'false', value: '0' }, - { cname: 'NULL', value: '0' }, - { cname: 'SMARTC', value: '' } + { cname: 'true', regex: /\btrue\b/, value: '1' }, + { cname: 'false', regex: /\bfalse\b/, value: '0' }, + { cname: 'NULL', regex: /\bNULL\b/, value: '0' }, + { cname: 'SMARTC', regex: /\bSMARTC\b/, value: '' } ] const ifActive: IF_INFO[] = [{ active: true, flipped: false }] let currentIfLevel = 0 @@ -101,12 +104,70 @@ export default function preprocessor (sourcecode: string) : string { throw new Error('Internal error.') } - function replaceDefines (codeline: string) : string { + function replaceDefines (codeline: string, lineNo: number) : string { + let retLine = codeline preprocessorReplacements.forEach((Replacement) => { - const rep = new RegExp('\\b' + Replacement.cname + '\\b', 'g') - codeline = codeline.replace(rep, Replacement.value) + if (Replacement.macro) { + while (true) { + const foundCname = Replacement.regex.exec(retLine) + if (foundCname === null) { + return + } + let replaced = Replacement.macro + const currExtArgs = extractArgs(retLine, foundCname.index + 1, lineNo) + const origExtArgs = extractArgs(Replacement.value, 0, lineNo) + if (origExtArgs.argArray.length !== currExtArgs.argArray.length) { + throw new Error(`At line: ${lineNo + 1}. ` + + `Wrong number of arguments for macro '${Replacement.cname}'. ` + + `Expected ${origExtArgs.argArray.length}, got ${currExtArgs.argArray.length}.`) + } + for (let currArg = 0; currArg < origExtArgs.argArray.length; currArg++) { + replaced = replaced.replace(new RegExp(`\\b${origExtArgs.argArray[currArg]}\\b`, 'g'), currExtArgs.argArray[currArg]) + } + retLine = retLine.slice(0, foundCname.index) + replaced + retLine.slice(currExtArgs.endPosition) + } + } + retLine = retLine.replace(Replacement.regex, Replacement.value) }) - return codeline + return retLine + } + + function extractArgs (fnArgString: string, needle: number, line: number): { argArray: string[], endPosition: number} { + const argArray : string [] = [] + let currArg: string = '' + let pLevel = 0 + let started = false + for (;;needle++) { + const currChar = fnArgString.charAt(needle) + if (currChar === '') { + throw new Error(`At line: ${line + 1}. Unmatched parenthesis or unexpected end of line.`) + } + if (currChar === '(') { + pLevel++ + if (pLevel === 1) { + started = true + continue + } + } + if (!started) continue + if (currChar === ')') { + pLevel-- + if (pLevel === 0) { + argArray.push(currArg.trim()) + break + } + } + if (currChar === ',' && pLevel === 1) { + argArray.push(currArg.trim()) + currArg = '' + continue + } + currArg += currChar + } + return { + argArray, + endPosition: needle + 1 + } } function processLine (currentLine: string, lineNo: number) : string { @@ -114,12 +175,12 @@ export default function preprocessor (sourcecode: string) : string { const IfTemplateObj = { active: true, flipped: false } let idx: number if (currentIfLevel < 0) { - throw new Error(`At line: ${lineNo}. Unmatched '#endif' directive.`) + throw new Error(`At line: ${lineNo + 1}. Unmatched '#endif' directive.`) } assertNotEqual(ifActive.length, 0, 'Internal error') const LastIfInfo = ifActive[ifActive.length - 1] const lineActive = ifActive[currentIfLevel].active - // Process rules that does not depend on lineActive + // Process rules that depend on lineActive switch (PrepRule.Code.type) { case 'IFDEF': currentIfLevel += lineActive ? 1 : 0 @@ -154,11 +215,16 @@ export default function preprocessor (sourcecode: string) : string { if (lineActive === false) { return '' } + // Process rules that does not depend on lineActive switch (PrepRule.Code.type) { case 'DEFINE_NULL': idx = preprocessorReplacements.findIndex(Obj => Obj.cname === PrepRule.parts[1]) if (idx === -1) { - preprocessorReplacements.push({ cname: PrepRule.parts[1], value: '' }) + preprocessorReplacements.push({ + cname: PrepRule.parts[1], + regex: new RegExp('\\b' + PrepRule.parts[1] + '\\b', 'g'), + value: '' + }) return '' } preprocessorReplacements[idx].value = '' @@ -168,17 +234,30 @@ export default function preprocessor (sourcecode: string) : string { if (idx === -1) { preprocessorReplacements.push({ cname: PrepRule.parts[1], - value: replaceDefines(PrepRule.parts[2]).trim() + regex: new RegExp('\\b' + PrepRule.parts[1] + '\\b', 'g'), + value: replaceDefines(PrepRule.parts[2], lineNo).trim() }) return '' } - preprocessorReplacements[idx].value = PrepRule.parts[2].trim() + preprocessorReplacements[idx].value = replaceDefines(PrepRule.parts[2], lineNo).trim() + return '' + case 'DEFINE_MACRO': + idx = preprocessorReplacements.findIndex(Obj => Obj.cname === PrepRule.parts[1]) + if (idx !== -1) { + throw new Error(`At line: ${lineNo + 1}. Cannot redefine macro '${PrepRule.parts[1]}'.`) + } + preprocessorReplacements.push({ + cname: PrepRule.parts[1], + regex: new RegExp(`\\b${PrepRule.parts[1]}\\s*\\(`, 'g'), + value: replaceDefines(PrepRule.parts[2], lineNo), + macro: replaceDefines(PrepRule.parts[3], lineNo) + }) return '' case 'UNDEF': preprocessorReplacements = preprocessorReplacements.filter(obj => obj.cname !== PrepRule.parts[1]) return '' - case 'MATCHES_ALL': - return replaceDefines(currentLine) + case 'MATCHES_REMAINING': + return replaceDefines(currentLine, lineNo) default: // Never reached code. throw new Error('Internal error.') From 3314689b99fbb0149dc07479fe6a020c44e30412 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 22 May 2022 19:24:50 -0300 Subject: [PATCH 038/112] Documentation for #define MACRO --- docs/1-Basis.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 5621d1d..056eded 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -39,6 +39,10 @@ This is optional. #### #define * `#define CNAME`: Just define CNAME with an empty value, or delete its content if it was previously defined. * `#define CNAME value or expression`: Replaces all ocurrences of 'CNAME' to 'value or expression' starting on next line. Compiler defines: `true` for 1; `false` and `NULL` for 0; `SMARTC` with empty value. +* `#define MACRO(arguments) (expression)`: Replaces all ocurrences of 'MACRO' to 'expression', starting on next line. +It works similar to a function, but no function call is executed. +Must be one line instruction (or use `\` at the end of line to escape the newline char). +Many arguments can be used. * `#undef CNAME`: Undefine CNAME. * `#ifdef CNAME`: Start a block to be included if CNAME is defined. Note that CNAME value does not matter and can be empty value. Block must end with a '#endif' directive. Blocks can be nested. * `#ifndef CNAME`: Complementary of '#ifdef'. Includes a block if CNAME is not defined. @@ -63,7 +67,7 @@ This is optional. * `#pragma outputSourceLineNumber[true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number to the C source code. Very usefull for debug. #### Escaping new line -Just end a line with `\` and it will be joined to the next one. It can be used anywhere, even inside "strings". Usefull for multiline program description, #define for a function, or in middle of a variable name! +Just end a line with `\` and it will be joined to the next one. It can be used anywhere, even inside "strings". Usefull for multiline program description, #define for a macro, or in middle of a variable name! ### Variables At the moment, only `long` values are implemented. User can assign them with decimal values (default) (floating point not allowed) `i=2;`, hexadecimal values `i=0xff;`, strings (up to 8 bytes) `msg="Hello!";` or Signum addresses `addr="S-297Z-EKMN-4AVV-7YWXP";` (also valid starting with BURST or TS). Long values can be assigned during their declaration. @@ -75,7 +79,7 @@ Global variables are available in all functions. Functions variables can only be Variables declarations can be inside other sentences, like `for (long i; i<10; i++)` or `if (a){ long i=0; ...}`, but their scope can only be 'global' or 'function', in other words, the result is the same as declaring variables at the program start (if global variables) or at the function start (if function variables). ### Functions -As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru macro definition. There are two special functions: `void main(void)` explained before and `void catch(void)` explained at **Contract states** topic. It is not obligatory to use them. +As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru preprocessor directives. There are two special functions: `void main(void)` explained before and `void catch(void)` explained at **Contract states** topic. It is not obligatory to use them. Functions can return also arrays and structs; the returning values can be used directly: example `if ( arrFn(a)[2] == 25 )` or `b = structFn(a)->value;` ### Built-in functions From f9b254d6fdaa0dbc4a79f69fc326aa1659a6d061 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 22 May 2022 19:28:27 -0300 Subject: [PATCH 039/112] Fix documentation for codeStackPages and userStackPages --- docs/1-Basis.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 056eded..d2aea06 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -33,6 +33,8 @@ A value is mandatory for deployment. Use `0` to make this information available at assembly output (during development). Use the actual number if you plan do distribute the source code, so the compiler will raise an error on divergency. This is optional. +* `#program codeStackPages N`: Code pages are used during function calls, to store the instruction pointer return position (also know as Program Counter). Default value is zero if not needed, or one if needed. Every page allows to store 16 values. Tweak this value if using many nested functions or recursive functions. Maximum value is 10 pages. +* `#program userStackPages N`: User pages are used during function calls to pass arguments values, to store function return value, or to store function scope variables during recursive calls. Default value is zero if not needed, or one if needed. Tweak this value if using more than 16 arguments on functions or recursive functions. Maximum value is 10 pages. #### #include * `#include APIFunctions [true/false/1/0/]`: Make Signum API functions available for use as functions. Default value is `false`. It can be enabled by declaring it with empty argument, `true` or `1`. Function names follow the [ciyam at documentation](https://ciyam.org/at/at_api.html). All API names and a pseudo-code are avaliable also in section **API Pseudo-Code**. @@ -50,8 +52,6 @@ Many arguments can be used. * `#endif`: Ends a block to be included. #### #pragma -* `#pragma codeStackPages N`: Code pages are used during function calls, to store the instruction pointer return position (also know as Program Counter). Default value is zero if not needed, or one if needed. Every page allows to store 16 values. Tweak this value if using many nested functions or recursive functions. Maximum value is 10 pages. -* `#pragma userStackPages N`: User pages are used during function calls to pass arguments values, to store function return value, or to store function scope variables during recursive calls. Default value is zero if not needed, or one if needed. Tweak this value if using more than 16 arguments on functions or recursive functions. Maximum value is 10 pages. * `#pragma enableRandom [true/false/1/0/]`: Makes labels for jumps and conditionals receive a random value. Default value is `false`. Default behaviour is labels having an increasing number starting with 1 (number is base 36). * `#pragma enableLineLabels [true/false/1/0/]`: Adds line number to labels in assembly. Only usefull for debug purposes. Default value is `false`. * `#pragma maxAuxVars N`: Used to tell compiler how many auxiliary variables will be available (they are used as registers). Default value is `3`, min value is `1` and max is `10`. If you are under memory pressure, try to reduce to minimal necessary for compiling. Simple contracts will use around 2 values, but this number depends on nested operations. From 85985bee85003c302f3fb1af73865f8557fca514 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 24 May 2022 10:41:03 -0300 Subject: [PATCH 040/112] Update docs for SIP-37 --- docs/2-API-Pseudo-Code.md | 77 ++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 17 deletions(-) diff --git a/docs/2-API-Pseudo-Code.md b/docs/2-API-Pseudo-Code.md index 664e92a..2f686a1 100644 --- a/docs/2-API-Pseudo-Code.md +++ b/docs/2-API-Pseudo-Code.md @@ -1,6 +1,7 @@ [Back](./) # API Functions pseudo code operations +This documentation applies to Signum AT version 3. # Keep in mind! ### A and B registers @@ -8,9 +9,11 @@ They are 256-bit registers and can be used as one big number (called A or B) or ### Timestamps They are actually two integer 32-bit values joined in a 64-bit value. The most significant part (MSP) is the blockheight and the LSP is the transaction order when the block was forged. +Do not be confused by transactions timestamps, that are the number of seconds since the genesis block (11-oct-2014 02:00:00 UTC) ### Messages An encrypted message to contract is the same as not sending a message. +Messages are read and sent in batches of 32 bytes, they are called pages. The superregisters are used to store these values. # Pseudo code The code below is not valid for SmartC, but can give an idea what is happening when an API function is called. @@ -157,20 +160,16 @@ void Copy_B_From_A(void) { long Check_A_Is_Zero(void) { // Assembly name: check_A_Is_Zero - /* Note that boolean logic is inverted. - * Try not use this function */ if (A1 == 0 && A2 == 0 && A3 == 0 && A4 == 0) - return 0; - return 1; + return 1; + return 0; } long Check_B_Is_Zero(void) { // Assembly name: check_B_Is_Zero - /* Note that boolean logic is inverted. - * Try not use this function */ if (B1 == 0 && B2 == 0 && B3 == 0 && B4 == 0) - return 0; - return 1; + return 1; + return 0; } long Check_A_Equals_B(void) { @@ -337,6 +336,11 @@ long Check_SHA256_A_With_B(void) { return 1; return 0; } + +long Check_Sig_B_With_A(void) { + // Assembly name: Check_Sig_B_With_A + // Checks if the signature of [AT ID, B2, B3, B4] can be verified with the message attached on tx id in A1 (page in A2) for account id in A3 +} ``` ## Generic functions that get block and tx info @@ -359,6 +363,8 @@ long Get_Last_Block_Timestamp(void) { void Put_Last_Block_Hash_In_A(void) { // Assembly name: put_Last_Block_Hash_In_A + // For randomness source use the function Put_Last_Block_GSig_In_A. + // It is less prone to manipulations. A = Blockchain.LastBlock.Hash; } @@ -372,11 +378,10 @@ void A_To_Tx_After_Timestamp(long value) { long Get_Type_For_Tx_In_A(void) { // Assembly name: get_Type_for_Tx_in_A + // Transaction types can be found via http api request: 'getConstants' if (Blockchain.IsThisTxValid(A1) == false) return -1; - if (Blockchain.IsThereMessageinTx(A1) == false) - return 0; - return 1; + return Blockchain.GetTransaction(A1).type; } long Get_Amount_For_Tx_In_A(void) { @@ -403,12 +408,11 @@ long Get_Random_Id_For_Tx_In_A(void) { void Message_From_Tx_In_A_To_B(void) { // Assembly name: message_from_Tx_in_A_to_B - if (Blockchain.IsThisTxValid(A1) == false) - return -1; B = 0; - + if (Blockchain.IsThisTxValid(A1) == false) + return; if (Blockchain.IsThereMessageinTx(A1)) - B = Blockchain.GetMessageFromTx(A1) + B = Blockchain.GetMessageFromTx(A1).AtPage(A2) } void B_To_Address_Of_Tx_In_A(void) { @@ -421,7 +425,24 @@ void B_To_Address_Of_Tx_In_A(void) { void B_To_Address_Of_Creator(void) { // Assembly name: B_to_Address_of_Creator B = 0; - B1 = ContractCreator; + if (B2 == 0) { + B1 = ContractCreator; + return; + } + if (Blockchain.IsAT(B2)) { + B1 = Blockchain.GetCreatorFromAT(B2); + } +} + +long Get_Code_Hash_Id(void) { + // Assembly name: Get_Code_Hash_Id + if (B2 == 0) { + return ThisContract.CodeHashId; + } + if (Blockchain.IsAT(B2)) { + return Blockchain.GetCodeHashIdFromAT(B2); + } + return 0; } ``` @@ -464,13 +485,35 @@ void Send_Old_To_Address_In_B(void) { void Send_A_To_Address_In_B(void) { // Assembly name: send_A_to_Address_in_B - Blockchain.SendMessageInATo(B1); + pendingMessage = ThisContract.GetPendingMessageTo(B1); + if (pendingMessage) { + pendingMessage += [A1..A4]; + return; + } + thisContract.AddMessageTo(B1, [A1..A4]) } long Add_Minutes_To_Timestamp(long timestamp,long minutes) { // Assembly name: add_Minutes_to_Timestamp return ((minutes/4) << 32) + timestamp } + +long Get_Activation_Fee(void) { + // Assembly name: Get_Activation_Fee + if (B2 == 0) { + return ThisContract.ActivationAmount; + } + if (Blockchain.IsAT(B2)) { + return Blockchain.GetActivationAmountFromAT(B2); + } + return 0; +} + +void Put_Last_Block_GSig_In_A(void) { + // Assembly name: Put_Last_Block_GSig_In_A + // Generation Signature is a better random source to be used. + A = Blockchain.LastBlock.GenerationSignature; +} ``` [Back](./) From e54f3a06024f59a02e579430f863991dc59c7ba5 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 24 May 2022 10:41:43 -0300 Subject: [PATCH 041/112] Update docs for SIP-38 --- docs/2-API-Pseudo-Code.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/2-API-Pseudo-Code.md b/docs/2-API-Pseudo-Code.md index 2f686a1..0648cde 100644 --- a/docs/2-API-Pseudo-Code.md +++ b/docs/2-API-Pseudo-Code.md @@ -498,6 +498,28 @@ long Add_Minutes_To_Timestamp(long timestamp,long minutes) { return ((minutes/4) << 32) + timestamp } +long Get_Map_Value_Keys_In_A(void) { + // Assembly name: Get_Map_Value_Keys_In_A + if (A3 == 0) { + if (isSet(ThisContract.map[A1][A2])) { + return ThisContract.map[A1][A2]; + } + return 0; + } + if (IsAT(A3)) { + otherContract = Blockchain.GetContractFromId(A3); + if (isSet(otherContract.map[A1][A2])) { + return otherContract.map[A1][A2]; + } + } + return 0; +} + +void Set_Map_Value_Keys_In_A(void) { + // Assembly name: Set_Map_Value_Keys_In_A + ThisContract.map[A1][A2] = A4; +} + long Get_Activation_Fee(void) { // Assembly name: Get_Activation_Fee if (B2 == 0) { From 1832ec5183f1c543f75224aa964594b67d213a49 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 24 May 2022 19:54:25 -0300 Subject: [PATCH 042/112] Update docs for SIP-39 --- docs/2-API-Pseudo-Code.md | 122 +++++++++++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 8 deletions(-) diff --git a/docs/2-API-Pseudo-Code.md b/docs/2-API-Pseudo-Code.md index 0648cde..3de5ec3 100644 --- a/docs/2-API-Pseudo-Code.md +++ b/docs/2-API-Pseudo-Code.md @@ -386,9 +386,13 @@ long Get_Type_For_Tx_In_A(void) { long Get_Amount_For_Tx_In_A(void) { // Assembly name: get_Amount_for_Tx_in_A - if (Blockchain.IsThisTxValid(A1) == false) + asset = B2; + tx = Blockchain.GetTransactionWithId(A1); + if (!tx) return -1; - return Blockchain.GetAmountFromTx(A1) - ContractActivationAmount; + if (asset == 0 ) + return tx.amount - ContractActivationAmount; + return tx.GetQuantityFromAsset(asset); } long Get_Timestamp_For_Tx_In_A(void) { @@ -444,6 +448,28 @@ long Get_Code_Hash_Id(void) { } return 0; } + +void B_To_Assets_Of_Tx_In_A(void) { + // Assembly name: B_To_Assets_Of_Tx_In_A + B = 0; + tx = Blockchain.GetTransactionWithId(A1); + if (!tx) { + return; + } + if (!HasAssets(tx)) { + return; + } + B1 = tx.asset[0].id; + if (tx.asset[1]) { + B2 = tx.asset[1].id; + } + if (tx.asset[2]) { + B3 = tx.asset[2].id; + } + if (tx.asset[3]) { + B4 = tx.asset[3].id; + } +} ``` ## Generic functions that check balances and perform ops @@ -451,7 +477,10 @@ long Get_Code_Hash_Id(void) { ``` c long Get_Current_Balance(void) { // Assembly name: get_Current_Balance - return Blockchain.GetMyBalanceNow(); + if (B2 == 0) { + return Blockchain.GetMyBalanceNow(); + } + return Blockchain.GetMyBalanceFromAsset(B2); } long Get_Previous_Balance(void) { @@ -459,13 +488,25 @@ long Get_Previous_Balance(void) { return Blockchain.GetMyBalanceLastTimeIWasFrozen(); } -void Send_To_Address_In_B(long value) { +void Send_To_Address_In_B(long amountOrQuantity) { // Assembly name: send_to_Address_in_B - long ContractBalance = Blockchain.GetMyBalanceNow(); - if (value > ContractBalance) - Blockchain.SendAllMyBalanceTo(B1); + recipient = B1; + asset = B2; + if (asset == 0) { + // Send Signa + long ContractBalance = Blockchain.GetMyBalanceNow(); + if (amountOrQuantity > ContractBalance) + Blockchain.SendAllMyBalanceTo(recipient); + else + Blockchain.SendBalanceTo(amountOrQuantity, recipient); + return; + } + // Send asset + long ContractQuantity = Blockchain.GetMyBalanceFromAsset(asset); + if (amountOrQuantity > ContractQuantity) + Blockchain.SendAllMyBalanceFromAssetTo(asset, recipient); else - Blockchain.SendBalanceTo(value, B1); + Blockchain.SendBalanceFromAssetTo(asset, recipient, amountOrQuantity); } void Send_All_To_Address_In_B(void) { @@ -520,6 +561,61 @@ void Set_Map_Value_Keys_In_A(void) { ThisContract.map[A1][A2] = A4; } +long Issue_Asset(void) { + // Assembly name: Issue_Asset + // This API costs 150 signa to be executed! Returns the assetId from created asset. + assetName = [A1, A2] // Limited to 10 chars + return Blockchain.IssueNewAssetWithName(assetName); +} + +void Mint_Asset(void) { + // Assembly name: Mint_Asset + quantity = B1; + asset = B2; + if (!WasIssuedByMe(asset)) + return; + ThisContract.BalanceFromAsset(B2) += quantity; +} + +void Distribute_To_Asset_Holders(void) { + // Assembly name: Distribute_To_Asset_Holders + // amount refers to Signa values, quantity refers to asset values + // holders refers to asset to used in distribution calculation + // toDistribute refers to asset that will be distributed. + holdersAssetMinimumQuantity = B1 + holdersAsset = B2 + amountToDistribute = A1 + assetToDistribute = A3 + quantityToDistribute = A4 + + /* + 1) Distribute 'amountToDistribute' Signa to holders of asset 'holdersAsset' + that have at least 'holdersAssetMinimumQuantity' in account. + 2) Distribute 'quantityToDistribute' from 'assetToDistribute' to holders of + asset 'holdersAsset' that have at least 'holdersAssetMinimumQuantity' + in account. + Notes: + * Treasury accounts will not be included in this distribuition. + * This distribution is done thru indirect transaction. + * The 'assetToDistribute' and 'holdersAsset' can be the same + * Only the free quantity will be taken in account for distribution. Quantity + frozen in sell orders will be disregarded. + * All values will be rounded down (QNT or NQT). This remaining value will be added in + the transaction to the holder that has the greatest quantity. + */ +} + +long Get_Asset_Holders_Count(void) { + // Assembly name: Get_Asset_Holders_Count + mininumQuantity = B1; + asset = B2; + + /* + 1) Return the number of accounts that have at least 'mininumQuantity' of + 'asset'. Does not consider treasury account. + */ +} + long Get_Activation_Fee(void) { // Assembly name: Get_Activation_Fee if (B2 == 0) { @@ -536,6 +632,16 @@ void Put_Last_Block_GSig_In_A(void) { // Generation Signature is a better random source to be used. A = Blockchain.LastBlock.GenerationSignature; } + +long Get_Asset_Circulating(void) { + // Assembly name: Get_Asset_Circulating + asset = B2; + + /* + 1) Return the circulating quantity of 'asset', excluding the quantity in + treasury account. + */ +} ``` [Back](./) From d8987b7c40249705ea0e1c50f369dae004e78077 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 24 May 2022 20:55:51 -0300 Subject: [PATCH 043/112] Bugfix 29 Wrongly reusing assigned var when there are same array in both sides of assignment. --- src/__tests__/bugfixes.a.spec.ts | 7 +++++++ src/codeGenerator/utils.ts | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/__tests__/bugfixes.a.spec.ts b/src/__tests__/bugfixes.a.spec.ts index 588237d..9550848 100644 --- a/src/__tests__/bugfixes.a.spec.ts +++ b/src/__tests__/bugfixes.a.spec.ts @@ -227,4 +227,11 @@ describe('Tests for bugfixes', () => { compiler.compile() }).toThrowError(/^At line/) }) + it('should compile: bug 29 Must not reuse assigned var if it is array and present at both sides', () => { + const code = '#pragma optimizationLevel 0\nlong message[3];\nmessage[1] = (message[1] & 0x0707070000) >> 16;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare message\n^const SET @message #0000000000000004\n^declare message_0\n^declare message_1\n^declare message_2\n\nSET @r0 #0000000707070000\nAND @r0 $message_1\nSET @r1 #0000000000000010\nSHR @r0 $r1\nSET @message_1 $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) diff --git a/src/codeGenerator/utils.ts b/src/codeGenerator/utils.ts index 7874139..72a6a7a 100644 --- a/src/codeGenerator/utils.ts +++ b/src/codeGenerator/utils.ts @@ -214,6 +214,10 @@ export default { } } function lookupAsn (InspAst: LOOKUP_ASN): boolean { + const parts = vname.split('_') + if (parts.find(part => part === InspAst.Token.value)) { + return false + } const CanReuse = InspAst.modifiers.find(CurrentModifier => { if (CurrentModifier.type === 'Array') { if (recursiveFind(CurrentModifier.Center) === false) { From a6b624734eace19ec94b4c260804f14c9b954465 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 24 May 2022 20:57:22 -0300 Subject: [PATCH 044/112] Bump rc release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 93b1915..ec0b0c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc1", + "version": "2.0.0-rc2", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From bff0b7105484ccd786d0500d94b56a6b6a86c7b8 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 29 May 2022 21:21:39 -0300 Subject: [PATCH 045/112] Included keyword 'fixed' and added 'fixed' types --- .../astProcessor/unaryAsnProcessor.ts | 1 + src/shaper/memoryProcessor.ts | 71 ++++++++++--------- src/shaper/shaper.ts | 6 +- src/shaper/templates.ts | 17 ++++- src/syntaxProcessor/createTree.ts | 1 + src/tokenizer/tokenizer.ts | 2 +- src/typings/syntaxTypes.ts | 11 ++- 7 files changed, 66 insertions(+), 43 deletions(-) diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index 0821f0b..bdcc8bc 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -291,6 +291,7 @@ export default function unaryAsnProcessor ( function unaryKeywordProcessor () : GENCODE_SOLVED_OBJECT { switch (CurrentNode.Operation.value) { case 'long': + case 'fixed': case 'void': AuxVars.isDeclaration = CurrentNode.Operation.value return traverseNotLogical() diff --git a/src/shaper/memoryProcessor.ts b/src/shaper/memoryProcessor.ts index 0219e01..0c666b0 100644 --- a/src/shaper/memoryProcessor.ts +++ b/src/shaper/memoryProcessor.ts @@ -30,8 +30,9 @@ export default function memoryProcessor ( while (phraseCode[tokenCounter]?.type === 'Keyword') { switch (phraseCode[tokenCounter].value) { case 'long': + case 'fixed': case 'void': - retMem.push(...longOrVoidProcessControl(phraseCode[tokenCounter].value as 'long'|'void')) + retMem.push(...lfvProcessControl(phraseCode[tokenCounter].value as 'long'|'fixed'|'void')) break case 'struct': retMem.push(...structProcessControl()) @@ -43,9 +44,9 @@ export default function memoryProcessor ( return retMem } - /** From Code containing long/void declaration, return an array of memory objects. + /** From Code containing long/fixed/void declaration, return an array of memory objects. * Handle regular variables, arrays and pointers. This is control flow */ - function longOrVoidProcessControl (definition: 'long'|'void') : MEMORY_SLOT[] { + function lfvProcessControl (definition: 'long'|'fixed'|'void') : MEMORY_SLOT[] { const retMemory : MEMORY_SLOT[] = [] const keywordIndex = tokenCounter let valid = true @@ -66,7 +67,7 @@ export default function memoryProcessor ( tokenCounter++ break } - retMemory.push(...longOrVoidToMemoryObject(definition)) + retMemory.push(...lfvToMemoryObject(definition)) valid = false tokenCounter++ break @@ -80,60 +81,60 @@ export default function memoryProcessor ( /** Return an array of memory objects. Handle regular variables, arrays and pointers. * This is the actual processing code. */ - function longOrVoidToMemoryObject (definition: 'long'|'void') : MEMORY_SLOT[] { - const LongTD = getTypeDefinitionTemplate('long') - const isLovPointer = isItPointer() + function lfvToMemoryObject (definition: 'long'|'fixed'|'void') : MEMORY_SLOT[] { + const definitionTD = getTypeDefinitionTemplate(definition) + const isPointer = isItPointer() const startingTokenCounter = tokenCounter - const lovDimensions = getArrayDimensions() + const dimensions = getArrayDimensions() // tokenCounter was advanced by structArrDimensions.length // prepare lovHeader - const LovHeader = deepCopy(LongTD.MemoryTemplate) - LovHeader.name = phraseCode[startingTokenCounter].value - LovHeader.asmName = AuxVars.currentPrefix + phraseCode[startingTokenCounter].value - LovHeader.scope = AuxVars.currentScopeName + const header = deepCopy(definitionTD.MemoryTemplate) + header.name = phraseCode[startingTokenCounter].value + header.asmName = AuxVars.currentPrefix + phraseCode[startingTokenCounter].value + header.scope = AuxVars.currentScopeName if (definition === 'void') { - if (isLovPointer === false) { + if (isPointer === false) { throw new Error(`At line: ${phraseCode[startingTokenCounter].line}.` + ' Can not declare variables as void.') } - LovHeader.declaration = 'void_ptr' - } else { // phraseCode[keywordIndex].value === 'long' - if (isLovPointer) { - LovHeader.declaration += '_ptr' + header.declaration = 'void_ptr' + } else { // phraseCode[keywordIndex].value === 'long' | 'fixed' + if (isPointer) { + header.declaration += '_ptr' } } - LovHeader.isDeclared = AuxVars.isFunctionArgument + header.isDeclared = AuxVars.isFunctionArgument // If is not an array, just send the header - if (lovDimensions.length === 0) { - return [LovHeader] + if (dimensions.length === 0) { + return [header] } // But if it IS an array, update header - LovHeader.type = 'array' - LovHeader.typeDefinition = structPrefix + LovHeader.asmName - LovHeader.ArrayItem = { + header.type = 'array' + header.typeDefinition = structPrefix + header.asmName + header.ArrayItem = { type: 'long', - declaration: LovHeader.declaration, - typeDefinition: structPrefix + LovHeader.asmName, + declaration: header.declaration, + typeDefinition: structPrefix + header.asmName, totalSize: 0 } - if (isLovPointer === false) { - LovHeader.declaration += '_ptr' + if (isPointer === false) { + header.declaration += '_ptr' } - LovHeader.ArrayItem.totalSize = 1 + lovDimensions.reduce(function (total, num) { + header.ArrayItem.totalSize = 1 + dimensions.reduce(function (total, num) { return total * num }, 1) // Push items into memory - const retArrMem = [LovHeader] - for (let i = 1; i < LovHeader.ArrayItem.totalSize; i++) { - const Mem2 = deepCopy(LongTD.MemoryTemplate) - Mem2.name = `${LovHeader.name}_${i - 1}` - Mem2.asmName = `${LovHeader.asmName}_${i - 1}` + const retArrMem = [header] + for (let i = 1; i < header.ArrayItem.totalSize; i++) { + const Mem2 = deepCopy(definitionTD.MemoryTemplate) + Mem2.name = `${header.name}_${i - 1}` + Mem2.asmName = `${header.asmName}_${i - 1}` Mem2.scope = AuxVars.currentScopeName - Mem2.declaration = LovHeader.ArrayItem.declaration + Mem2.declaration = header.ArrayItem.declaration retArrMem.push(Mem2) } // create array type definition - programTD.push(createArrayTypeDefinition(LovHeader, lovDimensions)) + programTD.push(createArrayTypeDefinition(header, dimensions)) return retArrMem } diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 50eeedf..fa5424b 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -32,7 +32,11 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { splitCode() Program.Global.macros.forEach(processMacroControl) checkCompilerVersion() - Program.typesDefinitions = [getTypeDefinitionTemplate('register'), getTypeDefinitionTemplate('long')] + Program.typesDefinitions = [ + getTypeDefinitionTemplate('register'), + getTypeDefinitionTemplate('long'), + getTypeDefinitionTemplate('fixed') + ] Program.memory.push(...addRegistersInMemory(Program.Config.maxAuxVars)) Program.memory.push(...addConstantsInMemory(Program.Config.maxConstVars)) processGlobalCode() diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 0540fd6..2ce420d 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -1,17 +1,18 @@ import { SC_FUNCTION } from '../typings/contractTypes' import { - REGISTER_TYPE_DEFINITION, LONG_TYPE_DEFINITION, STRUCT_TYPE_DEFINITION, MEMORY_BASE_TYPES, MEMORY_SLOT + REGISTER_TYPE_DEFINITION, LONG_TYPE_DEFINITION, STRUCT_TYPE_DEFINITION, MEMORY_BASE_TYPES, MEMORY_SLOT, FIXED_TYPE_DEFINITION } from '../typings/syntaxTypes' type ObjectTypeDefinition = T extends 'register' ? REGISTER_TYPE_DEFINITION : T extends 'long' ? LONG_TYPE_DEFINITION : + T extends 'fixed' ? LONG_TYPE_DEFINITION : T extends 'struct' ? STRUCT_TYPE_DEFINITION : never; -export function getTypeDefinitionTemplate ( +export function getTypeDefinitionTemplate ( templateType: T ) : ObjectTypeDefinition { - let RetObj: REGISTER_TYPE_DEFINITION | LONG_TYPE_DEFINITION | STRUCT_TYPE_DEFINITION + let RetObj: REGISTER_TYPE_DEFINITION | LONG_TYPE_DEFINITION | STRUCT_TYPE_DEFINITION | FIXED_TYPE_DEFINITION switch (templateType) { case 'register': RetObj = { @@ -24,6 +25,7 @@ export function getTypeDefinitionTemplate RetObj.MemoryTemplate.isDeclared = true break case 'long': + case 'void': RetObj = { type: 'long', name: '', @@ -32,6 +34,15 @@ export function getTypeDefinitionTemplate RetObj.MemoryTemplate.declaration = 'long' RetObj.MemoryTemplate.size = 1 break + case 'fixed': + RetObj = { + type: 'fixed', + name: '', + MemoryTemplate: getMemoryTemplate('fixed') + } + RetObj.MemoryTemplate.declaration = 'fixed' + RetObj.MemoryTemplate.size = 1 + break case 'struct': RetObj = { name: '', diff --git a/src/syntaxProcessor/createTree.ts b/src/syntaxProcessor/createTree.ts index ab8e064..eebb7d9 100644 --- a/src/syntaxProcessor/createTree.ts +++ b/src/syntaxProcessor/createTree.ts @@ -190,6 +190,7 @@ function KeywordToAST (tokens: TOKEN[], keywordLoc: number) : AST { } return { type: 'endASN', Token: tokens[0] } case 'long': + case 'fixed': case 'void': case 'struct': if (tokens.length === 1) { diff --git a/src/tokenizer/tokenizer.ts b/src/tokenizer/tokenizer.ts index 5d51bc0..e77048d 100644 --- a/src/tokenizer/tokenizer.ts +++ b/src/tokenizer/tokenizer.ts @@ -84,7 +84,7 @@ export default function tokenizer (inputSourceCode: string): PRE_TOKEN[] { addLength: 2 }, { // regular keywords - start: /^(break|case|const|continue|default|do|else|exit|for|goto|halt|if|long|return|sleep|sizeof|switch|void|while)\b/, + start: /^(break|case|const|continue|default|do|else|exit|fixed|for|goto|halt|if|long|return|sleep|sizeof|switch|void|while)\b/, pretokenType: 'keyword', addLength: 0 }, diff --git a/src/typings/syntaxTypes.ts b/src/typings/syntaxTypes.ts index 9241d56..30270c7 100644 --- a/src/typings/syntaxTypes.ts +++ b/src/typings/syntaxTypes.ts @@ -12,7 +12,7 @@ export type TOKEN_TYPES = 'Variable' | 'Constant' | 'Operator' | 'UnaryOperator' 'Arr'|'CodeCave'|'CodeDomain'|'Delimiter'|'Terminator'|'Macro'|'Member'|'Colon'| 'Keyword'|'Function' | 'APICall' | 'BuiltInCall' | 'Push' -export type DECLARATION_TYPES = 'void' | 'long' | 'struct' | 'void_ptr' | 'long_ptr' | 'struct_ptr' | '' +export type DECLARATION_TYPES = 'void' | 'long' | 'fixed' | 'struct' | 'void_ptr' | 'long_ptr' | 'struct_ptr' | '' export type TOKEN = { line: number @@ -27,7 +27,7 @@ export type TOKEN = { extValue?: string } -export type MEMORY_BASE_TYPES = 'register' | 'long' | 'constant' | 'struct' | 'structRef' | 'array' | 'label' | 'void' +export type MEMORY_BASE_TYPES = 'register' | 'long' | 'fixed' | 'constant' | 'struct' | 'structRef' | 'array' | 'label' | 'void' /** If constant, it is the number to shift. If variable, it is the address containing the value to shift. * Stores information about variable it is pointing to. @@ -256,4 +256,9 @@ export type LONG_TYPE_DEFINITION = { name: '', MemoryTemplate: MEMORY_SLOT } -export type TYPE_DEFINITIONS = STRUCT_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION | REGISTER_TYPE_DEFINITION | LONG_TYPE_DEFINITION +export type FIXED_TYPE_DEFINITION = { + type: 'fixed' + name: '', + MemoryTemplate: MEMORY_SLOT +} +export type TYPE_DEFINITIONS = STRUCT_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION | REGISTER_TYPE_DEFINITION | LONG_TYPE_DEFINITION | FIXED_TYPE_DEFINITION From 0220080a155f4088f4ffdd79ec3df912fec640a1 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 29 May 2022 21:59:05 -0300 Subject: [PATCH 046/112] Constants accepting fixed numbers --- src/codeGenerator/__tests__/utils.spec.ts | 30 ++++++++++++++++--- .../astProcessor/endAsnProcessor.ts | 7 +++-- src/codeGenerator/utils.ts | 30 ++++++++++++++----- src/parser/parser.ts | 24 +++++++++++++-- src/tokenizer/tokenizer.ts | 2 +- src/typings/syntaxTypes.ts | 2 +- 6 files changed, 75 insertions(+), 20 deletions(-) diff --git a/src/codeGenerator/__tests__/utils.spec.ts b/src/codeGenerator/__tests__/utils.spec.ts index 777a01d..3ef9de3 100644 --- a/src/codeGenerator/__tests__/utils.spec.ts +++ b/src/codeGenerator/__tests__/utils.spec.ts @@ -49,9 +49,31 @@ describe('codeGenerator utils functions', () => { utils.divHexContents(11, undefined) }).toThrowError('Division by zero') }) - test('should throw: Fractional number in createConstantMemObj', () => { - expect(() => { - utils.createConstantMemObj(1.5) - }).toThrowError('Only integer numbers in createConstantMemObj().') + it('should create: createConstantMemObj Number', () => { + const MemObj = utils.createConstantMemObj(32) + expect(MemObj.hexContent).toBe('0000000000000020') + expect(MemObj.declaration).toBe('long') + expect(MemObj.size).toBe(1) + }) + it('should create: createConstantMemObj Bigint', () => { + const MemObj = utils.createConstantMemObj(320n) + expect(MemObj.hexContent).toBe('0000000000000140') + expect(MemObj.declaration).toBe('long') + }) + it('should create: createConstantMemObj Bigint overflow', () => { + const MemObj = utils.createConstantMemObj(18446744073709551616n) + expect(MemObj.hexContent).toBe('00000000000000010000000000000000') + expect(MemObj.declaration).toBe('long') + expect(MemObj.size).toBe(2) + }) + it('should create: createConstantMemObj Fixed', () => { + const MemObj = utils.createConstantMemObj(1.5) + expect(MemObj.hexContent).toBe('0000000008f0d180') + expect(MemObj.declaration).toBe('fixed') + }) + it('should create: createConstantMemObj String', () => { + const MemObj = utils.createConstantMemObj('feff') + expect(MemObj.hexContent).toBe('000000000000feff') + expect(MemObj.declaration).toBe('long') }) }) diff --git a/src/codeGenerator/astProcessor/endAsnProcessor.ts b/src/codeGenerator/astProcessor/endAsnProcessor.ts index d7b4c21..2ac00d5 100644 --- a/src/codeGenerator/astProcessor/endAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/endAsnProcessor.ts @@ -44,9 +44,10 @@ export default function endAsnProcessor ( } return { SolvedMem: utils.createVoidMemObj(), asmCode: '' } } - const RetMemObj = utils.createConstantMemObj() - RetMemObj.size = CurrentNode.Token.value.length / 16 - RetMemObj.hexContent = CurrentNode.Token.value + const RetMemObj = utils.createConstantMemObj(CurrentNode.Token.value) + if (CurrentNode.Token.extValue === 'fixed') { + RetMemObj.declaration = 'fixed' + } return { SolvedMem: RetMemObj, asmCode: '' } } diff --git a/src/codeGenerator/utils.ts b/src/codeGenerator/utils.ts index 72a6a7a..fcce552 100644 --- a/src/codeGenerator/utils.ts +++ b/src/codeGenerator/utils.ts @@ -17,24 +17,38 @@ type HEXCONTENTS = number | string | undefined */ export default { /** Creates a constant Memory Object */ - createConstantMemObj (value: number | string = ''): MEMORY_SLOT { + createConstantMemObj (value?: number | bigint | string): MEMORY_SLOT { let param: string - if (typeof (value) === 'number') { + let declaration : 'long' | 'fixed' = 'long' + switch (typeof (value)) { + case 'number': if (value % 1 !== 0) { - throw new Error('Only integer numbers in createConstantMemObj().') + const intPart = BigInt(Math.trunc(value)) + const fractionalPart = BigInt(Math.trunc((value % 1) * 100000000)) + param = (intPart * 100000000n + fractionalPart).toString(16) + declaration = 'fixed' + break } - param = value.toString(16).padStart(16, '0').slice(-16) - } else { - param = value.padStart(16, '0').slice(-16) + param = value.toString(16) + break + case 'bigint': + param = value.toString(16) + break + case 'string': + param = value + break + default: + param = '' } + param = param.padStart((Math.floor((param.length - 1) / 16) + 1) * 16, '0') return { address: -1, name: '', asmName: '', type: 'constant', scope: '', - size: 1, - declaration: 'long', + size: param.length / 16, + declaration, isDeclared: true, hexContent: param } diff --git a/src/parser/parser.ts b/src/parser/parser.ts index dcf6237..6081d9d 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -79,9 +79,27 @@ export default function parser (preTokens: PRE_TOKEN[]): TOKEN[] { sequence: ['numberDec'], action (tokenID): TOKEN { const PreTkn = preTokens[tokenID] - let val = BigInt(PreTkn.value.replace(/_/g, '')).toString(16) - val = val.padStart((Math.floor((val.length - 1) / 16) + 1) * 16, '0') - return { type: 'Constant', precedence: 0, value: val, line: PreTkn.line } + PreTkn.value = PreTkn.value.replace(/_/g, '') + let val: bigint = 0n + let extValue = 'long' + if (PreTkn.value.includes('.')) { + const parts = PreTkn.value.split('.') + if (parts.length !== 2) { + throw new Error(`At line ${PreTkn.line}. ` + + ' Found more than one decimal point in number.') + } + if (parts[1].length > 8) { + throw new Error(`At line ${PreTkn.line}. ` + + 'Fixed numbers cannot have more than 8 digits as decimal fraction.') + } + val = BigInt(parts[0]) * 100000000n + BigInt(parts[1].padEnd(8, '0')) + extValue = 'fixed' + } else { + val = BigInt(PreTkn.value) + } + const valString = val.toString(16) + const paddedValString = valString.padStart((Math.floor((valString.length - 1) / 16) + 1) * 16, '0') + return { type: 'Constant', precedence: 0, value: paddedValString, line: PreTkn.line, extValue } } }, { diff --git a/src/tokenizer/tokenizer.ts b/src/tokenizer/tokenizer.ts index e77048d..e01c9e1 100644 --- a/src/tokenizer/tokenizer.ts +++ b/src/tokenizer/tokenizer.ts @@ -74,7 +74,7 @@ export default function tokenizer (inputSourceCode: string): PRE_TOKEN[] { addLength: 0 }, { // decimal numbers - start: /^(\d[\d_]*\b)/, + start: /(^\d[\d_.]*\b|^\.[\d_]+\b)/, pretokenType: 'numberDec', addLength: 0 }, diff --git a/src/typings/syntaxTypes.ts b/src/typings/syntaxTypes.ts index 30270c7..7aff7a2 100644 --- a/src/typings/syntaxTypes.ts +++ b/src/typings/syntaxTypes.ts @@ -23,7 +23,7 @@ export type TOKEN = { value: string /** Only applicable to Arr, CodeCave, CodeDomain, Variable with modifier */ params?: TOKEN[] - /** Only applicable to types: asm, break, continue, struct or label */ + /** Only applicable to types: asm, break, continue, constant, struct or label */ extValue?: string } From 1702a56f2f9a6d64ab23848b6f0c6028fa5e8dca Mon Sep 17 00:00:00 2001 From: deleterium Date: Mon, 30 May 2022 22:46:50 -0300 Subject: [PATCH 047/112] Assignment and Operators accepting fixed --- .../assemblyProcessor/assignmentToAsm.ts | 2 + .../assemblyProcessor/createInstruction.ts | 8 +- .../assemblyProcessor/operatorToAsm.ts | 130 ++++++++++++++++-- .../astProcessor/binaryAsnProcessor.ts | 13 +- src/shaper/shaper.ts | 12 +- src/shaper/templates.ts | 12 ++ 6 files changed, 161 insertions(+), 16 deletions(-) diff --git a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts index c2e4579..0950628 100644 --- a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts @@ -16,6 +16,7 @@ export default function assignmentToAsm ( switch (Left.type) { case 'register': case 'long': + case 'fixed': case 'structRef': return leftRegularToAsm() case 'array': @@ -37,6 +38,7 @@ export default function assignmentToAsm ( return leftRegularOffsetUndefinedAndRightConstantToAsm() case 'register': case 'long': + case 'fixed': case 'structRef': return leftRegularOffsetUndefinedAndRightRegularToAsm() case 'array': diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 9158d7d..757cb0b 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -59,6 +59,8 @@ export function createSimpleInstruction (instruction: string, param1: string = ' return `${param1}:\n` case 'Function': return `JSR :__fn_${param1}\n` + case 'LongToFixed': + return `MUL @${param1} $f100000000\n` default: throw new Error(`Unknow simple instruction: ${instruction}`) } @@ -180,8 +182,12 @@ export function flattenMemory ( } hexString = hexString.padStart(16, '0') assertExpression(hexString.length <= 16) + let prefix = 'n' + if (paramDec === 'fixed') { + prefix = 'f' + } const OptMem = AuxVars.memory.find(MEM => { - return MEM.asmName === 'n' + Number('0x' + hexString) && MEM.hexContent === hexString + return MEM.asmName === prefix + Number('0x' + hexString) && MEM.hexContent === hexString }) if (OptMem) { return { FlatMem: OptMem, asmCode: '', isNew: false } diff --git a/src/codeGenerator/assemblyProcessor/operatorToAsm.ts b/src/codeGenerator/assemblyProcessor/operatorToAsm.ts index 58b6f9f..7d9b3f0 100644 --- a/src/codeGenerator/assemblyProcessor/operatorToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/operatorToAsm.ts @@ -13,23 +13,107 @@ export default function operatorToAsm ( ) : string { const FlatLeft = flattenMemory(AuxVars, LeftMem, OperatorToken.line) const FlatRight = flattenMemory(AuxVars, RightMem, OperatorToken.line) + let assemblyCode = '' - function operatorToAsmMain () { + function operatorToAsmMain () : string { assertExpression(LeftMem.type !== 'constant') - let assemblyCode = '' - if (RightMem.type === 'constant') { - const optimizationResult = testOptimizations() - if (optimizationResult === undefined) { - AuxVars.freeRegister(FlatRight.FlatMem.address) - return '' + + switch (FlatLeft.FlatMem.declaration) { + case 'fixed': + return leftFixedToAsm() + default: + if (FlatRight.FlatMem.declaration === 'fixed') { + throw new Error('Internal error') } - if (optimizationResult.length > 0) { - // Optimizations before already flat left side. - assertExpression(FlatLeft.isNew === false, 'Internal error. Expecting not new item.') - return FlatLeft.asmCode + optimizationResult + return leftRegularRightRegularToAsm() + } + } + + function leftFixedToAsm () : string { + switch (FlatRight.FlatMem.declaration) { + case 'fixed': + return leftFixedRightFixedToAsm() + default: + return leftFixedRightRegularToAsm() + } + } + + function leftFixedRightFixedToAsm () : string { + switch (OperatorToken.value) { + case '%': + case '%=': + case '&': + case '&=': + case '|': + case '|=': + case '^': + case '^=': + throw new Error(`At line ${OperatorToken.line}. ` + + `Cannot use operator ${OperatorToken.value} with 'fixed' types.`) + case '<<': + case '<<=': + case '>>': + case '>>=': + throw new Error(`At line ${OperatorToken.line}. ` + + `Cannot use operator ${OperatorToken.value} with 'fixed' type on right side.`) + case '*': + case '*=': + assemblyCode = `MDV @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName} $f100000000\n` + break + case '/': + case '/=': + assemblyCode = `MDV @${FlatLeft.FlatMem.asmName} $f100000000 $${FlatRight.FlatMem.asmName}\n` + break + default: // + - + assemblyCode = chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` + } + freeRegisters() + return FlatLeft.asmCode + FlatRight.asmCode + assemblyCode + } + + function leftFixedRightRegularToAsm () : string { + switch (OperatorToken.value) { + case '%': + case '%=': + case '&': + case '&=': + case '|': + case '|=': + case '^': + case '^=': + throw new Error(`At line ${OperatorToken.line}. ` + + `Cannot use operator ${OperatorToken.value} with 'fixed' types.`) + case '+': + case '+=': + case '-': + case '-=': + if (FlatRight.isNew === true) { + assemblyCode = `MUL @${FlatRight.FlatMem.asmName} $f100000000\n` + assemblyCode += chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` + } else { + const RetObj = AuxVars.getNewRegister() + assemblyCode = `SET @${RetObj.asmName} $${FlatRight.FlatMem.asmName}\n` + assemblyCode += `MUL @${RetObj.asmName} $f100000000\n` + assemblyCode += chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${RetObj.asmName}\n` + AuxVars.freeRegister(RetObj.address) } + break + default: // << >> + assemblyCode = chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` + } + freeRegisters() + return FlatLeft.asmCode + FlatRight.asmCode + assemblyCode + } + + function leftRegularRightRegularToAsm () : string { + const optimized = tryOptimization() + if (optimized !== undefined) { + return optimized } - // No optimization was possible, do regular operations assemblyCode = chooseOperator(OperatorToken.value) + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` AuxVars.freeRegister(FlatRight.FlatMem.address) @@ -40,6 +124,20 @@ export default function operatorToAsm ( return FlatLeft.asmCode + FlatRight.asmCode + assemblyCode } + function tryOptimization () : string | undefined { + if (RightMem.type === 'constant') { + const optimizationResult = testOptimizations() + if (optimizationResult === undefined) { + AuxVars.freeRegister(FlatRight.FlatMem.address) + return '' + } + if (optimizationResult.length > 0) { + // Optimizations before already flat left side. + assertExpression(FlatLeft.isNew === false, 'Internal error. Expecting not new item.') + return FlatLeft.asmCode + optimizationResult + } + } + } /** Check and do optimization on a constant right side. * Returns undefined if optimization is do nothing * Returns empty string if no optimization was found @@ -114,6 +212,14 @@ export default function operatorToAsm ( return '' } + function freeRegisters () : void { + AuxVars.freeRegister(FlatRight.FlatMem.address) + if (FlatLeft.isNew === true) { + assemblyCode += createInstruction(AuxVars, utils.genAssignmentToken(OperatorToken.line), LeftMem, FlatLeft.FlatMem) + AuxVars.freeRegister(FlatLeft.FlatMem.address) + } + } + return operatorToAsmMain() } diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 721a99b..7ad49d0 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -103,6 +103,12 @@ export default function binaryAsnProcessor ( } else { TmpMemObj = LGenObj.SolvedMem } + // fixed verification + if (TmpMemObj.declaration !== 'fixed' && + utils.getDeclarationFromMemory(RGenObj.SolvedMem) === 'fixed') { + assemblyCode += createSimpleInstruction('LongToFixed', TmpMemObj.asmName) + TmpMemObj.declaration = 'fixed' + } // Pointer verifications 1 if (utils.getDeclarationFromMemory(RGenObj.SolvedMem).includes('_ptr') && !TmpMemObj.declaration.includes('_ptr')) { @@ -235,7 +241,7 @@ export default function binaryAsnProcessor ( function assignmentRightSideSolver (Left: MEMORY_SLOT) : GENCODE_SOLVED_OBJECT { if (CurrentNode.Operation.type !== 'Assignment' || Program.Config.reuseAssignedVar === false || - Left.type !== 'long' || + (Left.type !== 'long' && Left.type !== 'fixed') || Left.Offset !== undefined || !utils.findVarNameInAst(Left.name, CurrentNode.Right)) { // Can not reuse assigned var. @@ -250,7 +256,7 @@ export default function binaryAsnProcessor ( const registerInitialState = deepCopy(AuxVars.registerInfo) const NewRegister: MEMORY_SLOT = deepCopy(Left) NewRegister.type = 'register' - NewRegister.declaration = 'long' + NewRegister.declaration = Left.declaration AuxVars.registerInfo.unshift({ inUse: false, Template: NewRegister @@ -485,6 +491,9 @@ export default function binaryAsnProcessor ( default: return false } + if (Left.declaration === 'fixed' && Right.declaration !== 'fixed') { + return true + } // Try optimization if left side is constant (only commutativa operations!) if (checkOperatorOptimization(operatorVal, Left)) { return true diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index fa5424b..ac81e38 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -6,7 +6,7 @@ import { } from '../typings/syntaxTypes' import { assertNotUndefined, deepCopy } from '../repository/repository' import { - APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate + APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate, fixedBaseTemplate } from './templates' import sentencesProcessor from './sentencesProcessor' import memoryProcessor from './memoryProcessor' @@ -39,6 +39,9 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { ] Program.memory.push(...addRegistersInMemory(Program.Config.maxAuxVars)) Program.memory.push(...addConstantsInMemory(Program.Config.maxConstVars)) + if (fixedDetected()) { + Program.memory.push(fixedBaseTemplate) + } processGlobalCode() Program.functions.forEach(processFunctionCodeAndArguments) if (Program.Config.APIFunctions) { @@ -324,6 +327,13 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { return retObj } + /** Detects if fixed point calculations will be needed */ + function fixedDetected () : boolean { + return !!tokenAST.find((Tkn) => ( + (Tkn.type === 'Keyword' && Tkn.value === 'fixed') || + (Tkn.type === 'Constant' && Tkn.extValue === 'fixed'))) + } + /** Process global code, transforming them into global sentences properties */ function processGlobalCode () : void { AuxVars.currentScopeName = '' diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 2ce420d..4b9f53b 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -143,6 +143,18 @@ export function getMemoryTemplate (memType: MEMORY_BASE_TYPES) : MEMORY_SLOT { } } +export const fixedBaseTemplate : MEMORY_SLOT = { + address: -1, + asmName: 'f100000000', + declaration: 'fixed', + isDeclared: false, + name: 'f100000000', + hexContent: '0000000005f5e100', + scope: '', + size: 1, + type: 'fixed' +} + export const APITableTemplate: SC_FUNCTION[] = [ { argsMemObj: [], From 5da11ce699e6d334160660422a8d841ec74913d8 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 31 May 2022 17:05:29 -0300 Subject: [PATCH 048/112] More 'fixed' operations UnaryOperator SetUnaryOperator CheckOperator Unary/Binary Arr --- .../assemblyProcessor/createInstruction.ts | 12 ++++++++++++ .../astProcessor/binaryAsnProcessor.ts | 19 +++++++++++++------ .../astProcessor/lookupAsnProcessor.ts | 4 ++++ .../astProcessor/unaryAsnProcessor.ts | 5 +++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 757cb0b..0986fdf 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -252,6 +252,18 @@ export function createInstruction ( /** Create instruction for SetUnaryOperator `++`, `--`. Create instruction for Unary operator `~` and `+`. */ function unaryOperatorToAsm (OperatorToken: TOKEN, Variable: MEMORY_SLOT): string { + if (Variable.type === 'fixed') { + switch (OperatorToken.value) { + case '++': + return `ADD @${Variable.asmName} $f100000000\n` + case '--': + return `SUB @${Variable.asmName} $f100000000\n` + case '~': + return `NOT @${Variable.asmName}\n` + default: + throw new Error(`Internal error at line: ${OperatorToken.line}.`) + } + } switch (OperatorToken.value) { case '++': return `INC @${Variable.asmName}\n` diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 7ad49d0..26eb8ab 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -93,11 +93,13 @@ export default function binaryAsnProcessor ( RGenObj = LGenObj LGenObj = Temp } + const leftDeclaration = utils.getDeclarationFromMemory(LGenObj.SolvedMem) + const rightDeclaration = utils.getDeclarationFromMemory(RGenObj.SolvedMem) // Prepare return object let TmpMemObj: MEMORY_SLOT if (LGenObj.SolvedMem.type !== 'register') { TmpMemObj = AuxVars.getNewRegister() - TmpMemObj.declaration = utils.getDeclarationFromMemory(LGenObj.SolvedMem) + TmpMemObj.declaration = leftDeclaration assemblyCode += createInstruction(AuxVars, utils.genAssignmentToken(CurrentNode.Operation.line), TmpMemObj, LGenObj.SolvedMem) AuxVars.freeRegister(LGenObj.SolvedMem.address) } else { @@ -105,15 +107,15 @@ export default function binaryAsnProcessor ( } // fixed verification if (TmpMemObj.declaration !== 'fixed' && - utils.getDeclarationFromMemory(RGenObj.SolvedMem) === 'fixed') { + rightDeclaration === 'fixed') { assemblyCode += createSimpleInstruction('LongToFixed', TmpMemObj.asmName) TmpMemObj.declaration = 'fixed' } // Pointer verifications 1 - if (utils.getDeclarationFromMemory(RGenObj.SolvedMem).includes('_ptr') && + if (rightDeclaration.includes('_ptr') && !TmpMemObj.declaration.includes('_ptr')) { // Operation with pointers - TmpMemObj.declaration += '_ptr' + TmpMemObj.declaration = rightDeclaration } // Pointer verifications 2 if (TmpMemObj.declaration.includes('_ptr')) { @@ -298,9 +300,15 @@ export default function binaryAsnProcessor ( function assignmentDeclarationTests ( Left: MEMORY_SLOT, Right: MEMORY_SLOT, operVal: string, line: number ) : void { - if (utils.isNotValidDeclarationOp(utils.getDeclarationFromMemory(Left), Right)) { + if (!utils.isNotValidDeclarationOp(utils.getDeclarationFromMemory(Left), Right)) { + return + } const lDecl = utils.getDeclarationFromMemory(Left) const rDecl = utils.getDeclarationFromMemory(Right) + // Allow >>= and <<= with fixed / long types + if ((lDecl === 'fixed' && rDecl === 'long') && (operVal === '>>=' || operVal === '<<=')) { + return + } // Allow SetOperator and pointer operation if (!(lDecl === rDecl + '_ptr' && (operVal === '+=' || operVal === '-='))) { if (Program.Config.warningToError) { @@ -310,7 +318,6 @@ export default function binaryAsnProcessor ( } // Override declaration protection rules Left.declaration = Right.declaration - } } } diff --git a/src/codeGenerator/astProcessor/lookupAsnProcessor.ts b/src/codeGenerator/astProcessor/lookupAsnProcessor.ts index f99bf01..bf44d4c 100644 --- a/src/codeGenerator/astProcessor/lookupAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/lookupAsnProcessor.ts @@ -295,6 +295,10 @@ export default function lookupAsnProcessor ( if (Previous.SolvedMem.ArrayItem === undefined) { throw new Error('Internal error.') } + if (utils.getDeclarationFromMemory(Param) === 'fixed') { + throw new Error(`At line ${CurrentNode.Token.line}. ` + + 'Array index cannot be fixed type.') + } switch (paramType) { case 'constant': Previous.SolvedMem.Offset = { diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index bdcc8bc..c4b96c2 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -138,7 +138,7 @@ export default function unaryAsnProcessor ( CGenObj.SolvedMem.Offset = { type: 'constant', value: 0, - declaration: 'long' + declaration: declar.slice(0, -4) as DECLARATION_TYPES } if (ScopeInfo.logicalOp === true) { CGenObj.asmCode += createInstruction( @@ -276,8 +276,9 @@ export default function unaryAsnProcessor ( TmpMemObj.declaration = 'struct_ptr' break case 'long': + case 'fixed': TmpMemObj = utils.createConstantMemObj(RetMem.address) - TmpMemObj.declaration = 'long' + TmpMemObj.declaration = RetMem.type break default: throw new Error(`Internal error at line ${CurrentNode.Operation.line}.`) From 84b3ecde758bd3f8cc2b5b49bb02c26068b5b46c Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 1 Jun 2022 21:14:33 -0300 Subject: [PATCH 049/112] Fixes and improvements on BinaryAsnProcessor --- .../assemblyProcessor/createInstruction.ts | 68 ++++++++++- .../astProcessor/binaryAsnProcessor.ts | 107 +++++++++++------- src/codeGenerator/utils.ts | 7 +- src/typings/syntaxTypes.ts | 2 +- 4 files changed, 135 insertions(+), 49 deletions(-) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 0986fdf..59d5481 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -1,6 +1,6 @@ import { assertExpression, assertNotUndefined } from '../../repository/repository' -import { MEMORY_SLOT, TOKEN } from '../../typings/syntaxTypes' -import { FLATTEN_MEMORY_RETURN_OBJECT, GENCODE_AUXVARS } from '../codeGeneratorTypes' +import { DECLARATION_TYPES, MEMORY_SLOT, TOKEN } from '../../typings/syntaxTypes' +import { FLATTEN_MEMORY_RETURN_OBJECT, GENCODE_AUXVARS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' import assignmentToAsm from './assignmentToAsm' @@ -61,11 +61,73 @@ export function createSimpleInstruction (instruction: string, param1: string = ' return `JSR :__fn_${param1}\n` case 'LongToFixed': return `MUL @${param1} $f100000000\n` + case 'FixedToLong': + return `DIV @${param1} $f100000000\n` default: throw new Error(`Unknow simple instruction: ${instruction}`) } } +export function toRegister ( + AuxVars: GENCODE_AUXVARS, InSolved: GENCODE_SOLVED_OBJECT, line: number +) : GENCODE_SOLVED_OBJECT { + const retObj = flattenMemory(AuxVars, InSolved.SolvedMem, line) + + if (retObj.FlatMem.type !== 'register') { + const inType = utils.getDeclarationFromMemory(InSolved.SolvedMem) + const TmpMemObj = AuxVars.getNewRegister(line) + retObj.asmCode += `SET @${TmpMemObj.asmName} $${retObj.FlatMem.asmName}\n` + utils.setMemoryDeclaration(TmpMemObj, inType) + AuxVars.freeRegister(retObj.FlatMem.address) + AuxVars.freeRegister(InSolved.SolvedMem.address) + retObj.FlatMem = TmpMemObj + } + if (retObj.isNew === true) { + AuxVars.freeRegister(InSolved.SolvedMem.address) + } + return { + SolvedMem: retObj.FlatMem, + asmCode: InSolved.asmCode + retObj.asmCode + } +} + +export function typeCasting ( + AuxVars: GENCODE_AUXVARS, InSolved: GENCODE_SOLVED_OBJECT, toType: DECLARATION_TYPES, line: number +) : GENCODE_SOLVED_OBJECT { + const fromType = utils.getDeclarationFromMemory(InSolved.SolvedMem) + if (fromType === toType) { + return InSolved + } + if (fromType === 'fixed' || toType === 'fixed') { + // fixed type casting required + const retObj = flattenMemory(AuxVars, InSolved.SolvedMem, line) + if (retObj.FlatMem.type === 'register') { + if (fromType === 'fixed') { + retObj.asmCode += createSimpleInstruction('FixedToLong', retObj.FlatMem.asmName) + } else { + retObj.asmCode += createSimpleInstruction('LongToFixed', retObj.FlatMem.asmName) + } + } else { + const TmpMemObj = AuxVars.getNewRegister(line) + retObj.asmCode += `SET @${TmpMemObj.asmName} $${retObj.FlatMem.asmName}\n` + if (fromType === 'fixed') { + retObj.asmCode += createSimpleInstruction('FixedToLong', TmpMemObj.asmName) + } else { + retObj.asmCode += createSimpleInstruction('LongToFixed', TmpMemObj.asmName) + } + AuxVars.freeRegister(retObj.FlatMem.address) + retObj.FlatMem = TmpMemObj + } + utils.setMemoryDeclaration(retObj.FlatMem, toType) + return { + SolvedMem: retObj.FlatMem, + asmCode: InSolved.asmCode + retObj.asmCode + } + } + utils.setMemoryDeclaration(InSolved.SolvedMem, toType) + return InSolved +} + /** Create assembly code for one api function call */ export function createAPICallInstruction ( AstAuxVars: GENCODE_AUXVARS, ApiToken: TOKEN, RetMem: MEMORY_SLOT, argsMem: MEMORY_SLOT[] @@ -252,7 +314,7 @@ export function createInstruction ( /** Create instruction for SetUnaryOperator `++`, `--`. Create instruction for Unary operator `~` and `+`. */ function unaryOperatorToAsm (OperatorToken: TOKEN, Variable: MEMORY_SLOT): string { - if (Variable.type === 'fixed') { + if (Variable.declaration === 'fixed') { switch (OperatorToken.value) { case '++': return `ADD @${Variable.asmName} $f100000000\n` diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 26eb8ab..5d88c1c 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -1,7 +1,7 @@ import { deepCopy } from '../../repository/repository' import { CONTRACT } from '../../typings/contractTypes' import { MEMORY_SLOT, DECLARATION_TYPES, BINARY_ASN } from '../../typings/syntaxTypes' -import { createSimpleInstruction, createInstruction, setConstAsmCode } from '../assemblyProcessor/createInstruction' +import { createSimpleInstruction, createInstruction, setConstAsmCode, typeCasting, toRegister } from '../assemblyProcessor/createInstruction' import { GENCODE_AUXVARS, GENCODE_ARGS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' import genCode from './genCode' @@ -65,7 +65,6 @@ export default function binaryAsnProcessor ( jumpFalse: ScopeInfo.jumpFalse, jumpTrue: ScopeInfo.jumpTrue }) - assemblyCode += LGenObj.asmCode let RGenObj = genCode(Program, AuxVars, { RemAST: CurrentNode.Right, logicalOp: false, @@ -73,7 +72,7 @@ export default function binaryAsnProcessor ( jumpFalse: ScopeInfo.jumpFalse, jumpTrue: ScopeInfo.jumpTrue }) - assemblyCode += RGenObj.asmCode + LGenObj.asmCode += RGenObj.asmCode // Error handling if (LGenObj.SolvedMem.type === 'void' || RGenObj.SolvedMem.type === 'void') { throw new Error(`At line: ${CurrentNode.Operation.line}. Can not make operations with void values.`) @@ -85,65 +84,57 @@ export default function binaryAsnProcessor ( CurrentNode.Operation.value ) if (PossibleRetObj) { - return { SolvedMem: PossibleRetObj, asmCode: assemblyCode } + return { SolvedMem: PossibleRetObj, asmCode: LGenObj.asmCode } } // Optimizations 2 if (OperatorOptBySwap(LGenObj.SolvedMem, RGenObj.SolvedMem, CurrentNode.Operation.value)) { const Temp = RGenObj RGenObj = LGenObj LGenObj = Temp + LGenObj.asmCode = RGenObj.asmCode } const leftDeclaration = utils.getDeclarationFromMemory(LGenObj.SolvedMem) const rightDeclaration = utils.getDeclarationFromMemory(RGenObj.SolvedMem) // Prepare return object - let TmpMemObj: MEMORY_SLOT - if (LGenObj.SolvedMem.type !== 'register') { - TmpMemObj = AuxVars.getNewRegister() - TmpMemObj.declaration = leftDeclaration - assemblyCode += createInstruction(AuxVars, utils.genAssignmentToken(CurrentNode.Operation.line), TmpMemObj, LGenObj.SolvedMem) - AuxVars.freeRegister(LGenObj.SolvedMem.address) - } else { - TmpMemObj = LGenObj.SolvedMem - } + LGenObj = toRegister(AuxVars, LGenObj, CurrentNode.Operation.line) // fixed verification - if (TmpMemObj.declaration !== 'fixed' && + if (leftDeclaration === 'long' && rightDeclaration === 'fixed') { - assemblyCode += createSimpleInstruction('LongToFixed', TmpMemObj.asmName) - TmpMemObj.declaration = 'fixed' + LGenObj = typeCasting(AuxVars, LGenObj, 'fixed', CurrentNode.Operation.line) } // Pointer verifications 1 if (rightDeclaration.includes('_ptr') && - !TmpMemObj.declaration.includes('_ptr')) { + !LGenObj.SolvedMem.declaration.includes('_ptr')) { // Operation with pointers - TmpMemObj.declaration = rightDeclaration + LGenObj.SolvedMem.declaration = rightDeclaration } // Pointer verifications 2 - if (TmpMemObj.declaration.includes('_ptr')) { + if (LGenObj.SolvedMem.declaration.includes('_ptr')) { if (CurrentNode.Operation.value !== '+' && CurrentNode.Operation.value !== '-') { throw new Error(`At line: ${CurrentNode.Operation.line}. ` + "Operation not allowed on pointers. Only '+', '-', '++' and '--' are.") } } // Create instruction - assemblyCode += createInstruction(AuxVars, CurrentNode.Operation, TmpMemObj, RGenObj.SolvedMem) + LGenObj.asmCode += createInstruction(AuxVars, CurrentNode.Operation, LGenObj.SolvedMem, RGenObj.SolvedMem) // Handle logical operation if (ScopeInfo.logicalOp === true) { - assemblyCode += createInstruction( + LGenObj.asmCode += createInstruction( AuxVars, utils.genNotEqualToken(), - TmpMemObj, + LGenObj.SolvedMem, utils.createConstantMemObj(0), ScopeInfo.revLogic, ScopeInfo.jumpFalse, ScopeInfo.jumpTrue ) AuxVars.freeRegister(RGenObj.SolvedMem.address) - AuxVars.freeRegister(TmpMemObj.address) - return { SolvedMem: utils.createVoidMemObj(), asmCode: assemblyCode } + AuxVars.freeRegister(LGenObj.SolvedMem.address) + return { SolvedMem: utils.createVoidMemObj(), asmCode: LGenObj.asmCode } } // Return arithmetic result AuxVars.freeRegister(RGenObj.SolvedMem.address) - return { SolvedMem: TmpMemObj, asmCode: assemblyCode } + return LGenObj } function assignmentProc () : GENCODE_SOLVED_OBJECT { @@ -157,7 +148,6 @@ export default function binaryAsnProcessor ( jumpFalse: ScopeInfo.jumpFalse, jumpTrue: ScopeInfo.jumpTrue }) - assemblyCode += LGenObj.asmCode AuxVars.isLeftSideOfAssignment = false assignmentLeftSideErrorTests(LGenObj.SolvedMem) // Clear isDeclaration before right side evaluation. @@ -174,8 +164,7 @@ export default function binaryAsnProcessor ( ) } // Get right side gencode object - const RGenObj = assignmentRightSideSolver(LGenObj.SolvedMem) - assemblyCode += RGenObj.asmCode + let RGenObj = assignmentRightSideSolver(LGenObj.SolvedMem) // Restore isDeclaration value AuxVars.isDeclaration = savedDeclaration // Error check for Right side @@ -183,6 +172,12 @@ export default function binaryAsnProcessor ( throw new Error(`At line: ${CurrentNode.Operation.line}. ` + `Invalid right value for '${CurrentNode.Operation.type}'. Possible void value.`) } + // Implicit type casting on assignment + const lDecl = utils.getDeclarationFromMemory(LGenObj.SolvedMem) + const rDecl = utils.getDeclarationFromMemory(RGenObj.SolvedMem) + if (assigmentImplicitTypeCastingTest(CurrentNode.Operation.value, lDecl, rDecl)) { + RGenObj = typeCasting(AuxVars, RGenObj, lDecl, CurrentNode.Operation.line) + } // Check declaration types assignmentDeclarationTests( LGenObj.SolvedMem, @@ -191,18 +186,18 @@ export default function binaryAsnProcessor ( CurrentNode.Operation.line ) // Create instruction - assemblyCode += createInstruction(AuxVars, CurrentNode.Operation, LGenObj.SolvedMem, RGenObj.SolvedMem) + LGenObj.asmCode += RGenObj.asmCode + createInstruction(AuxVars, CurrentNode.Operation, LGenObj.SolvedMem, RGenObj.SolvedMem) // Process use of 'const' keyword if (AuxVars.isConstSentence === true) { return assignmentConstSolver( LGenObj.SolvedMem, RGenObj.SolvedMem, - assemblyCode, + LGenObj.asmCode, CurrentNode.Operation.line ) } AuxVars.freeRegister(RGenObj.SolvedMem.address) - return { SolvedMem: LGenObj.SolvedMem, asmCode: assemblyCode } + return LGenObj } function assignmentStartErrorTests () : void { @@ -240,6 +235,7 @@ export default function binaryAsnProcessor ( } } + /** Checks if left side can be reused and solve right side of assigment */ function assignmentRightSideSolver (Left: MEMORY_SLOT) : GENCODE_SOLVED_OBJECT { if (CurrentNode.Operation.type !== 'Assignment' || Program.Config.reuseAssignedVar === false || @@ -297,28 +293,53 @@ export default function binaryAsnProcessor ( return RetGenObj } + /** Tests if implicit type casting is needed (returns true if needed) */ + function assigmentImplicitTypeCastingTest (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : boolean { + if (operVal === '=') { + if (lDecl === 'long' && rDecl === 'fixed') return true + if (lDecl === 'fixed' && rDecl === 'long') return true + return false + } + // else SetOperator + if ((lDecl === 'long' && rDecl === 'fixed') || + (lDecl === 'fixed' && rDecl === 'long')) { + switch (operVal) { + case '+=': + case '-=': + case '*=': + case '/=': + return true + } + return false + } + return false + } + + /** Test both sides declaration and throws error */ function assignmentDeclarationTests ( Left: MEMORY_SLOT, Right: MEMORY_SLOT, operVal: string, line: number ) : void { - if (!utils.isNotValidDeclarationOp(utils.getDeclarationFromMemory(Left), Right)) { + const lDecl = utils.getDeclarationFromMemory(Left) + const rDecl = utils.getDeclarationFromMemory(Right) + if (!utils.isNotValidDeclarationOp(lDecl, Right)) { return } - const lDecl = utils.getDeclarationFromMemory(Left) - const rDecl = utils.getDeclarationFromMemory(Right) // Allow >>= and <<= with fixed / long types if ((lDecl === 'fixed' && rDecl === 'long') && (operVal === '>>=' || operVal === '<<=')) { return } - // Allow SetOperator and pointer operation - if (!(lDecl === rDecl + '_ptr' && (operVal === '+=' || operVal === '-='))) { - if (Program.Config.warningToError) { - throw new Error(`At line: ${line}.` + - ' Warning: Left and right values does not match.' + - ` Values are: '${Left.declaration}' and '${Right.declaration}'.`) - } - // Override declaration protection rules - Left.declaration = Right.declaration + // Allow SetOperator and pointer operation + if ((lDecl === rDecl + '_ptr' && (operVal === '+=' || operVal === '-='))) { + return + } + // Operation not allowed. Throws + if (Program.Config.warningToError) { + throw new Error(`At line: ${line}.` + + ' Warning: Left and Right types of assignment does not match.' + + ` Types are: '${lDecl}' and '${rDecl}'.`) } + // Override declaration protection rules + utils.setMemoryDeclaration(Left, rDecl) } function assignmentConstSolver ( diff --git a/src/codeGenerator/utils.ts b/src/codeGenerator/utils.ts index fcce552..76e79fd 100644 --- a/src/codeGenerator/utils.ts +++ b/src/codeGenerator/utils.ts @@ -69,6 +69,9 @@ export default { genMulToken (line: number = -1): TOKEN { return { type: 'Operator', precedence: 3, value: '*', line: line } }, + genDivToken (line: number = -1): TOKEN { + return { type: 'Operator', precedence: 3, value: '/', line: line } + }, genAddToken (line: number = -1): TOKEN { return { type: 'Operator', precedence: 4, value: '+', line: line } }, @@ -166,11 +169,11 @@ export default { return false } if (desiredDeclaration === 'void_ptr' && - (memoDeclaration === 'long_ptr' || memoDeclaration === 'struct_ptr')) { + memoDeclaration.includes('_ptr')) { return false } if (memoDeclaration === 'void_ptr' && - (desiredDeclaration === 'long_ptr' || desiredDeclaration === 'struct_ptr')) { + desiredDeclaration.includes('_ptr')) { return false } if (desiredDeclaration.includes('_ptr') && MemoObj.type === 'constant') { diff --git a/src/typings/syntaxTypes.ts b/src/typings/syntaxTypes.ts index 7aff7a2..95a4267 100644 --- a/src/typings/syntaxTypes.ts +++ b/src/typings/syntaxTypes.ts @@ -12,7 +12,7 @@ export type TOKEN_TYPES = 'Variable' | 'Constant' | 'Operator' | 'UnaryOperator' 'Arr'|'CodeCave'|'CodeDomain'|'Delimiter'|'Terminator'|'Macro'|'Member'|'Colon'| 'Keyword'|'Function' | 'APICall' | 'BuiltInCall' | 'Push' -export type DECLARATION_TYPES = 'void' | 'long' | 'fixed' | 'struct' | 'void_ptr' | 'long_ptr' | 'struct_ptr' | '' +export type DECLARATION_TYPES = 'void' | 'long' | 'fixed' | 'struct' | 'void_ptr' | 'long_ptr' | 'fixed_ptr' | 'struct_ptr' | '' export type TOKEN = { line: number From 0fe94d38392d6a6c41a91de21b8dc6acd11950f2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 00:07:02 -0300 Subject: [PATCH 050/112] Added type casting --- .../assemblyProcessor/createInstruction.ts | 39 +----- .../assemblyProcessor/typeCastingToAsm.ts | 119 ++++++++++++++++++ .../astProcessor/unaryAsnProcessor.ts | 15 +++ src/repository/repository.ts | 17 +++ src/syntaxProcessor/createTree.ts | 37 +++++- 5 files changed, 183 insertions(+), 44 deletions(-) create mode 100644 src/codeGenerator/assemblyProcessor/typeCastingToAsm.ts diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 59d5481..93ec189 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -1,5 +1,5 @@ import { assertExpression, assertNotUndefined } from '../../repository/repository' -import { DECLARATION_TYPES, MEMORY_SLOT, TOKEN } from '../../typings/syntaxTypes' +import { MEMORY_SLOT, TOKEN } from '../../typings/syntaxTypes' import { FLATTEN_MEMORY_RETURN_OBJECT, GENCODE_AUXVARS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' @@ -91,43 +91,6 @@ export function toRegister ( } } -export function typeCasting ( - AuxVars: GENCODE_AUXVARS, InSolved: GENCODE_SOLVED_OBJECT, toType: DECLARATION_TYPES, line: number -) : GENCODE_SOLVED_OBJECT { - const fromType = utils.getDeclarationFromMemory(InSolved.SolvedMem) - if (fromType === toType) { - return InSolved - } - if (fromType === 'fixed' || toType === 'fixed') { - // fixed type casting required - const retObj = flattenMemory(AuxVars, InSolved.SolvedMem, line) - if (retObj.FlatMem.type === 'register') { - if (fromType === 'fixed') { - retObj.asmCode += createSimpleInstruction('FixedToLong', retObj.FlatMem.asmName) - } else { - retObj.asmCode += createSimpleInstruction('LongToFixed', retObj.FlatMem.asmName) - } - } else { - const TmpMemObj = AuxVars.getNewRegister(line) - retObj.asmCode += `SET @${TmpMemObj.asmName} $${retObj.FlatMem.asmName}\n` - if (fromType === 'fixed') { - retObj.asmCode += createSimpleInstruction('FixedToLong', TmpMemObj.asmName) - } else { - retObj.asmCode += createSimpleInstruction('LongToFixed', TmpMemObj.asmName) - } - AuxVars.freeRegister(retObj.FlatMem.address) - retObj.FlatMem = TmpMemObj - } - utils.setMemoryDeclaration(retObj.FlatMem, toType) - return { - SolvedMem: retObj.FlatMem, - asmCode: InSolved.asmCode + retObj.asmCode - } - } - utils.setMemoryDeclaration(InSolved.SolvedMem, toType) - return InSolved -} - /** Create assembly code for one api function call */ export function createAPICallInstruction ( AstAuxVars: GENCODE_AUXVARS, ApiToken: TOKEN, RetMem: MEMORY_SLOT, argsMem: MEMORY_SLOT[] diff --git a/src/codeGenerator/assemblyProcessor/typeCastingToAsm.ts b/src/codeGenerator/assemblyProcessor/typeCastingToAsm.ts new file mode 100644 index 0000000..f56a063 --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/typeCastingToAsm.ts @@ -0,0 +1,119 @@ +import { DECLARATION_TYPES } from '../../typings/syntaxTypes' +import { GENCODE_AUXVARS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' +import utils from '../utils' +import { createSimpleInstruction, toRegister } from './createInstruction' + +export function typeCasting ( + AuxVars: GENCODE_AUXVARS, InSolved: GENCODE_SOLVED_OBJECT, toType: DECLARATION_TYPES, line: number +) : GENCODE_SOLVED_OBJECT { + const fromType = utils.getDeclarationFromMemory(InSolved.SolvedMem) + if (fromType === toType) { + return InSolved + } + + function typeCastingMain () : GENCODE_SOLVED_OBJECT { + switch (toType) { + case 'void': + // From anything to void + AuxVars.freeRegister(InSolved.SolvedMem.address) + InSolved.SolvedMem = utils.createVoidMemObj() + return InSolved + case 'long': + return toLong() + case 'fixed': + return toFixed() + case 'void_ptr': + case 'long_ptr': + case 'fixed_ptr': + case 'struct_ptr': + return toPointer() + case 'struct': + default: + throw new Error('Internal error') + } + } + + function toFixed () : GENCODE_SOLVED_OBJECT { + switch (fromType) { + case 'long': + // From long to fixed + InSolved = toRegister(AuxVars, InSolved, line) + InSolved.asmCode += createSimpleInstruction('LongToFixed', InSolved.SolvedMem.asmName) + utils.setMemoryDeclaration(InSolved.SolvedMem, 'fixed') + return InSolved + case 'void': + // From void to fixed + InSolved.SolvedMem = AuxVars.getNewRegister(line) + InSolved.asmCode += `CLR @${InSolved.SolvedMem.asmName}\n` + utils.setMemoryDeclaration(InSolved.SolvedMem, 'fixed') + return InSolved + case 'struct': + case 'void_ptr': + case 'long_ptr': + case 'fixed_ptr': + case 'struct_ptr': + throw new Error(`At line: ${line}. It is not possible to cast ${fromType} to fixed number.`) + default: + throw new Error('Internal error') + } + } + + function toLong () : GENCODE_SOLVED_OBJECT { + switch (fromType) { + case 'void': + // From void to long + InSolved.SolvedMem = AuxVars.getNewRegister(line) + InSolved.asmCode += `CLR @${InSolved.SolvedMem.asmName}\n` + utils.setMemoryDeclaration(InSolved.SolvedMem, 'long') + return InSolved + case 'fixed': + InSolved = toRegister(AuxVars, InSolved, line) + InSolved.asmCode += createSimpleInstruction('FixedToLong', InSolved.SolvedMem.asmName) + utils.setMemoryDeclaration(InSolved.SolvedMem, 'long') + return InSolved + case 'struct': + throw new Error(`At line: ${line}. It is not possible to cast ${fromType} to long number.`) + case 'void_ptr': + case 'long_ptr': + case 'fixed_ptr': + case 'struct_ptr': + utils.setMemoryDeclaration(InSolved.SolvedMem, 'long') + return InSolved + default: + throw new Error('Internal error') + } + } + + function toPointer () : GENCODE_SOLVED_OBJECT { + switch (fromType) { + case 'void': + // From void to pointer (NULL) + InSolved.SolvedMem = utils.createConstantMemObj(0) + utils.setMemoryDeclaration(InSolved.SolvedMem, toType) + return InSolved + case 'long': + // From long to any pointer + utils.setMemoryDeclaration(InSolved.SolvedMem, toType) + return InSolved + case 'fixed': + // From fixed to any pointer + throw new Error(`At line: ${line}. It is not possible to cast ${fromType} to a pointer type.`) + case 'struct': + // From struct to pointer (address of first value in struct) + InSolved.SolvedMem = utils.createConstantMemObj(InSolved.SolvedMem.hexContent) + utils.setMemoryDeclaration(InSolved.SolvedMem, toType) + return InSolved + case 'void_ptr': + case 'long_ptr': + case 'fixed_ptr': + case 'struct_ptr': + // From any pointer to any pointer + utils.setMemoryDeclaration(InSolved.SolvedMem, toType) + return InSolved + default: + throw new Error('Internal error') + } + } + + return typeCastingMain() +} diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index c4b96c2..70bdfd7 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -2,6 +2,7 @@ import { deepCopy } from '../../repository/repository' import { CONTRACT } from '../../typings/contractTypes' import { MEMORY_SLOT, DECLARATION_TYPES, UNARY_ASN } from '../../typings/syntaxTypes' import { createSimpleInstruction, createInstruction } from '../assemblyProcessor/createInstruction' +import { typeCasting } from '../assemblyProcessor/typeCastingToAsm' import { GENCODE_AUXVARS, GENCODE_ARGS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' import genCode from './genCode' @@ -18,6 +19,8 @@ export default function unaryAsnProcessor ( return UnaryOperatorProcessor() case 'Keyword': return unaryKeywordProcessor() + case 'CodeCave': + return CodeCaveProcessor() default: throw new Error(`Internal error at line: ${CurrentNode.Operation.line}.`) } @@ -378,5 +381,17 @@ export default function unaryAsnProcessor ( return { SolvedMem: utils.createConstantMemObj(size), asmCode: CGenObj.asmCode } } + function CodeCaveProcessor () : GENCODE_SOLVED_OBJECT { + if (CurrentNode.Operation.declaration === '' || CurrentNode.Operation.declaration === undefined) { + throw new Error('Internal error.') + } + const CGenObj = traverseNotLogical() + const cDecl = utils.getDeclarationFromMemory(CGenObj.SolvedMem) + if (cDecl === CurrentNode.Operation.declaration) { + return CGenObj + } + return typeCasting(AuxVars, CGenObj, CurrentNode.Operation.declaration, CurrentNode.Operation.line) + } + return unaryAsnProcessorMain() } diff --git a/src/repository/repository.ts b/src/repository/repository.ts index 0503693..fe49d7c 100644 --- a/src/repository/repository.ts +++ b/src/repository/repository.ts @@ -2,6 +2,8 @@ // Using them with regular error messages will lead to condition not beeing checked // in coverage report. +import { DECLARATION_TYPES } from '../typings/syntaxTypes' + /** * Ensure the value is not undefined * @param argument Anything @@ -186,3 +188,18 @@ export function ReedSalomonAddressDecode (RSString: string, currLine: number) : return run() } + +export function isDeclarationType (str: string) : str is DECLARATION_TYPES { + switch (str) { + case 'void': + case 'long': + case 'fixed': + case 'struct': + case 'void_ptr': + case 'long_ptr': + case 'fixed_ptr': + case 'struct_ptr': + return true + } + return false +} diff --git a/src/syntaxProcessor/createTree.ts b/src/syntaxProcessor/createTree.ts index eebb7d9..257891d 100644 --- a/src/syntaxProcessor/createTree.ts +++ b/src/syntaxProcessor/createTree.ts @@ -1,4 +1,4 @@ -import { assertNotUndefined } from '../repository/repository' +import { assertNotUndefined, isDeclarationType } from '../repository/repository' import { AST, LOOKUP_ASN, TOKEN } from '../typings/syntaxTypes' /** @@ -137,12 +137,37 @@ function VariableToAST (tokens: TOKEN[]) : AST { } function CodeCaveToAST (tokens: TOKEN[]) : AST { - if (tokens.length !== 1) { - throw new Error(`At line: ${tokens[0].line}. Modifiers not implemented on '${tokens[0].type}'.`) + if (tokens.length === 1) { + const newAST = createTree(tokens[0].params) + delete tokens[0].params + return newAST + } + if (tokens[0].params === undefined) { + return createTree(tokens.slice(1)) + } + if (tokens.length === 2) { + const remainingAST = createTree(tokens.slice(1)) + const askedType = tokens[0].params.reduce((previous, Tkn) => { + // Get declaration for type casting from params! + if (Tkn.type === 'Keyword') return previous + Tkn.value + if (Tkn.value === '*') return previous + '_ptr' + throw new Error(`At line: ${tokens[0].line}. Unexpected '${Tkn.type}' with value '${Tkn.value}' during type casting.`) + }, '') + if (!isDeclarationType(askedType)) { + throw new Error(`At line: ${tokens[0].line}. Unexpected declaration '${askedType}' during type casting.`) + } + if (askedType === 'struct') { + throw new Error(`At line: ${tokens[0].line}. 'struct' is not allowed for type casting.`) + } + tokens[0].declaration = askedType + delete tokens[0].params + return { + type: 'unaryASN', + Operation: tokens[0], + Center: remainingAST + } } - const newAST = createTree(tokens[0].params) - delete tokens[0].params - return newAST + throw new Error(`At line: ${tokens[0].line}. Modifiers not implemented on '${tokens[0].type}'.`) } function BinariesToAST (tokens: TOKEN[], operatorLoc: number) : AST { From f21ab6db6be5c1cc33731e74d1a24908a20a3dae Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 21:47:20 -0300 Subject: [PATCH 051/112] Brushing up type casting --- .../assemblyProcessor/assignmentToAsm.ts | 14 +- .../assemblyProcessor/operatorToAsm.ts | 97 +++----- .../astProcessor/binaryAsnProcessor.ts | 218 ++++++++++++------ 3 files changed, 183 insertions(+), 146 deletions(-) diff --git a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts index 0950628..f3f61ee 100644 --- a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts @@ -95,15 +95,13 @@ export default function assignmentToAsm ( /** Left type is 'register', 'long' or 'structRef', with offset undefined. Right type is 'register', 'long', or * 'structRef' with offset undefined. Create assembly instruction. */ function leftRegularOffsetUndefinedAndRightRegularOffsetUndefinedToAsm (): string { - if ((Left.declaration === Right.declaration) || - (Left.declaration === 'void_ptr' && Right.declaration.includes('ptr')) || - (Left.declaration.includes('ptr') && Right.declaration === 'void_ptr')) { - if (Left.address === Right.address) { - return '' - } - return `SET @${Left.asmName} $${Right.asmName}\n` + if (Left.declaration !== Right.declaration) { + throw new Error(`Internal error at line: ${operationLine}.`) + } + if (Left.address === Right.address) { + return '' } - throw new Error(`Internal error at line: ${operationLine}.`) + return `SET @${Left.asmName} $${Right.asmName}\n` } /** Left type is 'register', 'long' or 'structRef', with offset undefined. Right type is 'register', 'long' or diff --git a/src/codeGenerator/assemblyProcessor/operatorToAsm.ts b/src/codeGenerator/assemblyProcessor/operatorToAsm.ts index 7d9b3f0..dc72368 100644 --- a/src/codeGenerator/assemblyProcessor/operatorToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/operatorToAsm.ts @@ -13,7 +13,6 @@ export default function operatorToAsm ( ) : string { const FlatLeft = flattenMemory(AuxVars, LeftMem, OperatorToken.line) const FlatRight = flattenMemory(AuxVars, RightMem, OperatorToken.line) - let assemblyCode = '' function operatorToAsmMain () : string { assertExpression(LeftMem.type !== 'constant') @@ -40,73 +39,40 @@ export default function operatorToAsm ( function leftFixedRightFixedToAsm () : string { switch (OperatorToken.value) { - case '%': - case '%=': - case '&': - case '&=': - case '|': - case '|=': - case '^': - case '^=': - throw new Error(`At line ${OperatorToken.line}. ` + - `Cannot use operator ${OperatorToken.value} with 'fixed' types.`) - case '<<': - case '<<=': - case '>>': - case '>>=': - throw new Error(`At line ${OperatorToken.line}. ` + - `Cannot use operator ${OperatorToken.value} with 'fixed' type on right side.`) + case '+': + case '+=': + case '-': + case '-=': + return returnThisCode(chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n`) case '*': case '*=': - assemblyCode = `MDV @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName} $f100000000\n` - break + return returnThisCode(`MDV @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName} $f100000000\n`) case '/': case '/=': - assemblyCode = `MDV @${FlatLeft.FlatMem.asmName} $f100000000 $${FlatRight.FlatMem.asmName}\n` - break - default: // + - - assemblyCode = chooseOperator(OperatorToken.value) + - ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` + return returnThisCode(`MDV @${FlatLeft.FlatMem.asmName} $f100000000 $${FlatRight.FlatMem.asmName}\n`) + default: + // % & | ^ << >> + throw new Error('Internal error') } - freeRegisters() - return FlatLeft.asmCode + FlatRight.asmCode + assemblyCode } function leftFixedRightRegularToAsm () : string { switch (OperatorToken.value) { - case '%': - case '%=': - case '&': - case '&=': - case '|': - case '|=': - case '^': - case '^=': - throw new Error(`At line ${OperatorToken.line}. ` + - `Cannot use operator ${OperatorToken.value} with 'fixed' types.`) - case '+': - case '+=': - case '-': - case '-=': - if (FlatRight.isNew === true) { - assemblyCode = `MUL @${FlatRight.FlatMem.asmName} $f100000000\n` - assemblyCode += chooseOperator(OperatorToken.value) + - ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` - } else { - const RetObj = AuxVars.getNewRegister() - assemblyCode = `SET @${RetObj.asmName} $${FlatRight.FlatMem.asmName}\n` - assemblyCode += `MUL @${RetObj.asmName} $f100000000\n` - assemblyCode += chooseOperator(OperatorToken.value) + - ` @${FlatLeft.FlatMem.asmName} $${RetObj.asmName}\n` - AuxVars.freeRegister(RetObj.address) - } - break - default: // << >> - assemblyCode = chooseOperator(OperatorToken.value) + - ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` + case '/': + case '/=': + case '*': + case '*=': + case '>>': + case '>>=': + case '<<': + case '<<=': + return returnThisCode(chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n`) + default: + // + - % & | ^ + throw new Error('Internal error') } - freeRegisters() - return FlatLeft.asmCode + FlatRight.asmCode + assemblyCode } function leftRegularRightRegularToAsm () : string { @@ -114,14 +80,8 @@ export default function operatorToAsm ( if (optimized !== undefined) { return optimized } - assemblyCode = chooseOperator(OperatorToken.value) + - ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n` - AuxVars.freeRegister(FlatRight.FlatMem.address) - if (FlatLeft.isNew === true) { - assemblyCode += createInstruction(AuxVars, utils.genAssignmentToken(OperatorToken.line), LeftMem, FlatLeft.FlatMem) - AuxVars.freeRegister(FlatLeft.FlatMem.address) - } - return FlatLeft.asmCode + FlatRight.asmCode + assemblyCode + return returnThisCode(chooseOperator(OperatorToken.value) + + ` @${FlatLeft.FlatMem.asmName} $${FlatRight.FlatMem.asmName}\n`) } function tryOptimization () : string | undefined { @@ -212,12 +172,13 @@ export default function operatorToAsm ( return '' } - function freeRegisters () : void { + function returnThisCode (asm : string) : string { AuxVars.freeRegister(FlatRight.FlatMem.address) if (FlatLeft.isNew === true) { - assemblyCode += createInstruction(AuxVars, utils.genAssignmentToken(OperatorToken.line), LeftMem, FlatLeft.FlatMem) + asm += createInstruction(AuxVars, utils.genAssignmentToken(OperatorToken.line), LeftMem, FlatLeft.FlatMem) AuxVars.freeRegister(FlatLeft.FlatMem.address) } + return FlatLeft.asmCode + FlatRight.asmCode + asm } return operatorToAsmMain() diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 5d88c1c..8e7fba6 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -1,7 +1,8 @@ import { deepCopy } from '../../repository/repository' import { CONTRACT } from '../../typings/contractTypes' import { MEMORY_SLOT, DECLARATION_TYPES, BINARY_ASN } from '../../typings/syntaxTypes' -import { createSimpleInstruction, createInstruction, setConstAsmCode, typeCasting, toRegister } from '../assemblyProcessor/createInstruction' +import { createSimpleInstruction, createInstruction, setConstAsmCode, toRegister } from '../assemblyProcessor/createInstruction' +import { typeCasting } from '../assemblyProcessor/typeCastingToAsm' import { GENCODE_AUXVARS, GENCODE_ARGS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' import genCode from './genCode' @@ -97,23 +98,18 @@ export default function binaryAsnProcessor ( const rightDeclaration = utils.getDeclarationFromMemory(RGenObj.SolvedMem) // Prepare return object LGenObj = toRegister(AuxVars, LGenObj, CurrentNode.Operation.line) - // fixed verification - if (leftDeclaration === 'long' && - rightDeclaration === 'fixed') { - LGenObj = typeCasting(AuxVars, LGenObj, 'fixed', CurrentNode.Operation.line) - } - // Pointer verifications 1 - if (rightDeclaration.includes('_ptr') && - !LGenObj.SolvedMem.declaration.includes('_ptr')) { - // Operation with pointers - LGenObj.SolvedMem.declaration = rightDeclaration - } - // Pointer verifications 2 - if (LGenObj.SolvedMem.declaration.includes('_ptr')) { - if (CurrentNode.Operation.value !== '+' && CurrentNode.Operation.value !== '-') { - throw new Error(`At line: ${CurrentNode.Operation.line}. ` + - "Operation not allowed on pointers. Only '+', '-', '++' and '--' are.") - } + // implicit type casting tests and operations + const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) + switch (castSide) { + case 'left': + LGenObj = typeCasting(AuxVars, LGenObj, rightDeclaration, CurrentNode.Operation.line) + break + case 'right': { + const oldAsm = RGenObj.asmCode + RGenObj = typeCasting(AuxVars, RGenObj, leftDeclaration, CurrentNode.Operation.line) + // append only the diff + LGenObj.asmCode += RGenObj.asmCode.slice(oldAsm.length) + } } // Create instruction LGenObj.asmCode += createInstruction(AuxVars, CurrentNode.Operation, LGenObj.SolvedMem, RGenObj.SolvedMem) @@ -175,16 +171,13 @@ export default function binaryAsnProcessor ( // Implicit type casting on assignment const lDecl = utils.getDeclarationFromMemory(LGenObj.SolvedMem) const rDecl = utils.getDeclarationFromMemory(RGenObj.SolvedMem) - if (assigmentImplicitTypeCastingTest(CurrentNode.Operation.value, lDecl, rDecl)) { + const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, lDecl, rDecl) + switch (castSide) { + case 'left': + throw new Error('Internal error') + case 'right': RGenObj = typeCasting(AuxVars, RGenObj, lDecl, CurrentNode.Operation.line) } - // Check declaration types - assignmentDeclarationTests( - LGenObj.SolvedMem, - RGenObj.SolvedMem, - CurrentNode.Operation.value, - CurrentNode.Operation.line - ) // Create instruction LGenObj.asmCode += RGenObj.asmCode + createInstruction(AuxVars, CurrentNode.Operation, LGenObj.SolvedMem, RGenObj.SolvedMem) // Process use of 'const' keyword @@ -293,53 +286,138 @@ export default function binaryAsnProcessor ( return RetGenObj } - /** Tests if implicit type casting is needed (returns true if needed) */ - function assigmentImplicitTypeCastingTest (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : boolean { - if (operVal === '=') { - if (lDecl === 'long' && rDecl === 'fixed') return true - if (lDecl === 'fixed' && rDecl === 'long') return true - return false + /** Tests if implicit type casting is needed and also checks valid operations. + * @returns the side needed to be changed + * @throws Error if operation is not allowed */ + function implicitTypeCastingTest (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : 'left' | 'right' | 'none' { + if (lDecl === rDecl) { + if (lDecl === 'fixed') { + return fixedFixedImplicitTC(operVal) + } + return 'none' } - // else SetOperator - if ((lDecl === 'long' && rDecl === 'fixed') || - (lDecl === 'fixed' && rDecl === 'long')) { - switch (operVal) { - case '+=': - case '-=': - case '*=': - case '/=': - return true + const fixedRet = fixedImplicitTC(operVal, lDecl, rDecl) + if (fixedRet !== 'notFixed') { + return fixedRet + } + const pointerRet = remainingImplicitTC(operVal, lDecl, rDecl) + return pointerRet + } + + function fixedImplicitTC (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : 'left' | 'right' | 'none' | 'notFixed' { + let fixedSide: 'left' | 'right' | 'none' = 'none' + if (lDecl === 'long' && rDecl === 'fixed') { + fixedSide = 'right' + } + if (lDecl === 'fixed' && rDecl === 'long') { + fixedSide = 'left' + } + if (fixedSide === 'none') { + return 'notFixed' + } + // now there is only one fixed and one long + switch (operVal) { + case '=': + case '+=': + case '-=': + return 'right' + case '+': + case '-': + return fixedSide === 'left' ? 'right' : 'left' + case '/': + case '*': + return fixedSide === 'left' ? 'none' : 'left' + case '%': + case '&': + case '|': + case '^': + case '%=': + case '&=': + case '|=': + case '^=': + throw new Error(`At line ${CurrentNode.Operation.line}. Cannot use operator ${operVal} with fixed type numbers.`) + case '>>': + case '<<': + case '>>=': + case '<<=': + if (fixedSide === 'right') { + throw new Error(`At line ${CurrentNode.Operation.line}. Cannot use operator ${operVal} with fixed type numbers on right side.`) } - return false + return 'none' + case '/=': + case '*=': + return fixedSide === 'left' ? 'none' : 'right' + default: + throw new Error('Internal error') } - return false } - /** Test both sides declaration and throws error */ - function assignmentDeclarationTests ( - Left: MEMORY_SLOT, Right: MEMORY_SLOT, operVal: string, line: number - ) : void { - const lDecl = utils.getDeclarationFromMemory(Left) - const rDecl = utils.getDeclarationFromMemory(Right) - if (!utils.isNotValidDeclarationOp(lDecl, Right)) { - return - } - // Allow >>= and <<= with fixed / long types - if ((lDecl === 'fixed' && rDecl === 'long') && (operVal === '>>=' || operVal === '<<=')) { - return - } - // Allow SetOperator and pointer operation - if ((lDecl === rDecl + '_ptr' && (operVal === '+=' || operVal === '-='))) { - return - } - // Operation not allowed. Throws - if (Program.Config.warningToError) { - throw new Error(`At line: ${line}.` + - ' Warning: Left and Right types of assignment does not match.' + - ` Types are: '${lDecl}' and '${rDecl}'.`) - } - // Override declaration protection rules - utils.setMemoryDeclaration(Left, rDecl) + function fixedFixedImplicitTC (operVal: string) : 'left' | 'right' | 'none' { + switch (operVal) { + case '%': + case '&': + case '|': + case '^': + case '%=': + case '&=': + case '|=': + case '^=': + case '>>': + case '<<': + throw new Error(`At line ${CurrentNode.Operation.line}. Cannot use operator ${operVal} with fixed type numbers.`) + case '>>=': + case '<<=': + throw new Error(`At line ${CurrentNode.Operation.line}. Cannot use operator ${operVal} with fixed type numbers on right side.`) + default: + return 'none' + } + } + + function remainingImplicitTC (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : 'left' | 'right' | 'none' { + switch (operVal) { + case '=': + if ((lDecl === 'void_ptr' && rDecl.includes('_ptr')) || + (lDecl.includes('_ptr') && rDecl === 'void_ptr')) { + return 'right' + } + if (lDecl.includes('ptr') && rDecl === 'long' && AuxVars.hasVoidArray) { + return 'none' + } + throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of assigment does not match. Types are '${lDecl}' and '${rDecl}'.`) + case '+=': + case '-=': + if (lDecl === rDecl + '_ptr') { + return 'none' + } + throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) + case '+': + case '-': + if (lDecl.includes('_ptr') && rDecl === 'long') { + return 'right' + } + if (rDecl.includes('_ptr') && lDecl === 'long') { + return 'left' + } + throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) + case '/': + case '*': + case '%': + case '&': + case '|': + case '^': + case '%=': + case '&=': + case '|=': + case '^=': + case '>>': + case '<<': + case '>>=': + case '<<=': + case '/=': + case '*=': + default: + throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) + } } function assignmentConstSolver ( @@ -519,8 +597,8 @@ export default function binaryAsnProcessor ( default: return false } - if (Left.declaration === 'fixed' && Right.declaration !== 'fixed') { - return true + if (Left.declaration === 'fixed' && Right.declaration === 'long') { + return operatorVal === '+' } // Try optimization if left side is constant (only commutativa operations!) if (checkOperatorOptimization(operatorVal, Left)) { From b072f61a64ed1d57d8f09a2bd2fab8100a87908a Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 21:48:53 -0300 Subject: [PATCH 052/112] Removed warningToError where casting solves it --- .../astProcessor/functionSolver.ts | 12 ++--------- .../astProcessor/setupGenCode.ts | 5 ++--- .../astProcessor/unaryAsnProcessor.ts | 21 +++++++------------ 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/src/codeGenerator/astProcessor/functionSolver.ts b/src/codeGenerator/astProcessor/functionSolver.ts index 386ce6b..7a92670 100644 --- a/src/codeGenerator/astProcessor/functionSolver.ts +++ b/src/codeGenerator/astProcessor/functionSolver.ts @@ -68,14 +68,10 @@ export default function functionSolver ( }) const fnArg = FunctionToCall.argsMemObj[i] if (utils.isNotValidDeclarationOp(fnArg.declaration, ArgGenObj.SolvedMem)) { - if (Program.Config.warningToError) { throw new Error(`At line: ${CurrentNode.Token.line}.` + - ` Warning: Function parameter type is different from variable: '${fnArg.declaration}'` + + ` Function parameter type is different from variable: '${fnArg.declaration}'` + ` and '${ArgGenObj.SolvedMem.declaration}'.`) } - // Override declaration protection rules - utils.setMemoryDeclaration(ArgGenObj.SolvedMem, fnArg.declaration) - } if (ArgGenObj.SolvedMem.size !== 1 && ArgGenObj.SolvedMem.Offset === undefined) { throw new Error(`At line: ${CurrentNode.Token.line}.` + ' Overflow in argument size.') @@ -138,13 +134,9 @@ export default function functionSolver ( }) returnAssemblyCode += ArgGenObj.asmCode if (utils.getDeclarationFromMemory(ArgGenObj.SolvedMem) !== 'long') { - if (Program.Config.warningToError) { throw new Error(`At line: ${CurrentNode.Token.line}.` + - ' Warning: API Function parameter type is different from variable: ' + + ' API Function parameter type is different from variable: ' + ` 'long' and '${ArgGenObj.SolvedMem.declaration}'.`) - } - // Override declaration protection rules - utils.setMemoryDeclaration(ArgGenObj.SolvedMem, 'long') } if (ArgGenObj.SolvedMem.size !== 1 && ArgGenObj.SolvedMem.Offset === undefined) { throw new Error(`At line: ${CurrentNode.Token.line}.` + diff --git a/src/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts index 5114314..8316404 100644 --- a/src/codeGenerator/astProcessor/setupGenCode.ts +++ b/src/codeGenerator/astProcessor/setupGenCode.ts @@ -62,14 +62,13 @@ export default function setupGenCode ( } function validateReturnedVariable (InitAST: AST, RetObj: MEMORY_SLOT) { - if (Globals.Program.Config.warningToError && - CodeGenInfo.initialJumpTarget === undefined && + if (CodeGenInfo.initialJumpTarget === undefined && RetObj.type === 'register') { if ((InitAST.type === 'unaryASN' && InitAST.Operation.value !== '*') || (InitAST.type === 'binaryASN' && (InitAST.Operation.type === 'Comparision' || InitAST.Operation.type === 'Operator'))) { throw new Error(`At line: ${InitAST.Operation.line}. ` + - 'Warning: Operation returning a value that is not being used.') + 'Operation returning a value that is not being used. Use casting to (void) to avoid this error.') } } } diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index 70bdfd7..24ced0a 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -116,16 +116,13 @@ export default function unaryAsnProcessor ( } const declar = utils.getDeclarationFromMemory(CGenObj.SolvedMem) if (declar.includes('_ptr') === false) { - if (Program.Config.warningToError) { - if (CurrentNode.Center.type === 'endASN' || CurrentNode.Center.type === 'lookupASN') { - throw new Error(`At line: ${CurrentNode.Operation.line}.` + - ` Warning: Trying to read/set content of variable ${CurrentNode.Center.Token.value}` + - ' that is not declared as pointer.') - } + if (CurrentNode.Center.type === 'endASN' || CurrentNode.Center.type === 'lookupASN') { throw new Error(`At line: ${CurrentNode.Operation.line}.` + - ' Warning: Trying to read/set content of a value that is not declared as pointer.') + ` Trying to read/set content of variable ${CurrentNode.Center.Token.value}` + + ' that is not declared as pointer.') } - utils.setMemoryDeclaration(CGenObj.SolvedMem, (declar + '_ptr') as DECLARATION_TYPES) + throw new Error(`At line: ${CurrentNode.Operation.line}.` + + ' Trying to read/set content of a value that is not declared as pointer.') } if (CGenObj.SolvedMem.Offset) { // Double deference: deference and continue @@ -336,14 +333,10 @@ export default function unaryAsnProcessor ( const CGenObj = traverseNotLogical() CGenObj.asmCode += AuxVars.getPostOperations() if (utils.isNotValidDeclarationOp(AuxVars.CurrentFunction.declaration, CGenObj.SolvedMem)) { - if (Program.Config.warningToError) { - throw new Error(`At line: ${CurrentNode.Operation.line}.` + - ` Warning: Function ${AuxVars.CurrentFunction.name} must return` + + throw new Error(`At line: ${CurrentNode.Operation.line}.` + + ` Function ${AuxVars.CurrentFunction.name} must return` + ` '${AuxVars.CurrentFunction.declaration}' value,` + ` but it is returning '${CGenObj.SolvedMem.declaration}'.`) - } - // Override declaration protection rules - utils.setMemoryDeclaration(CGenObj.SolvedMem, AuxVars.CurrentFunction.declaration) } CGenObj.asmCode += createInstruction(AuxVars, CurrentNode.Operation, CGenObj.SolvedMem) AuxVars.freeRegister(CGenObj.SolvedMem.address) From 5a05a0433e98d8f174d7ccd0fdb147cbf28a76d2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 21:50:27 -0300 Subject: [PATCH 053/112] Fixed bugs 30 and 31 30) Internal functions not setting right return type 31) It was allowed to set array item outside range --- src/__tests__/bugfixes.a.spec.ts | 14 ++++++++++++++ .../astProcessor/binaryAsnProcessor.ts | 4 ++++ src/codeGenerator/astProcessor/functionSolver.ts | 7 ++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/__tests__/bugfixes.a.spec.ts b/src/__tests__/bugfixes.a.spec.ts index 9550848..b4e9d2b 100644 --- a/src/__tests__/bugfixes.a.spec.ts +++ b/src/__tests__/bugfixes.a.spec.ts @@ -234,4 +234,18 @@ describe('Tests for bugfixes', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + test('should throw: bug 30 Internal functions not setting right return type', () => { + expect(() => { + const code = '#include APIFunctions\nlong a, *b; b = Get_A1();' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: bug 31 It was allowed to set array item outside range', () => { + expect(() => { + const code = 'long a[4], b; a[4] = 25;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) }) diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 8e7fba6..a861d5a 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -155,6 +155,10 @@ export default function binaryAsnProcessor ( // If it is an array item we know, change to the item if (LGenObj.SolvedMem.type === 'array' && LGenObj.SolvedMem.Offset?.type === 'constant') { + if (LGenObj.SolvedMem.ArrayItem !== undefined && LGenObj.SolvedMem.ArrayItem.totalSize <= LGenObj.SolvedMem.Offset.value + 1) { + throw new Error(`At line ${CurrentNode.Operation.line}. ` + + 'Array index is outside array size.') + } LGenObj.SolvedMem = AuxVars.getMemoryObjectByLocation( utils.addHexContents(LGenObj.SolvedMem.hexContent, LGenObj.SolvedMem.Offset.value) ) diff --git a/src/codeGenerator/astProcessor/functionSolver.ts b/src/codeGenerator/astProcessor/functionSolver.ts index 7a92670..e9d5d58 100644 --- a/src/codeGenerator/astProcessor/functionSolver.ts +++ b/src/codeGenerator/astProcessor/functionSolver.ts @@ -68,10 +68,10 @@ export default function functionSolver ( }) const fnArg = FunctionToCall.argsMemObj[i] if (utils.isNotValidDeclarationOp(fnArg.declaration, ArgGenObj.SolvedMem)) { - throw new Error(`At line: ${CurrentNode.Token.line}.` + + throw new Error(`At line: ${CurrentNode.Token.line}.` + ` Function parameter type is different from variable: '${fnArg.declaration}'` + ` and '${ArgGenObj.SolvedMem.declaration}'.`) - } + } if (ArgGenObj.SolvedMem.size !== 1 && ArgGenObj.SolvedMem.Offset === undefined) { throw new Error(`At line: ${CurrentNode.Token.line}.` + ' Overflow in argument size.') @@ -117,6 +117,7 @@ export default function functionSolver ( FnRetObj = utils.createVoidMemObj() } else { FnRetObj = AuxVars.getNewRegister() // reserve tempvar for return type + FnRetObj.declaration = ifnToCall.declaration } if (rawArgs[0].type === 'nullASN') { rawArgs.pop() @@ -134,7 +135,7 @@ export default function functionSolver ( }) returnAssemblyCode += ArgGenObj.asmCode if (utils.getDeclarationFromMemory(ArgGenObj.SolvedMem) !== 'long') { - throw new Error(`At line: ${CurrentNode.Token.line}.` + + throw new Error(`At line: ${CurrentNode.Token.line}.` + ' API Function parameter type is different from variable: ' + ` 'long' and '${ArgGenObj.SolvedMem.declaration}'.`) } From 396242eac9a36cd5bc52e04dd52b383134f5fbf2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 22:01:19 -0300 Subject: [PATCH 054/112] Removed option #pragma warningToError --- docs/1-Basis.md | 1 - src/__tests__/keywords.b.spec.ts | 7 ++ src/__tests__/macros.a.spec.ts | 7 ++ src/__tests__/macros.b.spec.ts | 67 ------------------- src/__tests__/pointers.a.spec.ts | 7 -- .../astProcessor/unaryAsnProcessor.ts | 8 +-- src/shaper/shaper.ts | 3 - src/smartc.ts | 1 - src/typings/contractTypes.ts | 2 - 9 files changed, 16 insertions(+), 87 deletions(-) delete mode 100644 src/__tests__/macros.b.spec.ts diff --git a/docs/1-Basis.md b/docs/1-Basis.md index d2aea06..171733b 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -63,7 +63,6 @@ Many arguments can be used. * 3: Dangerous optimizations no well tested. Result must be inspected by developer. * `#pragma reuseAssignedVar [true/false/1/0/]`: When set, compiler will try to use a variable on left side of and `Assignment` as a register. If variable is also used on right side, the compiler will not reuse it. This can save one assembly instruction for every expression used! Default value is `true` and it is highly recomended to maintain it active. * `#pragma version N`: Informs which compiler's version the code was developed. Must be set if not using development version. To skip this check, set it to `dev`. -* `#pragma warningToError [true/false/1/0/]`: All warnings to compiler errors. Default value is `true`. Warning messages begin with WARNING, other ones are actually errors. * `#pragma outputSourceLineNumber[true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number to the C source code. Very usefull for debug. #### Escaping new line diff --git a/src/__tests__/keywords.b.spec.ts b/src/__tests__/keywords.b.spec.ts index 4f0bc91..79c3425 100644 --- a/src/__tests__/keywords.b.spec.ts +++ b/src/__tests__/keywords.b.spec.ts @@ -295,6 +295,13 @@ describe('Keywords wrong usage', () => { compiler.compile() }).toThrowError(/^At line/) }) + test('should throw: Trying to get the address of a register', () => { + expect(() => { + const code = 'long a, *b; b = &r1;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) test('should throw: const and variable in right side', () => { expect(() => { const code = 'long a, d; const d=a;' diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index 502e31f..087ecce 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -41,6 +41,13 @@ describe('#program', () => { compiler.compile() }).toThrowError(/^At line/) }) + test('should throw: forbidden char in name', () => { + expect(() => { + const code = '#program name test2 d\n long a; a++;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) test('should throw: description bigger than 1000 chars', () => { expect(() => { const code = '#program description Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam efficitur mollis mauris eu pretium. Vivamus ut nisl eget elit aliquam finibus eget a ex. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vivamus vel neque risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse potenti. Sed eget lacinia lorem, et luctus orci. Praesent ut lorem pretium, iaculis dui eu, convallis sem. Ut lorem metus, eleifend eu velit in, volutpat ullamcorper sem. Donec hendrerit ornare posuere. Curabitur vitae lacus non dolor lacinia mollis. Sed ex felis, fringilla ac fringilla id, lobortis condimentum mi. Vestibulum nec orci vel lectus pulvinar imperdiet sit amet id nulla. Morbi quis orci tristique, pharetra libero pharetra, fermentum nunc. Nulla vestibulum felis risus, at cursus leo blandit ut. Praesent interdum commodo ex, sed vehicula sem luctus eu. Ut sed diam quis lectus lobortis maximus. Etiam hendrerit tincidunt ligula nec efficitur. Donec pulvinar mauris ac integer.\nlong a; a++;' diff --git a/src/__tests__/macros.b.spec.ts b/src/__tests__/macros.b.spec.ts deleted file mode 100644 index 477eb3f..0000000 --- a/src/__tests__/macros.b.spec.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { SmartC } from '../smartc' - -describe('#pragma warningToError false', () => { - it('should compile: regular variable as pointer + warningToError false', () => { - const code = '#pragma warningToError false\nlong *pa, *pb, va, vb;\n pa=vb; pa=*pb; *pa=pb; *pa=&pb; *pa=&vb; va=pb; va=&pb; va=&vb;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare pa\n^declare pb\n^declare va\n^declare vb\n\nSET @pa $vb\nSET @pa $($pb)\nSET @($pa) $pb\nSET @r0 #0000000000000004\nSET @($pa) $r0\nSET @r0 #0000000000000006\nSET @($pa) $r0\nSET @va $pb\nSET @va #0000000000000004\nSET @va #0000000000000006\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: function argument', () => { - const code = '#pragma warningToError false\n long a, *b; test(a); void test(long *arg) {}' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare test_arg\n\nPSH $a\nJSR :__fn_test\nFIN\n\n__fn_test:\nPOP @test_arg\nRET\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: function return', () => { - const code = '#pragma warningToError false\nlong a, *b; b = test(); long test(void) { return 5; }' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test\nPOP @b\nFIN\n\n__fn_test:\nSET @r0 #0000000000000005\nPSH $r0\nRET\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: function return 2', () => { - const code = '#pragma warningToError false\n long a, *b; b = test(); long test(void) { return b; }' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nJSR :__fn_test\nPOP @b\nFIN\n\n__fn_test:\nPSH $b\nRET\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: API function argument', () => { - const code = '#pragma warningToError false\n#include APIFunctions\nlong a, *b; Set_A1(b);' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nFUN set_A1 $b\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: API function return', () => { - const code = '#pragma warningToError false\n#include APIFunctions\nlong a, *b; b = Get_A1();' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nFUN @b get_A1\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: Address of an register', () => { - const code = '#pragma warningToError false\nlong a, *b; b = &r1;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @b #0000000000000001\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: Using regular variable as pointer', () => { - const code = '#pragma warningToError false\nlong a, b; a=*(b+1);' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @a $b\nINC @a\nSET @a $($a)\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - test('should throw: forbidden char in name', () => { - expect(() => { - const code = '#program name test2 d\n long a; a++;' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) -}) diff --git a/src/__tests__/pointers.a.spec.ts b/src/__tests__/pointers.a.spec.ts index 2601cb4..c74b9fa 100644 --- a/src/__tests__/pointers.a.spec.ts +++ b/src/__tests__/pointers.a.spec.ts @@ -102,13 +102,6 @@ describe('Pointer/Array assignment', () => { compiler.compile() }).toThrowError(/^At line/) }) - it('should compile: Address of array to regular variable (disregard warning)', () => { - const code = '#pragma warningToError false\nlong a[4], *b, c; c=&a; c=&a[0]; c=&c;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^const SET @a #0000000000000004\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c #0000000000000003\nSET @c #0000000000000004\nSET @c #0000000000000009\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) it('should compile: Operation with pointer before deferencing', () => { const code = 'long *a, b, c;\n*(a+1)=b; *(a+30)=b; *(a+c)=b;\nb=*(a+1); b=*(a+30); b=*(a+c);' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 $a\nINC @r0\nSET @($r0) $b\nSET @r0 #000000000000001e\nADD @r0 $a\nSET @($r0) $b\nSET @r0 $a\nADD @r0 $c\nSET @($r0) $b\nSET @b $a\nINC @b\nSET @b $($b)\nSET @b #000000000000001e\nADD @b $a\nSET @b $($b)\nSET @b $a\nADD @b $c\nSET @b $($b)\nFIN\n' diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index 24ced0a..4634499 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -230,12 +230,8 @@ export default function unaryAsnProcessor ( throw new Error(`At line: ${CurrentNode.Operation.line}. ` + 'Trying to get address of void value.') case 'register': - if (Program.Config.warningToError) { - throw new Error(`At line: ${CurrentNode.Operation.line}. ` + - 'Warning: Returning address of a register.') - } - TmpMemObj = utils.createConstantMemObj(RetMem.address) - break + throw new Error(`At line: ${CurrentNode.Operation.line}. ` + + 'Returning address of a register.') case 'constant': throw new Error(`At line: ${CurrentNode.Operation.line}. ` + 'Trying to get address of a constant value.') diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index ac81e38..6d8e907 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -201,9 +201,6 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { case 'version': Program.Config.sourcecodeVersion = MacroToken.value return false - case 'warningToError': - Program.Config.warningToError = bool - return true case 'outputSourceLineNumber': Program.Config.outputSourceLineNumber = bool return true diff --git a/src/smartc.ts b/src/smartc.ts index 289da00..da36422 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -58,7 +58,6 @@ export class SmartC { optimizationLevel: 2, reuseAssignedVar: true, sourcecodeVersion: '', - warningToError: true, APIFunctions: false, PName: '', PDescription: '', diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index 5074b06..74400aa 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -18,8 +18,6 @@ export type SC_CONFIG = { /** Default version for user's programs. If not on a dev version, user must * specify #pragma version to set source code version */ sourcecodeVersion: string, - /** Warning to error: #pragma warningToError */ - warningToError: boolean, /** Support for API Functions: #include APIFunctions */ APIFunctions: boolean, /** Program Name: #program name */ From d93077a6d1ab3c616c7e598a4bcb46f0803c5282 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 23:02:22 -0300 Subject: [PATCH 055/112] Testcases for fixed numbers and type castings --- src/__tests__/castings.a.spec.ts | 74 +++++++ src/__tests__/fixed.a.spec.ts | 340 +++++++++++++++++++++++++++++++ src/__tests__/fixed.b.spec.ts | 139 +++++++++++++ 3 files changed, 553 insertions(+) create mode 100644 src/__tests__/castings.a.spec.ts create mode 100644 src/__tests__/fixed.a.spec.ts create mode 100644 src/__tests__/fixed.b.spec.ts diff --git a/src/__tests__/castings.a.spec.ts b/src/__tests__/castings.a.spec.ts new file mode 100644 index 0000000..9d143c2 --- /dev/null +++ b/src/__tests__/castings.a.spec.ts @@ -0,0 +1,74 @@ +import { SmartC } from '../smartc' + +describe('Castings', () => { + it('should compile: special verification on long <=> fixed', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, fb; long la, lb;\n la = lb + (long)fa; fa = la + (fixed)lb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare fb\n^declare la\n^declare lb\n\nSET @la $fa\nDIV @la $f100000000\nADD @la $lb\nSET @fa $lb\nMUL @fa $f100000000\nSET @r0 $la\nMUL @r0 $f100000000\nADD @fa $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: from void to all', () => { + const code = ' #pragma optimizationLevel 0\n void *pv; long l, *pl; fixed f, *pf; struct TEST { long aa, bb; } s, *ps;\n l = (long)(); f = (fixed)(); pv = (void *)(); pl = (long *)(); pf = (fixed *)(); ps = (struct BB *)();' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare pv\n^declare l\n^declare pl\n^declare f\n^declare pf\n^declare s_aa\n^declare s_bb\n^declare ps\n\nCLR @l\nCLR @f\nCLR @pv\nCLR @pl\nCLR @pf\nCLR @ps\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: from all to void', () => { + const code = ' #pragma optimizationLevel 0\nvoid *pv; long l, *pl; fixed f, *pf; struct TEST { long aa, bb; } s, *ps;\n (void)(l+1); (void)(f+1.2);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare pv\n^declare l\n^declare pl\n^declare f\n^declare pf\n^declare s_aa\n^declare s_bb\n^declare ps\n\nSET @r0 $l\nINC @r0\nSET @r0 #0000000007270e00\nADD @r0 $f\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: from long to all', () => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n l = (long)l; f = (fixed)l; pv = (void *)l; pl = (long *)l; pf = (fixed *)l; ps = (struct BB *)l;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare pv\n^declare l\n^declare pl\n^declare f\n^declare pf\n^declare s_aa\n^declare s_bb\n^declare ps\n\nSET @f $l\nMUL @f $f100000000\nSET @pv $l\nSET @pl $l\nSET @pf $l\nSET @ps $l\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: from fixed to pointers', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n pv = (void *)f;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: from struct to all', () => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n pv = (void *)s; pl = (long *)s; pf = (fixed *)s; ps = (struct BB *)s;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare pv\n^declare l\n^declare pl\n^declare f\n^declare pf\n^declare s_aa\n^declare s_bb\n^declare ps\n\nSET @pv #0000000000000009\nSET @pl #0000000000000009\nSET @pf #0000000000000009\nSET @ps #0000000000000009\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: from struct to long', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n l = (long)s;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: from struct to fixed', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n f = (fixed)s;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: from pointer to all', () => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n l = (long)pl; pv = (void *)pl; pl = (long *)pl; pf = (fixed *)pl; ps = (struct BB *)pl;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare pv\n^declare l\n^declare pl\n^declare f\n^declare pf\n^declare s_aa\n^declare s_bb\n^declare ps\n\nSET @l $pl\nSET @pv $pl\nSET @pf $pl\nSET @ps $pl\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: from pointer to fixed', () => { + expect(() => { + const code = '#pragma optimizationLevel 0\nvoid *pv;long l, *pl;fixed f, *pf;struct TEST { long aa, bb; } s, *ps;\n f = (fixed)pv;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) +}) diff --git a/src/__tests__/fixed.a.spec.ts b/src/__tests__/fixed.a.spec.ts new file mode 100644 index 0000000..023f836 --- /dev/null +++ b/src/__tests__/fixed.a.spec.ts @@ -0,0 +1,340 @@ +import { SmartC } from '../smartc' + +describe('Assignment', () => { + it('should compile: = fixed/fixed', () => { + const code = '#pragma optimizationLevel 0\nfixed a, b; a=b;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a $b\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: = fixed/long', () => { + const code = '#pragma optimizationLevel 0\nfixed a; long b; a=b;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 $b\nMUL @r0 $f100000000\nSET @a $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: = long/fixed', () => { + const code = '#pragma optimizationLevel 0\nfixed a; long b; b=a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 $a\nDIV @r0 $f100000000\nSET @b $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: = fixed/constantfixed', () => { + const code = '#pragma optimizationLevel 0\nfixed a, b; a=2.23;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a #000000000d4ab5c0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: = fixed/constantlong', () => { + const code = '#pragma optimizationLevel 0\nfixed a; long b; a=55;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #0000000000000037\nMUL @r0 $f100000000\nSET @a $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: = long/constantfixed', () => { + const code = '#pragma optimizationLevel 0\nfixed a; long b; b=32.3;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #00000000c085e380\nDIV @r0 $f100000000\nSET @b $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) + +describe('SetOperator', () => { + it('should compile: += -= fixed/fixed fixed/long fixed/constantlong', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, fb; long lc; fa+=fb; fa-=fb; fa+=lc; fa-=lc; fa+=2; fa-=2;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare fb\n^declare lc\n\nADD @fa $fb\nSUB @fa $fb\nSET @r0 $lc\nMUL @r0 $f100000000\nADD @fa $r0\nSET @r0 $lc\nMUL @r0 $f100000000\nSUB @fa $r0\nSET @r0 #0000000000000002\nMUL @r0 $f100000000\nADD @fa $r0\nSET @r0 #0000000000000002\nMUL @r0 $f100000000\nSUB @fa $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: += -= long/fixed long/constantfixed', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, fb; long lc; lc+=fa; lc-=fb; lc+=2.2; lc-=2.2;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare fb\n^declare lc\n\nSET @r0 $fa\nDIV @r0 $f100000000\nADD @lc $r0\nSET @r0 $fb\nDIV @r0 $f100000000\nSUB @lc $r0\nSET @r0 #000000000d1cef00\nDIV @r0 $f100000000\nADD @lc $r0\nSET @r0 #000000000d1cef00\nDIV @r0 $f100000000\nSUB @lc $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *= /= fixed/fixed fixed/long fixed/constantlong', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, fb; long lc; fa*=fb; fa/=fb; fa*=lc; fa/=lc; fa*=2; fa/=2;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare fb\n^declare lc\n\nMDV @fa $fb $f100000000\nMDV @fa $f100000000 $fb\nMUL @fa $lc\nDIV @fa $lc\nSET @r0 #0000000000000002\nMUL @fa $r0\nSET @r0 #0000000000000002\nDIV @fa $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *= /= long/fixed long/constantfixed', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, fb; long lc; lc*=fa; lc/=fb; lc*=2.2; lc/=2.2;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare fb\n^declare lc\n\nSET @r0 $fa\nDIV @r0 $f100000000\nMUL @lc $r0\nSET @r0 $fb\nDIV @r0 $f100000000\nDIV @lc $r0\nSET @r0 #000000000d1cef00\nDIV @r0 $f100000000\nMUL @lc $r0\nSET @r0 #000000000d1cef00\nDIV @r0 $f100000000\nDIV @lc $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: %= ', () => { + expect(() => { + const code = 'fixed a; fixed b; a%=b;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: &= ', () => { + expect(() => { + const code = 'fixed a; fixed b; a&=b;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: |= ', () => { + expect(() => { + const code = 'fixed a; fixed b; a|=b;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: ^= ', () => { + expect(() => { + const code = 'fixed a; fixed b; a^=b;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: <<= >>= with long', () => { + const code = '#pragma optimizationLevel 0\nfixed a; long b; a>>=3; a<<=3; a>>=b; a<<=b;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #0000000000000003\nSHR @a $r0\nSET @r0 #0000000000000003\nSHL @a $r0\nSHR @a $b\nSHL @a $b\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: <<= ', () => { + expect(() => { + const code = 'fixed a; fixed b; a<<=b;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: >>= ', () => { + expect(() => { + const code = 'fixed a; fixed b; a>>=b;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) +}) + +describe('Operator', () => { + it('should compile: / ', () => { + const code = '#pragma optimizationLevel 0\n long la; fixed fa, fb, fresult; fresult = la / fa; fresult = fa / la; fresult = fa / fb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare fa\n^declare fb\n^declare fresult\n\nSET @fresult $la\nMUL @fresult $f100000000\nMDV @fresult $f100000000 $fa\nSET @fresult $fa\nDIV @fresult $la\nSET @fresult $fa\nMDV @fresult $f100000000 $fb\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: % ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=fa%la;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: & ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=fa&la;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: | ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=fa|la;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: ^ ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=fa^la;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: << >> right usage', () => { + const code = 'long la; fixed fa, fb, fresult; fresult = fa << la; fresult = fa >> la; fb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare fa\n^declare fb\n^declare fresult\n\nSET @fresult $fa\nSHL @fresult $la\nSET @fresult $fa\nSHR @fresult $la\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: >> wrong ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=la>>fa;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: << wrong ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=la< { + it('should compile: Assignment', () => { + const code = '#pragma optimizationLevel 0\nfixed fa; fa=2.5;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n\nSET @fa #000000000ee6b280\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) + +describe('UnaryOperator', () => { + it('should compile: !', () => { + const code = '#pragma optimizationLevel 0\nlong a; fixed b; a=!b;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nBNZ $b :__NOT_1_sF\n__NOT_1_sT:\nSET @a #0000000000000001\nJMP :__NOT_1_end\n__NOT_1_sF:\nCLR @a\n__NOT_1_end:\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: ~', () => { + const code = '#pragma optimizationLevel 0\nfixed a, b; a=~b;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a $b\nNOT @a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) + +describe('SetUnaryOperator', () => { + it('should compile: ++ post', () => { + const code = 'fixed a, b; b=a++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @b $a\nADD @a $f100000000\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: -- post', () => { + const code = 'fixed a, b; b=a--;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @b $a\nSUB @a $f100000000\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: ++ pre', () => { + const code = 'fixed a, b; b=++a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nADD @a $f100000000\nSET @b $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: -- pre', () => { + const code = 'fixed a, b; b=--a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSUB @a $f100000000\nSET @b $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) + +describe('CheckOperator Unary', () => { + it('should compile: - ', () => { + const code = 'fixed a, b; b=-a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nCLR @b\nSUB @b $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: + ', () => { + const code = 'fixed a, b; b=+a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @b $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: & ', () => { + const code = 'fixed a, *b; b=&a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @b #0000000000000004\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: * ', () => { + const code = 'fixed a, *b; a=*b;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a $($b)\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *() ', () => { + const code = 'fixed a, *b; a=*(b+1);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a $b\nINC @a\nSET @a $($a)\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *() ', () => { + const code = 'fixed a, *b; a=*(b+3);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a #0000000000000003\nADD @a $b\nSET @a $($a)\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *() ', () => { + const code = 'fixed a, *b;long la; a=*(b+la);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n^declare la\n\nSET @a $b\nADD @a $la\nSET @a $($a)\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: * on left side', () => { + const code = 'fixed a, *b; *b=a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @($b) $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *() on left side paren opt', () => { + const code = 'fixed a, *b; *(b + 1)=a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 $b\nINC @r0\nSET @($r0) $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *() on left side paren not opt', () => { + const code = 'fixed a, *b; *(b + 3)=a;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #0000000000000003\nADD @r0 $b\nSET @($r0) $a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) + +describe('CheckOperator Binary', () => { + it('should compile: + -', () => { + const code = '#pragma optimizationLevel 0\nlong la; fixed fa, fb, fresult; fresult = la + fa; fresult = fa + la; fresult = la - fa; fresult = fa - la; fresult = fa + fb; fresult = fa - fb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare fa\n^declare fb\n^declare fresult\n\nSET @fresult $la\nMUL @fresult $f100000000\nADD @fresult $fa\nSET @fresult $la\nMUL @fresult $f100000000\nADD @fresult $fa\nSET @fresult $la\nMUL @fresult $f100000000\nSUB @fresult $fa\nSET @fresult $fa\nSET @r0 $la\nMUL @r0 $f100000000\nSUB @fresult $r0\nSET @fresult $fa\nADD @fresult $fb\nSET @fresult $fa\nSUB @fresult $fb\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: *', () => { + const code = '#pragma optimizationLevel 0\n long la; fixed fa, fb, fresult; fresult = la * fa; fresult = fa * la; fresult = fa * fb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare fa\n^declare fb\n^declare fresult\n\nSET @fresult $la\nMUL @fresult $f100000000\nMDV @fresult $fa $f100000000\nSET @fresult $fa\nMUL @fresult $la\nSET @fresult $fa\nMDV @fresult $fb $f100000000\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: & ', () => { + expect(() => { + const code = 'long la; fixed fa, fr; fr=la&fa;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) +}) diff --git a/src/__tests__/fixed.b.spec.ts b/src/__tests__/fixed.b.spec.ts new file mode 100644 index 0000000..a177368 --- /dev/null +++ b/src/__tests__/fixed.b.spec.ts @@ -0,0 +1,139 @@ +import { SmartC } from '../smartc' + +describe('Arrays', () => { + describe('Array assignment (left side)', () => { + it('should compile: Array long constant index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4]; long b; fixed c; a[3]=c;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @a_3 $c\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: array fixed constant index', () => { + expect(() => { + const code = 'fixed a[4]; long b; fixed c; a[3.0]=c;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: Array long variable index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4]; long b; fixed c; a[b]=c;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @($a + $b) $c\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: array fixed variable index', () => { + expect(() => { + const code = 'fixed a[4]; long b; fixed c; a[c]=c;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + }) + describe('Array assignment (right side)', () => { + it('should compile: Array long constant index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4]; long b; fixed c; c=a[3];' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c $a_3\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: array fixed constant index', () => { + expect(() => { + const code = 'fixed a[4]; long b; fixed c; c=a[3.0];' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + it('should compile: Array long variable index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4]; long b; fixed c; c=a[b];' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^declare c\n\nSET @c $($a + $b)\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: array fixed variable index', () => { + expect(() => { + const code = 'fixed a[4]; long b; fixed c; c=a[c];' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + }) + describe('Array assignment (both sides)', () => { + it('should compile: Array long constant/constant index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4], b[4]; long c,d; a[2]=b[3];' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^const SET @b #000000000000000a\n^declare b_0\n^declare b_1\n^declare b_2\n^declare b_3\n^declare c\n^declare d\n\nSET @a_2 $b_3\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: Array long long/constant index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4], b[4]; long c,d; a[c]=b[3];' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^const SET @b #000000000000000a\n^declare b_0\n^declare b_1\n^declare b_2\n^declare b_3\n^declare c\n^declare d\n\nSET @($a + $c) $b_3\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: Array long constant/long index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4], b[4]; long c,d; a[3]=b[d];' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^const SET @b #000000000000000a\n^declare b_0\n^declare b_1\n^declare b_2\n^declare b_3\n^declare c\n^declare d\n\nSET @a_3 $($b + $d)\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: Array long long/long index', () => { + const code = '#pragma optimizationLevel 0\nfixed a[4], b[4]; long c,d; a[c]=b[d];' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare b\n^const SET @b #000000000000000a\n^declare b_0\n^declare b_1\n^declare b_2\n^declare b_3\n^declare c\n^declare d\n\nSET @r0 $($b + $d)\nSET @($a + $c) $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + }) + + describe('Multi dimensional Arrays assignment (left side)', () => { + it('should compile: constants', () => { + const code = 'fixed a[4][2]; long b, c; a[2][1]=4.0;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n\nSET @a_5 #0000000017d78400\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: variable+constants', () => { + const code = 'fixed a[4][2]; long b, c; a[b][1]=4.0;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n\nSET @r0 #0000000000000002\nMUL @r0 $b\nINC @r0\nSET @r1 #0000000017d78400\nSET @($a + $r0) $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: variable+zero', () => { + const code = 'fixed a[4][2]; long b, c; a[b][0]=4.0;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n\nSET @r0 #0000000000000002\nMUL @r0 $b\nSET @r1 #0000000017d78400\nSET @($a + $r0) $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: zero+variable', () => { + const code = 'fixed a[4][2]; long b, c; a[0][b]=4.0;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n\nSET @r0 #0000000017d78400\nSET @($a + $b) $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: constant+variable', () => { + const code = 'fixed a[4][2]; long b, c; a[3][b]=4.0;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n\nSET @r0 $b\nSET @r1 #0000000000000006\nADD @r0 $r1\nSET @r1 #0000000017d78400\nSET @($a + $r0) $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: variable+variable', () => { + const code = 'fixed a[4][2]; long b, c; a[b][c]=4.0;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^const SET @a #0000000000000005\n^declare a_0\n^declare a_1\n^declare a_2\n^declare a_3\n^declare a_4\n^declare a_5\n^declare a_6\n^declare a_7\n^declare b\n^declare c\n\nSET @r0 #0000000000000002\nMUL @r0 $b\nADD @r0 $c\nSET @r1 #0000000017d78400\nSET @($a + $r0) $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + }) +}) From dbc7f0854df982547658b9e58c6148fce3b359dc Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 2 Jun 2022 23:03:03 -0300 Subject: [PATCH 056/112] Minor fixes --- debug.html | 26 +++++++++++++++++++------- docs/6-Deeper-into-SmartC.md | 4 ++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/debug.html b/debug.html index f7d7559..ebbf49d 100644 --- a/debug.html +++ b/debug.html @@ -58,15 +58,19 @@ } textarea { padding: 1ch; - height: 50vh; + height: 75vh; font-size: inherit; - width: calc(100vw - 2ch); + width: 50vw; + } + td { + vertical-align: top; } pre { padding: 1ch; border: 1px black solid; word-wrap: anywhere; white-space: pre-wrap; + margin: 0; } .msg_failure { font-weight: bold; @@ -83,11 +87,19 @@
Simple debugger page

Use this page to debug or inspect SmartC process, using a browser.

- - -

-    

-    

+    
+        
+            
+                
+                
+            
+        
+    


+                    

+                    
+ + +
\ No newline at end of file diff --git a/docs/6-Deeper-into-SmartC.md b/docs/6-Deeper-into-SmartC.md index 4602c7b..92e90f7 100644 --- a/docs/6-Deeper-into-SmartC.md +++ b/docs/6-Deeper-into-SmartC.md @@ -15,7 +15,7 @@ Following table presents operators precedence order that are [based on C](https: | 7 | `&` `^` `|` | Bitwise AND XOR OR | Left-to-right | | 8 | `&&` | Logical AND | Left-to-right | | 9 | `||` | Logical OR | Left-to-right | -| 10 | `=` `+=` `-=` `*=` `/=` `%=` `&=` `\=` `;=` `^=` `<<=` `>>=` | Assignment operators| Right-to-left | +| 10 | `=` `+=` `-=` `/=` `*=` `%=` `&=` `^=` `|=` `<<=` `>>=` | Assignment operators| Right-to-left | | 11 | `,` | Delimiter, comma | Left-to-right | | 12 | `;` `keywords` | Terminator, semi, keywords other than sizeof | Right-to-left | @@ -34,7 +34,7 @@ Tokens are divided in groups and later on checked if their combinations are synt | UnaryOperator | `!` `~` | Tokens that are undoubtly unary operators and have no other interpretation. | | SetUnaryOperator | `++` `--` | Special unary operations with same meaning in C - pre/post increment/decrement | | Assignment | `=` | Common assignment operation | -| SetOperator | `+=` `-=` `/=` `*=` `%=` `<<=` `>>=` `&=` `|=` | Special assignment operations | +| SetOperator | `+=` `-=` `/=` `*=` `%=` `&=` `^=` `|=` `<<=` `>>=` | Special assignment operations | | Comparision | `==` `<=` `<` `>` `>=` `!=` `&&` `||` | Logical comparisions operations | | CheckOperator | `+` `-` `*` `&` | Tokens that have two meanings and need to be checked agains previous tokens to know their behaviour. After parsed they are treated as UnaryOperator or Operator | | Arr | `[expr]` | Representation of an array index. Must have a variable before it. | From a8260e937369e25e55442227e35986f97fe1343a Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 3 Jun 2022 19:51:43 -0300 Subject: [PATCH 057/112] Comparision implict type casting and check --- src/__tests__/castings.a.spec.ts | 19 +++++- .../astProcessor/binaryAsnProcessor.ts | 67 ++++++++++++------- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/__tests__/castings.a.spec.ts b/src/__tests__/castings.a.spec.ts index 9d143c2..886cdf9 100644 --- a/src/__tests__/castings.a.spec.ts +++ b/src/__tests__/castings.a.spec.ts @@ -1,6 +1,6 @@ import { SmartC } from '../smartc' -describe('Castings', () => { +describe('Castings arithmetic', () => { it('should compile: special verification on long <=> fixed', () => { const code = '#pragma optimizationLevel 0\nfixed fa, fb; long la, lb;\n la = lb + (long)fa; fa = la + (fixed)lb;' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare fb\n^declare la\n^declare lb\n\nSET @la $fa\nDIV @la $f100000000\nADD @la $lb\nSET @fa $lb\nMUL @fa $f100000000\nSET @r0 $la\nMUL @r0 $f100000000\nADD @fa $r0\nFIN\n' @@ -72,3 +72,20 @@ describe('Castings', () => { }).toThrowError(/^At line/) }) }) + +describe('Castings logical', () => { + it('should compile: all permitted types', () => { + const code = '#pragma optimizationLevel 0\nlong la, lb, *pl; fixed fa, fb, *pf; void * pv;\n if (la > fb) la++; if (fa > lb) la++; if (fa >= fb) la++; if (la < pl) la++; if (la <= pf) la++; if (pv == pl) la++; if (pf != pl) la++;' + const assembly = '' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: pointer vs fixed', () => { + expect(() => { + const code = 'long la, lb, *pl; fixed fa, fb, *pf; void * pv;\n if (la > fb) la++; if (fa > pv) la++;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) +}) diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index a861d5a..1a317e0 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -290,7 +290,7 @@ export default function binaryAsnProcessor ( return RetGenObj } - /** Tests if implicit type casting is needed and also checks valid operations. + /** Tests if implicit type casting is needed and also checks valid operations for binary operators. * @returns the side needed to be changed * @throws Error if operation is not allowed */ function implicitTypeCastingTest (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : 'left' | 'right' | 'none' { @@ -300,15 +300,15 @@ export default function binaryAsnProcessor ( } return 'none' } - const fixedRet = fixedImplicitTC(operVal, lDecl, rDecl) - if (fixedRet !== 'notFixed') { + const fixedRet = fixedLongImplicitTC(operVal, lDecl, rDecl) + if (fixedRet !== 'notFixedLong') { return fixedRet } const pointerRet = remainingImplicitTC(operVal, lDecl, rDecl) return pointerRet } - function fixedImplicitTC (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : 'left' | 'right' | 'none' | 'notFixed' { + function fixedLongImplicitTC (operVal: string, lDecl: DECLARATION_TYPES, rDecl: DECLARATION_TYPES) : 'left' | 'right' | 'none' | 'notFixedLong' { let fixedSide: 'left' | 'right' | 'none' = 'none' if (lDecl === 'long' && rDecl === 'fixed') { fixedSide = 'right' @@ -317,7 +317,7 @@ export default function binaryAsnProcessor ( fixedSide = 'left' } if (fixedSide === 'none') { - return 'notFixed' + return 'notFixedLong' } // now there is only one fixed and one long switch (operVal) { @@ -351,6 +351,13 @@ export default function binaryAsnProcessor ( case '/=': case '*=': return fixedSide === 'left' ? 'none' : 'right' + case '==': + case '!=': + case '<=': + case '>=': + case '<': + case '>': + return fixedSide === 'left' ? 'right' : 'left' default: throw new Error('Internal error') } @@ -403,23 +410,24 @@ export default function binaryAsnProcessor ( return 'left' } throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) - case '/': - case '*': - case '%': - case '&': - case '|': - case '^': - case '%=': - case '&=': - case '|=': - case '^=': - case '>>': - case '<<': - case '>>=': - case '<<=': - case '/=': - case '*=': + case '==': + case '!=': + case '<=': + case '>=': + case '<': + case '>': + if (lDecl.includes('_ptr') && rDecl.includes('_ptr')) { + return 'right' + } + if (lDecl.includes('_ptr') && rDecl === 'long') { + return 'right' + } + if (lDecl === 'long' && rDecl.includes('_ptr')) { + return 'left' + } + throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) default: + // / * % & | ^ %= &= |= ^= >> << >>= <<= /= *= throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) } } @@ -544,18 +552,27 @@ export default function binaryAsnProcessor ( } function defaultLogicalOpProc () : GENCODE_SOLVED_OBJECT { - const LGenObj = genCode(Program, AuxVars, { + let LGenObj = genCode(Program, AuxVars, { RemAST: CurrentNode.Left, logicalOp: false, revLogic: ScopeInfo.revLogic }) // ScopeInfo.jumpFalse and ScopeInfo.jumpTrue must be undefined to evaluate expressions - assemblyCode += LGenObj.asmCode - const RGenObj = genCode(Program, AuxVars, { + let RGenObj = genCode(Program, AuxVars, { RemAST: CurrentNode.Right, logicalOp: false, revLogic: ScopeInfo.revLogic }) // ScopeInfo.jumpFalse and ScopeInfo.jumpTrue must be undefined to evaluate expressions - assemblyCode += RGenObj.asmCode + const leftDeclaration = utils.getDeclarationFromMemory(LGenObj.SolvedMem) + const rightDeclaration = utils.getDeclarationFromMemory(RGenObj.SolvedMem) + const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) + switch (castSide) { + case 'left': + LGenObj = typeCasting(AuxVars, LGenObj, rightDeclaration, CurrentNode.Operation.line) + break + case 'right': + RGenObj = typeCasting(AuxVars, RGenObj, leftDeclaration, CurrentNode.Operation.line) + } + assemblyCode = LGenObj.asmCode + RGenObj.asmCode assemblyCode += createInstruction( AuxVars, CurrentNode.Operation, From 245b67808c38d6104fb6088894010d1a45ff384e Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 4 Jun 2022 11:57:58 -0300 Subject: [PATCH 058/112] Added #include fixedAPIFunctions --- src/__tests__/functions.b.spec.ts | 31 +++ .../astProcessor/functionSolver.ts | 12 +- src/shaper/shaper.ts | 12 +- src/shaper/templates.ts | 263 ++++++++++++++++++ src/smartc.ts | 1 + src/typings/contractTypes.ts | 2 + 6 files changed, 313 insertions(+), 8 deletions(-) diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index a9c2c6a..44796ba 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -66,6 +66,37 @@ describe('API functions', () => { }) }) +describe('fixed API functions', () => { + it('should compile: right use', () => { + const code = '#pragma optimizationLevel 0\n#include fixedAPIFunctions\n fixed fa;F_Set_A1(fa);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n\nFUN set_A1 $fa\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: all fixed API', () => { + const code = '#include fixedAPIFunctions\nfixed fa; fa = F_Get_A1();\n fa = F_Get_A2();\n fa = F_Get_A3();\n fa = F_Get_A4();\n fa = F_Get_B1();\n fa = F_Get_B2();\n fa = F_Get_B3();\n fa = F_Get_B4();\n F_Set_A1(fa);\n F_Set_A2(fa);\n F_Set_A3(fa);\n F_Set_A4(fa);\n F_Set_B1(fa);\n F_Set_B2(fa);\n F_Set_B3(fa);\n F_Set_B4(2.33);\n fa = F_Get_Amount_For_Tx_In_A();\n fa = F_Get_Current_Balance();\n fa = F_Get_Previous_Balance();\n F_Send_To_Address_In_B(fa);\n fa = F_Get_Map_Value_Keys_In_A();\n fa = F_Get_Activation_Fee();\n fa = F_Get_Asset_Circulating();\n ' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n\nFUN @fa get_A1\nFUN @fa get_A2\nFUN @fa get_A3\nFUN @fa get_A4\nFUN @fa get_B1\nFUN @fa get_B2\nFUN @fa get_B3\nFUN @fa get_B4\nFUN set_A1 $fa\nFUN set_A2 $fa\nFUN set_A3 $fa\nFUN set_A4 $fa\nFUN set_B1 $fa\nFUN set_B2 $fa\nFUN set_B3 $fa\nSET @r0 #000000000de34c40\nFUN set_B4 $r0\nFUN @fa get_Amount_for_Tx_in_A\nFUN @fa get_Current_Balance\nFUN @fa get_Previous_Balance\nFUN send_to_Address_in_B $fa\nFUN @fa Get_Map_Value_Keys_In_A\nFUN @fa Get_Activation_Fee\nFUN @fa Get_Asset_Circulating\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + test('should throw: wrong argument (expect long, got fixed)', () => { + expect(() => { + const code = '#include APIFunctions\nfixed fa; Set_A1(fa);' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) + test('should throw: wrong argument (expected fixed, got long)', () => { + expect(() => { + const code = '#include APIFunctions\nlong a; F_Set_A1(a);' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + }).toThrowError(/^At line/) + }) +}) + describe('Built-in functions', () => { it('should compile: mdv()', () => { const code = '#pragma optimizationLevel 0\nlong a, b, c, d; a = mdv(b, c, d);' diff --git a/src/codeGenerator/astProcessor/functionSolver.ts b/src/codeGenerator/astProcessor/functionSolver.ts index e9d5d58..5abc298 100644 --- a/src/codeGenerator/astProcessor/functionSolver.ts +++ b/src/codeGenerator/astProcessor/functionSolver.ts @@ -69,8 +69,8 @@ export default function functionSolver ( const fnArg = FunctionToCall.argsMemObj[i] if (utils.isNotValidDeclarationOp(fnArg.declaration, ArgGenObj.SolvedMem)) { throw new Error(`At line: ${CurrentNode.Token.line}.` + - ` Function parameter type is different from variable: '${fnArg.declaration}'` + - ` and '${ArgGenObj.SolvedMem.declaration}'.`) + ` Type of function argument #${i + 1} is different from variable: ` + + ` Expecting '${fnArg.declaration}', got '${ArgGenObj.SolvedMem.declaration}'.`) } if (ArgGenObj.SolvedMem.size !== 1 && ArgGenObj.SolvedMem.Offset === undefined) { throw new Error(`At line: ${CurrentNode.Token.line}.` + @@ -127,17 +127,17 @@ export default function functionSolver ( ` Wrong number of arguments for function '${ifnToCall.name}'.` + ` It must have '${ifnToCall.argsMemObj.length}' args.`) } - rawArgs.forEach(RawSentence => { + rawArgs.forEach((RawSentence, idx) => { const ArgGenObj = genCode(Program, AuxVars, { RemAST: RawSentence, logicalOp: false, revLogic: false }) returnAssemblyCode += ArgGenObj.asmCode - if (utils.getDeclarationFromMemory(ArgGenObj.SolvedMem) !== 'long') { + if (utils.isNotValidDeclarationOp(ifnToCall.argsMemObj[idx].declaration, ArgGenObj.SolvedMem)) { throw new Error(`At line: ${CurrentNode.Token.line}.` + - ' API Function parameter type is different from variable: ' + - ` 'long' and '${ArgGenObj.SolvedMem.declaration}'.`) + ` Type of API Function argument #${idx + 1} is different from variable. ` + + ` Expecting '${ifnToCall.argsMemObj[idx].declaration}', got '${ArgGenObj.SolvedMem.declaration}'.`) } if (ArgGenObj.SolvedMem.size !== 1 && ArgGenObj.SolvedMem.Offset === undefined) { throw new Error(`At line: ${CurrentNode.Token.line}.` + diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 6d8e907..1489af4 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -6,7 +6,7 @@ import { } from '../typings/syntaxTypes' import { assertNotUndefined, deepCopy } from '../repository/repository' import { - APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate, fixedBaseTemplate + APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate, fixedBaseTemplate, fixedAPITableTemplate } from './templates' import sentencesProcessor from './sentencesProcessor' import memoryProcessor from './memoryProcessor' @@ -39,7 +39,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { ] Program.memory.push(...addRegistersInMemory(Program.Config.maxAuxVars)) Program.memory.push(...addConstantsInMemory(Program.Config.maxConstVars)) - if (fixedDetected()) { + if (Program.Config.fixedAPIFunctions || fixedDetected()) { Program.memory.push(fixedBaseTemplate) } processGlobalCode() @@ -47,6 +47,9 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { if (Program.Config.APIFunctions) { Program.Global.APIFunctions = APITableTemplate.slice() } + if (Program.Config.fixedAPIFunctions) { + Program.Global.APIFunctions.push(...fixedAPITableTemplate) + } Program.Global.BuiltInFunctions = BuiltInTemplate.slice() validateFunctions() validateMemory() @@ -150,6 +153,11 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { usedBoolVal = true break } + if (Token.property === 'fixedAPIFunctions') { + Program.Config.fixedAPIFunctions = boolVal + usedBoolVal = true + break + } throw new Error(`At line: ${Token.line}.` + ` Unknow macro property '#${Token.type} ${Token.property}'.` + " Do you mean 'APIFunctions'? Check valid values on Help page") diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 4b9f53b..ba19e9d 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -932,3 +932,266 @@ export const APITableTemplate: SC_FUNCTION[] = [ name: 'Get_Asset_Circulating' } ] + +export const fixedAPITableTemplate: SC_FUNCTION[] = [ + { + argsMemObj: [], + asmName: 'get_A1', + declaration: 'fixed', + sentences: [], + name: 'F_Get_A1' + }, + { + argsMemObj: [], + asmName: 'get_A2', + declaration: 'fixed', + sentences: [], + name: 'F_Get_A2' + }, + { + argsMemObj: [], + asmName: 'get_A3', + declaration: 'fixed', + sentences: [], + name: 'F_Get_A3' + }, + { + argsMemObj: [], + asmName: 'get_A4', + declaration: 'fixed', + sentences: [], + name: 'F_Get_A4' + }, + { + argsMemObj: [], + asmName: 'get_B1', + declaration: 'fixed', + sentences: [], + name: 'F_Get_B1' + }, + { + argsMemObj: [], + asmName: 'get_B2', + declaration: 'fixed', + sentences: [], + name: 'F_Get_B2' + }, + { + argsMemObj: [], + asmName: 'get_B3', + declaration: 'fixed', + sentences: [], + name: 'F_Get_B3' + }, + { + argsMemObj: [], + asmName: 'get_B4', + declaration: 'fixed', + sentences: [], + name: 'F_Get_B4' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_A1_addr', + type: 'fixed', + scope: 'F_Set_A1', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_A1', + declaration: 'void', + sentences: [], + name: 'F_Set_A1' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_A2_addr', + type: 'fixed', + scope: 'F_Set_A2', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_A2', + declaration: 'void', + sentences: [], + name: 'F_Set_A2' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_A3_addr', + type: 'fixed', + scope: 'F_Set_A3', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_A3', + declaration: 'void', + sentences: [], + name: 'F_Set_A3' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_A4_addr', + type: 'fixed', + scope: 'F_Set_A4', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_A4', + declaration: 'void', + sentences: [], + name: 'F_Set_A4' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_B1_addr', + type: 'fixed', + scope: 'F_Set_B1', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_B1', + declaration: 'void', + sentences: [], + name: 'F_Set_B1' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_B2_addr', + type: 'fixed', + scope: 'F_Set_B2', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_B2', + declaration: 'void', + sentences: [], + name: 'F_Set_B2' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_B3_addr', + type: 'fixed', + scope: 'F_Set_B3', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_B3', + declaration: 'void', + sentences: [], + name: 'F_Set_B3' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Set_B4_addr', + type: 'fixed', + scope: 'F_Set_B4', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'set_B4', + declaration: 'void', + sentences: [], + name: 'F_Set_B4' + }, + { + argsMemObj: [], + asmName: 'get_Amount_for_Tx_in_A', + declaration: 'fixed', + sentences: [], + name: 'F_Get_Amount_For_Tx_In_A' + }, + { + argsMemObj: [], + asmName: 'get_Current_Balance', + declaration: 'fixed', + sentences: [], + name: 'F_Get_Current_Balance' + }, + { + argsMemObj: [], + asmName: 'get_Previous_Balance', + declaration: 'fixed', + sentences: [], + name: 'F_Get_Previous_Balance' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'F_Send_To_Address_In_B_addr', + type: 'fixed', + scope: 'F_Send_To_Address_In_B', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'send_to_Address_in_B', + declaration: 'void', + sentences: [], + name: 'F_Send_To_Address_In_B' + }, + { + argsMemObj: [], + asmName: 'Get_Map_Value_Keys_In_A', + declaration: 'fixed', + sentences: [], + name: 'F_Get_Map_Value_Keys_In_A' + }, + { + argsMemObj: [], + asmName: 'Get_Activation_Fee', + declaration: 'fixed', + sentences: [], + name: 'F_Get_Activation_Fee' + }, + { + argsMemObj: [], + asmName: 'Get_Asset_Circulating', + declaration: 'fixed', + sentences: [], + name: 'F_Get_Asset_Circulating' + } +] diff --git a/src/smartc.ts b/src/smartc.ts index da36422..ae11043 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -59,6 +59,7 @@ export class SmartC { reuseAssignedVar: true, sourcecodeVersion: '', APIFunctions: false, + fixedAPIFunctions: false, PName: '', PDescription: '', PActivationAmount: '', diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index 74400aa..3f72418 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -20,6 +20,8 @@ export type SC_CONFIG = { sourcecodeVersion: string, /** Support for API Functions: #include APIFunctions */ APIFunctions: boolean, + /** Support for API Functions with fixed numbers: #include fixedAPIFunctions */ + fixedAPIFunctions: boolean, /** Program Name: #program name */ PName: string, /** Program description: #program description */ From 51d7a9cff7f9916ce641be0a22c403b3b39607d6 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 4 Jun 2022 11:59:42 -0300 Subject: [PATCH 059/112] Added built-in powf and memcopy --- src/__tests__/castings.a.spec.ts | 7 ++ src/__tests__/functions.b.spec.ts | 14 ++++ .../assemblyProcessor/assignmentToAsm.ts | 14 ++++ .../assemblyProcessor/createInstruction.ts | 65 ++++++++++++++++--- src/shaper/templates.ts | 56 ++++++++++++++++ 5 files changed, 146 insertions(+), 10 deletions(-) diff --git a/src/__tests__/castings.a.spec.ts b/src/__tests__/castings.a.spec.ts index 886cdf9..c3be3f0 100644 --- a/src/__tests__/castings.a.spec.ts +++ b/src/__tests__/castings.a.spec.ts @@ -71,6 +71,13 @@ describe('Castings arithmetic', () => { compiler.compile() }).toThrowError(/^At line/) }) + it('should compile: complex hack', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, *pf; long la, *pl; la = *((long*)(&fa)); fa = *((fixed*)(&la));' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare pf\n^declare la\n^declare pl\n\nSET @la $fa\nSET @fa $la\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) describe('Castings logical', () => { diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index 44796ba..3d62318 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -112,4 +112,18 @@ describe('Built-in functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: powf()', () => { + const code = '#pragma optimizationLevel 0\nlong a, b; fixed fc; a=powf(b,fc);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n^declare fc\n\nSET @a $b\nPOW @a $fc\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: memcopy()', () => { + const code = '#pragma optimizationLevel 0\nfixed fa, *pf; long la, *pl; memcopy(&fa, &la); memcopy(pf, &la); memcopy(&la, pf); memcopy(pf, pl); memcopy(pf+1, pl+4);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare pf\n^declare la\n^declare pl\n\nSET @fa $la\nSET @($pf) $la\nSET @la $($pf)\nSET @r0 $($pl)\nSET @($pf) $r0\nSET @r0 $pf\nINC @r0\nSET @r1 #0000000000000004\nADD @r1 $pl\nSET @r2 $($r1)\nSET @($r0) $r2\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) diff --git a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts index f3f61ee..4d5cb90 100644 --- a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts @@ -60,6 +60,20 @@ export default function assignmentToAsm ( /** Left type is 'register', 'long' or ''structRef', with offset undefined. Right type is 'constant'. * Create assembly instruction. */ function leftRegularOffsetUndefinedAndRightConstantToAsm () : string { + let newVarName: string + switch (Right.Offset?.type) { + case undefined: + return leftRegularOffsetUndefinedAndRightConstantOffsetUndefinedToAsm() + case 'constant': + Right.hexContent = assertNotUndefined(Right.hexContent) + newVarName = auxVars.getMemoryObjectByLocation(utils.addHexContents(Right.Offset.value, Right.hexContent), operationLine).asmName + return `SET @${Left.asmName} $${newVarName}\n` + case 'variable': + throw new Error('Not implemented.') + } + } + + function leftRegularOffsetUndefinedAndRightConstantOffsetUndefinedToAsm () : string { Right.hexContent = assertNotUndefined(Right.hexContent) if (Right.hexContent.length > 17) { throw new Error(`At line: ${operationLine}.` + diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 93ec189..aa467da 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -118,25 +118,70 @@ export function createAPICallInstruction ( export function createBuiltInInstruction ( AstAuxVars: GENCODE_AUXVARS, BuiltInToken: TOKEN, RetMem: MEMORY_SLOT, argsMem: MEMORY_SLOT[] ) : string { + let memcopyType : 'SIMPLE' | 'MIXED_LEFT' | 'MIXED_RIGHT' | 'COMPLEX' + let AuxRegister: MEMORY_SLOT let assemblyCode = '' - const tempArgsMem: MEMORY_SLOT[] = [] - argsMem.forEach((VarObj) => { - const Temp = flattenMemory(AstAuxVars, VarObj, -1) - assemblyCode += Temp.asmCode - tempArgsMem.push(Temp.FlatMem) - }) + const tempArgsMem = argsMem.map((VarObj) => flattenMemory(AstAuxVars, VarObj, -1)) switch (BuiltInToken.value) { case 'pow': - assemblyCode += `SET @${RetMem.asmName} $${tempArgsMem[0].asmName}\n` + - `POW @${RetMem.asmName} $${tempArgsMem[1].asmName}\n` + case 'powf': + assemblyCode = tempArgsMem[0].asmCode + + tempArgsMem[1].asmCode + + `SET @${RetMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + `POW @${RetMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` break case 'mdv': - assemblyCode += `SET @${RetMem.asmName} $${tempArgsMem[0].asmName}\n` + - `MDV @${RetMem.asmName} $${tempArgsMem[1].asmName} $${tempArgsMem[2].asmName}\n` + assemblyCode = tempArgsMem[0].asmCode + + tempArgsMem[1].asmCode + + `SET @${RetMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + `MDV @${RetMem.asmName} $${tempArgsMem[1].FlatMem.asmName} $${tempArgsMem[2].FlatMem.asmName}\n` + break + case 'memcopy': + memcopyType = 'COMPLEX' + if (argsMem[0].type === 'constant' || argsMem[1].type === 'constant') { + if (argsMem[0].type === 'constant' && argsMem[1].type === 'constant') { + memcopyType = 'SIMPLE' + } else if (argsMem[0].type === 'constant') { + memcopyType = 'MIXED_LEFT' + } else { + memcopyType = 'MIXED_RIGHT' + } + } + switch (memcopyType) { + case 'SIMPLE': + argsMem[0].hexContent = assertNotUndefined(argsMem[0].hexContent) + argsMem[1].hexContent = assertNotUndefined(argsMem[1].hexContent) + assemblyCode = `SET @${AstAuxVars.getMemoryObjectByLocation(argsMem[0].hexContent).asmName} $${AstAuxVars.getMemoryObjectByLocation(argsMem[1].hexContent).asmName}\n` + break + case 'MIXED_LEFT': + argsMem[0].hexContent = assertNotUndefined(argsMem[0].hexContent) + assemblyCode = tempArgsMem[1].asmCode + + `SET @${AstAuxVars.getMemoryObjectByLocation(argsMem[0].hexContent).asmName} $($${tempArgsMem[1].FlatMem.asmName})\n` + break + case 'MIXED_RIGHT': + argsMem[1].hexContent = assertNotUndefined(argsMem[1].hexContent) + assemblyCode = tempArgsMem[0].asmCode + + `SET @($${tempArgsMem[0].FlatMem.asmName}) $${AstAuxVars.getMemoryObjectByLocation(argsMem[1].hexContent).asmName}\n` + break + default: + // 'COMPLEX' + AuxRegister = AstAuxVars.getNewRegister() + assemblyCode = tempArgsMem[1].asmCode + + tempArgsMem[0].asmCode + + `SET @${AuxRegister.asmName} $($${tempArgsMem[1].FlatMem.asmName})\n` + + `SET @($${tempArgsMem[0].FlatMem.asmName}) $${AuxRegister.asmName}\n` + AstAuxVars.freeRegister(AuxRegister.address) + break + } break default: throw new Error(`Internal error at line: ${BuiltInToken.line}. Built-in function not implemented.`) } + tempArgsMem.forEach(tmpArg => { + if (tmpArg.isNew) { + AstAuxVars.freeRegister(tmpArg.FlatMem.address) + } + }) return assemblyCode } diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index ba19e9d..d3c31bb 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -127,6 +127,62 @@ export const BuiltInTemplate: SC_FUNCTION[] = [ declaration: 'long', sentences: [], name: 'mdv' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr1', + asmName: 'powf_addr1', + type: 'long', + scope: 'powf', + declaration: 'long', + size: 1, + isDeclared: true + }, + { + address: -1, + name: 'addr2', + asmName: 'powf_addr2', + type: 'fixed', + scope: 'powf', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'powf', + declaration: 'long', + sentences: [], + name: 'powf' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr1', + asmName: 'memcopy_addr1', + type: 'long', + scope: 'memcopy', + declaration: 'void_ptr', + size: 1, + isDeclared: true + }, + { + address: -1, + name: 'addr2', + asmName: 'memcopy_addr2', + type: 'long', + scope: 'memcopy', + declaration: 'void_ptr', + size: 1, + isDeclared: true + } + ], + asmName: 'memcopy', + declaration: 'void', + sentences: [], + name: 'memcopy' } ] From 7b9bfe883530234e460610e87eed4e11d61e7130 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 4 Jun 2022 12:00:19 -0300 Subject: [PATCH 060/112] Minor fixes --- debug.html | 25 +++++++++++-------------- src/__tests__/castings.a.spec.ts | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/debug.html b/debug.html index ebbf49d..1ea2876 100644 --- a/debug.html +++ b/debug.html @@ -60,7 +60,7 @@ padding: 1ch; height: 75vh; font-size: inherit; - width: 50vw; + width: calc(50vw - 2ch); } td { vertical-align: top; @@ -87,19 +87,16 @@
Simple debugger page

Use this page to debug or inspect SmartC process, using a browser.

- - - - - - - -


-                    

-                    
- - - +
+
+
+
+
+

+                

+                

+            
+
\ No newline at end of file diff --git a/src/__tests__/castings.a.spec.ts b/src/__tests__/castings.a.spec.ts index c3be3f0..7d4826b 100644 --- a/src/__tests__/castings.a.spec.ts +++ b/src/__tests__/castings.a.spec.ts @@ -83,7 +83,7 @@ describe('Castings arithmetic', () => { describe('Castings logical', () => { it('should compile: all permitted types', () => { const code = '#pragma optimizationLevel 0\nlong la, lb, *pl; fixed fa, fb, *pf; void * pv;\n if (la > fb) la++; if (fa > lb) la++; if (fa >= fb) la++; if (la < pl) la++; if (la <= pf) la++; if (pv == pl) la++; if (pf != pl) la++;' - const assembly = '' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare lb\n^declare pl\n^declare fa\n^declare fb\n^declare pf\n^declare pv\n\nSET @r0 $la\nMUL @r0 $f100000000\nBLE $r0 $fb :__if1_endif\n__if1_start:\nINC @la\n__if1_endif:\nSET @r0 $lb\nMUL @r0 $f100000000\nBLE $fa $r0 :__if2_endif\n__if2_start:\nINC @la\n__if2_endif:\nBLT $fa $fb :__if3_endif\n__if3_start:\nINC @la\n__if3_endif:\nBGE $la $pl :__if4_endif\n__if4_start:\nINC @la\n__if4_endif:\nBGT $la $pf :__if5_endif\n__if5_start:\nINC @la\n__if5_endif:\nBNE $pv $pl :__if6_endif\n__if6_start:\nINC @la\n__if6_endif:\nBEQ $pf $pl :__if7_endif\n__if7_start:\nINC @la\n__if7_endif:\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) From fafae0d6ffde61f0ad9eaf7f3230408d2b00f9ae Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 4 Jun 2022 13:58:36 -0300 Subject: [PATCH 061/112] Bump rc release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec0b0c9..7a8a059 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc2", + "version": "2.0.0-rc3", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 117930c4e253e5ab8ec805c4e08429d3635ba0a8 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 4 Jun 2022 21:54:16 -0300 Subject: [PATCH 062/112] Documentation update: New 'fixed' types and type casting. New built-in 'powf', 'memcopy'. New include 'fixedAPIFunctions'. --- docs/1-Basis.md | 81 ++----------- docs/1.2-Preprocessor-directives.md | 182 ++++++++++++++++++++++++++++ docs/1.5-Built-in-functions.md | 51 ++++++++ docs/README.md | 2 + 4 files changed, 247 insertions(+), 69 deletions(-) create mode 100644 docs/1.2-Preprocessor-directives.md create mode 100644 docs/1.5-Built-in-functions.md diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 171733b..7f86acf 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -14,6 +14,7 @@ Some keywords have the same meaning and use in C: `asm`, `break`, `continue`, `d * `case`: The standard C is fully supported, featuring also that expressions can be added using parenthesis. If standard switch is used, an expression can be used: `switch (a) { case (b/2): ... }` and it will be evaluated as `if (a == b/2) ... `. If the logical switch statement is used, then it is possible to add a logical expression in `case` using parenthesis, in the form `switch (true) { case (a>5): ...}` and it will be evaluated as `if (a>5) ...` There are also additional keywords: +* `fixed`: Declares a variable that is a fixed point number. All fixed numbers have 8 decimals, so it is handyful to make Signa calculations with it. It supports positives values from 0.00000001 to 92,233,720,368.54775807 and negative from -0.00000001 to -92,233,720,368.54775808. They are internally a signed 64-bit number. * `sleep`: Puts the contract in 'sleep' mode and resumes contract execution on next block. Alternativelly it can have an argument to indicate the number of blocks to sleep and the argument can be an expression. This tree sentences have the same result `sleep;`, `sleep 0;`, and `sleep 1;`, but it is prefered the first one because the instruction is smaller. * `exit`: Puts the contract in 'stop' mode and set program to restart from main function ('finished' mode). It will be inactive until a new transaction is received. Once a tx is received, it will start execution at `void main(void)` function. If main function is not defined, it will start again from beginning of code. `exit` takes no argument. If contract activation amount is zero, contract will resume execution on next block. * `halt`: Puts the contract in 'stop' mode. It will be inactive until a new transaction is received, then it will resume execution at next instruction. It takes no argument. If contract activation amount is zero, contract will resume execution on next block. @@ -21,55 +22,15 @@ There are also additional keywords: Others keyword have no assembly support. They are disabled: `auto`, `double`, `float`, `register`, `volatile`. For future implementation these keywords can be added: `char`, `enum`, `extern`, `int`, `short`, `signed`, `static`, `typedef`, `union`, `unsigned`. ### Preprocessor -Some special features can be enabled/disable via preprocessor directives: -#### #program -* `#program name YourProgramName`: Set program's name. Only regular letters and numbers allowed, max 30 chars in length. -A value is mandatory for deployment. -* `#program description Your program description`: Set program's description. No new lines and max length is 1000 chars. -This is optional. -* `#program activationAmount 100000000`: Set program's activation amount in NQT (1 Signum = 100000000 NQT). If an incoming transaction has an amount is less than this value, it will not be processed by program (but the amount will be received!). Set a low value but bigger than worst case amount needed to run in your program. If set too low, your program will be frozen during execution (out of gas). If set too high, program balance will be high after execution (unburned balance). Remember to handle this case if creating serious program! -A value is mandatory for deployment. -* `#program codeHashId N`: Ensure the compiled program will have this exact code hash id. -Use `0` to make this information available at assembly output (during development). -Use the actual number if you plan do distribute the source code, so the compiler will raise an error on divergency. -This is optional. -* `#program codeStackPages N`: Code pages are used during function calls, to store the instruction pointer return position (also know as Program Counter). Default value is zero if not needed, or one if needed. Every page allows to store 16 values. Tweak this value if using many nested functions or recursive functions. Maximum value is 10 pages. -* `#program userStackPages N`: User pages are used during function calls to pass arguments values, to store function return value, or to store function scope variables during recursive calls. Default value is zero if not needed, or one if needed. Tweak this value if using more than 16 arguments on functions or recursive functions. Maximum value is 10 pages. - -#### #include -* `#include APIFunctions [true/false/1/0/]`: Make Signum API functions available for use as functions. Default value is `false`. It can be enabled by declaring it with empty argument, `true` or `1`. Function names follow the [ciyam at documentation](https://ciyam.org/at/at_api.html). All API names and a pseudo-code are avaliable also in section **API Pseudo-Code**. -#### #define -* `#define CNAME`: Just define CNAME with an empty value, or delete its content if it was previously defined. -* `#define CNAME value or expression`: Replaces all ocurrences of 'CNAME' to 'value or expression' starting on next line. Compiler defines: `true` for 1; `false` and `NULL` for 0; `SMARTC` with empty value. -* `#define MACRO(arguments) (expression)`: Replaces all ocurrences of 'MACRO' to 'expression', starting on next line. -It works similar to a function, but no function call is executed. -Must be one line instruction (or use `\` at the end of line to escape the newline char). -Many arguments can be used. -* `#undef CNAME`: Undefine CNAME. -* `#ifdef CNAME`: Start a block to be included if CNAME is defined. Note that CNAME value does not matter and can be empty value. Block must end with a '#endif' directive. Blocks can be nested. -* `#ifndef CNAME`: Complementary of '#ifdef'. Includes a block if CNAME is not defined. -* `#else`: Can be used with '#ifdef' or '#ifndef' to toggle the addition of some source code block. -* `#endif`: Ends a block to be included. - -#### #pragma -* `#pragma enableRandom [true/false/1/0/]`: Makes labels for jumps and conditionals receive a random value. Default value is `false`. Default behaviour is labels having an increasing number starting with 1 (number is base 36). -* `#pragma enableLineLabels [true/false/1/0/]`: Adds line number to labels in assembly. Only usefull for debug purposes. Default value is `false`. -* `#pragma maxAuxVars N`: Used to tell compiler how many auxiliary variables will be available (they are used as registers). Default value is `3`, min value is `1` and max is `10`. If you are under memory pressure, try to reduce to minimal necessary for compiling. Simple contracts will use around 2 values, but this number depends on nested operations. -* `#pragma maxConstVars N`: Compiler will create variable from 1 to maxConstVars. Variables will be named 'n1', 'n2', ... 'n10'. It is very usefull to use, because compiler will change all numbers references to these variables and optimize code, making code much much smaller! Default min value is `0` (deactivated) and max is `10`. -* `#pragma optimizationLevel N`: Choose strategy for code optimizer. It can be between 0 and 3. - * 0: No optimization. - * 1: Very basic optimization, just remove silly and unused code. - * 2: **Default**. Safely change and/or delete code for smarter outcome. - * 3: Dangerous optimizations no well tested. Result must be inspected by developer. -* `#pragma reuseAssignedVar [true/false/1/0/]`: When set, compiler will try to use a variable on left side of and `Assignment` as a register. If variable is also used on right side, the compiler will not reuse it. This can save one assembly instruction for every expression used! Default value is `true` and it is highly recomended to maintain it active. -* `#pragma version N`: Informs which compiler's version the code was developed. Must be set if not using development version. To skip this check, set it to `dev`. -* `#pragma outputSourceLineNumber[true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number to the C source code. Very usefull for debug. - -#### Escaping new line -Just end a line with `\` and it will be joined to the next one. It can be used anywhere, even inside "strings". Usefull for multiline program description, #define for a macro, or in middle of a variable name! +Some special features can be enabled/disable via preprocessor directives. Check chapter 1.2. + ### Variables -At the moment, only `long` values are implemented. User can assign them with decimal values (default) (floating point not allowed) `i=2;`, hexadecimal values `i=0xff;`, strings (up to 8 bytes) `msg="Hello!";` or Signum addresses `addr="S-297Z-EKMN-4AVV-7YWXP";` (also valid starting with BURST or TS). Long values can be assigned during their declaration. +Variables can be `long`, `fixed` or pointers. User can assign them: +* With decimal values: `i=2;` for longs or `i=2.0;` for fixeds, +* Hexadecimal values: `i=0xff;` for longs and not allowed for fixeds +* Strings (up to 8 bytes) `msg="Hello!";` or Signum addresses `addr="S-297Z-EKMN-4AVV-7YWXP";` (also valid starting with BURST or TS). +Variables can be assigned during their declaration. Arrays can be declared but can be initialized only at a later instruction. Declaration of an array with 5 elements (0 to 4): `long arr[5];`. Use as in C: `arr[1]=4;`. Multi-long values can be set `arr[]='This is a text message';`. To clear the entire array: `arr[]=0;`. It is possible to get an array length a member operation: `size = arr.length;` Structs use same notation in C. Structs pointers can also be used. To access a member, use `.` or `->` depending if struct is already allocated in memory or if it is a pointer to the memory location. Arrays of structs, arrays inside structs and recursive pointer definition are also supported. All variables are initialized with value `0` at the first time the contract is executed, unless other value is set by `const` statement. @@ -77,33 +38,15 @@ All variables are similar to `static` in C. So every time a function is called o Global variables are available in all functions. Functions variables can only be used inside the function. Variables declarations can be inside other sentences, like `for (long i; i<10; i++)` or `if (a){ long i=0; ...}`, but their scope can only be 'global' or 'function', in other words, the result is the same as declaring variables at the program start (if global variables) or at the function start (if function variables). +### Implicit types casting +The compiler will convert numbers and variables between fixed and long if used in binary operators. Most of times long will be converted to fixed, unless there is an assigment and the left side is long. In this case (=, +=, -=, ...) fixed values will be transformed into long. Data can be lost in this transformation, so keep an eye on it! + ### Functions As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru preprocessor directives. There are two special functions: `void main(void)` explained before and `void catch(void)` explained at **Contract states** topic. It is not obligatory to use them. Functions can return also arrays and structs; the returning values can be used directly: example `if ( arrFn(a)[2] == 25 )` or `b = structFn(a)->value;` ### Built-in functions -In 2022 it was introduced two new specific instructions. They are coded in SmartC as built-in functions, so no declaration is needed to use them. -#### mdv -* Prototype: -`long mdv(long m1, long m2, long div);` -* Description: -Computes the value of `m1` multiplied by `m2` with 128-bit precision (no overflow) and then divides this result by `div`. -The calculation is returned as value. -* Notes: - 1) This instruction will be used in optimizations, even if not explicit declared. Use this form to ensure the instruction, or check generated assembly code if in doubt. -#### pow -* Prototype: -`long pow(long base, long expBy1e8);` -* Description: -Computes the value of `base` to the power of `expBy1e8`, where expBy1e8 is used as fixed point representation with 8 decimals (like the values in Signa). The result is returned as long value, decimals are truncated. -* Examples: - * sqrt(49) = 7 :: `val = pow(49, 5000_0000);` - * 5 * 5 * 5 * 5 = 5^4 = 625 :: `val = pow(5, 4_0000_0000);` - * sqrt(48) = 6 :: `val = pow(48, 5000_0000);` -* Notes - 1) pow will return zero if the result is matematically undefined; - 2) pow will return zero if base is negative; - 3) pow will return zero if result is greater than 9223372036854775807 (max positive long). +In 2022 it was introduced two new specific instructions. They are coded in SmartC from version 2.0 as built-in functions, so no declaration is needed to use them. Check chapter 1.5. ### Global statements All global statements are grouped at the beginning of assembly code (even if after functions or end of file). When the contract is executed first time, it does not begin at main function, but will start at the beginning of file and run all global statements. If there is a main function, it will be then executed during this first run. If you stop execution in global statements (with `exit`), the main function will not be processed and the starting point for next transactions will be the start of code. In this case (not using main function) use `halt` keyword to wait next transaction. diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md new file mode 100644 index 0000000..ec4e7d2 --- /dev/null +++ b/docs/1.2-Preprocessor-directives.md @@ -0,0 +1,182 @@ +[Back](./) + +# Preprocessor +Some special features can be enabled/disable via preprocessor directives. + +## #program +* `#program name YourProgramName`: Set program's name. Only regular letters and numbers allowed, max 30 chars in length. +A value is mandatory for deployment. +* `#program description Your program description`: Set program's description. No new lines and max length is 1000 chars. +This is optional. +* `#program activationAmount 100000000`: Set program's activation amount in NQT (1 Signum = 100000000 NQT). If an incoming transaction has an amount is less than this value, it will not be processed by program (but the amount will be received!). Set a low value but bigger than worst case amount needed to run in your program. If set too low, your program will be frozen during execution (out of gas). If set too high, program balance will be high after execution (unburned balance). Remember to handle this case if creating serious program! +A value is mandatory for deployment. +* `#program codeHashId N`: Ensure the compiled program will have this exact code hash id. +Use `0` to make this information available at assembly output (during development). +Use the actual number if you plan do distribute the source code, so the compiler will raise an error on divergency. +This is optional. +* `#program codeStackPages N`: Code pages are used during function calls, to store the instruction pointer return position (also know as Program Counter). Default value is zero if not needed, or one if needed. Every page allows to store 16 values. Tweak this value if using many nested functions or recursive functions. Maximum value is 10 pages. +* `#program userStackPages N`: User pages are used during function calls to pass arguments values, to store function return value, or to store function scope variables during recursive calls. Default value is zero if not needed, or one if needed. Tweak this value if using more than 16 arguments on functions or recursive functions. Maximum value is 10 pages. + +## #include + +### API functions +* `#include APIFunctions [true/false/1/0/]`: Make Signum API functions available for use as functions. Default value is `false`. It can be enabled by declaring it with empty argument, `true` or `1`. Function names follow the [ciyam at documentation](https://ciyam.org/at/at_api.html). All API names and a pseudo-code are avaliable also in section **API Pseudo-Code**. The prototypes of available functions are: + +```c +#define APIFunctions + +// Get/Set functions for “pseudo registers” +long Get_A1(void); +long Get_A2(void); +long Get_A3(void); +long Get_A4(void); +long Get_B1(void); +long Get_B2(void); +long Get_B3(void); +long Get_B4(void) +void Set_A1(long); +void Set_A2(long); +void Set_A3(long); +void Set_A4(long); +void Set_A1_A2(long); +void Set_A3_A4(long); +void Set_B1(long); +void Set_B2(long); +void Set_B3(long); +void Set_B4(long); +void Set_B1_B2(long); +void Set_B3_B4(long); +void Clear_A(void); +void Clear_B(void); +void Clear_A_And_B(void); +void Copy_A_From_B(void); +void Copy_B_From_A(void); +long Check_A_Is_Zero(void); +long Check_B_Is_Zero(void); +long Check_A_Equals_B(void); +void Swap_A_and_B(void); +void OR_A_with_B(void); +void OR_B_with_A(void); +void AND_A_with_B(void); +void AND_B_with_A(void); +void XOR_A_with_B(void); +void XOR_B_with_A(void); +void Add_A_To_B(void); +void Add_B_To_A(void); +void Sub_A_From_B(void); +void Sub_B_From_A(void); +void Mul_A_By_B(void); +void Mul_B_By_A(void); +void Div_A_By_B(void); +void Div_B_By_A(void); + +// Functions that perform hash operations +void MD5_A_To_B(void); +long Check_MD5_A_With_B(void); +void HASH160_A_To_B(void); +long Check_HASH160_A_With_B(void); +void SHA256_A_To_B(void); +long Check_SHA256_A_With_B(void); +long Check_Sig_B_With_A(void); + +// Generic functions that get block and tx info +long Get_Block_Timestamp(void); +long Get_Creation_Timestamp(void); +long Get_Last_Block_Timestamp(void); +void Put_Last_Block_Hash_In_A(void); +void A_To_Tx_After_Timestamp(long) +long Get_Type_For_Tx_In_A(void); +long Get_Amount_For_Tx_In_A(void); +long Get_Timestamp_For_Tx_In_A(void); +long Get_Random_Id_For_Tx_In_A(void); +void Message_From_Tx_In_A_To_B(void); +void B_To_Address_Of_Tx_In_A(void); +void B_To_Address_Of_Creator(void); +long Get_Code_Hash_Id(void); +void B_To_Assets_Of_Tx_In_A(void); + +// Generic functions that check balances and perform ops +long Get_Current_Balance(void); +long Get_Previous_Balance(void); +void Send_To_Address_In_B(long); +void Send_All_To_Address_In_B(void); +void Send_Old_To_Address_In_B(void); +void Send_A_To_Address_In_B(void); +long Add_Minutes_To_Timestamp(long, long); +long Get_Map_Value_Keys_In_A(void); +void Set_Map_Value_Keys_In_A(void); +long Issue_Asset(void); +void Mint_Asset(void); +void Distribute_To_Asset_Holders(void); +long Get_Asset_Holders_Count(void); +long Get_Asset_Circulating(void); +long Get_Activation_Fee(void); +void Put_Last_Block_GSig_In_A(void); +``` + +### Fixed API functions +* `#include fixedAPIFunctions [true/false/1/0/]`: Make the fixed numbers versions of Signum API functions available for use. Default value is `false`. It can be enabled by declaring it with empty argument, `true` or `1`. Function names are similar to the regular versions, but prepended with 'F_'. The prototypes of available functions are: + +```c +#define fixedAPIFunctions + +fixed F_Get_A1(void); +fixed F_Get_A2(void); +fixed F_Get_A3(void); +fixed F_Get_A4(void); +fixed F_Get_B1(void); +fixed F_Get_B2(void); +fixed F_Get_B3(void); +fixed F_Get_B4(void); +void F_Set_A1(fixed); +void F_Set_A2(fixed); +void F_Set_A3(fixed); +void F_Set_A4(fixed); +void F_Set_B1(fixed); +void F_Set_B2(fixed); +void F_Set_B3(fixed); +void F_Set_B4(fixed); + +fixed F_Get_Amount_For_Tx_In_A(void); +fixed F_Get_Current_Balance(void); +fixed F_Get_Previous_Balance(void); +void F_Send_To_Address_In_B(fixed); + +fixed F_Get_Map_Value_Keys_In_A(void); +fixed F_Get_Activation_Fee(void); +fixed F_Get_Asset_Circulating(void); +``` + +## #define +Preprocessor definitions will change code before compilation. +* `#define CNAME`: Just define CNAME with an empty value, or delete its content if it was previously defined. +* `#define CNAME value or expression`: Replaces all ocurrences of 'CNAME' to 'value or expression' starting on next line. Compiler defines: `true` for 1; `false` and `NULL` for 0; `SMARTC` with empty value. +* `#define MACRO(arguments) (expression)`: Replaces all ocurrences of 'MACRO' to 'expression', starting on next line. +It works similar to a function, but no function call is executed. +Must be one line instruction (or use `\` at the end of line to escape the newline char). +Many arguments can be used. +* `#undef CNAME`: Undefine CNAME. +* `#ifdef CNAME`: Start a block to be included if CNAME is defined. Note that CNAME value does not matter and can be empty value. Block must end with a '#endif' directive. Blocks can be nested. +* `#ifndef CNAME`: Complementary of '#ifdef'. Includes a block if CNAME is not defined. +* `#else`: Can be used with '#ifdef' or '#ifndef' to toggle the addition of some source code block. +* `#endif`: Ends a block to be included. + +## #pragma +Special features used by compiler. +* `#pragma enableRandom [true/false/1/0/]`: Makes labels for jumps and conditionals receive a random value. Default value is `false`. Default behaviour is labels having an increasing number starting with 1 (number is base 36). +* `#pragma enableLineLabels [true/false/1/0/]`: Adds line number to labels in assembly. Only usefull for debug purposes. Default value is `false`. +* `#pragma maxAuxVars N`: Used to tell compiler how many auxiliary variables will be available (they are used as registers). Default value is `3`, min value is `1` and max is `10`. If you are under memory pressure, try to reduce to minimal necessary for compiling. Simple contracts will use around 2 values, but this number depends on nested operations. +* `#pragma maxConstVars N`: Compiler will create variable from 1 to maxConstVars. Variables will be named 'n1', 'n2', ... 'n10'. It is very usefull to use, because compiler will change all numbers references to these variables and optimize code, making code much much smaller! Default min value is `0` (deactivated) and max is `10`. +* `#pragma optimizationLevel N`: Choose strategy for code optimizer. It can be between 0 and 3. + * 0: No optimization. + * 1: Very basic optimization, just remove silly and unused code. + * 2: **Default**. Safely change and/or delete code for smarter outcome. + * 3: Dangerous optimizations no well tested. Result must be inspected by developer. +* `#pragma reuseAssignedVar [true/false/1/0/]`: When set, compiler will try to use a variable on left side of and `Assignment` as a register. If variable is also used on right side, the compiler will not reuse it. This can save one assembly instruction for every expression used! Default value is `true` and it is highly recomended to maintain it active. +* `#pragma version N`: Informs which compiler's version the code was developed. Must be set if not using development version. To skip this check, set it to `dev`. +* `#pragma outputSourceLineNumber[true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number to the C source code. Very usefull for debug. + +### Escaping new line +Just end a line with `\` and it will be joined to the next one. It can be used anywhere, even inside "strings". Usefull for multiline program description, #define for a macro, or in middle of a variable name! + +[Back](./) diff --git a/docs/1.5-Built-in-functions.md b/docs/1.5-Built-in-functions.md new file mode 100644 index 0000000..b88244f --- /dev/null +++ b/docs/1.5-Built-in-functions.md @@ -0,0 +1,51 @@ +[Back](./) + +# Built-in functions +Since version 2.0 some built-in functions were added. + +## mdv +* Prototype: +`long mdv(long m1, long m2, long div);` +* Description: +Computes the value of `m1` multiplied by `m2` with 128-bit precision (no overflow) and then divides this result by `div`. +The calculation is returned as value. +* Notes: + 1) This instruction will be used in optimizations, even if not explicit declared. Use this form to ensure the instruction, or check generated assembly code if in doubt. + +## pow +* Prototype: +`long pow(long base, long expBy1e8);` +* Description: +Computes the value of `base` to the power of `expBy1e8`, where expBy1e8 is used as fixed point representation with 8 decimals (like the values in Signa). The result is returned as long value, decimals are truncated. +* Examples: + * sqrt(49) = 7 :: `val = pow(49, 5000_0000);` + * 5 * 5 * 5 * 5 = 5^4 = 625 :: `val = pow(5, 4_0000_0000);` + * sqrt(48) = 6 :: `val = pow(48, 5000_0000);` +* Notes + 1) pow will return zero if the result is matematically undefined; + 2) pow will return zero if base is negative; + 3) pow will return zero if result is greater than 9223372036854775807 (max positive long). + +## powf +* Prototype: +`long pow(long base, fixed exp);` +* Description: +Same as `pow` but using fixed point number for the exponent. +* Examples: + * sqrt(49) = 7 :: `val = powf(49, 0.5);` + * 5 * 5 * 5 * 5 = 5^4 = 625 :: `val = pow(5, 4.0);` + * sqrt(48) = 6 :: `val = pow(48, .5);` +* Notes + 1) pow will return zero if the result is matematically undefined; + 2) pow will return zero if base is negative; + 3) pow will return zero if result is greater than 9223372036854775807 (max positive long). + +## memcopy +* Prototype: +`void memcopy(void * destination, void * source);` +* Description: +Copies the binary value from source to destination. Handyful to copy variables content without type casting modifying them. +* Example: + * `fixed f; long l; memcopy(&f, &l);` This will copy the binary data from variable `l` to `f` without transformations. If l is 50, then f will be 0.00000050. + +[Back](./) diff --git a/docs/README.md b/docs/README.md index 8caa5b0..0cce105 100644 --- a/docs/README.md +++ b/docs/README.md @@ -14,6 +14,8 @@ To empower developers, allowing them to create complex and highly optimized smar ### Technical documentation: * [Basis](./1-Basis.md) +* [Preprocessor directives](./1.2-Preprocessor-directives.md) +* [Built-in functions](./1.5-Built-in-functions.md) * [API Functions](./2-API-Pseudo-Code.md) * [Learning with examples](./3-Learning-with-examples.md) * [Functions repository](./4-Functions-repository.md) From 08d6c5103c322890a581ae68077654d81241e79c Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 5 Jun 2022 16:40:08 -0300 Subject: [PATCH 063/112] Opt Constant/Constant operations with fixed/long types --- docs/1.2-Preprocessor-directives.md | 2 +- src/__tests__/macros.a.spec.ts | 7 +- src/codeGenerator/__tests__/utils.spec.ts | 163 +++++++++++++----- .../assemblyProcessor/assignmentToAsm.ts | 6 +- .../assemblyProcessor/createInstruction.ts | 2 +- .../astProcessor/binaryAsnProcessor.ts | 12 +- .../astProcessor/setupGenCode.ts | 10 +- .../astProcessor/unaryAsnProcessor.ts | 7 +- src/codeGenerator/codeGeneratorTypes.ts | 2 +- src/codeGenerator/utils.ts | 159 +++++++++++++---- src/parser/parser.ts | 27 +-- src/repository/__tests__/repository.spec.ts | 15 +- src/repository/repository.ts | 32 +++- src/shaper/shaper.ts | 9 +- src/typings/syntaxTypes.ts | 7 + 15 files changed, 327 insertions(+), 133 deletions(-) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index ec4e7d2..02abe97 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -8,7 +8,7 @@ Some special features can be enabled/disable via preprocessor directives. A value is mandatory for deployment. * `#program description Your program description`: Set program's description. No new lines and max length is 1000 chars. This is optional. -* `#program activationAmount 100000000`: Set program's activation amount in NQT (1 Signum = 100000000 NQT). If an incoming transaction has an amount is less than this value, it will not be processed by program (but the amount will be received!). Set a low value but bigger than worst case amount needed to run in your program. If set too low, your program will be frozen during execution (out of gas). If set too high, program balance will be high after execution (unburned balance). Remember to handle this case if creating serious program! +* `#program activationAmount VALUE`: Set program's activation amount. If VALUE is fixed point (Example: `.34`), it is used as Signa amount. If not, the value will be set in NQT (Example: `3400_0000`). If an incoming transaction has an amount is less than this value, it will not be processed by program (but the amount will be received!). Set a low value but bigger than worst case amount needed to run in your program. If set too low, your program will be frozen during execution (out of gas). If set too high, program balance will be high after execution (unspent balance). Remember to handle this case if creating serious program! A value is mandatory for deployment. * `#program codeHashId N`: Ensure the compiled program will have this exact code hash id. Use `0` to make this information available at assembly output (during development). diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index 087ecce..3d7ccdb 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -62,12 +62,15 @@ describe('#program', () => { compiler.compile() }).toThrowError(/^At line/) }) - test('should throw: forbiden activation amount in hex', () => { + it('should compile: activation amount in hex', () => { expect(() => { const code = '#program activationAmount 0xff\n long a; a++;' + const assembly = '^program activationAmount 500000000\n^declare r0\n^declare r1\n^declare r2\n\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() - }).toThrowError(/^At line/) + expect(compiler.getAssemblyCode()).toBe(assembly) + expect(compiler.getMachineCode().PActivationAmount).toBe('255') + }) }) it('should compile: allow _ in activationAmount', () => { const code = '#program activationAmount 5_0000_0000' diff --git a/src/codeGenerator/__tests__/utils.spec.ts b/src/codeGenerator/__tests__/utils.spec.ts index 3ef9de3..2faa904 100644 --- a/src/codeGenerator/__tests__/utils.spec.ts +++ b/src/codeGenerator/__tests__/utils.spec.ts @@ -1,52 +1,60 @@ import utils from '../utils' -describe('codeGenerator utils functions', () => { - it('should calculate: addHexContents', () => { - expect(utils.addHexContents( - '000a000', 'aaa0aaa' - )).toBe('000000000aaaaaaa') - expect(utils.addHexContents( - 139840123, 93364483 - )).toBe('000000000de66b7e') - expect(utils.addHexContents( - 'fffffffffffffff6', 20 - )).toBe('000000000000000a') +describe('codeGenerator utils functions (long)', () => { + it('should calculate: addConstants long, long', () => { + expect(utils.addConstants( + { value: '000a000', declaration: 'long' }, + { value: 'aaa0aaa', declaration: 'long' } + )).toStrictEqual({ value: 0xaaaaaaan, declaration: 'long' }) + expect(utils.addConstants( + { value: 139840123, declaration: 'long' }, + { value: 93364483, declaration: 'long' } + )).toStrictEqual({ value: 0xde66b7en, declaration: 'long' }) + expect(utils.addConstants( + { value: 'fffffffffffffff6', declaration: 'long' }, + { value: 20, declaration: 'long' } + )).toStrictEqual({ value: 0xan, declaration: 'long' }) }) - it('should calculate: subHexContents', () => { - expect(utils.subHexContents( - '0000', 'a' - )).toBe('fffffffffffffff6') - expect(utils.subHexContents( - 20, 10 - )).toBe('000000000000000a') + it('should calculate: subConstants long, long', () => { + expect(utils.subConstants( + { value: '0000', declaration: 'long' }, + { value: 'a', declaration: 'long' } + )).toStrictEqual({ value: 0xfffffffffffffff6n, declaration: 'long' }) + expect(utils.subConstants( + { value: 20, declaration: 'long' }, + { value: 10, declaration: 'long' } + )).toStrictEqual({ value: 0xan, declaration: 'long' }) }) - it('should calculate: mulHexContents', () => { - expect(utils.mulHexContents( - '0000', 'a' - )).toBe('0000000000000000') - expect(utils.mulHexContents( - 20, 10 - )).toBe('00000000000000c8') - expect(utils.mulHexContents( - '89528e28c0542dba', 4 - )).toBe('254a38a30150b6e8') + it('should calculate: mulHexContents long, long', () => { + expect(utils.mulConstants( + { value: '0000', declaration: 'long' }, + { value: 'a', declaration: 'long' } + )).toStrictEqual({ value: 0n, declaration: 'long' }) + expect(utils.mulConstants( + { value: 20, declaration: 'long' }, + { value: 10, declaration: 'long' } + )).toStrictEqual({ value: 0xc8n, declaration: 'long' }) + expect(utils.mulConstants( + { value: '89528e28c0542dba', declaration: 'long' }, + { value: 4, declaration: 'long' } + )).toStrictEqual({ value: 0x254a38a30150b6e8n, declaration: 'long' }) }) - it('should calculate: divHexContents', () => { - expect(utils.divHexContents( - 11, 2 - )).toBe('0000000000000005') - expect(utils.divHexContents( - 0, 10 - )).toBe('0000000000000000') + it('should calculate: divHexContents long, long', () => { + expect(utils.divConstants( + { value: 11, declaration: 'long' }, + { value: 2, declaration: 'long' } + )).toStrictEqual({ value: 0x5n, declaration: 'long' }) + expect(utils.divConstants( + { value: 0, declaration: 'long' }, + { value: 10, declaration: 'long' } + )).toStrictEqual({ value: 0n, declaration: 'long' }) }) - test('should throw: divHexContents', () => { + test('should throw: divHexContents long, long', () => { expect(() => { - utils.divHexContents(11, undefined) - }).toThrowError('Division by zero') - }) - test('should throw: divHexContents', () => { - expect(() => { - utils.divHexContents(11, undefined) + utils.divConstants( + { value: 11, declaration: 'long' }, + { value: '', declaration: 'long' } + ) }).toThrowError('Division by zero') }) it('should create: createConstantMemObj Number', () => { @@ -66,10 +74,10 @@ describe('codeGenerator utils functions', () => { expect(MemObj.declaration).toBe('long') expect(MemObj.size).toBe(2) }) - it('should create: createConstantMemObj Fixed', () => { - const MemObj = utils.createConstantMemObj(1.5) - expect(MemObj.hexContent).toBe('0000000008f0d180') - expect(MemObj.declaration).toBe('fixed') + test('should throw: createConstantMemObj Fixed', () => { + expect(() => { + utils.createConstantMemObj(1.5) + }).toThrowError('Internal error') }) it('should create: createConstantMemObj String', () => { const MemObj = utils.createConstantMemObj('feff') @@ -77,3 +85,66 @@ describe('codeGenerator utils functions', () => { expect(MemObj.declaration).toBe('long') }) }) + +describe('codeGenerator utils functions (mixed long/fixed)', () => { + it('should calculate: addConstants (mixed)', () => { + expect(utils.addConstants( + { value: '000a000', declaration: 'long' }, + { value: 'aaa0aaa', declaration: 'fixed' } + )).toStrictEqual({ value: 0x3B9B74A0AAAn, declaration: 'fixed' }) + expect(utils.addConstants( + { value: 139840123, declaration: 'fixed' }, + { value: 93364483, declaration: 'fixed' } + )).toStrictEqual({ value: 0xde66b7en, declaration: 'fixed' }) + expect(utils.addConstants( + { value: 0x3b9aca01, declaration: 'fixed' }, + { value: 'fffffffffffffff6', declaration: 'long' } + )).toStrictEqual({ value: 0x1n, declaration: 'fixed' }) + }) + it('should calculate: subConstants (mixed)', () => { + expect(utils.subConstants( + { value: '0000', declaration: 'long' }, + { value: 'a', declaration: 'fixed' } + )).toStrictEqual({ value: 0xfffffffffffffff6n, declaration: 'fixed' }) + expect(utils.subConstants( + { value: 200000002, declaration: 'fixed' }, + { value: 1, declaration: 'long' } + )).toStrictEqual({ value: 100000002n, declaration: 'fixed' }) + expect(utils.subConstants( + { value: 300000003, declaration: 'fixed' }, + { value: 200000002, declaration: 'fixed' } + )).toStrictEqual({ value: 100000001n, declaration: 'fixed' }) + }) + it('should calculate: mulHexContents (mixed)', () => { + expect(utils.mulConstants( + { value: '0000', declaration: 'fixed' }, + { value: 'a', declaration: 'long' } + )).toStrictEqual({ value: 0n, declaration: 'fixed' }) + expect(utils.mulConstants( + { value: 20, declaration: 'long' }, + { value: 10, declaration: 'fixed' } + )).toStrictEqual({ value: 0xc8n, declaration: 'fixed' }) + expect(utils.mulConstants( + { value: 300000003, declaration: 'fixed' }, + { value: 200000002, declaration: 'fixed' } + )).toStrictEqual({ value: 600000012n, declaration: 'fixed' }) + }) + it('should calculate: divHexContents (mixed)', () => { + expect(utils.divConstants( + { value: 11, declaration: 'fixed' }, + { value: 2, declaration: 'long' } + )).toStrictEqual({ value: 0x5n, declaration: 'fixed' }) + expect(utils.divConstants( + { value: 0, declaration: 'long' }, + { value: 10, declaration: 'fixed' } + )).toStrictEqual({ value: 0n, declaration: 'fixed' }) + expect(utils.divConstants( + { value: 1, declaration: 'long' }, + { value: 10000000, declaration: 'fixed' } + )).toStrictEqual({ value: 1000000000n, declaration: 'fixed' }) + expect(utils.divConstants( + { value: 200000002, declaration: 'fixed' }, + { value: 300030000, declaration: 'fixed' } + )).toStrictEqual({ value: 66660001n, declaration: 'fixed' }) + }) +}) diff --git a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts index 4d5cb90..2628bc0 100644 --- a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts @@ -66,7 +66,7 @@ export default function assignmentToAsm ( return leftRegularOffsetUndefinedAndRightConstantOffsetUndefinedToAsm() case 'constant': Right.hexContent = assertNotUndefined(Right.hexContent) - newVarName = auxVars.getMemoryObjectByLocation(utils.addHexContents(Right.Offset.value, Right.hexContent), operationLine).asmName + newVarName = auxVars.getMemoryObjectByLocation(utils.addHexSimple(Right.Offset.value, Right.hexContent), operationLine).asmName return `SET @${Left.asmName} $${newVarName}\n` case 'variable': throw new Error('Not implemented.') @@ -139,7 +139,7 @@ export default function assignmentToAsm ( return `SET @${Left.asmName} $${Right.asmName}\n` } if (Right.Offset.type === 'constant') { - const memLoc = utils.addHexContents(Right.hexContent, Right.Offset.value) + const memLoc = utils.addHexSimple(Right.hexContent, Right.Offset.value) const RightMem = auxVars.getMemoryObjectByLocation(memLoc, operationLine) return `SET @${Left.asmName} $${RightMem.asmName}\n` } @@ -199,7 +199,7 @@ export default function assignmentToAsm ( const paddedLong = assertNotUndefined(Right.hexContent).padStart(arraySize * 16, '0') let assemblyCode = '' for (let i = 0; i < arraySize; i++) { - const newLeft = auxVars.getMemoryObjectByLocation(utils.addHexContents(Left.hexContent, i), operationLine) + const newLeft = auxVars.getMemoryObjectByLocation(utils.addHexSimple(Left.hexContent, i), operationLine) const newRight = utils.createConstantMemObj( paddedLong.slice(16 * (arraySize - i - 1), 16 * (arraySize - i)) ) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index aa467da..cdbfe59 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -233,7 +233,7 @@ export function flattenMemory ( case 'array': // Looks like an array but can be converted to regular variable RetObj = AuxVars.getMemoryObjectByLocation( - utils.addHexContents(StuffedMemory.hexContent, StuffedMemory.Offset.value), line + utils.addHexSimple(StuffedMemory.hexContent, StuffedMemory.Offset.value), line ) AuxVars.freeRegister(StuffedMemory.address) return { FlatMem: RetObj, asmCode: retInstructions, isNew: true } diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 1a317e0..9ab393c 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -160,7 +160,7 @@ export default function binaryAsnProcessor ( 'Array index is outside array size.') } LGenObj.SolvedMem = AuxVars.getMemoryObjectByLocation( - utils.addHexContents(LGenObj.SolvedMem.hexContent, LGenObj.SolvedMem.Offset.value) + utils.addHexSimple(LGenObj.SolvedMem.hexContent, LGenObj.SolvedMem.Offset.value) ) } // Get right side gencode object @@ -592,15 +592,17 @@ export default function binaryAsnProcessor ( ) : MEMORY_SLOT | undefined { // If left and right side are constants, do the math now for basic operations if (Left.type === 'constant' && Right.type === 'constant') { + const LeftConstant = utils.memoryToConstantContent(Left) + const RightConstant = utils.memoryToConstantContent(Right) switch (operatorVal) { case '+': - return utils.createConstantMemObj(utils.addHexContents(Left.hexContent, Right.hexContent)) + return utils.createConstantMemObjWithDeclaration(utils.addConstants(LeftConstant, RightConstant)) case '*': - return utils.createConstantMemObj(utils.mulHexContents(Left.hexContent, Right.hexContent)) + return utils.createConstantMemObjWithDeclaration(utils.mulConstants(LeftConstant, RightConstant)) case '/': - return utils.createConstantMemObj(utils.divHexContents(Left.hexContent, Right.hexContent)) + return utils.createConstantMemObjWithDeclaration(utils.divConstants(LeftConstant, RightConstant)) case '-': - return utils.createConstantMemObj(utils.subHexContents(Left.hexContent, Right.hexContent)) + return utils.createConstantMemObjWithDeclaration(utils.subConstants(LeftConstant, RightConstant)) } } } diff --git a/src/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts index 8316404..d27c2b4 100644 --- a/src/codeGenerator/astProcessor/setupGenCode.ts +++ b/src/codeGenerator/astProcessor/setupGenCode.ts @@ -130,12 +130,12 @@ export default function setupGenCode ( return deepCopy(MemFound) } - function auxvarsGetMemoryObjectByLocation (loc: number|string, line: number = sentenceLine): MEMORY_SLOT { + function auxvarsGetMemoryObjectByLocation (loc: number|bigint|string, line: number = sentenceLine): MEMORY_SLOT { let addr:number - if (typeof loc === 'number') { - addr = loc - } else { - addr = parseInt(loc, 16) + switch (typeof loc) { + case 'number': addr = loc; break + case 'string': addr = parseInt(loc, 16); break + default: addr = Number(loc) } const FoundMemory = AuxVars.memory.find(obj => obj.address === addr) if (FoundMemory === undefined) { diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index 4634499..b07d207 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -160,7 +160,10 @@ export default function unaryAsnProcessor ( let { SolvedMem: CGenObj, asmCode } = traverseNotLogical() if (CGenObj.type === 'constant') { return { - SolvedMem: utils.createConstantMemObj(utils.subHexContents(0, CGenObj.hexContent)), + SolvedMem: utils.createConstantMemObjWithDeclaration(utils.subConstants( + { value: 0, declaration: 'long' }, + utils.memoryToConstantContent(CGenObj) + )), asmCode: asmCode } } @@ -239,7 +242,7 @@ export default function unaryAsnProcessor ( if (RetMem.Offset !== undefined) { if (RetMem.Offset.type === 'constant') { TmpMemObj = utils.createConstantMemObj( - utils.addHexContents(RetMem.hexContent, RetMem.Offset.value) + utils.addHexSimple(RetMem.hexContent, RetMem.Offset.value) ) TmpMemObj.declaration = RetMem.declaration break diff --git a/src/codeGenerator/codeGeneratorTypes.ts b/src/codeGenerator/codeGeneratorTypes.ts index 546915f..abd77b1 100644 --- a/src/codeGenerator/codeGeneratorTypes.ts +++ b/src/codeGenerator/codeGeneratorTypes.ts @@ -84,7 +84,7 @@ export type GENCODE_AUXVARS = { * Object can be global or local function scope. * if not found, throws exception with line number. */ - getMemoryObjectByLocation (loc: number|string, line?: number): MEMORY_SLOT + getMemoryObjectByLocation (loc: number|bigint|string, line?: number): MEMORY_SLOT /** Get a new jump id according to current Configs (genCode scope) */ getNewJumpID(currLine: number): string } diff --git a/src/codeGenerator/utils.ts b/src/codeGenerator/utils.ts index 76e79fd..bd09171 100644 --- a/src/codeGenerator/utils.ts +++ b/src/codeGenerator/utils.ts @@ -1,5 +1,5 @@ -import { assertNotUndefined } from '../repository/repository' -import { MEMORY_SLOT, TOKEN, AST, DECLARATION_TYPES, LOOKUP_ASN, BINARY_ASN, END_ASN, EXCEPTION_ASN, NULL_ASN, UNARY_ASN, SWITCH_ASN } from '../typings/syntaxTypes' +import { assertExpression, assertNotUndefined } from '../repository/repository' +import { MEMORY_SLOT, TOKEN, AST, DECLARATION_TYPES, LOOKUP_ASN, BINARY_ASN, END_ASN, EXCEPTION_ASN, NULL_ASN, UNARY_ASN, SWITCH_ASN, CONSTANT_CONTENT, HEX_CONTENT } from '../typings/syntaxTypes' type OBJECT_ASN_TYPE = T extends 'binaryASN' ? BINARY_ASN : T extends 'unaryASN' ? UNARY_ASN : @@ -10,8 +10,6 @@ T extends 'exceptionASN' ? EXCEPTION_ASN : T extends 'switchASN' ? SWITCH_ASN : never; -type HEXCONTENTS = number | string | undefined - /** * Simple functions that do not depend external variables. */ @@ -19,16 +17,9 @@ export default { /** Creates a constant Memory Object */ createConstantMemObj (value?: number | bigint | string): MEMORY_SLOT { let param: string - let declaration : 'long' | 'fixed' = 'long' switch (typeof (value)) { case 'number': - if (value % 1 !== 0) { - const intPart = BigInt(Math.trunc(value)) - const fractionalPart = BigInt(Math.trunc((value % 1) * 100000000)) - param = (intPart * 100000000n + fractionalPart).toString(16) - declaration = 'fixed' - break - } + if (value % 1 !== 0) throw new Error('Internal error') param = value.toString(16) break case 'bigint': @@ -48,11 +39,17 @@ export default { type: 'constant', scope: '', size: param.length / 16, - declaration, + declaration: 'long', isDeclared: true, hexContent: param } }, + /** Creates a constant Memory Object with a given declaration */ + createConstantMemObjWithDeclaration (input: CONSTANT_CONTENT): MEMORY_SLOT { + const retObj = this.createConstantMemObj(input.value) + retObj.declaration = input.declaration + return retObj + }, /** Creates a constant Memory Object */ createVoidMemObj (): MEMORY_SLOT { return { @@ -99,42 +96,130 @@ export default { genPushToken (line: number): TOKEN { return { type: 'Push', precedence: 12, value: '', line: line } }, - mulHexContents (param1: HEXCONTENTS, param2: HEXCONTENTS) { - const n1 = this.HexContentsToBigint(param1) - const n2 = this.HexContentsToBigint(param2) - return (n1 * n2).toString(16).padStart(16, '0').slice(-16) + memoryToConstantContent (MemObj: MEMORY_SLOT) : CONSTANT_CONTENT { + assertExpression(MemObj.type === 'constant') + return { + value: MemObj.hexContent ?? '', + declaration: MemObj.declaration === 'fixed' ? 'fixed' : 'long' + } + }, + mulConstants (param1: CONSTANT_CONTENT, param2: CONSTANT_CONTENT) : CONSTANT_CONTENT { + const n1 = this.HexContentToBigint(param1.value) + const n2 = this.HexContentToBigint(param2.value) + switch (param1.declaration + param2.declaration) { + case 'fixedfixed': + return { + value: ((n1 * n2) / 100000000n) % 18446744073709551616n, + declaration: 'fixed' + } + case 'fixedlong': + case 'longfixed': + return { + value: (n1 * n2) % 18446744073709551616n, + declaration: 'fixed' + } + default: + return { + value: (n1 * n2) % 18446744073709551616n, + declaration: 'long' + } + } }, - divHexContents (param1: HEXCONTENTS, param2: HEXCONTENTS) { - const n1 = this.HexContentsToBigint(param1) - const n2 = this.HexContentsToBigint(param2) + divConstants (param1: CONSTANT_CONTENT, param2: CONSTANT_CONTENT) : CONSTANT_CONTENT { + const n1 = this.HexContentToBigint(param1.value) + const n2 = this.HexContentToBigint(param2.value) if (n2 === 0n) { throw new Error('Division by zero') } - return (n1 / n2).toString(16).padStart(16, '0').slice(-16) + switch (param1.declaration + param2.declaration) { + case 'fixedfixed': + return { + value: ((n1 * 100000000n) / n2) % 18446744073709551616n, + declaration: 'fixed' + } + case 'fixedlong': + return { + value: n1 / n2, + declaration: 'fixed' + } + case 'longfixed': + return { + value: ((n1 * 100000000n * 100000000n) / n2), + declaration: 'fixed' + } + default: + // longlong': + return { + value: n1 / n2, + declaration: 'long' + } + } }, - addHexContents (param1: HEXCONTENTS, param2: HEXCONTENTS) { - const n1 = this.HexContentsToBigint(param1) - const n2 = this.HexContentsToBigint(param2) + addHexSimple (param1: HEX_CONTENT = '', param2: HEX_CONTENT = '') { + const n1 = this.HexContentToBigint(param1) + const n2 = this.HexContentToBigint(param2) return (n1 + n2).toString(16).padStart(16, '0').slice(-16) }, - subHexContents (param1: HEXCONTENTS, param2: HEXCONTENTS) { - const n1 = this.HexContentsToBigint(param1) - const n2 = this.HexContentsToBigint(param2) - let sub = n1 - n2 - if (sub < 0) { - sub += 18446744073709551616n + addConstants (param1: CONSTANT_CONTENT, param2: CONSTANT_CONTENT) : CONSTANT_CONTENT { + const n1 = this.HexContentToBigint(param1.value) + const n2 = this.HexContentToBigint(param2.value) + switch (param1.declaration + param2.declaration) { + case 'fixedlong': + return { + value: (n1 + (n2 * 100000000n)) % 18446744073709551616n, + declaration: 'fixed' + } + case 'longfixed': + return { + value: ((n1 * 100000000n) + n2) % 18446744073709551616n, + declaration: 'fixed' + } + default: + // 'fixedfixed' or 'longlong': + return { + value: (n1 + n2) % 18446744073709551616n, + declaration: param1.declaration + } } - return sub.toString(16).padStart(16, '0').slice(-16) }, - /** Converts a hex string or number to bigint */ - HexContentsToBigint (arg: HEXCONTENTS) : bigint { - if (typeof arg === 'undefined') { - return 0n + subConstants (param1: CONSTANT_CONTENT, param2: CONSTANT_CONTENT) { + const n1 = this.HexContentToBigint(param1.value) + const n2 = this.HexContentToBigint(param2.value) + let value: bigint + let declaration: 'fixed'|'long' + switch (param1.declaration + param2.declaration) { + case 'fixedfixed': + case 'longlong': + value = n1 - n2 + declaration = param1.declaration + break + case 'fixedlong': + value = n1 - (n2 * 100000000n) + declaration = 'fixed' + break + default: + // 'longfixed': + value = (n1 * 100000000n) - n2 + declaration = 'fixed' + } + if (value < 0) { + value += 18446744073709551616n } - if (typeof arg === 'number') { + return { value, declaration } + }, + /** Converts a hex string or number to bigint NO FIXED NUMBER! */ + HexContentToBigint (arg: HEX_CONTENT | undefined) : bigint { + switch (typeof (arg)) { + case 'number': return BigInt(arg) + case 'bigint': + return arg + case 'string': + if (arg === '') return 0n + return BigInt('0x' + arg) + default: + return 0n } - return BigInt('0x' + arg) }, /** Splits an AST into array of AST based on delimiters */ splitASTOnDelimiters (Obj: AST) { diff --git a/src/parser/parser.ts b/src/parser/parser.ts index 6081d9d..cc97497 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -1,5 +1,5 @@ import { PRE_TOKEN, TOKEN, TOKEN_TYPES } from '../typings/syntaxTypes' -import { stringToHexstring, ReedSalomonAddressDecode } from '../repository/repository' +import { stringToHexstring, ReedSalomonAddressDecode, parseDecimalNumber } from '../repository/repository' type TOKEN_SPEC = { sequence: string[] @@ -79,27 +79,10 @@ export default function parser (preTokens: PRE_TOKEN[]): TOKEN[] { sequence: ['numberDec'], action (tokenID): TOKEN { const PreTkn = preTokens[tokenID] - PreTkn.value = PreTkn.value.replace(/_/g, '') - let val: bigint = 0n - let extValue = 'long' - if (PreTkn.value.includes('.')) { - const parts = PreTkn.value.split('.') - if (parts.length !== 2) { - throw new Error(`At line ${PreTkn.line}. ` + - ' Found more than one decimal point in number.') - } - if (parts[1].length > 8) { - throw new Error(`At line ${PreTkn.line}. ` + - 'Fixed numbers cannot have more than 8 digits as decimal fraction.') - } - val = BigInt(parts[0]) * 100000000n + BigInt(parts[1].padEnd(8, '0')) - extValue = 'fixed' - } else { - val = BigInt(PreTkn.value) - } - const valString = val.toString(16) + const Parsed = parseDecimalNumber(PreTkn.value, PreTkn.line) + const valString = Parsed.value.toString(16) const paddedValString = valString.padStart((Math.floor((valString.length - 1) / 16) + 1) * 16, '0') - return { type: 'Constant', precedence: 0, value: paddedValString, line: PreTkn.line, extValue } + return { type: 'Constant', precedence: 0, value: paddedValString, line: PreTkn.line, extValue: Parsed.declaration } } }, { @@ -108,7 +91,7 @@ export default function parser (preTokens: PRE_TOKEN[]): TOKEN[] { const PreTkn = preTokens[tokenID] let val = PreTkn.value.replace(/_/g, '').toLowerCase() val = val.padStart((Math.floor((val.length - 1) / 16) + 1) * 16, '0') - return { type: 'Constant', precedence: 0, value: val, line: PreTkn.line } + return { type: 'Constant', precedence: 0, value: val, line: PreTkn.line, extValue: 'long' } } }, { diff --git a/src/repository/__tests__/repository.spec.ts b/src/repository/__tests__/repository.spec.ts index 5f68357..a1de5f1 100644 --- a/src/repository/__tests__/repository.spec.ts +++ b/src/repository/__tests__/repository.spec.ts @@ -1,4 +1,4 @@ -import { stringToHexstring, ReedSalomonAddressDecode, assertNotUndefined, assertNotEqual, assertExpression, deepCopy } from '../repository' +import { stringToHexstring, ReedSalomonAddressDecode, assertNotUndefined, assertNotEqual, assertExpression, deepCopy, parseDecimalNumber } from '../repository' describe('Strings to hexstring', () => { it('should convert: simple string ( <= 0x7f)', () => { @@ -181,3 +181,16 @@ describe('assert/deepcopy functions', () => { expect(data).not.toBe(copy) }) }) + +describe('parseDecimal error', () => { + test('should throw: two decimal points', () => { + expect(() => { + parseDecimalNumber('2.234.33', -1) + }).toThrowError(/^At line/) + }) + test('should throw: more than 8 decimals', () => { + expect(() => { + parseDecimalNumber('2.123456789', -1) + }).toThrowError(/^At line/) + }) +}) diff --git a/src/repository/repository.ts b/src/repository/repository.ts index fe49d7c..0808ca0 100644 --- a/src/repository/repository.ts +++ b/src/repository/repository.ts @@ -2,7 +2,7 @@ // Using them with regular error messages will lead to condition not beeing checked // in coverage report. -import { DECLARATION_TYPES } from '../typings/syntaxTypes' +import { CONSTANT_CONTENT, DECLARATION_TYPES } from '../typings/syntaxTypes' /** * Ensure the value is not undefined @@ -189,6 +189,36 @@ export function ReedSalomonAddressDecode (RSString: string, currLine: number) : return run() } +/** Parse a string supposed to be a decimal (no negative) + * @returns Object with value and type + * @throws Error if string is not valid + */ +export function parseDecimalNumber (strNum: string, line: number): CONSTANT_CONTENT { + strNum = strNum.replace(/_/g, '') + let value: bigint + let type : 'long'|'fixed' + if (strNum.includes('.')) { + const parts = strNum.split('.') + if (parts.length !== 2) { + throw new Error(`At line ${line}. ` + + ' Found more than one decimal point in number.') + } + if (parts[1].length > 8) { + throw new Error(`At line ${line}. ` + + 'Fixed numbers cannot have more than 8 digits as decimal fraction.') + } + value = BigInt(parts[0]) * 100000000n + BigInt(parts[1].padEnd(8, '0')) + type = 'fixed' + } else { + value = BigInt(strNum) + type = 'long' + } + return { + value, + declaration: type + } +} + export function isDeclarationType (str: string) : str is DECLARATION_TYPES { switch (str) { case 'void': diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 1489af4..c19a979 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -4,7 +4,7 @@ import { MEMORY_SLOT, REGISTER_TYPE_DEFINITION } from '../typings/syntaxTypes' -import { assertNotUndefined, deepCopy } from '../repository/repository' +import { assertNotUndefined, deepCopy, parseDecimalNumber } from '../repository/repository' import { APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate, fixedBaseTemplate, fixedAPITableTemplate } from './templates' @@ -237,11 +237,8 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { Program.Config.PDescription = MacroToken.value return case 'activationAmount': - if (/^[0-9_]{1,20}$/.test(MacroToken.value)) { - Program.Config.PActivationAmount = MacroToken.value.replace(/_/g, '') - return - } - throw new Error(`At line: ${MacroToken.line}. Program activation must be only numbers or '_'.`) + Program.Config.PActivationAmount = parseDecimalNumber(MacroToken.value, MacroToken.line).value.toString(10) + return case 'userStackPages': if (/^\d\s*$|^10\s*$/.test(MacroToken.value)) { Program.Config.PUserStackPages = Number(MacroToken.value) diff --git a/src/typings/syntaxTypes.ts b/src/typings/syntaxTypes.ts index 95a4267..38f1ff5 100644 --- a/src/typings/syntaxTypes.ts +++ b/src/typings/syntaxTypes.ts @@ -6,6 +6,13 @@ export type PRE_TOKEN = { extValue?: string } +export type HEX_CONTENT = number | bigint | string + +export type CONSTANT_CONTENT = { + value: HEX_CONTENT + declaration: 'long' | 'fixed' +} + /** Allowed token types */ export type TOKEN_TYPES = 'Variable' | 'Constant' | 'Operator' | 'UnaryOperator' | 'SetUnaryOperator' | 'Assignment'| 'SetOperator'|'Comparision'|'CheckOperator'| From 7a02a7d0a3848213e4dd65e273194375435fd92c Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 5 Jun 2022 17:42:44 -0300 Subject: [PATCH 064/112] Optimization for fX: const fixed numbers --- docs/1-Basis.md | 4 +++- src/__tests__/optimizations.a.spec.ts | 7 +++++++ src/codeGenerator/assemblyProcessor/assignmentToAsm.ts | 9 ++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 7f86acf..8bff1a1 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -58,7 +58,9 @@ All global statements are grouped at the beginning of assembly code (even if aft * Dead: Execution raised one of these exceptions: 1) division by zero; 2) trying to read/set a variable outside memory range; or 3) stack overflow/underflow for user/code stack. The default behaviour is all contract balance to be distributed as fee for current block forger. Also any next transaction to that dead contract will be transformed in fee. To avoid this situation, it is possible to define a special function `void catch(void)`. When the exception is found, the execution will jump to 'catch' function and a new entry point for next incoming transactions will be set. A use case for 'catch' function is to send all balance to creator to avoid losing contract balance. When using 'catch' function the contract will never reach dead state. ### Designing tips -If you plan to use a number many times, declare it globally with `const` keyword and name it with `nVALUE`: example `const long n65535=65535`. This can save one instruction for each use and also make your code smaller. But if you use it only a few times, or is under memory pressure, you can use constants at your code but making machine code bigger. For big programs it is more common be under codesize pressure, so this is a great exchange. The exception is Zero. Setting a variable to zero has an special assembly code. Comparisons against zero are also smaller than comparisons against variables. Comparisons against numbers are long assembly instrunctions. Try it to see assembly code genereated! If you are under memory pressure (or want to code smallest code possible) use global variables, because exchanging variables thru functions will cause they to be declared twice, pushed onto stack and popped at function. +If you plan to use a number many times, declare it globally with `const` keyword and name it with `nVALUE`: example `const long n65535=65535`. +If the value is fixed, use the name with all decimals: example `const fixed f2000001=.02000001`. +This can save one instruction for each use and also make your code smaller. But if you use it only a few times, or is under memory pressure, you can use constants at your code but making machine code bigger. For big programs it is more common be under codesize pressure, so this is a great exchange. The exception is Zero. Setting a variable to zero has an special assembly code. Comparisons against zero are also smaller than comparisons against variables. Comparisons against numbers are long assembly instrunctions. Try it to see assembly code genereated! If you are under memory pressure (or want to code smallest code possible) use global variables, because exchanging variables thru functions will cause they to be declared twice, pushed onto stack and popped at function. ### Main differences from C * signed or unsigned: There is no difference between signed and unsigned longs. The rule is that all values behave as signed when comparing values or during arithmetic operations, but treated as unsigned during bit operations. Keep this in mind if developing with gcc. diff --git a/src/__tests__/optimizations.a.spec.ts b/src/__tests__/optimizations.a.spec.ts index a4b5130..6f3e986 100644 --- a/src/__tests__/optimizations.a.spec.ts +++ b/src/__tests__/optimizations.a.spec.ts @@ -23,6 +23,13 @@ describe('Optimizations level zero', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: Optimization with const fX variables', () => { + const code = '#pragma optimizationLevel 0\nconst fixed f20000000 = .2; fixed fb; long a= fb * .2;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare f20000000\n^declare fb\n^declare a\n\n^const SET @f20000000 #0000000001312d00\nSET @a $f20000000\nMDV @a $fb $f100000000\nDIV @a $f100000000\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) it('should compile: Specifc operator optimization with WRONG const n2 variables', () => { const code = '#pragma optimizationLevel 0\nlong a , b; const long n2 = 20; a=b+2;' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare n2\n\n^const SET @n2 #0000000000000014\nSET @a $b\nINC @a\nINC @a\nFIN\n' diff --git a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts index 2628bc0..7772e04 100644 --- a/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts +++ b/src/codeGenerator/assemblyProcessor/assignmentToAsm.ts @@ -82,9 +82,12 @@ export default function assignmentToAsm ( if (Right.hexContent === '0000000000000000') { return `CLR @${Left.asmName}\n` } - const findOpt = auxVars.memory.find(MEM => { - return MEM.asmName === `n${Number('0x' + Right.hexContent)}` && MEM.hexContent === Right.hexContent - }) + let optVarName = 'n' + if (Right.declaration === 'fixed') { + optVarName = 'f' + } + optVarName += Number('0x' + Right.hexContent).toString(10) + const findOpt = auxVars.memory.find(MEM => MEM.asmName === optVarName && MEM.hexContent === Right.hexContent) if (findOpt) { return `SET @${Left.asmName} $${findOpt.asmName}\n` } From 59775c57c8c8dc311015366ebb4b3d8217c8b7b6 Mon Sep 17 00:00:00 2001 From: deleterium Date: Mon, 6 Jun 2022 21:47:49 -0300 Subject: [PATCH 065/112] Casting hack on values returned by functions --- src/__tests__/arithmetics.e.spec.ts | 7 +++++++ src/__tests__/castings.a.spec.ts | 7 +++++++ src/__tests__/keywords.b.spec.ts | 7 ------- .../assemblyProcessor/createInstruction.ts | 20 +++++++++++++++++-- .../astProcessor/binaryAsnProcessor.ts | 2 +- .../astProcessor/unaryAsnProcessor.ts | 5 +++-- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/__tests__/arithmetics.e.spec.ts b/src/__tests__/arithmetics.e.spec.ts index 77d0f0c..aef5e70 100644 --- a/src/__tests__/arithmetics.e.spec.ts +++ b/src/__tests__/arithmetics.e.spec.ts @@ -8,6 +8,13 @@ describe('Adress Of', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: address of register', () => { + const code = 'long a, *b; b = &r1;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nSET @b #0000000000000001\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) test('should throw: deferencing variable not pointer on left side', () => { expect(() => { const code = 'long a, b, c, d; *(a+1)=b;' diff --git a/src/__tests__/castings.a.spec.ts b/src/__tests__/castings.a.spec.ts index 7d4826b..2fdda06 100644 --- a/src/__tests__/castings.a.spec.ts +++ b/src/__tests__/castings.a.spec.ts @@ -78,6 +78,13 @@ describe('Castings arithmetic', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: casting hack on returning function', () => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\nfixed a, b; a = b + (*(fixed *)(&Get_A1()));' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nFUN @r0 get_A1\nSET @a $b\nADD @a $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) describe('Castings logical', () => { diff --git a/src/__tests__/keywords.b.spec.ts b/src/__tests__/keywords.b.spec.ts index 79c3425..4f0bc91 100644 --- a/src/__tests__/keywords.b.spec.ts +++ b/src/__tests__/keywords.b.spec.ts @@ -295,13 +295,6 @@ describe('Keywords wrong usage', () => { compiler.compile() }).toThrowError(/^At line/) }) - test('should throw: Trying to get the address of a register', () => { - expect(() => { - const code = 'long a, *b; b = &r1;' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - }).toThrowError(/^At line/) - }) test('should throw: const and variable in right side', () => { expect(() => { const code = 'long a, d; const d=a;' diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index cdbfe59..a41e4fc 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -1,5 +1,5 @@ import { assertExpression, assertNotUndefined } from '../../repository/repository' -import { MEMORY_SLOT, TOKEN } from '../../typings/syntaxTypes' +import { MEMORY_SLOT, OFFSET_MODIFIER_CONSTANT, TOKEN } from '../../typings/syntaxTypes' import { FLATTEN_MEMORY_RETURN_OBJECT, GENCODE_AUXVARS, GENCODE_SOLVED_OBJECT } from '../codeGeneratorTypes' import utils from '../utils' @@ -198,7 +198,15 @@ export function flattenMemory ( function flattenMemoryMain (): FLATTEN_MEMORY_RETURN_OBJECT { let retInstructions = '' if (StuffedMemory.type === 'constant') { - return flattenConstant(StuffedMemory.hexContent) + switch (StuffedMemory.Offset?.type) { + case undefined: + return flattenConstant(StuffedMemory.hexContent) + case 'constant': + return flattenConstantWithOffsetConstant(StuffedMemory.Offset) + default: + // 'variable' + throw new Error('Not implemented') + } } if (StuffedMemory.Offset === undefined) { return { FlatMem: StuffedMemory, asmCode: '', isNew: false } @@ -242,6 +250,14 @@ export function flattenMemory ( } } + function flattenConstantWithOffsetConstant (ConstOffset: OFFSET_MODIFIER_CONSTANT) : FLATTEN_MEMORY_RETURN_OBJECT { + const deferencedVar = AuxVars.getMemoryObjectByLocation(utils.addHexSimple(ConstOffset.value, StuffedMemory.hexContent), line) + if (AuxVars.isTemp(deferencedVar.address)) { + deferencedVar.declaration = paramDec + } + return { FlatMem: deferencedVar, asmCode: '', isNew: false } + } + function flattenConstant (hexParam: string|number|undefined): FLATTEN_MEMORY_RETURN_OBJECT { hexParam = assertNotUndefined(hexParam) let hexString: string diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 9ab393c..e805256 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -632,7 +632,7 @@ export default function binaryAsnProcessor ( return true } // Try optimization if right side is constant, but do not mess if already optimized - if (Right.type === 'constant' && !checkOperatorOptimization(operatorVal, Right)) { + if (Right.type === 'constant' && Right.Offset === undefined && !checkOperatorOptimization(operatorVal, Right)) { return true } return false diff --git a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts index b07d207..4e925f6 100644 --- a/src/codeGenerator/astProcessor/unaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/unaryAsnProcessor.ts @@ -233,8 +233,9 @@ export default function unaryAsnProcessor ( throw new Error(`At line: ${CurrentNode.Operation.line}. ` + 'Trying to get address of void value.') case 'register': - throw new Error(`At line: ${CurrentNode.Operation.line}. ` + - 'Returning address of a register.') + TmpMemObj = utils.createConstantMemObj(RetMem.address) + TmpMemObj.declaration = RetMem.declaration + break case 'constant': throw new Error(`At line: ${CurrentNode.Operation.line}. ` + 'Trying to get address of a constant value.') From 252f077d4b326b69bb382dea276d05805766c74f Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 7 Jun 2022 10:29:34 -0300 Subject: [PATCH 066/112] New built-in bcltof and bcftol --- docs/1-Basis.md | 3 ++ docs/1.5-Built-in-functions.md | 16 +++++++++ src/__tests__/functions.b.spec.ts | 7 ++++ .../astProcessor/functionSolver.ts | 6 +++- src/shaper/templates.ts | 36 +++++++++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 8bff1a1..734363f 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -41,6 +41,9 @@ Variables declarations can be inside other sentences, like `for (long i; i<10; i ### Implicit types casting The compiler will convert numbers and variables between fixed and long if used in binary operators. Most of times long will be converted to fixed, unless there is an assigment and the left side is long. In this case (=, +=, -=, ...) fixed values will be transformed into long. Data can be lost in this transformation, so keep an eye on it! +### Explict types casting +Same as in C `fixedVariable = (fixed)longVariable`. The compiler will make the transformation. It is also possible to use some built-in functions if the desired transformation is just to copy the value in memory (memcopy) or use in arguments for functions (bcftol). Check chapter 1.5 Built-in functions. + ### Functions As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru preprocessor directives. There are two special functions: `void main(void)` explained before and `void catch(void)` explained at **Contract states** topic. It is not obligatory to use them. Functions can return also arrays and structs; the returning values can be used directly: example `if ( arrFn(a)[2] == 25 )` or `b = structFn(a)->value;` diff --git a/docs/1.5-Built-in-functions.md b/docs/1.5-Built-in-functions.md index b88244f..b0285e2 100644 --- a/docs/1.5-Built-in-functions.md +++ b/docs/1.5-Built-in-functions.md @@ -48,4 +48,20 @@ Copies the binary value from source to destination. Handyful to copy variables c * Example: * `fixed f; long l; memcopy(&f, &l);` This will copy the binary data from variable `l` to `f` without transformations. If l is 50, then f will be 0.00000050. +## bcftol - binary casting fixed to long +* Prototype: +`long bcftol(fixed value);` +* Description: +Creates a binary casting (do not change values in memory) from a fixed value to long. Useful to change arguments types for API functions. Example: `Set_A1_A2(longValue, bcftol(fixedValue))` +* Examples: + * `long val; val = bcftol(0.5);` Output: val with have content 5000_0000. + +## bcltof - binary casting long to fixed +* Prototype: +`fixed bcltof(long value);` +* Description: +Creates a binary casting (do not change values in memory) from a long value to fixed. +* Examples: + * `fixed val; val = bcltof(5000_0000);` Output: val will have content 0.5. + [Back](./) diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index 3d62318..2579bee 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -126,4 +126,11 @@ describe('Built-in functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: bcltof() and bcftol()', () => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\n#include fixedAPIFunctions\n fixed fa; long la; fa = bcltof(Get_A1()+25); la = bcftol(F_Get_A1()+25.0);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n^declare la\n\nFUN @r0 get_A1\nSET @fa #0000000000000019\nADD @fa $r0\nFUN @r0 get_A1\nSET @la #000000009502f900\nADD @la $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) diff --git a/src/codeGenerator/astProcessor/functionSolver.ts b/src/codeGenerator/astProcessor/functionSolver.ts index 5abc298..7926607 100644 --- a/src/codeGenerator/astProcessor/functionSolver.ts +++ b/src/codeGenerator/astProcessor/functionSolver.ts @@ -113,7 +113,7 @@ export default function functionSolver ( let FnRetObj: MEMORY_SLOT const processedArgs: MEMORY_SLOT [] = [] let returnAssemblyCode = '' - if (ifnToCall.declaration === 'void') { + if (ifnToCall.declaration === 'void' || ifnToCall.name === 'bcftol' || ifnToCall.name === 'bcltof') { FnRetObj = utils.createVoidMemObj() } else { FnRetObj = AuxVars.getNewRegister() // reserve tempvar for return type @@ -153,6 +153,10 @@ export default function functionSolver ( processedArgs ) } else { + if (ifnToCall.name === 'bcftol' || ifnToCall.name === 'bcltof') { + utils.setMemoryDeclaration(processedArgs[0], ifnToCall.declaration) + return { SolvedMem: processedArgs[0], asmCode: returnAssemblyCode } + } returnAssemblyCode += createBuiltInInstruction( AuxVars, utils.genBuiltInToken(CurrentNode.Token.line, ifnToCall.asmName), diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index d3c31bb..c31ce4a 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -183,6 +183,42 @@ export const BuiltInTemplate: SC_FUNCTION[] = [ declaration: 'void', sentences: [], name: 'memcopy' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'bcftol_addr', + type: 'fixed', + scope: 'bcftol', + declaration: 'fixed', + size: 1, + isDeclared: true + } + ], + asmName: 'bcftol', + declaration: 'long', + sentences: [], + name: 'bcftol' + }, + { + argsMemObj: [ + { + address: -1, + name: 'addr', + asmName: 'bcltof_addr', + type: 'long', + scope: 'bcltof', + declaration: 'long', + size: 1, + isDeclared: true + } + ], + asmName: 'bcltof', + declaration: 'fixed', + sentences: [], + name: 'bcltof' } ] From 3f07a07b7bdf066b59d9e6b11ed6b4fc5f3e0297 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 7 Jun 2022 10:34:05 -0300 Subject: [PATCH 067/112] Added option #pragma verboseAssembly to show lines and source code in comments --- docs/1.2-Preprocessor-directives.md | 2 +- src/__tests__/macros.a.spec.ts | 12 ++++++------ src/codeGenerator/codeGenerator.ts | 8 ++++---- src/shaper/shaper.ts | 4 ++-- src/smartc.ts | 4 +++- src/typings/contractTypes.ts | 6 ++++-- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index 02abe97..461a1bb 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -174,7 +174,7 @@ Special features used by compiler. * 3: Dangerous optimizations no well tested. Result must be inspected by developer. * `#pragma reuseAssignedVar [true/false/1/0/]`: When set, compiler will try to use a variable on left side of and `Assignment` as a register. If variable is also used on right side, the compiler will not reuse it. This can save one assembly instruction for every expression used! Default value is `true` and it is highly recomended to maintain it active. * `#pragma version N`: Informs which compiler's version the code was developed. Must be set if not using development version. To skip this check, set it to `dev`. -* `#pragma outputSourceLineNumber[true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number to the C source code. Very usefull for debug. +* `#pragma verboseAssembly [true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number and the source code. Very usefull for debug. ### Escaping new line Just end a line with `\` and it will be joined to the next one. It can be used anywhere, even inside "strings". Usefull for multiline program description, #define for a macro, or in middle of a variable name! diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index 3d7ccdb..43a4a6c 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -153,9 +153,9 @@ describe('#program', () => { }) describe('#pragma', () => { - it('should compile: outputSourceLineNumber', () => { - const code = '#pragma outputSourceLineNumber\nlong a=5;\nif (a){\nwhile (a<5) {\n a--;\n }\n a--;\n}\n#pragma optimizationLevel 0\n' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n^comment line 2\nSET @a #0000000000000005\n^comment line 3\nBZR $a :__if1_endif\n__if1_start:\n^comment line 4\n__loop2_continue:\nSET @r0 #0000000000000005\nBGE $a $r0 :__loop2_break\n__loop2_start:\n^comment line 5\nDEC @a\nJMP :__loop2_continue\n__loop2_break:\n^comment line 7\nDEC @a\n__if1_endif:\nFIN\n' + it('should compile: verboseAssembly', () => { + const code = '#pragma verboseAssembly\nlong a=5;\nif (a){\nwhile (a<5) {\n a--;\n }\n a--;\n}\n#pragma optimizationLevel 0\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n^comment line 2 long a=5;\nSET @a #0000000000000005\n^comment line 3 if (a){\nBZR $a :__if1_endif\n__if1_start:\n^comment line 4 while (a<5) {\n__loop2_continue:\nSET @r0 #0000000000000005\nBGE $a $r0 :__loop2_break\n__loop2_start:\n^comment line 5 a--;\nDEC @a\nJMP :__loop2_continue\n__loop2_break:\n^comment line 7 a--;\nDEC @a\n__if1_endif:\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) @@ -209,9 +209,9 @@ describe('#pragma', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) - it('should compile: outputSourceLineNumber', () => { - const code = '#pragma outputSourceLineNumber true\n long a;\n if (a) a++;\n a++;\n#pragma optimizationLevel 0\n' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n^comment line 3\nBZR $a :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\n^comment line 4\nINC @a\nFIN\n' + it('should compile: verboseAssembly', () => { + const code = '#pragma verboseAssembly true\n long a;\n if (a) a++;\n a++;\n#pragma optimizationLevel 0\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n^comment line 3 if (a) a++;\nBZR $a :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\n^comment line 4 a++;\nINC @a\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) diff --git a/src/codeGenerator/codeGenerator.ts b/src/codeGenerator/codeGenerator.ts index 65ee519..fd9fe65 100644 --- a/src/codeGenerator/codeGenerator.ts +++ b/src/codeGenerator/codeGenerator.ts @@ -86,10 +86,10 @@ export default function codeGenerator (Program: CONTRACT) { } function writeAsmLine (lineContent: string, sourceCodeLine: number = 0) { - if (Program.Config.outputSourceLineNumber === true && + if (Program.Config.verboseAssembly === true && sourceCodeLine !== 0 && sourceCodeLine !== GlobalCodeVars.currSourceLine) { - GlobalCodeVars.assemblyCode += `^comment line ${sourceCodeLine}\n` + GlobalCodeVars.assemblyCode += `^comment line ${sourceCodeLine} ${Program.sourceLines[sourceCodeLine - 1]}\n` GlobalCodeVars.currSourceLine = sourceCodeLine } GlobalCodeVars.assemblyCode += lineContent + '\n' @@ -99,10 +99,10 @@ export default function codeGenerator (Program: CONTRACT) { if (lines.length === 0) { return } - if (Program.Config.outputSourceLineNumber === true && + if (Program.Config.verboseAssembly === true && sourceCodeLine !== 0 && sourceCodeLine !== GlobalCodeVars.currSourceLine) { - GlobalCodeVars.assemblyCode += `^comment line ${sourceCodeLine}\n` + GlobalCodeVars.assemblyCode += `^comment line ${sourceCodeLine} ${Program.sourceLines[sourceCodeLine - 1]}\n` GlobalCodeVars.currSourceLine = sourceCodeLine } GlobalCodeVars.assemblyCode += lines diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index c19a979..486b3cf 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -209,8 +209,8 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { case 'version': Program.Config.sourcecodeVersion = MacroToken.value return false - case 'outputSourceLineNumber': - Program.Config.outputSourceLineNumber = bool + case 'verboseAssembly': + Program.Config.verboseAssembly = bool return true default: throw new Error(`At line: ${MacroToken.line}.` + diff --git a/src/smartc.ts b/src/smartc.ts index ae11043..cfe2231 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -39,6 +39,7 @@ export class SmartC { private preAssemblyCode?: string private MachineCode?: MACHINE_OBJECT private Program: CONTRACT = { + sourceLines: [], Global: { BuiltInFunctions: [], APIFunctions: [], @@ -66,11 +67,12 @@ export class SmartC { PUserStackPages: 0, PCodeStackPages: 0, PCodeHashId: '', - outputSourceLineNumber: false + verboseAssembly: false } } constructor (Options: { language: 'C' | 'Assembly', sourceCode: string }) { + this.Program.sourceLines = Options.sourceCode.split('\n') this.language = Options.language this.sourceCode = Options.sourceCode } diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index 3f72418..a073304 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -34,8 +34,8 @@ export type SC_CONFIG = { PCodeStackPages: number, /** Machine code hash id to be matched during compilation: #program codeHashId */ PCodeHashId: string, - /** Adds a comment in generated assembly code with the respective C source code line number */ - outputSourceLineNumber: boolean, + /** Adds a comment in generated assembly code with source code line number and content */ + verboseAssembly: boolean, } export type SC_MACRO = { @@ -83,6 +83,8 @@ export type SC_GLOBAL = { } export type CONTRACT = { + /** Source code splitted by lines */ + sourceLines: string[], /** Global statements and information */ Global: SC_GLOBAL, /** Declared functions */ From 05ae01d39841a80883563f9881d216335450c109 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 7 Jun 2022 10:44:54 -0300 Subject: [PATCH 068/112] Remove pragma enableLineLabes and enableRandom Deprecated in favor of verboseAssembly --- docs/1.2-Preprocessor-directives.md | 2 -- src/__tests__/macros.a.spec.ts | 30 +------------------ .../astProcessor/setupGenCode.ts | 9 +----- src/codeGenerator/codeGenerator.ts | 10 +------ src/shaper/shaper.ts | 6 ---- src/smartc.ts | 2 -- src/typings/contractTypes.ts | 4 --- 7 files changed, 3 insertions(+), 60 deletions(-) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index 461a1bb..9d78445 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -163,8 +163,6 @@ Many arguments can be used. ## #pragma Special features used by compiler. -* `#pragma enableRandom [true/false/1/0/]`: Makes labels for jumps and conditionals receive a random value. Default value is `false`. Default behaviour is labels having an increasing number starting with 1 (number is base 36). -* `#pragma enableLineLabels [true/false/1/0/]`: Adds line number to labels in assembly. Only usefull for debug purposes. Default value is `false`. * `#pragma maxAuxVars N`: Used to tell compiler how many auxiliary variables will be available (they are used as registers). Default value is `3`, min value is `1` and max is `10`. If you are under memory pressure, try to reduce to minimal necessary for compiling. Simple contracts will use around 2 values, but this number depends on nested operations. * `#pragma maxConstVars N`: Compiler will create variable from 1 to maxConstVars. Variables will be named 'n1', 'n2', ... 'n10'. It is very usefull to use, because compiler will change all numbers references to these variables and optimize code, making code much much smaller! Default min value is `0` (deactivated) and max is `10`. * `#pragma optimizationLevel N`: Choose strategy for code optimizer. It can be between 0 and 3. diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index 43a4a6c..9240d6a 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -181,34 +181,6 @@ describe('#pragma', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) - it('should compile: enableRandom', () => { - const code = '#pragma optimizationLevel 0\n#pragma maxAuxVars 1\n#pragma enableRandom true\nlong a; if (a) a++;' - const assembly = /^\^declare r0\n\^declare a\n\nBZR \$a :__if\w{5}_endif\n__if\w{5}_start:\nINC @a\n__if\w{5}_endif:\nFIN\n$/g - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toMatch(assembly) - }) - it('should compile: enableRandom (with getJumpID in AuxVars)', () => { - const code = '#pragma optimizationLevel 0\n#pragma maxAuxVars 1\n#pragma enableRandom true\nlong a, b; b = !a;' - const assembly = /^\^declare r0\n\^declare a\n\^declare b\n\nBNZ \$a :__NOT_(\w{5})_sF\n__NOT_\1_sT:\nSET @b #0000000000000001\nJMP :__NOT_\1_end\n__NOT_\1_sF:\nCLR @b\n__NOT_\1_end:\nFIN\n$/g - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toMatch(assembly) - }) - it('should compile: enableLineLabels', () => { - const code = '#pragma enableLineLabels true\nlong a;\nif (a) a++;\n#pragma optimizationLevel 0' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nBZR $a :__if3_1_endif\n__if3_1_start:\nINC @a\n__if3_1_endif:\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) - it('should compile: enableLineLabels (getJumpId in AuxVars)', () => { - const code = '#pragma enableLineLabels true\n long a, b;\n a = !b;\n#pragma optimizationLevel 0\n' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n\nBNZ $b :__NOT_3_1_sF\n__NOT_3_1_sT:\nSET @a #0000000000000001\nJMP :__NOT_3_1_end\n__NOT_3_1_sF:\nCLR @a\n__NOT_3_1_end:\nFIN\n' - const compiler = new SmartC({ language: 'C', sourceCode: code }) - compiler.compile() - expect(compiler.getAssemblyCode()).toBe(assembly) - }) it('should compile: verboseAssembly', () => { const code = '#pragma verboseAssembly true\n long a;\n if (a) a++;\n a++;\n#pragma optimizationLevel 0\n' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\n^comment line 3 if (a) a++;\nBZR $a :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\n^comment line 4 a++;\nINC @a\nFIN\n' @@ -253,7 +225,7 @@ describe('#pragma', () => { }) test('should throw: wrong boolean value', () => { expect(() => { - const code = '#pragma enableLineLabels 10\nlong a;\nif (a) a++;' + const code = '#pragma APIFunctions 10\nlong a;\nif (a) a++;' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() }).toThrowError(/^At line/) diff --git a/src/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts index d27c2b4..44929e6 100644 --- a/src/codeGenerator/astProcessor/setupGenCode.ts +++ b/src/codeGenerator/astProcessor/setupGenCode.ts @@ -146,15 +146,8 @@ export default function setupGenCode ( function auxvarsGetNewJumpID (line: number) : string { // This code shall be equal GlobalCodeVars.getNewJumpID() - let id = '' - if (Globals.Program.Config.enableLineLabels) { - id += line + '_' - } - if (Globals.Program.Config.enableRandom === true) { - return id + Math.random().toString(36).substr(2, 5) - } AuxVars.jumpId++ - return id + AuxVars.jumpId.toString(36) + return AuxVars.jumpId.toString(36) } return setupGenCodeMain() diff --git a/src/codeGenerator/codeGenerator.ts b/src/codeGenerator/codeGenerator.ts index fd9fe65..2857921 100644 --- a/src/codeGenerator/codeGenerator.ts +++ b/src/codeGenerator/codeGenerator.ts @@ -21,16 +21,8 @@ export default function codeGenerator (Program: CONTRACT) { currSourceLine: 0, getNewJumpID: function (line: number) { // Any changes here, also change function auxvarsGetNewJumpID - let id = '' - if (this.Program.Config.enableLineLabels) { - id += line + '_' - } - if (this.Program.Config.enableRandom === true) { - return id + Math.random().toString(36).substr(2, 5) - } - this.jumpId++ - return id + this.jumpId.toString(36) + return this.jumpId.toString(36) }, getLatestLoopID: function () { // error check must be in code! diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 486b3cf..4590c80 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -194,12 +194,6 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { case 'reuseAssignedVar': Program.Config.reuseAssignedVar = bool return true - case 'enableRandom': - Program.Config.enableRandom = bool - return true - case 'enableLineLabels': - Program.Config.enableLineLabels = bool - return true case 'optimizationLevel': if (num >= 0 && num <= 3) { Program.Config.optimizationLevel = num diff --git a/src/smartc.ts b/src/smartc.ts index cfe2231..a3177f7 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -52,8 +52,6 @@ export class SmartC { // Default configuration for compiler Config: { compilerVersion: '2.0-dev', - enableRandom: false, - enableLineLabels: false, maxAuxVars: 3, maxConstVars: 0, optimizationLevel: 2, diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index a073304..a8c7d0d 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -3,10 +3,6 @@ import { DECLARATION_TYPES, MEMORY_SLOT, SENTENCES, TOKEN, TYPE_DEFINITIONS } fr export type SC_CONFIG = { /** Hardcoded compiler version!!! */ compilerVersion: string, - /** Add random string to labels: #pragma enableRandom */ - enableRandom: boolean, - /** Add line number to labels: #pragma enableLineLabels */ - enableLineLabels: boolean, /** Number of auxiliary vars to be declared by compiler: #pragma maxAuxVars */ maxAuxVars: number, /** Number of auxiliary Constants to be declared by compiler: #pragma maxConstVars */ From c5f878973e998d788062c800137500ddef73350e Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 7 Jun 2022 20:21:48 -0300 Subject: [PATCH 069/112] Bump rc4 version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a8a059..8819949 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc3", + "version": "2.0.0-rc4", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 85a32687e759e01ab2df4c71dcaee2c9c1d97b46 Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 10 Jun 2022 17:07:57 -0300 Subject: [PATCH 070/112] Fix empty argument on macro definition --- .../__tests__/preprocessor.spec.ts | 23 +++++++++++++++++++ src/preprocessor/preprocessor.ts | 14 +++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/preprocessor/__tests__/preprocessor.spec.ts b/src/preprocessor/__tests__/preprocessor.spec.ts index 820fa69..9c757ea 100644 --- a/src/preprocessor/__tests__/preprocessor.spec.ts +++ b/src/preprocessor/__tests__/preprocessor.spec.ts @@ -37,6 +37,11 @@ describe('preprocessor right tests', () => { const result = '\nlong a,b,c;\na = (((b) << 8) | (c));\n' expect(preprocessor(code)).toBe(result) }) + it('#define macro (empty argument)', () => { + const code = '#define DEF() (Get_Current_Timestamp( ) >> 32)\nlong a;\na = DEF() ;\n' + const result = '\nlong a;\na = (Get_Current_Timestamp( ) >> 32) ;\n' + expect(preprocessor(code)).toBe(result) + }) it('#define macro (complex)', () => { const code = '#define DEF(top, bottom) (((top) << 8) | (bottom))\nlong a,b,c;\na = DEF(mdv(a,b, c), c) + DEF(22, 25);\n' const result = '\nlong a,b,c;\na = (((mdv(a,b, c)) << 8) | (c)) + (((22) << 8) | (25));\n' @@ -173,4 +178,22 @@ describe('preprocessor wrong code', () => { preprocessor(code) }).toThrowError(/^At line/) }) + test('macro wrong numbers of arguments (empty)', () => { + expect(() => { + const code = '#define getCurrentBlock( ) (Get_Block_Timestamp() >> 32)\n long a; a = getCurrentBlock( s );' + preprocessor(code) + }).toThrowError(/^At line/) + }) + test('macro wrong numbers of arguments (empty, something)', () => { + expect(() => { + const code = '#define getCurrentBlock( , a ) (Get_Block_Timestamp(a) >> 32)\n long ll; ll = getCurrentBlock( ll , ll );' + preprocessor(code) + }).toThrowError(/^At line/) + }) + test('macro wrong numbers of arguments (something, empty)', () => { + expect(() => { + const code = '#define getCurrentBlock( a) (Get_Block_Timestamp(a) >> 32)\n long ll; ll = getCurrentBlock( ll , );' + preprocessor(code) + }).toThrowError(/^At line/) + }) }) diff --git a/src/preprocessor/preprocessor.ts b/src/preprocessor/preprocessor.ts index 792a43f..99cefe0 100644 --- a/src/preprocessor/preprocessor.ts +++ b/src/preprocessor/preprocessor.ts @@ -28,7 +28,7 @@ export default function preprocessor (sourcecode: string) : string { const preprocessorCodes: PREPROCESSOR_RULE[] = [ // Regex order is important! { regex: /^\s*#\s*define\s+(\w+)\s*$/, type: 'DEFINE_NULL' }, - { regex: /^\s*#\s*define\s+(\w+)\s*(\([^)]+\))\s*(\(.+\))\s*$/, type: 'DEFINE_MACRO' }, + { regex: /^\s*#\s*define\s+(\w+)\s*(\([^)]*\))\s*(\(.+\))\s*$/, type: 'DEFINE_MACRO' }, { regex: /^\s*#\s*define\s+(\w+\b)(.+)$/, type: 'DEFINE_VAL' }, { regex: /^\s*#\s*undef\s+(\w+)\s*$/, type: 'UNDEF' }, { regex: /^\s*#\s*ifdef\s+(\w+)\s*$/, type: 'IFDEF' }, @@ -153,11 +153,21 @@ export default function preprocessor (sourcecode: string) : string { if (currChar === ')') { pLevel-- if (pLevel === 0) { - argArray.push(currArg.trim()) + const endArg = currArg.trim() + if (endArg.length === 0 && argArray.length !== 0) { + throw new Error(`At line: ${line + 1}. Found empty argument on macro declaration.`) + } + if (endArg.length !== 0) { + argArray.push(currArg.trim()) + } break } } if (currChar === ',' && pLevel === 1) { + const newArg = currArg.trim() + if (newArg.length === 0) { + throw new Error(`At line: ${line + 1}. Found empty argument on macro declaration.`) + } argArray.push(currArg.trim()) currArg = '' continue From 29592c0d45bd2476a3f0233b8a79ad61e969d0e7 Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 10 Jun 2022 17:18:46 -0300 Subject: [PATCH 071/112] Bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8819949..b4bf1e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc4", + "version": "2.0.0-rc5", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From ec4db609ab1f310689e541080dc83852b957307e Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 10 Jun 2022 22:48:02 -0300 Subject: [PATCH 072/112] Fixing mdv createInstruction --- src/__tests__/functions.b.spec.ts | 14 ++++++++++++++ .../assemblyProcessor/createInstruction.ts | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index 2579bee..40e878d 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -105,6 +105,13 @@ describe('Built-in functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: mdv() (using flatmem)', () => { + const code = '#pragma optimizationLevel 0\nlong a, b, c, d; a = mdv(2, 4, 6);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n^declare d\n\nSET @r0 #0000000000000002\nSET @a $r0\nSET @r1 #0000000000000004\nSET @r2 #0000000000000006\nMDV @a $r1 $r2\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) it('should compile: pow()', () => { const code = '#pragma optimizationLevel 0\nlong a, b, c; a=pow(b,c);' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @a $b\nPOW @a $c\nFIN\n' @@ -112,6 +119,13 @@ describe('Built-in functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: pow() (using flatmem)', () => { + const code = '#pragma optimizationLevel 0\nlong a, b, c; a=pow(2,4);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare c\n\nSET @r0 #0000000000000002\nSET @a $r0\nSET @r1 #0000000000000004\nPOW @a $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) it('should compile: powf()', () => { const code = '#pragma optimizationLevel 0\nlong a, b; fixed fc; a=powf(b,fc);' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n^declare fc\n\nSET @a $b\nPOW @a $fc\nFIN\n' diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index a41e4fc..7823616 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -126,14 +126,15 @@ export function createBuiltInInstruction ( case 'pow': case 'powf': assemblyCode = tempArgsMem[0].asmCode + - tempArgsMem[1].asmCode + `SET @${RetMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + tempArgsMem[1].asmCode + `POW @${RetMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` break case 'mdv': assemblyCode = tempArgsMem[0].asmCode + - tempArgsMem[1].asmCode + `SET @${RetMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + tempArgsMem[1].asmCode + + tempArgsMem[2].asmCode + `MDV @${RetMem.asmName} $${tempArgsMem[1].FlatMem.asmName} $${tempArgsMem[2].FlatMem.asmName}\n` break case 'memcopy': From 565020198314a784041c2e351c316d895f8b4274 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 11 Jun 2022 20:57:23 -0300 Subject: [PATCH 073/112] Bug 29 touch up --- src/__tests__/bugfixes.a.spec.ts | 7 +++++++ src/codeGenerator/utils.ts | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/__tests__/bugfixes.a.spec.ts b/src/__tests__/bugfixes.a.spec.ts index b4e9d2b..0cb0919 100644 --- a/src/__tests__/bugfixes.a.spec.ts +++ b/src/__tests__/bugfixes.a.spec.ts @@ -234,6 +234,13 @@ describe('Tests for bugfixes', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: bug 29 Must reuse assigned var if it is struct and present at both sides', () => { + const code = '#pragma optimizationLevel 0\nstruct TXINFO { long txId, timestamp, deadline, sender; } currentTX; currentTX.deadline = currentTX.txId >> 1;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare currentTX_txId\n^declare currentTX_timestamp\n^declare currentTX_deadline\n^declare currentTX_sender\n\nSET @currentTX_deadline $currentTX_txId\nSET @r0 #0000000000000001\nSHR @currentTX_deadline $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) test('should throw: bug 30 Internal functions not setting right return type', () => { expect(() => { const code = '#include APIFunctions\nlong a, *b; b = Get_A1();' diff --git a/src/codeGenerator/utils.ts b/src/codeGenerator/utils.ts index bd09171..cb9e918 100644 --- a/src/codeGenerator/utils.ts +++ b/src/codeGenerator/utils.ts @@ -317,7 +317,9 @@ export default { } function lookupAsn (InspAst: LOOKUP_ASN): boolean { const parts = vname.split('_') - if (parts.find(part => part === InspAst.Token.value)) { + const idx = parts.findIndex(part => part === InspAst.Token.value) + if (idx !== -1 && /^\d+$/.test(parts[idx + 1])) { + // Inpect next part. If is number, it is an array. Cancel reuseAssignedVar return false } const CanReuse = InspAst.modifiers.find(CurrentModifier => { From 6d7c3840bc8c82bfa452afafb22b18d46db0394f Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 11 Jun 2022 23:14:37 -0300 Subject: [PATCH 074/112] Avoid error with ^program directives for sc-simulator --- src/__tests__/assembly.a.spec.ts | 8 ++++++++ src/assembler/assembler.ts | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/__tests__/assembly.a.spec.ts b/src/__tests__/assembly.a.spec.ts index dc3f211..1921111 100644 --- a/src/__tests__/assembly.a.spec.ts +++ b/src/__tests__/assembly.a.spec.ts @@ -130,6 +130,14 @@ describe('Assembly compilation:', () => { expect(result.UserStackPages).toBe(10) expect(result.CodeStackPages).toBe(10) }) + it('should compile: reserved ^program directives for sc-simulator', () => { + const code = '^program creator 555\n^program contract 121314\nFIN\n' + const MachineCode = '28' + const MachineData = '' + const result = new SmartC({ language: 'Assembly', sourceCode: code }).compile().getMachineCode() + expect(result.ByteCode).toBe(MachineCode) + expect(result.ByteData).toBe(MachineData) + }) it('should compile: hashMachineCode test', () => { const code = '^declare var00\n^declare var01\n^declare var02\n^declare var03\n^declare var04\n^declare var05\n\nFUN set_B1 $var05\nFUN send_All_to_Address_in_B\nFIN' const result = new SmartC({ language: 'Assembly', sourceCode: code }).compile().getMachineCode() diff --git a/src/assembler/assembler.ts b/src/assembler/assembler.ts index d5a643f..ec10ba7 100644 --- a/src/assembler/assembler.ts +++ b/src/assembler/assembler.ts @@ -356,6 +356,10 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { AsmObj.PCodeHashId = parts[2].trim() AsmObj.PCodeHashIdLine = line break + case 'creator': + case 'contract': + // Reserved for use in SC-Simulator. Do nothing here + break default: throw new Error(`assembler() error #7. Unknow '^program' directive: '${parts[1]}'`) } From 35bfb597e513742e9496ff0f77508cc8bd0c4b46 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 12 Jun 2022 20:55:48 -0300 Subject: [PATCH 075/112] Bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b4bf1e8..68c779f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc5", + "version": "2.0.0-rc6", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From feb52440c71741b6dbb3b852d934e7e2aaa4eeb9 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 15 Jun 2022 19:13:52 -0300 Subject: [PATCH 076/112] Adding #program creator and #program contract --- docs/1.2-Preprocessor-directives.md | 2 ++ src/__tests__/macros.a.spec.ts | 7 +++++++ src/codeGenerator/codeGenerator.ts | 6 ++++++ src/shaper/shaper.ts | 6 ++++++ src/smartc.ts | 2 ++ src/typings/contractTypes.ts | 4 ++++ 6 files changed, 27 insertions(+) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index 9d78445..9248913 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -14,6 +14,8 @@ A value is mandatory for deployment. Use `0` to make this information available at assembly output (during development). Use the actual number if you plan do distribute the source code, so the compiler will raise an error on divergency. This is optional. +* `#program creator N`: Valid only in SC-Simulator. N must be decimal number. When set, this will set the creator ID of the contract. Use to simulate many contracts deployed from diferent users. It is ignored in machine code generation or during actual deployment. +* `#program contract N`: Valid only in SC-Simulator. N must be decimal number. When set, this will set the contract ID. Use if deploying many contracts, then the deployment can be made in any order. It is ignored in machine code generation or during actual deployment. * `#program codeStackPages N`: Code pages are used during function calls, to store the instruction pointer return position (also know as Program Counter). Default value is zero if not needed, or one if needed. Every page allows to store 16 values. Tweak this value if using many nested functions or recursive functions. Maximum value is 10 pages. * `#program userStackPages N`: User pages are used during function calls to pass arguments values, to store function return value, or to store function scope variables during recursive calls. Default value is zero if not needed, or one if needed. Tweak this value if using more than 16 arguments on functions or recursive functions. Maximum value is 10 pages. diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index 9240d6a..0d66b75 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -87,6 +87,13 @@ describe('#program', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: creator and contract', () => { + const code = '#pragma optimizationLevel 0\n#program creator 10 \n#program contract 9223372036854775808 \nlong a; void test(void) { a++; return; a++; }' + const assembly = '^program creator 10\n^program contract 9223372036854775808\n^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFIN\n\n__fn_test:\nINC @a\nRET\nINC @a\nRET\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) it('should compile: codeStackPages userStackPages ', () => { const code = '#pragma optimizationLevel 0\n#program codeStackPages 0 \n#program userStackPages 5\n long a; void test(long aa) { a++; return; a++; }' const assembly = '^program userStackPages 5\n^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare test_aa\n\nFIN\n\n__fn_test:\nPOP @test_aa\nINC @a\nRET\nINC @a\nRET\n' diff --git a/src/codeGenerator/codeGenerator.ts b/src/codeGenerator/codeGenerator.ts index 2857921..d2f4c6a 100644 --- a/src/codeGenerator/codeGenerator.ts +++ b/src/codeGenerator/codeGenerator.ts @@ -111,6 +111,12 @@ export default function codeGenerator (Program: CONTRACT) { if (Program.Config.PActivationAmount !== '') { writeAsmLine('^program activationAmount ' + Program.Config.PActivationAmount) } + if (Program.Config.PCreator !== '') { + writeAsmLine(`^program creator ${Program.Config.PCreator}`) + } + if (Program.Config.PContract !== '') { + writeAsmLine(`^program contract ${Program.Config.PContract}`) + } if (Program.Config.PUserStackPages !== 0) { writeAsmLine(`^program userStackPages ${Program.Config.PUserStackPages}`) } diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 4590c80..29f6344 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -233,6 +233,12 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { case 'activationAmount': Program.Config.PActivationAmount = parseDecimalNumber(MacroToken.value, MacroToken.line).value.toString(10) return + case 'creator': + Program.Config.PCreator = parseDecimalNumber(MacroToken.value, MacroToken.line).value.toString(10) + return + case 'contract': + Program.Config.PContract = parseDecimalNumber(MacroToken.value, MacroToken.line).value.toString(10) + return case 'userStackPages': if (/^\d\s*$|^10\s*$/.test(MacroToken.value)) { Program.Config.PUserStackPages = Number(MacroToken.value) diff --git a/src/smartc.ts b/src/smartc.ts index a3177f7..96d8b1a 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -62,6 +62,8 @@ export class SmartC { PName: '', PDescription: '', PActivationAmount: '', + PCreator: '', + PContract: '', PUserStackPages: 0, PCodeStackPages: 0, PCodeHashId: '', diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index a8c7d0d..88916bd 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -24,6 +24,10 @@ export type SC_CONFIG = { PDescription: string, /** Program activationAmount: #program activationAmount */ PActivationAmount: string, + /** Program creator: Used only in SC-Simulator. Ignored in machine code output. */ + PCreator: string, + /** Program contract ID: Used only in SC-Simulator. Ignored in machine code output. */ + PContract: string, /** User stack pages to be available: #program userStackPages */ PUserStackPages: number, /** Code stack pages to be available:: #program codeStackPages */ From 904666ea18fa040b99a63dcabe29a0519fdc5eef Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 15 Jun 2022 23:06:04 -0300 Subject: [PATCH 077/112] Updating tutorial --- docs/1-Basis.md | 4 +- docs/1.2-Preprocessor-directives.md | 4 +- docs/1.5-Built-in-functions.md | 4 +- docs/2-API-Pseudo-Code.md | 4 +- docs/3-Learning-with-examples.md | 124 +++++++++++++------------ docs/4-Functions-repository.md | 32 ++++++- docs/5-Comprehensive-example.md | 134 +++++++++++++++------------- docs/6-Deeper-into-SmartC.md | 4 +- docs/Non-Technical-FAQ.md | 4 +- 9 files changed, 179 insertions(+), 135 deletions(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index 734363f..fdf168c 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -1,4 +1,4 @@ -[Back](./) +[Back](./README.md) ## Language rules This project aims to be as close to C as possible. But given special characteristics in Signum assembly language (derived from CIYAM) some differences will occur. @@ -78,4 +78,4 @@ This can save one instruction for each use and also make your code smaller. But * Run testcases to check tested operations. It shall be no failed cases. * Please report a bug if any strange behavior is found. -[Back](./) +[Back](./README.md) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index 9248913..325ed5d 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -1,4 +1,4 @@ -[Back](./) +[Back](./README.md) # Preprocessor Some special features can be enabled/disable via preprocessor directives. @@ -179,4 +179,4 @@ Special features used by compiler. ### Escaping new line Just end a line with `\` and it will be joined to the next one. It can be used anywhere, even inside "strings". Usefull for multiline program description, #define for a macro, or in middle of a variable name! -[Back](./) +[Back](./README.md) diff --git a/docs/1.5-Built-in-functions.md b/docs/1.5-Built-in-functions.md index b0285e2..c5d23e2 100644 --- a/docs/1.5-Built-in-functions.md +++ b/docs/1.5-Built-in-functions.md @@ -1,4 +1,4 @@ -[Back](./) +[Back](./README.md) # Built-in functions Since version 2.0 some built-in functions were added. @@ -64,4 +64,4 @@ Creates a binary casting (do not change values in memory) from a long value to f * Examples: * `fixed val; val = bcltof(5000_0000);` Output: val will have content 0.5. -[Back](./) +[Back](./README.md) diff --git a/docs/2-API-Pseudo-Code.md b/docs/2-API-Pseudo-Code.md index 3de5ec3..323b8cc 100644 --- a/docs/2-API-Pseudo-Code.md +++ b/docs/2-API-Pseudo-Code.md @@ -1,4 +1,4 @@ -[Back](./) +[Back](./README.md) # API Functions pseudo code operations This documentation applies to Signum AT version 3. @@ -644,4 +644,4 @@ long Get_Asset_Circulating(void) { } ``` -[Back](./) +[Back](./README.md) diff --git a/docs/3-Learning-with-examples.md b/docs/3-Learning-with-examples.md index 36fb94c..1d8d92f 100644 --- a/docs/3-Learning-with-examples.md +++ b/docs/3-Learning-with-examples.md @@ -1,7 +1,7 @@ -[Back](./) +[Back](./README.md) # Lessons and examples to create smart contracts in Signum network -Following guide will show examples with progressive complexity and comments how they works. It is expected that you know C language. It is a good idea to read all docs from SmartC. If you plan to debug programs it is good to read also ciyam official documentation available [here](https://ciyam.org/at/) for more specific knowledge in assembly code. There is also some videos compiling these examples at my [personal Youtube channel](https://www.youtube.com/playlist?list=PLyu0NNtb1eg3Gcg2JCrOle8MjtuFPb-Gi). +Following guide will show examples with progressive complexity and comments how they works. It is expected that you know C language. It is a good idea to read all docs from SmartC. If you plan to be expert, read ciyam official documentation available [here](https://ciyam.org/at/) and Signum [SIP-37](https://github.com/signum-network/SIPs/blob/master/SIP/sip-37.md), [SIP-38](https://github.com/signum-network/SIPs/blob/master/SIP/sip-38.md), [SIP-39](https://github.com/signum-network/SIPs/blob/master/SIP/sip-39.md) for major changes introduced in JUN/2022. There is also some videos compiling these examples at my [personal Youtube channel](https://www.youtube.com/playlist?list=PLyu0NNtb1eg3Gcg2JCrOle8MjtuFPb-Gi). ## Basic contracts @@ -49,9 +49,7 @@ void main(void) { #include APIFunctions void main(void) { - for (A_To_Tx_After_Timestamp(currentTX.timestamp); Get_A1() != 0; A_To_Tx_After_Timestamp(currentTX.timestamp)) { - // Update transaction variables - getTxDetails(); + while (getNextTxDetails()) { // Process transaction in a specific function processTX(); } @@ -71,10 +69,16 @@ struct TXINFO { message[4]; } currentTX; -// A must have a TX_Timestamp! -void getTxDetails(void) { - currentTX.amount = Get_Amount_For_Tx_In_A(); +/* Checks if there is a new transaction. If there is, fill currentTX struct + and returns true. Returns false otherwise. */ +long getNextTxDetails(void) { + // Do not change the value of currentTX.timestamp on your code!!! + A_To_Tx_After_Timestamp(currentTX.timestamp); + if (Get_A1() == 0) { + return false; + } currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); + currentTX.amount = Get_Amount_For_Tx_In_A(); Message_From_Tx_In_A_To_B(); currentTX.message[0]=Get_B1(); currentTX.message[1]=Get_B2(); @@ -82,13 +86,14 @@ void getTxDetails(void) { currentTX.message[3]=Get_B4(); B_To_Address_Of_Tx_In_A(); currentTX.sender = Get_B1(); + return true; } ``` * To get details from incoming transaction, we will use the API functions. Tell the compiler you will need them with macro `#include APIFunctions`. -* It is presented the function `getTxDetails()` that will get all details from incoming message to a global variable `currentTX`. This struct has members to store all information that can be retrieved from a TX. Remember to comment values not needed you your code, because every API call costs 0.00735 signa to be executed. +* It is presented the function `getTxDetails()` that will get all details from incoming message to a global variable `currentTX`. This struct has members to store information that can be retrieved from a TX. Remember to comment values not needed you your code, because every API call costs 0.01 signa to be executed. * The `main` function will loop thru all TX received in same block. When the API `A_To_Tx_After_Timestamp` returns timestamp zero or -1, it means there is no more pending transactions, so the contract can be finished. * Counter value will be set to 10 during contract deployment (keyword const!). Then it will be increased for each new valid tx received. -* Global variable is used because it needs less instructions to make same thing. It is important to note, because every assembly instructions will be charged a fee of 0.000735 signa for execution and there are limitations for code and memory sizes when deploying an smart contract in the blockchain. +* Global variable is used because it needs less instructions to make same thing. It is important to note, because every assembly instructions will be charged a fee of 0.001 signa for execution and there are limitations for code and memory sizes when deploying an smart contract in the blockchain. ### Sending signa ```c @@ -96,61 +101,66 @@ void getTxDetails(void) { #program name SendSigna #program description Using a function to send signa. -#program activationAmount 2000_0000 +#program activationAmount 0.3 #include APIFunctions +#include fixedAPIFunctions -const long ONE_SIGNUM = 1_0000_0000; +B_To_Address_Of_Creator(); +long creatorId = Get_B1(); void main(void) { - for (A_To_Tx_After_Timestamp(currentTX.timestamp); Get_A1() != 0; A_To_Tx_After_Timestamp(currentTX.timestamp)) { - // Update transaction variables - getTxDetails(); - if (currentTX.amount > 5 * ONE_SIGNUM) { - // If TX is bigger than 5 signa, send 5 signa to creator and refund - // remaining amount to sender. - B_To_Address_Of_Creator(); - Send_To_Address_In_B(5 * ONE_SIGNUM); - Set_B1(currentTX.sender); - Send_To_Address_In_B(currentTX.amount - (5 * ONE_SIGNUM)); + const fixed cashBackPercent = 0.05; + while (getNextTxDetails()) { + if (currentTX.amount > 5.2) { + // If TX is bigger than 5.2 signa, refund 5% to sender + // CashBack to sender. + Set_B1_B2(currentTX.sender, 0); + F_Send_To_Address_In_B(currentTX.amount * cashBackPercent); + // Remaining to creator + Set_B1_B2(creatorId, 0); + F_Send_To_Address_In_B(currentTX.amount * (1.0 - cashBackPercent)); } else { - // Send tx amount to creator. - B_To_Address_Of_Creator(); - Send_To_Address_In_B(currentTX.amount); + // Low amount, no cashBack. + Set_B1_B2(creatorId, 0); + F_Send_To_Address_In_B(currentTX.amount); } } // After all transactions processed - if (Get_Current_Balance() > ONE_SIGNUM) { - B_To_Address_Of_Creator(); - Send_To_Address_In_B(7000_0000); + if (F_Get_Current_Balance() > 1.0) { + Set_B1_B2(creatorId, 0); + F_Send_To_Address_In_B(.7); } } struct TXINFO { long timestamp; long sender; - long amount; - long message[4]; + fixed amount; } currentTX; -// A must have a TX_Timestamp! -void getTxDetails(void) { - currentTX.amount = Get_Amount_For_Tx_In_A(); +/* Checks if there is a new transaction. If there is, fill currentTX struct + and returns true. Returns false otherwise. */ +long getNextTxDetails(void) { + // Do not change the value of currentTX.timestamp on your code!!! + A_To_Tx_After_Timestamp(currentTX.timestamp); + if (Get_A1() == 0) { + return false; + } currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0]=Get_B1(); - currentTX.message[1]=Get_B2(); - currentTX.message[2]=Get_B3(); - currentTX.message[3]=Get_B4(); + currentTX.amount = F_Get_Amount_For_Tx_In_A(); B_To_Address_Of_Tx_In_A(); currentTX.sender = Get_B1(); + return true; } ``` -* `#program activationAmount 2000_0000` ensures that only transactions with an amount greater or equal 0.2 signa will be processed. -* For every transaction, if value is greater than 5 signa, contract sends 5 signa to creator and refund excess amount to sender. Else, sends all incoming amount to creator. -* To avoid balance accumulation, when all transactions were processed, contract checks if current balance is greater than 1 signum and then sends 0.7 signa to creator. -* Signum quantity is always specified in NQT. 1 signum is 100000000 NQT. I prefer to group the 'decimal amount' in in two parts with 4 zeros for easier counting. Signa is plural of signum. +* In this contract the Signa amount is handled with fixed point variables. They have the same 8 decimal numbers the people is used to and can be calculated with operators + - * / >> and <<. +* Compiler will throw error when trying to use fixed values in the original API functions. So there is a new fixedAPIFunctions that will handle fixed numbers. +* `#program activationAmount 0.3` ensures that only transactions with an amount greater or equal 0.3 signa will be processed. +* For every transaction, if value is greater than 5.2 signa, contract sends 5 percent back to sender and the remaining 95% is sent to the creator. If the value is lower or equal to 5.2 sends all incoming amount to creator. This amount has discounted the activationAmount, so user will need to send 5.5 signa to get the cashback. +* Every transaction processed, some unspent balance will build up in the contract. To avoid this situation, when all transactions were processed, contract checks if current balance is greater than 1 signum and then sends 0.7 signa to creator. +* If not using fixed numbers, signum quantity is always specified in NQT. 1 signum is 100000000 NQT. I prefer to group the 'decimal amount' in in two parts with 4 zeros for easier counting. Signa is plural of signum. ### Sending a message ```c @@ -164,9 +174,7 @@ void getTxDetails(void) { // main loop while (true) { - for (A_To_Tx_After_Timestamp(currentTX.timestamp); Get_A1() != 0; A_To_Tx_After_Timestamp(currentTX.timestamp)) { - // Update transaction variables - getTxDetails(); + while (getNextTxDetails()) { // Process TX send_message.recipient = currentTX.sender; @@ -174,6 +182,7 @@ while (true) { Send_Message(); } // After all processed, send all balance to creator. + Clear_B(); B_To_Address_Of_Creator(); Send_All_To_Address_In_B(); } @@ -194,25 +203,26 @@ struct TXINFO { long timestamp; long sender; long amount; - long message[4]; } currentTX; -// A must have a TX_Timestamp! -void getTxDetails(void) { - currentTX.amount = Get_Amount_For_Tx_In_A(); +/* Checks if there is a new transaction. If there is, fill currentTX struct + and returns true. Returns false otherwise. */ +long getNextTxDetails(void) { + // Do not change the value of currentTX.timestamp on your code!!! + A_To_Tx_After_Timestamp(currentTX.timestamp); + if (Get_A1() == 0) { + return false; + } currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0]=Get_B1(); - currentTX.message[1]=Get_B2(); - currentTX.message[2]=Get_B3(); - currentTX.message[3]=Get_B4(); + currentTX.amount = Get_Amount_For_Tx_In_A(); B_To_Address_Of_Tx_In_A(); currentTX.sender = Get_B1(); + return true; } ``` * Presenting function `Send_Message()` thats sends a message with content in global variable `send_message`. -* If the contract sends two messages to same recipient in same block, recipient will receive only the last one. -* Messages are limited to 32 bytes, the size of superregister A. Text is encoded with UTF-8, so some characters need more than one byte. +* If the contract sends two messages to same recipient in same block, recipient will receive the concatenation of messages. +* Messages are added in pages, each page has 32 bytes, the size of superregister A. Text is encoded with UTF-8, so some characters need more than one byte. * There is no main function. The main loop will process transactions and then send all contract balance to creator. When the API `Send_All_To_Address_In_B` sends all balance, then the contract execution will stop because there is no more balance to run it (it will be frozen). When a new transaction above activation amoun is received, contract resumes execution and process all incoming transactions again. ### Sending a message and signa @@ -234,4 +244,4 @@ void Send_Message_And_Signa(long amount) { * Easy, just join the API call to send message and send signa. Function and global variable is show in example. * Signum node will join message and signa instructions and recipient will receive only one transaction. -[Back](./) +[Back](./README.md) diff --git a/docs/4-Functions-repository.md b/docs/4-Functions-repository.md index d95ee21..6bb96f2 100644 --- a/docs/4-Functions-repository.md +++ b/docs/4-Functions-repository.md @@ -1,7 +1,33 @@ -[Back](./) +[Back](./README.md) # Functions repository -These functions can be added to projects and speed up development time! +These functions and macros can be added to projects and speed up development time! + +## Macros +Macro functions are elaborated substitutions done during compilation. Check some options: + +```c + +#define getCurrentBlock() (Get_Block_Timestamp() >> 32) + +#define sendSigna(recipient, amount) (\ + Set_B1_B2(recipient, 0), \ + F_Send_To_Address_In_B(amount)) + +#define sendMessage1(recipient, m1) (\ + Clear_A_And_B(), \ + Set_B1(recipient), \ + Set_A1(m1), \ + Send_A_To_Address_In_B()) + +#define sendMessage4(recipient, m1, m2, m3, m4) (\ + Set_B1_B2(recipient, 0), \ + Set_A1_A2(m1, m2), \ + Set_A3_A4(m3, m4), \ + Send_A_To_Address_In_B()) + +// You got it! +``` ## Text to number: atol() @@ -169,4 +195,4 @@ long concat(long * source, long source_length, long * ret, long ret_length) } ``` -[Back](./) +[Back](./README.md) diff --git a/docs/5-Comprehensive-example.md b/docs/5-Comprehensive-example.md index 8e3c295..cb5d29b 100644 --- a/docs/5-Comprehensive-example.md +++ b/docs/5-Comprehensive-example.md @@ -1,11 +1,12 @@ -[Back](./) +[Back](./README.md) ```c /* ****************************************************************** * * Program: calculator.c * Author: Rui Deleterium * - * This contract is online at S-6CPX-Y8EH-6G3E-FW3R3 + * A previous version of this contract is online at + * S-6CPX-Y8EH-6G3E-FW3R3. Currently it was upgraded to SmartC v2.0 * * Contract expects a message with 3 arguments: Number Operator Number. * Arguments must have only one space between them. @@ -29,8 +30,41 @@ long ONE_SIGNUM = 1_0000_0000; long n8 = 8, n10 = 10, n255 = 0xff; -void process_TX(void) { +void main(void) { + while (getNextTxDetails()) { + process_TX(); + } + //clean_up(); +} + +struct TXINFO { + long timestamp; + long sender; + long amount; + long message[4]; +} currentTX; + +/* Checks if there is a new transaction. If there is, fill currentTX struct + and returns true. Returns false otherwise. */ +long getNextTxDetails(void) { + // Do not change the value of currentTX.timestamp on your code!!! + A_To_Tx_After_Timestamp(currentTX.timestamp); + if (Get_A1() == 0) { + return false; + } + currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); + currentTX.amount = Get_Amount_For_Tx_In_A(); + Message_From_Tx_In_A_To_B(); + currentTX.message[0]=Get_B1(); + currentTX.message[1]=Get_B2(); + currentTX.message[2]=Get_B3(); + currentTX.message[3]=Get_B4(); + B_To_Address_Of_Tx_In_A(); + currentTX.sender = Get_B1(); + return true; +} +void process_TX(void) { long values[3], beauty_msg[7], result; if (currentTX.message[0] == 0) { //no message @@ -53,35 +87,36 @@ void process_TX(void) { return; } - if (values[1] == "+") { - result = ltoa(atol(values[0]) + atol(values[2])); - - } else if (values[1] == "*") { - result = ltoa(atol(values[0]) * atol(values[2])); - - } else if (values[1] == "-") { - result = atol(values[0]) - atol(values[2]); - if (result < 0){ - beauty_msg[0] = '-'; - beauty_msg[1] = ltoa(-result); - concat(beauty_msg, 2, &result, 1); - } else { - result = ltoa(result); - } - - } else if (values[1] == "/") { - result = atol(values[2]); - if (result == 0) { - result = "div/0"; - } else { - result = ltoa(atol(values[0]) / result); - } - - } else { - send_message.recipient = currentTX.sender; - send_message.message[] = "Unknow operator. Use +-*/"; - Send_Message(); - return; + switch (values[1]) { + case "+": + result = ltoa(atol(values[0]) + atol(values[2])); + break; + case "*": + result = ltoa(atol(values[0]) * atol(values[2])); + break; + case "-": + result = atol(values[0]) - atol(values[2]); + if (result < 0){ + beauty_msg[0] = '-'; + beauty_msg[1] = ltoa(-result); + concat(beauty_msg, 2, &result, 1); + } else { + result = ltoa(result); + } + break; + case "/": + result = atol(values[2]); + if (result == 0) { + result = "div/0"; + } else { + result = ltoa(atol(values[0]) / result); + } + break; + default: + send_message.recipient = currentTX.sender; + send_message.message[] = "Unknow operator. Use +-*/"; + Send_Message(); + return; } beauty_msg[0] = values[0]; @@ -97,30 +132,11 @@ void process_TX(void) { Send_Message(); } -struct TXINFO { - long timestamp; - long sender; - long amount; - long message[4]; -} currentTX; - -// A must have a TX_Timestamp! -void getTxDetails(void) { - currentTX.amount = Get_Amount_For_Tx_In_A(); - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0]=Get_B1(); - currentTX.message[1]=Get_B2(); - currentTX.message[2]=Get_B3(); - currentTX.message[3]=Get_B4(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); -} - struct SENDMESSAGE { long recipient; long message[4]; } send_message; + void Send_Message(void) { Set_B1(send_message.recipient); Set_A1_A2(send_message.message[0], send_message.message[1]); @@ -157,7 +173,7 @@ long split(long separator, long * source, long source_length, long * ret, long r while (i_param < source_length) { act_arg = source[i_param]; chr = act_arg & 0xff; - while (chr != 0) { + while (chr != 0) { if (chr == separator){ field++; i_ret = 0; @@ -258,6 +274,7 @@ long atol(long val) } while (true); return ret; } + // Integer to ASCII (base10 positive and less than 100.000.000) // Iterative function to implement itoa() clone function in C // Expects a long. If number is negative or bigger than MAX_LTOA @@ -276,15 +293,6 @@ long ltoa(long val) } while (val != 0); return ret; } - -void main(void) { - for (A_To_Tx_After_Timestamp(currentTX.timestamp); Get_A1() != 0; A_To_Tx_After_Timestamp(currentTX.timestamp)) { - // Update transaction variables - getTxDetails(); - process_TX(); - } - //clean_up(); -} ``` -[Back](./) +[Back](./README.md) diff --git a/docs/6-Deeper-into-SmartC.md b/docs/6-Deeper-into-SmartC.md index 92e90f7..9e72c51 100644 --- a/docs/6-Deeper-into-SmartC.md +++ b/docs/6-Deeper-into-SmartC.md @@ -1,4 +1,4 @@ -[Back](./) +[Back](./README.md) ### Operators precedence Following table presents operators precedence order that are [based on C](https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence) but with some simplifications. When two or more symbols with same precedence are in an expression, the operations will be evaluated from left to right, with exception for unary operators, assignment and keyword. Example: `a=16/4/4` will be evaluated as `a=(16/4)/4`, just like in C. If in doubt, use parenthesis! @@ -48,4 +48,4 @@ Tokens are divided in groups and later on checked if their combinations are synt ### Internal object structure Please refer to typescript source code for details. -[Back](./) +[Back](./README.md) diff --git a/docs/Non-Technical-FAQ.md b/docs/Non-Technical-FAQ.md index 80a8350..ad9d25c 100644 --- a/docs/Non-Technical-FAQ.md +++ b/docs/Non-Technical-FAQ.md @@ -1,4 +1,4 @@ -[Back](./) +[Back](./README.md) # Non-Technical frequently asked questions @@ -32,4 +32,4 @@ Just set a higher minimum activation amount, to ensure the contract will have ba ### What happens if I send a value higher than activation amount to the contract? The contract will be activated in next block and do what it is programed to do. The value above the activation amount will be the value that the contract reads as transaction amount received. -[Back](./) +[Back](./README.md) From d80948e7c0f91517558a66d181161f42f068908a Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 17 Jun 2022 15:39:43 -0300 Subject: [PATCH 078/112] Allow define macro to return values --- src/__tests__/macros.a.spec.ts | 9 +++++++++ src/codeGenerator/astProcessor/binaryAsnProcessor.ts | 8 +++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/__tests__/macros.a.spec.ts b/src/__tests__/macros.a.spec.ts index 0d66b75..a8b20e8 100644 --- a/src/__tests__/macros.a.spec.ts +++ b/src/__tests__/macros.a.spec.ts @@ -261,3 +261,12 @@ describe('#include and misc', () => { }).toThrowError(/^At line/) }) }) +describe('#define macro() ()', () => { + it('should compile: macro returning value', () => { + const code = '#pragma optimizationLevel 0\n#include APIFunctions\n#define getCreator() (Clear_A(), B_To_Address_Of_Creator(), Get_B1())\n long a; if (getCreator() == 0) a++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFUN clear_A\nFUN B_to_Address_of_Creator\nFUN @r0 get_B1\nBNZ $r0 :__if1_endif\n__if1_start:\nINC @a\n__if1_endif:\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index e805256..768d637 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -51,11 +51,9 @@ export default function binaryAsnProcessor ( jumpFalse: ScopeInfo.jumpFalse, jumpTrue: ScopeInfo.jumpTrue }) - LGenObj.asmCode += RGenObj.asmCode - LGenObj.asmCode += AuxVars.getPostOperations() - // Note: RGenObj always have MemObj, because jumpTarget is undefined. - AuxVars.freeRegister(RGenObj.SolvedMem.address) - return LGenObj + RGenObj.asmCode = LGenObj.asmCode + RGenObj.asmCode + AuxVars.getPostOperations() + AuxVars.freeRegister(LGenObj.SolvedMem.address) + return RGenObj } function operatorProc () : GENCODE_SOLVED_OBJECT { From 05f01e086b1e052026b981ee8e6ace821fc56396 Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 17 Jun 2022 22:41:40 -0300 Subject: [PATCH 079/112] Simplification on templates arguments. --- src/shaper/templates.ts | 489 +++++----------------------------------- 1 file changed, 51 insertions(+), 438 deletions(-) diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index c31ce4a..ba424a7 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -60,97 +60,46 @@ export function getTypeDefinitionTemplate } +const longArg : MEMORY_SLOT = { + address: -1, + name: 'dummy', + asmName: 'dummy_dummy', + type: 'long', + scope: 'dummy', + declaration: 'long', + size: 1, + isDeclared: true +} + +const fixedArg : MEMORY_SLOT = { + address: -1, + name: 'dummy', + asmName: 'dummy_dummy', + type: 'fixed', + scope: 'dummy', + declaration: 'fixed', + size: 1, + isDeclared: true +} + export const BuiltInTemplate: SC_FUNCTION[] = [ /* Note here: asmName and name shall be the same */ { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'pow_addr1', - type: 'long', - scope: 'pow', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'pow_addr2', - type: 'long', - scope: 'pow', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg], asmName: 'pow', declaration: 'long', sentences: [], name: 'pow' }, { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'mdv_addr1', - type: 'long', - scope: 'mdf', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'mdv_addr2', - type: 'long', - scope: 'mdv', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr3', - asmName: 'mdv_addr3', - type: 'long', - scope: 'mdv', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg, longArg], asmName: 'mdv', declaration: 'long', sentences: [], name: 'mdv' }, { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'powf_addr1', - type: 'long', - scope: 'powf', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'powf_addr2', - type: 'fixed', - scope: 'powf', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, fixedArg], asmName: 'powf', declaration: 'long', sentences: [], @@ -185,36 +134,14 @@ export const BuiltInTemplate: SC_FUNCTION[] = [ name: 'memcopy' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'bcftol_addr', - type: 'fixed', - scope: 'bcftol', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'bcftol', declaration: 'long', sentences: [], name: 'bcftol' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'bcltof_addr', - type: 'long', - scope: 'bcltof', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'bcltof', declaration: 'fixed', sentences: [], @@ -305,256 +232,84 @@ export const APITableTemplate: SC_FUNCTION[] = [ name: 'Get_B4' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_A1_addr', - type: 'long', - scope: 'Set_A1', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_A1', declaration: 'void', sentences: [], name: 'Set_A1' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_A2_addr', - type: 'long', - scope: 'Set_A2', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_A2', declaration: 'void', sentences: [], name: 'Set_A2' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_A3_addr', - type: 'long', - scope: 'Set_A3', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_A3', declaration: 'void', sentences: [], name: 'Set_A3' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_A4_addr', - type: 'long', - scope: 'Set_A4', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_A4', declaration: 'void', sentences: [], name: 'Set_A4' }, { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'Set_A1_A2_addr1', - type: 'long', - scope: 'Set_A1_A2', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'Set_A1_A2_addr2', - type: 'long', - scope: 'Set_A1_A2', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg], asmName: 'set_A1_A2', declaration: 'void', sentences: [], name: 'Set_A1_A2' }, { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'Set_A3_A4_addr1', - type: 'long', - scope: 'Set_A3_A4', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'Set_A3_A4_addr2', - type: 'long', - scope: 'Set_A3_A4', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg], asmName: 'set_A3_A4', declaration: 'void', sentences: [], name: 'Set_A3_A4' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_B1_addr', - type: 'long', - scope: 'Set_B1', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_B1', declaration: 'void', sentences: [], name: 'Set_B1' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_B2_addr', - type: 'long', - scope: 'Set_B2', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_B2', declaration: 'void', sentences: [], name: 'Set_B2' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_B3_addr', - type: 'long', - scope: 'Set_B3', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_B3', declaration: 'void', sentences: [], name: 'Set_B3' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Set_B4_addr', - type: 'long', - scope: 'Set_B4', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'set_B4', declaration: 'void', sentences: [], name: 'Set_B4' }, { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'Set_B1_B2_addr1', - type: 'long', - scope: 'Set_B1_B2', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'Set_B1_B2_addr2', - type: 'long', - scope: 'Set_B1_B2', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg], asmName: 'set_B1_B2', declaration: 'void', sentences: [], name: 'Set_B1_B2' }, { - argsMemObj: [ - { - address: -1, - name: 'addr1', - asmName: 'Set_B3_B4_addr1', - type: 'long', - scope: 'Set_B3_B4', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr2', - asmName: 'Set_B3_B4_addr2', - type: 'long', - scope: 'Set_B3_B4', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg], asmName: 'set_B3_B4', declaration: 'void', sentences: [], @@ -792,18 +547,7 @@ export const APITableTemplate: SC_FUNCTION[] = [ name: 'Put_Last_Block_Hash_In_A' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'A_To_Tx_After_Timestamp_addr', - type: 'long', - scope: 'A_To_Tx_After_Timestamp', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'A_to_Tx_after_Timestamp', declaration: 'void', sentences: [], @@ -873,18 +617,7 @@ export const APITableTemplate: SC_FUNCTION[] = [ name: 'Get_Previous_Balance' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'Send_To_Address_In_B_addr', - type: 'long', - scope: 'Send_To_Address_In_B', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg], asmName: 'send_to_Address_in_B', declaration: 'void', sentences: [], @@ -912,28 +645,7 @@ export const APITableTemplate: SC_FUNCTION[] = [ name: 'Send_A_To_Address_In_B' }, { - argsMemObj: [ - { - address: -1, - name: 'addr2', - asmName: 'Add_Minutes_To_Timestamp_addr2', - type: 'long', - scope: 'Add_Minutes_To_Timestamp', - declaration: 'long', - size: 1, - isDeclared: true - }, - { - address: -1, - name: 'addr3', - asmName: 'Add_Minutes_To_Timestamp_addr3', - type: 'long', - scope: 'Add_Minutes_To_Timestamp', - declaration: 'long', - size: 1, - isDeclared: true - } - ], + argsMemObj: [longArg, longArg], asmName: 'add_Minutes_to_Timestamp', declaration: 'long', sentences: [], @@ -1083,144 +795,56 @@ export const fixedAPITableTemplate: SC_FUNCTION[] = [ name: 'F_Get_B4' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_A1_addr', - type: 'fixed', - scope: 'F_Set_A1', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_A1', declaration: 'void', sentences: [], name: 'F_Set_A1' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_A2_addr', - type: 'fixed', - scope: 'F_Set_A2', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_A2', declaration: 'void', sentences: [], name: 'F_Set_A2' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_A3_addr', - type: 'fixed', - scope: 'F_Set_A3', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_A3', declaration: 'void', sentences: [], name: 'F_Set_A3' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_A4_addr', - type: 'fixed', - scope: 'F_Set_A4', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_A4', declaration: 'void', sentences: [], name: 'F_Set_A4' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_B1_addr', - type: 'fixed', - scope: 'F_Set_B1', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_B1', declaration: 'void', sentences: [], name: 'F_Set_B1' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_B2_addr', - type: 'fixed', - scope: 'F_Set_B2', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_B2', declaration: 'void', sentences: [], name: 'F_Set_B2' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_B3_addr', - type: 'fixed', - scope: 'F_Set_B3', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_B3', declaration: 'void', sentences: [], name: 'F_Set_B3' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Set_B4_addr', - type: 'fixed', - scope: 'F_Set_B4', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'set_B4', declaration: 'void', sentences: [], @@ -1248,18 +872,7 @@ export const fixedAPITableTemplate: SC_FUNCTION[] = [ name: 'F_Get_Previous_Balance' }, { - argsMemObj: [ - { - address: -1, - name: 'addr', - asmName: 'F_Send_To_Address_In_B_addr', - type: 'fixed', - scope: 'F_Send_To_Address_In_B', - declaration: 'fixed', - size: 1, - isDeclared: true - } - ], + argsMemObj: [fixedArg], asmName: 'send_to_Address_in_B', declaration: 'void', sentences: [], From 1cee961f5ba7ade9c0627f230dfd97cae69eec9c Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 21 Jun 2022 10:59:14 -0300 Subject: [PATCH 080/112] Added easy to use built-in functions for API Functions. --- .../assemblyProcessor/createInstruction.ts | 387 +++++++++++++++++- src/shaper/shaper.ts | 21 +- src/shaper/templates.ts | 304 ++++++++++++++ 3 files changed, 710 insertions(+), 2 deletions(-) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 7823616..3c2e0cd 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -120,8 +120,20 @@ export function createBuiltInInstruction ( ) : string { let memcopyType : 'SIMPLE' | 'MIXED_LEFT' | 'MIXED_RIGHT' | 'COMPLEX' let AuxRegister: MEMORY_SLOT + let AuxRegisterA: MEMORY_SLOT + let AuxRegisterB: MEMORY_SLOT + let newJump: string + let auxFlatMem: FLATTEN_MEMORY_RETURN_OBJECT let assemblyCode = '' - const tempArgsMem = argsMem.map((VarObj) => flattenMemory(AstAuxVars, VarObj, -1)) + + switch (BuiltInToken.value) { + case 'checkSignature': + case 'distributeToHolders': + case 'distributeToHoldersFx': + return createBuiltIn4ArgsPlusInstruction(AstAuxVars, BuiltInToken, RetMem, argsMem) + } + + const tempArgsMem = argsMem.map((VarObj) => flattenMemory(AstAuxVars, VarObj, BuiltInToken.line)) switch (BuiltInToken.value) { case 'pow': case 'powf': @@ -175,6 +187,319 @@ export function createBuiltInInstruction ( break } break + case 'getNextTx': + newJump = '__GNT_' + AstAuxVars.getNewJumpID(BuiltInToken.line) + assemblyCode = 'FUN A_to_Tx_after_Timestamp $_counterTimestamp\n' + + `FUN @${RetMem.asmName} get_A1\n` + + `BZR $${RetMem.asmName} :${newJump}\n` + + 'FUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n' + + `${newJump}:\n` + break + case 'getNextTxFromBlockheight': + newJump = '__GNT_' + AstAuxVars.getNewJumpID(BuiltInToken.line) + assemblyCode = tempArgsMem[0].asmCode + if (tempArgsMem[0].FlatMem.type !== 'register') { + AuxRegister = AstAuxVars.getNewRegister() + assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + } else { + AuxRegister = tempArgsMem[0].FlatMem + } + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(32), BuiltInToken.line) + assemblyCode += auxFlatMem.asmCode + + `SHL @${AuxRegister.asmName} $${auxFlatMem.FlatMem.asmName}\n` + + `FUN A_to_Tx_after_Timestamp $${AuxRegister.asmName}\n` + + `FUN @${RetMem.asmName} get_A1\n` + + `BZR $${RetMem.asmName} :${newJump}\n` + + 'FUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n' + + `${newJump}:\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) + AstAuxVars.freeRegister(AuxRegister.address) + break + case 'getBlockheight': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_A1 $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} get_Timestamp_for_Tx_in_A\n` + AstAuxVars.freeRegister(tempArgsMem[0].FlatMem.address) + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(32), BuiltInToken.line) + assemblyCode += auxFlatMem.asmCode + + `SHR @${RetMem.asmName} $${auxFlatMem.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) + break + case 'getCurrentBlockheight': + assemblyCode = `FUN @${RetMem.asmName} get_Block_Timestamp\n` + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(32), BuiltInToken.line) + assemblyCode += auxFlatMem.asmCode + + `SHR @${RetMem.asmName} $${auxFlatMem.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) + break + case 'getAmount': + case 'getAmountFx': + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) + assemblyCode = tempArgsMem[0].asmCode + auxFlatMem.asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${auxFlatMem.FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} get_Amount_for_Tx_in_A\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) + break + case 'getSender': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_A1 $${tempArgsMem[0].FlatMem.asmName}\n` + + 'FUN B_to_Address_of_Tx_in_A\n' + + `FUN @${RetMem.asmName} get_B1\n` + break + case 'getType': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_A1 $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} get_Type_for_Tx_in_A\n` + break + case 'getCreator': + assemblyCode = 'FUN clear_A\n' + + 'FUN B_to_Address_of_Creator\n' + + `FUN @${RetMem.asmName} get_B1\n` + break + case 'getCreatorOf': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_B2 $${tempArgsMem[0].FlatMem.asmName}\n` + + 'FUN B_to_Address_of_Creator\n' + + `FUN @${RetMem.asmName} get_B1\n` + break + case 'getCodeHashOf': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_B2 $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Get_Code_Hash_Id\n` + break + case 'getWeakRandomNumber': + assemblyCode = 'FUN Put_Last_Block_GSig_In_A\n' + + `FUN @${RetMem.asmName} get_A2\n` + break + case 'getActivationOf': + case 'getActivationOfFx': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_B2 $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Get_Activation_Fee\n` + break + case 'getCurrentBalance': + case 'getCurrentBalanceFx': + assemblyCode = 'FUN clear_A\n' + + `FUN @${RetMem.asmName} get_Current_Balance\n` + break + case 'readMessage': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + 'FUN message_from_Tx_in_A_to_B\n' + AstAuxVars.freeRegister(tempArgsMem[0].FlatMem.address) + AstAuxVars.freeRegister(tempArgsMem[1].FlatMem.address) + if (argsMem[2].type === 'constant' || (argsMem[2].type === 'array' && argsMem[2].Offset === undefined)) { + argsMem[2].hexContent = assertNotUndefined(argsMem[2].hexContent) + const m1 = AstAuxVars.getMemoryObjectByLocation(argsMem[2].hexContent).asmName + const m2 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(argsMem[2].hexContent, 1)).asmName + const m3 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(argsMem[2].hexContent, 2)).asmName + const m4 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(argsMem[2].hexContent, 3)).asmName + assemblyCode += + `FUN @${m1} get_B1\n` + + `FUN @${m2} get_B2\n` + + `FUN @${m3} get_B3\n` + + `FUN @${m4} get_B4\n` + break + } + assemblyCode += tempArgsMem[2].asmCode + if (tempArgsMem[2].FlatMem.type !== 'register') { + AuxRegister = AstAuxVars.getNewRegister() + assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[2].FlatMem.asmName}\n` + } else { + AuxRegister = tempArgsMem[2].FlatMem + } + AuxRegisterA = AstAuxVars.getNewRegister() + assemblyCode += + `FUN @${AuxRegisterA.asmName} get_B1\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + + `FUN @${AuxRegisterA.asmName} get_B2\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + + `FUN @${AuxRegisterA.asmName} get_B3\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + + `FUN @${AuxRegisterA.asmName} get_B4\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + AstAuxVars.freeRegister(AuxRegister.address) + AstAuxVars.freeRegister(AuxRegisterA.address) + break + case 'sendMessage': + case 'sendAmountAndMessage': + case 'sendAmountAndMessageFx': { + let amountArg = 0 + let messageArg = 1 + let recipientArg = 2 + if (BuiltInToken.value === 'sendMessage') { + amountArg = -1 + messageArg = 0 + recipientArg = 1 + } + if (amountArg !== -1) { + assemblyCode = 'FUN clear_A\n' + + tempArgsMem[recipientArg].asmCode + + `FUN set_B1 $${tempArgsMem[recipientArg].FlatMem.asmName}\n` + + tempArgsMem[amountArg].asmCode + + `FUN send_to_Address_in_B $${tempArgsMem[amountArg].FlatMem.asmName}\n` + AstAuxVars.freeRegister(tempArgsMem[amountArg].FlatMem.address) + } else { + assemblyCode = tempArgsMem[recipientArg].asmCode + + `FUN set_B1 $${tempArgsMem[recipientArg].FlatMem.asmName}\n` + } + AstAuxVars.freeRegister(tempArgsMem[recipientArg].FlatMem.address) + assemblyCode += tempArgsMem[messageArg].asmCode + if (argsMem[messageArg].type === 'constant' || (argsMem[messageArg].type === 'array' && argsMem[messageArg].Offset === undefined)) { + const theHexContent = assertNotUndefined(argsMem[messageArg].hexContent) + const m1 = AstAuxVars.getMemoryObjectByLocation(theHexContent).asmName + const m2 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(theHexContent, 1)).asmName + const m3 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(theHexContent, 2)).asmName + const m4 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(theHexContent, 3)).asmName + assemblyCode += + `FUN set_A1_A2 $${m1} $${m2}\n` + + `FUN set_A3_A4 $${m3} $${m4}\n` + + 'FUN send_A_to_Address_in_B\n' + break + } + if (tempArgsMem[messageArg].FlatMem.type !== 'register') { + AuxRegister = AstAuxVars.getNewRegister() + assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[messageArg].FlatMem.asmName}\n` + } else { + AuxRegister = tempArgsMem[messageArg].FlatMem + } + AuxRegisterA = AstAuxVars.getNewRegister() + AuxRegisterB = AstAuxVars.getNewRegister() + assemblyCode += + `SET @${AuxRegisterA.asmName} $($${AuxRegister.asmName})\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @${AuxRegisterB.asmName} $($${AuxRegister.asmName})\n` + + `FUN set_A1_A2 $${AuxRegisterA.asmName} $${AuxRegisterB.asmName}\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @${AuxRegisterA.asmName} $($${AuxRegister.asmName})\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @${AuxRegisterB.asmName} $($${AuxRegister.asmName})\n` + + `FUN set_A3_A4 $${AuxRegisterA.asmName} $${AuxRegisterB.asmName}\n` + + 'FUN send_A_to_Address_in_B\n' + AstAuxVars.freeRegister(AuxRegister.address) + AstAuxVars.freeRegister(AuxRegisterA.address) + AstAuxVars.freeRegister(AuxRegisterB.address) + break + } + case 'sendAmount': + case 'sendAmountFx': + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) + assemblyCode = tempArgsMem[1].asmCode + auxFlatMem.asmCode + + `FUN set_B1_B2 $${tempArgsMem[1].FlatMem.asmName} $${auxFlatMem.FlatMem.asmName}\n` + + tempArgsMem[0].asmCode + + `FUN send_to_Address_in_B $${tempArgsMem[0].FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) + break + case 'sendBalance': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_B1 $${tempArgsMem[0].FlatMem.asmName}\n` + + 'FUN send_All_to_Address_in_B\n' + break + case 'getMapValue': + case 'getMapValueFx': + assemblyCode = 'FUN clear_A\n' + + tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Get_Map_Value_Keys_In_A\n` + break + case 'getExtMapValue': + case 'getExtMapValueFx': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + tempArgsMem[2].asmCode + + `FUN set_A3 $${tempArgsMem[2].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Get_Map_Value_Keys_In_A\n` + break + case 'setMapValue': + case 'setMapValueFx': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + tempArgsMem[2].asmCode + + `FUN set_A4 $${tempArgsMem[2].FlatMem.asmName}\n` + + 'FUN Set_Map_Value_Keys_In_A\n' + break + case 'issueAsset': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + tempArgsMem[2].asmCode + + `FUN set_B1 $${tempArgsMem[2].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Issue_Asset\n` + break + case 'mintAsset': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_B1_B2 $${tempArgsMem[1].FlatMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + 'FUN Mint_Asset\n' + break + case 'sendQuantity': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[2].asmCode + + `FUN set_B1_B2 $${tempArgsMem[2].FlatMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + tempArgsMem[1].asmCode + + `FUN send_to_Address_in_B $${tempArgsMem[1].FlatMem.asmName}\n` + break + case 'getAssetBalance': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_B2 $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} get_Current_Balance\n` + break + case 'getAssetHoldersCount': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_B1_B2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Get_Asset_Holders_Count\n` + break + case 'readAssets': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_A1 $${tempArgsMem[0].FlatMem.asmName}\n` + + 'FUN B_To_Assets_Of_Tx_In_A\n' + if (argsMem[1].type === 'constant' || (argsMem[1].type === 'array' && argsMem[1].Offset === undefined)) { + argsMem[1].hexContent = assertNotUndefined(argsMem[1].hexContent) + const m1 = AstAuxVars.getMemoryObjectByLocation(argsMem[1].hexContent).asmName + const m2 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(argsMem[1].hexContent, 1)).asmName + const m3 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(argsMem[1].hexContent, 2)).asmName + const m4 = AstAuxVars.getMemoryObjectByLocation(utils.addHexSimple(argsMem[1].hexContent, 3)).asmName + assemblyCode += + `FUN @${m1} get_B1\n` + + `FUN @${m2} get_B2\n` + + `FUN @${m3} get_B3\n` + + `FUN @${m4} get_B4\n` + break + } + AstAuxVars.freeRegister(tempArgsMem[0].FlatMem.address) + assemblyCode += tempArgsMem[1].asmCode + if (tempArgsMem[1].FlatMem.type !== 'register') { + AuxRegister = AstAuxVars.getNewRegister() + assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + } else { + AuxRegister = tempArgsMem[1].FlatMem + } + AuxRegisterA = AstAuxVars.getNewRegister() + assemblyCode += + `FUN @${AuxRegisterA.asmName} get_B1\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + + `FUN @${AuxRegisterA.asmName} get_B2\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + + `FUN @${AuxRegisterA.asmName} get_B3\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + + `FUN @${AuxRegisterA.asmName} get_B4\n` + + `INC @${AuxRegister.asmName}\n` + + `SET @($${AuxRegister.asmName}) $${AuxRegisterA.asmName}\n` + AstAuxVars.freeRegister(AuxRegister.address) + AstAuxVars.freeRegister(AuxRegisterA.address) + break + case 'getQuantity': + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} get_Amount_for_Tx_in_A\n` + break + case 'getAssetCirculating': + assemblyCode = tempArgsMem[0].asmCode + + `FUN set_A2 $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Get_Asset_Circulating\n` + break default: throw new Error(`Internal error at line: ${BuiltInToken.line}. Built-in function not implemented.`) } @@ -186,6 +511,66 @@ export function createBuiltInInstruction ( return assemblyCode } +/** Create assembly code for built-in functions */ +export function createBuiltIn4ArgsPlusInstruction ( + AstAuxVars: GENCODE_AUXVARS, BuiltInToken: TOKEN, RetMem: MEMORY_SLOT, argsMem: MEMORY_SLOT[] +) : string { + let auxFlatMemA: FLATTEN_MEMORY_RETURN_OBJECT + let auxFlatMemB: FLATTEN_MEMORY_RETURN_OBJECT + let assemblyCode = '' + + switch (BuiltInToken.value) { + case 'checkSignature': + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[3], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[4], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + + `FUN set_A1_A2 $${auxFlatMemA.FlatMem.asmName} $${auxFlatMemB.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[5], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[0], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + + `FUN set_A3 $${auxFlatMemA.FlatMem.asmName}\n` + + auxFlatMemB.asmCode + + `FUN set_B2 $${auxFlatMemB.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[1], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[2], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + + `FUN set_B3_B4 $${auxFlatMemA.FlatMem.asmName} $${auxFlatMemB.FlatMem.asmName}\n` + + `FUN @${RetMem.asmName} Check_Sig_B_With_A\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + return assemblyCode + case 'distributeToHolders': + case 'distributeToHoldersFx': + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[0], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[1], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + + `FUN set_B1_B2 $${auxFlatMemA.FlatMem.asmName} $${auxFlatMemB.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[2], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + + `FUN set_A1 $${auxFlatMemA.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[3], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[4], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + + `FUN set_A3_A4 $${auxFlatMemA.FlatMem.asmName} $${auxFlatMemB.FlatMem.asmName}\n` + + 'FUN Distribute_To_Asset_Holders\n' + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + return assemblyCode + default: + throw new Error('Internal error') + } +} + /** * From ParamMemObj create an memory object suitable for assembly operations (a regular long variable). * Do do rely in createInstruction, all hardwork done internally. Returns also instructions maybe needed for diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 29f6344..35187c7 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -6,7 +6,7 @@ import { } from '../typings/syntaxTypes' import { assertNotUndefined, deepCopy, parseDecimalNumber } from '../repository/repository' import { - APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate, fixedBaseTemplate, fixedAPITableTemplate + APITableTemplate, getMemoryTemplate, getTypeDefinitionTemplate, BuiltInTemplate, fixedBaseTemplate, fixedAPITableTemplate, autoCounterTemplate } from './templates' import sentencesProcessor from './sentencesProcessor' import memoryProcessor from './memoryProcessor' @@ -42,6 +42,9 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { if (Program.Config.fixedAPIFunctions || fixedDetected()) { Program.memory.push(fixedBaseTemplate) } + if (autoCounterDetected(tokenAST)) { + Program.memory.push(autoCounterTemplate) + } processGlobalCode() Program.functions.forEach(processFunctionCodeAndArguments) if (Program.Config.APIFunctions) { @@ -336,6 +339,22 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { (Tkn.type === 'Constant' && Tkn.extValue === 'fixed'))) } + /** Detects if hidden variable for timestamp loop will be needed */ + function autoCounterDetected (tokenTrain: TOKEN[] | undefined) : boolean { + if (tokenTrain === undefined) return false + return !!tokenTrain.find((Tkn) => { + if (Tkn.type === 'Variable' && (Tkn.value === 'getNextTx' || Tkn.value === 'getNextTxFromBlockheight')) { + return true + } + if (Tkn.type === 'CodeDomain') { + if (autoCounterDetected(Tkn.params) === true) { + return true + } + } + return false + }) + } + /** Process global code, transforming them into global sentences properties */ function processGlobalCode () : void { AuxVars.currentScopeName = '' diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index ba424a7..7da207e 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -71,6 +71,17 @@ const longArg : MEMORY_SLOT = { isDeclared: true } +const longPtrArg : MEMORY_SLOT = { + address: -1, + name: 'dummy', + asmName: 'dummy_dummy', + type: 'long', + scope: 'dummy', + declaration: 'long_ptr', + size: 1, + isDeclared: true +} + const fixedArg : MEMORY_SLOT = { address: -1, name: 'dummy', @@ -82,6 +93,17 @@ const fixedArg : MEMORY_SLOT = { isDeclared: true } +export const autoCounterTemplate : MEMORY_SLOT = { + address: -1, + asmName: '_counterTimestamp', + declaration: 'long', + isDeclared: true, + name: '_counterTimestamp', + scope: '', + size: 1, + type: 'long' +} + export const BuiltInTemplate: SC_FUNCTION[] = [ /* Note here: asmName and name shall be the same */ { @@ -146,6 +168,288 @@ export const BuiltInTemplate: SC_FUNCTION[] = [ declaration: 'fixed', sentences: [], name: 'bcltof' + }, + { + argsMemObj: [], + asmName: 'getNextTx', + declaration: 'long', + sentences: [], + name: 'getNextTx' + }, + { + argsMemObj: [longArg], + asmName: 'getNextTxFromBlockheight', + declaration: 'long', + sentences: [], + name: 'getNextTxFromBlockheight' + }, + { + argsMemObj: [longArg], + asmName: 'getBlockheight', + declaration: 'long', + sentences: [], + name: 'getBlockheight' + }, + { + argsMemObj: [], + asmName: 'getCurrentBlockheight', + declaration: 'long', + sentences: [], + name: 'getCurrentBlockheight' + }, + { + argsMemObj: [longArg], + asmName: 'getAmount', + declaration: 'long', + sentences: [], + name: 'getAmount' + }, + { + argsMemObj: [longArg], + asmName: 'getSender', + declaration: 'long', + sentences: [], + name: 'getSender' + }, + { + argsMemObj: [longArg], + asmName: 'getType', + declaration: 'long', + sentences: [], + name: 'getType' + }, + { + argsMemObj: [], + asmName: 'getCreator', + declaration: 'long', + sentences: [], + name: 'getCreator' + }, + { + argsMemObj: [longArg], + asmName: 'getCreatorOf', + declaration: 'long', + sentences: [], + name: 'getCreatorOf' + }, + { + argsMemObj: [longArg], + asmName: 'getCodeHashOf', + declaration: 'long', + sentences: [], + name: 'getCodeHashOf' + }, + { + argsMemObj: [], + asmName: 'getWeakRandomNumber', + declaration: 'long', + sentences: [], + name: 'getWeakRandomNumber' + }, + { + argsMemObj: [longArg], + asmName: 'getActivationOf', + declaration: 'long', + sentences: [], + name: 'getActivationOf' + }, + { + argsMemObj: [], + asmName: 'getCurrentBalance', + declaration: 'long', + sentences: [], + name: 'getCurrentBalance' + }, + { + argsMemObj: [longArg, longArg, longPtrArg], + asmName: 'readMessage', + declaration: 'void', + sentences: [], + name: 'readMessage' + }, + { + argsMemObj: [longPtrArg, longArg], + asmName: 'sendMessage', + declaration: 'void', + sentences: [], + name: 'sendMessage' + }, + { + argsMemObj: [longArg, longPtrArg, longArg], + asmName: 'sendAmountAndMessage', + declaration: 'void', + sentences: [], + name: 'sendAmountAndMessage' + }, + { + argsMemObj: [longArg, longArg], + asmName: 'sendAmount', + declaration: 'void', + sentences: [], + name: 'sendAmount' + }, + { + argsMemObj: [longArg], + asmName: 'sendBalance', + declaration: 'void', + sentences: [], + name: 'sendBalance' + }, + { + argsMemObj: [longArg, longArg], + asmName: 'getMapValue', + declaration: 'long', + sentences: [], + name: 'getMapValue' + }, + { + argsMemObj: [longArg, longArg, longArg], + asmName: 'getExtMapValue', + declaration: 'long', + sentences: [], + name: 'getExtMapValue' + }, + { + argsMemObj: [longArg, longArg, longArg], + asmName: 'setMapValue', + declaration: 'void', + sentences: [], + name: 'setMapValue' + }, + { + argsMemObj: [longArg, longArg, longArg], + asmName: 'issueAsset', + declaration: 'long', + sentences: [], + name: 'issueAsset' + }, + { + argsMemObj: [longArg, longArg], + asmName: 'mintAsset', + declaration: 'void', + sentences: [], + name: 'mintAsset' + }, + { + argsMemObj: [longArg, longArg, longArg], + asmName: 'sendQuantity', + declaration: 'void', + sentences: [], + name: 'sendQuantity' + }, + { + argsMemObj: [longArg], + asmName: 'getAssetBalance', + declaration: 'long', + sentences: [], + name: 'getAssetBalance' + }, + { + argsMemObj: [longArg, longArg, longArg, longArg, longArg, longArg], + asmName: 'checkSignature', + declaration: 'long', + sentences: [], + name: 'checkSignature' + }, + { + argsMemObj: [longArg, longArg, longArg, longArg, longArg], + asmName: 'distributeToHolders', + declaration: 'void', + sentences: [], + name: 'distributeToHolders' + }, + { + argsMemObj: [longArg, longArg], + asmName: 'getAssetHoldersCount', + declaration: 'long', + sentences: [], + name: 'getAssetHoldersCount' + }, + { + argsMemObj: [longArg, longPtrArg], + asmName: 'readAssets', + declaration: 'void', + sentences: [], + name: 'readAssets' + }, + { + argsMemObj: [longArg, longArg], + asmName: 'getQuantity', + declaration: 'long', + sentences: [], + name: 'getQuantity' + }, + { + argsMemObj: [longArg], + asmName: 'getAssetCirculating', + declaration: 'long', + sentences: [], + name: 'getAssetCirculating' + }, + + /* fixed number versions */ + { + argsMemObj: [longArg], + asmName: 'getAmountFx', + declaration: 'fixed', + sentences: [], + name: 'getAmountFx' + }, + { + argsMemObj: [longArg], + asmName: 'getActivationOfFx', + declaration: 'fixed', + sentences: [], + name: 'getActivationOfFx' + }, + { + argsMemObj: [], + asmName: 'getCurrentBalanceFx', + declaration: 'fixed', + sentences: [], + name: 'getCurrentBalanceFx' + }, + { + argsMemObj: [fixedArg, longPtrArg, longArg], + asmName: 'sendAmountAndMessageFx', + declaration: 'void', + sentences: [], + name: 'sendAmountAndMessageFx' + }, + { + argsMemObj: [fixedArg, longArg], + asmName: 'sendAmountFx', + declaration: 'void', + sentences: [], + name: 'sendAmountFx' + }, + { + argsMemObj: [longArg, longArg], + asmName: 'getMapValueFx', + declaration: 'fixed', + sentences: [], + name: 'getMapValueFx' + }, + { + argsMemObj: [longArg, longArg, longArg], + asmName: 'getExtMapValueFx', + declaration: 'fixed', + sentences: [], + name: 'getExtMapValueFx' + }, + { + argsMemObj: [longArg, longArg, fixedArg], + asmName: 'setMapValueFx', + declaration: 'void', + sentences: [], + name: 'setMapValueFx' + }, + { + argsMemObj: [longArg, longArg, fixedArg, longArg, longArg], + asmName: 'distributeToHoldersFx', + declaration: 'void', + sentences: [], + name: 'distributeToHoldersFx' } ] From 6ac1023bd6f70b7ee04a565874d5c4d09cacaa14 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 23 Jun 2022 12:03:02 -0300 Subject: [PATCH 081/112] Updated documentation for built-in and APIFunctions. --- docs/1-Basis.md | 10 +- docs/1.5-Built-in-functions.md | 482 ++++++++++++++++++++++++++++++++- docs/2-API-Pseudo-Code.md | 194 ++++++++++++- src/shaper/templates.ts | 1 + 4 files changed, 671 insertions(+), 16 deletions(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index fdf168c..c08dda4 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -49,7 +49,15 @@ As avaliable in C, the developer can make use of functions to make coding easier Functions can return also arrays and structs; the returning values can be used directly: example `if ( arrFn(a)[2] == 25 )` or `b = structFn(a)->value;` ### Built-in functions -In 2022 it was introduced two new specific instructions. They are coded in SmartC from version 2.0 as built-in functions, so no declaration is needed to use them. Check chapter 1.5. +From SmartC version 2.0 built-in functions were introduced. +No declaration is needed to use them. +They are coded to hide some internal components of Signum machine code and make the development easier. +Read the chapter (1.5-Built-in functions.md)[./1.5-Built-in-functions.md] but just after reading this one. + +### API functions +Low level functions to handle assembly level superregister. +Only needed for very complex contracts or to hand-picked optimizations code. +Read the chapter (2-API Pseudo Code.md)[./2-API-Pseudo-Code.md] only if you plan to program at low level. ### Global statements All global statements are grouped at the beginning of assembly code (even if after functions or end of file). When the contract is executed first time, it does not begin at main function, but will start at the beginning of file and run all global statements. If there is a main function, it will be then executed during this first run. If you stop execution in global statements (with `exit`), the main function will not be processed and the starting point for next transactions will be the start of code. In this case (not using main function) use `halt` keyword to wait next transaction. diff --git a/docs/1.5-Built-in-functions.md b/docs/1.5-Built-in-functions.md index c5d23e2..101ace8 100644 --- a/docs/1.5-Built-in-functions.md +++ b/docs/1.5-Built-in-functions.md @@ -1,9 +1,468 @@ [Back](./README.md) # Built-in functions -Since version 2.0 some built-in functions were added. +Since version 2.0 many built-in functions were added. +Some functions have a version to handle fixed point numbers, in special the ones to handle Signa balance. +When using the fixed point to Signa, the values are straigth-forward as used in wallets and show in block explorer, they can have up to 8 decimals. +But using the long values version, the Signa balance are handled as NQT values (1 NQT = 0.00000001 Signa). +When handling assets, all values are expressed as QNT. 1 QNT is the least quantity of asset and depends on the decimals. If decimals is set to 4, 1 QNT is 0.0001 assets. -## mdv +
+ + +## Protypes summary + + +```c +// Handling transactions loop +long getNextTx(); +long getNextTxFromBlockheight(long blockheight); + +// Receiving transactions +long getBlockheight(long transaction); +long getAmount(long transaction); +fixed getAmountFx(long transaction); +long getSender(long transaction); +long getType(long transaction); +void readMessage(long transaction, long page, long * buffer); +void readAssets(long transaction, long * buffer); +long getQuantity(long transaction, long assetId); + +// Sending transaction +void sendAmount(long amount, long accountId); +void sendAmountFx(fixed amount, long accountId); +void sendMessage(long * buffer, long accountId); +void sendAmountAndMessage(long amount, long * buffer, long accountId); +void sendAmountAndMessageFx(fixed amount, long * buffer, long accountId); +void sendBalance(long accountId); +void sendQuantity(long assetId, long quantity, long accountId); + +// Blockchain details +long getCurrentBlockheight(); +long getWeakRandomNumber(); + +// Contract details +long getCreator(); +long getCreatorOf(long contractId); +long getCodeHashOf(long contractId); +long getActivationOf(long contractId); +fixed getActivationOfFx(long contractId); +long getCurrentBalance(); +fixed getCurrentBalanceFx(); +long getAssetBalance(long assetId); + +// Using maps +void setMapValue(long key1, long key2, long value); +void setMapValueFx(long key1, long key2, fixed value); +long getMapValue(long key1, long key2); +fixed getMapValueFx(long key1, long key2); +long getExtMapValue(long key1, long key2, long contractId); +fixed getExtMapValueFx(long key1, long key2, long contractId); + +// Verifying messages +long checkSignature( + long message2, + long message3, + long message4, + long transaction, + long page, + long accountId +); + +// Handling assets +long issueAsset(long name1, long name2, long decimals); +void mintAsset(long assetId, long quantity); +void distributeToHolders( + long holdersAssetMinQuantity, + long holdersAsset, + long amountToDistribute, + long assetToDistribute, + long quantityToDistribute +); +void distributeToHoldersFx( + long holdersAssetMinQuantity, + long holdersAsset, + fixed amountToDistribute, + long assetToDistribute, + long quantityToDistribute +); +long getAssetHoldersCount(long minimumQuantity, long assetId); +long getAssetCirculating(long assetId); + +// Special instructions +long mdv(long m1, long m2, long div); +long pow(long base, long expBy1e8); +long powf(long base, fixed exp); + +// SmartC internal +void memcopy(void * destination, void * source); +long bcftol(fixed value); +fixed bcltof(long value); +``` +
+
+ + +## Handling transactions loop + + +### getNextTx +* Prototype: +`long getNextTx();` +* Description: +Keep track of incoming transactions and returns the next transaction Id. +If there is no new transaction, zero is returned. +A internal variable '_counterTimestamp' is used to store the last transaction received and it is updated by this function. +* Note: +If it is needed to come back to a given transaction later on, it is possible to save the contents of auto counter to another variable minus one. Later just overwrite the auto counter and then call `getNextTx` function. In this way it is possible to loop again thru all messages starting at that giving point. Example: +```c +// Save current loop point +currrentTransaction = getNextTx(); +rewindPoint = _counterTimestamp - 1; +// ... + +// Restore loop point +_counterTimestamp = rewindPoint; +currrentTransaction = getNextTx(); +// currrentTransaction will be the same from save point +// and all messages after that one can be visited again. +``` + +### getNextTxFromBlockheight +* Prototype: +`long getNextTxFromBlockheight(long blockheight);` +* Description: +Returns the transaction Id of the first transaction received at block 'blockheight' or later. +If there is no transaction, zero is returned. +This function also sets the internal variable '_counterTimestamp' and can be used together `getNextTx`. +
+
+ + +## Receiving transactions + + +### getBlockheight +* Prototype: +`long getBlockheight(long transaction);` +* Description: +Returns the blockheight of 'transaction'. +If transaction is invalid, 4294967295 is returned. + +### getAmount, getAmountFx +* Prototype: +`long getAmount(long transaction);` +* Fixed version prototype: +`fixed getAmountFx(long transaction);` +* Description: +Returns the Signa amount from 'transaction'. +The returned value is the original amount sent minus the activation amount from the contract. +If transaction is invalid, -1 is returned (-0.00000001 in fixed). + +### getSender +* Prototype: +`long getSender(long transaction);` +* Description: +Returns the sender's Id from 'transaction'. +If transaction is invalid, 0 is returned. + +### getType +* Prototype: +`long getType(long transaction);` +* Description: +Returns the type from 'transaction'. +All transactions types can be fetch at http api [getConstants](https://europe.signum.network/api-doc?requestTag=INFO). +If transaction is invalid, -1 is returned. + +### readMessage +* Prototype: +`void readMessage(long transaction, long page, long * buffer);` +* Description: +Reads the incoming message from 'transaction' at 'page' and store it at 'buffer'. +Each page has 32 bytes (4 longs), so the buffer size must be at least 4 longs or the function will overflow the buffer. +First page is 0 and there is no indicator of message size. Control the message expecting zeros after the end of message. +If 'page' is lower than zero or greater than 32, buffer is filled with zeros. +If 'transaction' is invalid or there is no message attached, buffer is filled with zeros. + +### readAssets +* Prototype: +`void readAssets(long transaction, long * buffer);` +* Description: +Reads all assets Id (up to 4) of 'transaction' and store them at 'buffer'. +Four values will be read, so the buffer size must be at least 4 longs or the function will overflow the buffer. +If 'transaction' is invalid, or no assets are found, buffer is filled with zeros. +If less than 4 assets are found, the firsts values will have the assetId and the remaining will be zeros. + +### getQuantity +* Prototype: +`long getQuantity(long transaction, long assetId);` +* Description: +Returns the quantity (QNT) of 'assetId' transfered in 'transaction'. +If transaction is invalid, -1 is returned. +If transaction valid and there is asset transfers that match 'assetId', zero is returned. +
+
+ + +## Sending transaction + + +### sendAmount, sendAmountFx +* Prototype: +`void sendAmount(long amount, long accountId);` +* Fixed version prototype: +`void sendAmountFx(fixed amount, long accountId);` +* Description: +Enqueues a transaction to send 'amount' of Signa to 'accountId'. +For sending Signa and Messages, only one transaction will be sent each block. The amounts are added. +If 'amount' is greater than contract's current balance, all balance is sent and contract halts execution (no gas). +No empty transactions are sent, they must send at least 1 NQT (or 0.00000001 Signa). + +### sendMessage +* Prototype: +`void sendMessage(long * buffer, long accountId);` +* Description: +Enqueues a transaction to send the content of 'buffer' as one message page (32 bytes or 4 longs) to 'accountId'. +Buffer size must be at least 4 longs or the function will overflow reading the buffer. +If the function is used more than once in a block, the messages are concatenated up to 992 bytes (31 pages). +If a 32th page is sent, the first 31 pages are disregarded and the loop restarts. +VERIFY: Transaction is sent with empty message? A empty message is one containing only zeros. + +### sendAmountAndMessage, sendAmountAndMessageFx +* Prototype: +`void sendAmountAndMessage(long amount, long * buffer, long accountId);` +* Fixed version prototype: +`void sendAmountAndMessageFx(fixed amount, long * buffer, long accountId);` +* Description: +Shorthand for use `sendAmount` and `sendMessage` (optimized code). Same restrictions apply. + +### sendBalance +* Prototype: +`void sendBalance(long accountId);` +* Description: +Enqueues a transaction to send all current balance (Signa) to 'accountId'. +Same restrictions from `sendAmount` apply. +Contract will halt execution (no gas). + +### sendQuantity +* Prototype: +`void sendQuantity(long assetId, long quantity, long accountId);` +* Description: +Sends a transaction to transfer 'quantity' of 'assetId' to 'accountId'. +If contract balance of 'assetId' is lower than 'quantity', all balance of 'assetId' is sent. +Transactions to transfer assets can not have messages or Signa attached. +If the same asset is transfered two times at same block, their quantities are added and only one transaction is sent. +Transactions from smart contracts can transfer only one asset. If two different assets are transfered in same block, two transactions will be sent. +No empty transactions are sent, they must transfer at least 1 QNT of some asset. +
+
+ + +## Blockchain details + + +### getCurrentBlockheight +* Prototype: +`long getCurrentBlockheight();` +* Description: +Returns the current blockheight when the instruction is executed. + +### getWeakRandomNumber +* Prototype: +`long getWeakRandomNumber();` +* Description: +Returns a simple random number based on last block signature. +It is very unlikely someone to tamper this number, but can be done in theory. +Attention needed for contracts dealing big amount of coins. +
+
+ + +## Contract details + + +### getCreator +* Prototype: +`long getCreator();` +* Description: +Returns the account Id of the creator from current contract. + +### getCreatorOf +* Prototype: +`long getCreatorOf(long contractId);` +* Description: +Returns the account Id of the creator of 'contractId'. +If 'contractId' is not a contract, zero is returned. + +### getCodeHashOf +* Prototype: +`long getCodeHashOf(long contractId);` +* Description: +Returns the code hash id of 'contractId'. +If 'contractId' is not a contract, zero is returned. + +### getActivationOf, getActivationOfFx +* Prototype: +`long getActivationOf(long contractId);` +* Fixed version prototype: +`fixed getActivationOfFx(long contractId);` +* Description: +Returns the minimum amount of Signa needed activate 'contractId'. +If 'contractId' is zero, it is returned the min activation amount for current contract. +If 'contractId' is not a contract, zero is returned. + +### getCurrentBalance, getCurrentBalanceFx +* Prototype: +`long getCurrentBalance();` +* Fixed version prototype: +`fixed getCurrentBalanceFx();` +* Description: +Returns the contract balance (Signa) at the time the instruction is executed. + + +### getAssetBalance +* Prototype: +`long getAssetBalance(long assetId);` +* Description: +Returns the contract balance of the given 'assetId' at the time the instruction is executed. +If 'assetId' is zero, it is returned value is the same as `getCurrentBalance`. +
+
+ + +## Using maps + + +Maps offer 'unlimited' space to store values. Each value (long) can be found using two keys (also longs) to be read or written. +Any item that was not previously set, has zero value. No deletion is possible, just set to zero if needed. + +### setMapValue, setMapValueFx +* Prototype: +`void setMapValue(long key1, long key2, long value);` +* Fixed version prototype: +`void setMapValueFx(long key1, long key2, fixed value);` +* Description: +Sets to 'value' the map at 'currentContract[key1][key2]'. + +### getMapValue, getMapValueFx +* Prototype: +`long getMapValue(long key1, long key2);` +* Fixed version prototype: +`fixed getMapValueFx(long key1, long key2);` +* Description: +Returns the value stored at the map 'currentContract[key1][key2]'. + +### getExtMapValue, getExtMapValueFx +* Prototype: +`long getExtMapValue(long key1, long key2, long contractId);` +* Fixed version prototype: +`fixed getExtMapValueFx(long key1, long key2, long contractId);` +* Description: +Get the map stored at external contract 'contractId[key1][key2]'. +If the contract has no map, or 'contractId' is not a contract, zero is returned. +Unlike the contract memory, the map values from other contracts can be retrieved using this function. +
+
+ + +## Verifying messages + + +### checkSignature +* Prototype: +```c +long checkSignature( + long message2, + long message3, + long message4, + long transaction, + long page, + long accountId +); +``` +* Description: +Checks if the signature of the given 'accountId' in 'transaction' at 'page' and 'page+1' matches for the given 'message2..4'. +Returns 1 (true) if the message is valid, 0 otherwise. +
+
+ + +## Handling assets + + +### issueAsset +* Prototype: +`long issueAsset(long name1, long name2, long decimals);` +* Description: +Issue a new asset and returns its Id. +Asset name must have between 3 and 10 chars. Only uppercase letters, lowercase letters, and numbers are allowed. +The first 8 chars are specified in 'name1' and the remaining in 'name2'. +Set 'name2' to 0 or "" if the name has 8 or less chars. +The decimal limits are 0 to 8 decimals. +It costs 150 Signa to issue an asset. The contract execution will be halted at this instruction until the balance is reached. + +### mintAsset +* Prototype: +`void mintAsset(long assetId, long quantity);` +* Description: +Mint the 'quantity' of 'assetId'. +The asset must be issued by the contract. +No negative quantity allowed. To burn them send to accountId 0. +Minted quantity is available just after the instruction. + +### distributeToHolders, distributeToHoldersFx +* Prototype: +```c +void distributeToHolders( + long holdersAssetMinQuantity, + long holdersAsset, + long amountToDistribute, + long assetToDistribute, + long quantityToDistribute +); +``` +* Fixed version prototype: +```c +void distributeToHoldersFx( + long holdersAssetMinQuantity, + long holdersAsset, + fixed amountToDistribute, + long assetToDistribute, + long quantityToDistribute +); +``` +* Description: +Distribute the Signa 'amountToDistribute' and 'quantityToDistribute' of 'assetToDistribute' to accounts that hold at least 'holdersAssetMinQuantity' of 'holdersAsset'. +If amountToDistribute and quantityToDistribute are zero, no distribution is done. +Both 'amountToDistribute' and 'quantityToDistribute' can be distributed in same transaction. +Only the free balance is taken in account, this means, if there is quantity in sell orders, they will not be considered. +If current block already has the maximum indirect transactions, no distribution is done. +If no holders have more than the minimum quantity, no distribution is done. +Configured treasury accounts will not join dividends distributed. +The 'assetToDistribute' can be the same as 'holdersAsset' and, in this case, the contract will join the distribution (verify). + + +### getAssetHoldersCount +* Prototype: +`long getAssetHoldersCount(long minimumQuantity, long assetId);` +* Description: +Returns the number of holders that have at lease 'minimumQuantity' of 'assetId'. +Only the free balance is taken in account, this means, if there is quantity in sell orders, they will not be considered. + +### getAssetCirculating +* Prototype: +`long getAssetCirculating(long assetId);` +* Description: +Returns the quantity of 'assetId' currently in circulation. +Quantities in treasury accounts are not considered. +
+
+ + +## Special instructions + + +### mdv * Prototype: `long mdv(long m1, long m2, long div);` * Description: @@ -12,7 +471,7 @@ The calculation is returned as value. * Notes: 1) This instruction will be used in optimizations, even if not explicit declared. Use this form to ensure the instruction, or check generated assembly code if in doubt. -## pow +### pow * Prototype: `long pow(long base, long expBy1e8);` * Description: @@ -26,9 +485,9 @@ Computes the value of `base` to the power of `expBy1e8`, where expBy1e8 is used 2) pow will return zero if base is negative; 3) pow will return zero if result is greater than 9223372036854775807 (max positive long). -## powf +### powf * Prototype: -`long pow(long base, fixed exp);` +`long powf(long base, fixed exp);` * Description: Same as `pow` but using fixed point number for the exponent. * Examples: @@ -39,8 +498,14 @@ Same as `pow` but using fixed point number for the exponent. 1) pow will return zero if the result is matematically undefined; 2) pow will return zero if base is negative; 3) pow will return zero if result is greater than 9223372036854775807 (max positive long). +
+
+ + +## SmartC internal + -## memcopy +### memcopy * Prototype: `void memcopy(void * destination, void * source);` * Description: @@ -48,7 +513,7 @@ Copies the binary value from source to destination. Handyful to copy variables c * Example: * `fixed f; long l; memcopy(&f, &l);` This will copy the binary data from variable `l` to `f` without transformations. If l is 50, then f will be 0.00000050. -## bcftol - binary casting fixed to long +### bcftol - binary casting fixed to long * Prototype: `long bcftol(fixed value);` * Description: @@ -56,12 +521,13 @@ Creates a binary casting (do not change values in memory) from a fixed value to * Examples: * `long val; val = bcftol(0.5);` Output: val with have content 5000_0000. -## bcltof - binary casting long to fixed +### bcltof - binary casting long to fixed * Prototype: `fixed bcltof(long value);` * Description: Creates a binary casting (do not change values in memory) from a long value to fixed. * Examples: * `fixed val; val = bcltof(5000_0000);` Output: val will have content 0.5. +
[Back](./README.md) diff --git a/docs/2-API-Pseudo-Code.md b/docs/2-API-Pseudo-Code.md index 323b8cc..5a3f6cd 100644 --- a/docs/2-API-Pseudo-Code.md +++ b/docs/2-API-Pseudo-Code.md @@ -1,10 +1,10 @@ [Back](./README.md) # API Functions pseudo code operations -This documentation applies to Signum AT version 3. +Ok, you are unleashing the full potencial of machine code. To use this functions, you must include them by `#include APIFunctions` for regular functions or `#include fixedAPIFunctions` if using the fixed version of them (prepended by 'F_'). # Keep in mind! -### A and B registers +### A and B superregisters They are 256-bit registers and can be used as one big number (called A or B) or in 64-bit pieces (called A1..A4 or B1..B4). A1 is the least significative long. They have the same "mixed" mode as long vars: unsigned for bit operations and signed for aritmetics. ### Timestamps @@ -15,10 +15,13 @@ Do not be confused by transactions timestamps, that are the number of seconds si An encrypted message to contract is the same as not sending a message. Messages are read and sent in batches of 32 bytes, they are called pages. The superregisters are used to store these values. -# Pseudo code -The code below is not valid for SmartC, but can give an idea what is happening when an API function is called. +# Pseudo code for regular functions +The code below is not valid for SmartC, but can give an idea what is happening when an API function is called. Good luck! +
+ -## Get/Set functions for "pseudo registers" +## Get/Set functions for "superregisters" + ``` c long Get_A1(void){ @@ -130,7 +133,6 @@ void Clear_A(void) { A1 = A2 = A3 = A4 = 0; } - void Clear_B(void) { // Assembly name: clear_B B1 = B2 = B3 = B4 = 0; @@ -285,8 +287,12 @@ void Div_B_By_A(void) { A = B / A; } ``` +
+
+ ## Functions that perform hash operations + ``` c void MD5_A_To_B(void) { @@ -342,8 +348,12 @@ long Check_Sig_B_With_A(void) { // Checks if the signature of [AT ID, B2, B3, B4] can be verified with the message attached on tx id in A1 (page in A2) for account id in A3 } ``` +
+
+ ## Generic functions that get block and tx info + ``` c long Get_Block_Timestamp(void) { @@ -399,7 +409,8 @@ long Get_Timestamp_For_Tx_In_A(void) { // Assembly name: get_Timestamp_for_Tx_in_A if (Blockchain.IsThisTxValid(A1) == false) return -1; - return Blockchain.GetTimestampFromTx(A1) - ContractActivationAmount;} + return Blockchain.GetTimestampFromTx(A1); +} long Get_Random_Id_For_Tx_In_A(void) { // Assembly name: get_Ticket_Id_for_Tx_in_A @@ -471,8 +482,12 @@ void B_To_Assets_Of_Tx_In_A(void) { } } ``` +
+
+ ## Generic functions that check balances and perform ops + ``` c long Get_Current_Balance(void) { @@ -643,5 +658,170 @@ long Get_Asset_Circulating(void) { */ } ``` +
+
+ + +# Pseudo code for fixed version functions + + +``` c +// Get/Set functions for "superregisters" + +fixed F_Get_A1(void){ + // Assembly name: get_A1 + return A1; +} + +fixed F_Get_A2(void) { + // Assembly name: get_A2 + return A2; +} + +fixed F_Get_A3(void) { + // Assembly name: get_A3 + return A3; +} + +fixed F_Get_A4(void) { + // Assembly name: get_A4 + return A4; +} + +fixed F_Get_B1(void) { + // Assembly name: get_B1 + return B1; +} + +fixed F_Get_B2(void) { + // Assembly name: get_B2 + return B2; +} + +fixed F_Get_B3(void) { + // Assembly name: get_B3 + return B3; +} + +fixed F_Get_B4(void) { + // Assembly name: get_B4 + return B4; +} + +void F_Set_A1(fixed value) { + // Assembly name: set_A1 + A1 = value; +} + +void F_Set_A2(fixed value) { + // Assembly name: set_A2 + A2 = value; +} + +void F_Set_A3(fixed value) { + // Assembly name: set_A3 + A3 = value; +} + +void F_Set_A4(fixed value) { + // Assembly name: set_A4 + A4 = value; +} + +void F_Set_B1(fixed value) { + // Assembly name: set_B1 + B1 = value; +} + +void F_Set_B2(fixed value) { + // Assembly name: set_B2 + B2 = value; +} + +void F_Set_B3(fixed value) { + // Assembly name: set_B3 + B3 = value; +} + +void F_Set_B4(fixed value) { + // Assembly name: set_B4 + B4 = value; +} + + +// Generic functions that get block and tx info + +fixed F_Get_Amount_For_Tx_In_A(void) { + // Assembly name: get_Amount_for_Tx_in_A + asset = B2; + tx = Blockchain.GetTransactionWithId(A1); + if (!tx) + return -1; + if (asset == 0 ) + return tx.amount - ContractActivationAmount; + return tx.GetQuantityFromAsset(asset); +} + + +// Generic functions that check balances and perform ops + +fixed F_Get_Current_Balance(void) { + // Assembly name: get_Current_Balance + if (B2 == 0) { + return Blockchain.GetMyBalanceNow(); + } + return Blockchain.GetMyBalanceFromAsset(B2); +} + +void F_Send_To_Address_In_B(fixed amountOrQuantity) { + // Assembly name: send_to_Address_in_B + recipient = B1; + asset = B2; + if (asset == 0) { + // Send Signa + long ContractBalance = Blockchain.GetMyBalanceNow(); + if (amountOrQuantity > ContractBalance) + Blockchain.SendAllMyBalanceTo(recipient); + else + Blockchain.SendBalanceTo(amountOrQuantity, recipient); + return; + } + // Send asset + long ContractQuantity = Blockchain.GetMyBalanceFromAsset(asset); + if (amountOrQuantity > ContractQuantity) + Blockchain.SendAllMyBalanceFromAssetTo(asset, recipient); + else + Blockchain.SendBalanceFromAssetTo(asset, recipient, amountOrQuantity); +} + +fixed F_Get_Map_Value_Keys_In_A(void) { + // Assembly name: Get_Map_Value_Keys_In_A + if (A3 == 0) { + if (isSet(ThisContract.map[A1][A2])) { + return ThisContract.map[A1][A2]; + } + return 0; + } + if (IsAT(A3)) { + otherContract = Blockchain.GetContractFromId(A3); + if (isSet(otherContract.map[A1][A2])) { + return otherContract.map[A1][A2]; + } + } + return 0; +} + +fixed F_Get_Activation_Fee(void) { + // Assembly name: Get_Activation_Fee + if (B2 == 0) { + return ThisContract.ActivationAmount; + } + if (Blockchain.IsAT(B2)) { + return Blockchain.GetActivationAmountFromAT(B2); + } + return 0; +} +``` +
[Back](./README.md) diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 7da207e..9fdb11a 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -1201,6 +1201,7 @@ export const fixedAPITableTemplate: SC_FUNCTION[] = [ asmName: 'Get_Asset_Circulating', declaration: 'fixed', sentences: [], + name: 'F_Get_Asset_Circulating' } ] From 8bef10678ec900071a60c784dfb3e3a1290d3f43 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 23 Jun 2022 13:28:32 -0300 Subject: [PATCH 082/112] Removed F_Get_Asset_Circulating --- src/__tests__/functions.b.spec.ts | 4 ++-- src/shaper/templates.ts | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index 40e878d..acad9ca 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -75,8 +75,8 @@ describe('fixed API functions', () => { expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: all fixed API', () => { - const code = '#include fixedAPIFunctions\nfixed fa; fa = F_Get_A1();\n fa = F_Get_A2();\n fa = F_Get_A3();\n fa = F_Get_A4();\n fa = F_Get_B1();\n fa = F_Get_B2();\n fa = F_Get_B3();\n fa = F_Get_B4();\n F_Set_A1(fa);\n F_Set_A2(fa);\n F_Set_A3(fa);\n F_Set_A4(fa);\n F_Set_B1(fa);\n F_Set_B2(fa);\n F_Set_B3(fa);\n F_Set_B4(2.33);\n fa = F_Get_Amount_For_Tx_In_A();\n fa = F_Get_Current_Balance();\n fa = F_Get_Previous_Balance();\n F_Send_To_Address_In_B(fa);\n fa = F_Get_Map_Value_Keys_In_A();\n fa = F_Get_Activation_Fee();\n fa = F_Get_Asset_Circulating();\n ' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n\nFUN @fa get_A1\nFUN @fa get_A2\nFUN @fa get_A3\nFUN @fa get_A4\nFUN @fa get_B1\nFUN @fa get_B2\nFUN @fa get_B3\nFUN @fa get_B4\nFUN set_A1 $fa\nFUN set_A2 $fa\nFUN set_A3 $fa\nFUN set_A4 $fa\nFUN set_B1 $fa\nFUN set_B2 $fa\nFUN set_B3 $fa\nSET @r0 #000000000de34c40\nFUN set_B4 $r0\nFUN @fa get_Amount_for_Tx_in_A\nFUN @fa get_Current_Balance\nFUN @fa get_Previous_Balance\nFUN send_to_Address_in_B $fa\nFUN @fa Get_Map_Value_Keys_In_A\nFUN @fa Get_Activation_Fee\nFUN @fa Get_Asset_Circulating\nFIN\n' + const code = '#include fixedAPIFunctions\nfixed fa; fa = F_Get_A1();\n fa = F_Get_A2();\n fa = F_Get_A3();\n fa = F_Get_A4();\n fa = F_Get_B1();\n fa = F_Get_B2();\n fa = F_Get_B3();\n fa = F_Get_B4();\n F_Set_A1(fa);\n F_Set_A2(fa);\n F_Set_A3(fa);\n F_Set_A4(fa);\n F_Set_B1(fa);\n F_Set_B2(fa);\n F_Set_B3(fa);\n F_Set_B4(2.33);\n fa = F_Get_Amount_For_Tx_In_A();\n fa = F_Get_Current_Balance();\n fa = F_Get_Previous_Balance();\n F_Send_To_Address_In_B(fa);\n fa = F_Get_Map_Value_Keys_In_A();\n fa = F_Get_Activation_Fee();\n ' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare fa\n\nFUN @fa get_A1\nFUN @fa get_A2\nFUN @fa get_A3\nFUN @fa get_A4\nFUN @fa get_B1\nFUN @fa get_B2\nFUN @fa get_B3\nFUN @fa get_B4\nFUN set_A1 $fa\nFUN set_A2 $fa\nFUN set_A3 $fa\nFUN set_A4 $fa\nFUN set_B1 $fa\nFUN set_B2 $fa\nFUN set_B3 $fa\nSET @r0 #000000000de34c40\nFUN set_B4 $r0\nFUN @fa get_Amount_for_Tx_in_A\nFUN @fa get_Current_Balance\nFUN @fa get_Previous_Balance\nFUN send_to_Address_in_B $fa\nFUN @fa Get_Map_Value_Keys_In_A\nFUN @fa Get_Activation_Fee\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 9fdb11a..3043428 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -1195,13 +1195,5 @@ export const fixedAPITableTemplate: SC_FUNCTION[] = [ declaration: 'fixed', sentences: [], name: 'F_Get_Activation_Fee' - }, - { - argsMemObj: [], - asmName: 'Get_Asset_Circulating', - declaration: 'fixed', - sentences: [], - - name: 'F_Get_Asset_Circulating' } ] From 4d71c5050af1fed7cd9a300775f636ef66946782 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 23 Jun 2022 14:36:26 -0300 Subject: [PATCH 083/112] Added optimization by VM (O3) and moved dangerous optimizations to O4 Documentation included --- docs/1.2-Preprocessor-directives.md | 3 +- src/__tests__/optimizations.a.spec.ts | 8 +- .../assemblyProcessor/optimizer.ts | 18 +- .../assemblyProcessor/optimizerVM/api.ts | 877 ++++++++++++++++++ .../assemblyProcessor/optimizerVM/cpu.ts | 624 +++++++++++++ .../assemblyProcessor/optimizerVM/index.ts | 179 ++++ src/shaper/shaper.ts | 2 +- 7 files changed, 1702 insertions(+), 9 deletions(-) create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/api.ts create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/index.ts diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index 325ed5d..2f1fe55 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -171,7 +171,8 @@ Special features used by compiler. * 0: No optimization. * 1: Very basic optimization, just remove silly and unused code. * 2: **Default**. Safely change and/or delete code for smarter outcome. - * 3: Dangerous optimizations no well tested. Result must be inspected by developer. + * 3: Use a VM to trace variable's content and remove redundant code. Beta feature, to be included as default once more tests are done. Can generate a good optimization reducing the number of calls to API functions. + * 4: Dangerous optimizations no well tested. Result must be inspected by developer. * `#pragma reuseAssignedVar [true/false/1/0/]`: When set, compiler will try to use a variable on left side of and `Assignment` as a register. If variable is also used on right side, the compiler will not reuse it. This can save one assembly instruction for every expression used! Default value is `true` and it is highly recomended to maintain it active. * `#pragma version N`: Informs which compiler's version the code was developed. Must be set if not using development version. To skip this check, set it to `dev`. * `#pragma verboseAssembly [true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number and the source code. Very usefull for debug. diff --git a/src/__tests__/optimizations.a.spec.ts b/src/__tests__/optimizations.a.spec.ts index 6f3e986..8f209e2 100644 --- a/src/__tests__/optimizations.a.spec.ts +++ b/src/__tests__/optimizations.a.spec.ts @@ -166,22 +166,22 @@ describe('Optimizations level 2', () => { /* Please note that these optimizations are not well tested. Code generated by smartc mostly have this safely coded during AST processing. */ -describe('Optimizations level 3', () => { +describe('Optimizations level 4', () => { it('should optimize: pop+set = pop', () => { const code = 'SET @r0 #000000000000655a\nPOP @r0\nSET @pcar $r0\nFIN\n' const assembly = 'SET @r0 #000000000000655a\nPOP @pcar\nFIN\n' - const result = optimizer(3, code, []) + const result = optimizer(4, code, []) expect(result).toBe(assembly) }) it('should compile: clear+pointer = pointer', () => { - const code = '#pragma optimizationLevel 3\nlong a, d[2]; a=0; d[a]=5; d[1]=d[a];' + const code = '#pragma optimizationLevel 4\nlong a, d[2]; a=0; d[a]=5; d[1]=d[a];' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare d\n^const SET @d #0000000000000005\n^declare d_0\n^declare d_1\n\nSET @r0 #0000000000000005\nSET @($d) $r0\nSET @d_1 $($d)\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: set+pointer = pointer with old var', () => { - const code = '#pragma optimizationLevel 3\nlong a, b, d[2]; a=b; d[a]=5; d[1]=d[a];' + const code = '#pragma optimizationLevel 4\nlong a, b, d[2]; a=b; d[a]=5; d[1]=d[a];' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare d\n^const SET @d #0000000000000006\n^declare d_0\n^declare d_1\n\nSET @r0 #0000000000000005\nSET @($d + $b) $r0\nSET @d_1 $($d + $b)\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() diff --git a/src/codeGenerator/assemblyProcessor/optimizer.ts b/src/codeGenerator/assemblyProcessor/optimizer.ts index 6ee17f6..b2b4e95 100644 --- a/src/codeGenerator/assemblyProcessor/optimizer.ts +++ b/src/codeGenerator/assemblyProcessor/optimizer.ts @@ -1,10 +1,13 @@ +import { CONTRACT } from './optimizerVM/index' + /** * Optimize assembly code with peephole strategy. * @param O Optimization level: * - 0: No optimization * - 1: Very basic optimization, just remove silly/unused code * - 2: Safely changes and delete code for smarter outcome - * - 3: Dangerous deep optimizations. Must be checked by developer + * - 3: Use final optimizations tracing variable contents (beta) + * - 4: Dangerous deep optimizations. Must be checked by developer * @param assemblyCode Input assembly * @param labels Array with labels (they will not be removed) * @returns Assembly code processed @@ -33,7 +36,7 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri codeLines.forEach(mdvOpt) codeLines = codeLines.flatMap(branchOpt) } - if (O >= 3) { + if (O >= 4) { codeLines.forEach(operatorSetSwap) codeLines.forEach(pushOpt) codeLines.forEach(setOperatorSwap) @@ -42,7 +45,16 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri codeLines.forEach(pointerZeroOpt) } } while (optimizedLines !== 0) - return codeLines.join('\n') + const partialOptimized = codeLines.join('\n') + if (O >= 3) { + const OptVM = new CONTRACT(codeLines) + try { + return OptVM.optimize().join('\n') + } catch (error) { + return partialOptimized + } + } + return partialOptimized } // Collect jumps information diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts new file mode 100644 index 0000000..c2510ca --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts @@ -0,0 +1,877 @@ +import { CONTRACT, MemoryObj, unknownValue } from './index' + +interface T_EXT { + funName: string + opCode: number +} +interface T_EXT_FUN extends T_EXT{ + execute(ContractState: CONTRACT): boolean|null +} +interface T_EXT_FUN_DAT extends T_EXT{ + execute(ContractState: CONTRACT, value: MemoryObj): boolean|null +} +interface T_EXT_FUN_DAT_2 extends T_EXT{ + execute(ContractState: CONTRACT, value1: MemoryObj, value2: MemoryObj): boolean|null +} +interface T_EXT_FUN_RET extends T_EXT{ + execute(ContractState: CONTRACT, RetVar: MemoryObj): boolean|null +} +interface T_EXT_FUN_RET_DAT_2 extends T_EXT{ + execute(ContractState: CONTRACT, value1: MemoryObj, value2: MemoryObj): boolean|null +} + +export class API_MICROCODE { + static EXT_FUN: T_EXT_FUN[] = [ + { + funName: 'clear_A', + opCode: 0x32, + execute (ContractState) { + const A1 = ContractState.getMemoryByName('A1') + const A2 = ContractState.getMemoryByName('A2') + const A3 = ContractState.getMemoryByName('A3') + const A4 = ContractState.getMemoryByName('A4') + if (A1.value === 0n && A2.value === 0n && A3.value === 0n && A4.value === 0n) { + // Optimize: already all zero + return null + } + ContractState.zeroAndRevoke(A1) + ContractState.zeroAndRevoke(A2) + ContractState.zeroAndRevoke(A3) + ContractState.zeroAndRevoke(A4) + return true + } + }, + { + funName: 'clear_B', + opCode: 0x32, + execute (ContractState) { + const B1 = ContractState.getMemoryByName('B1') + const B2 = ContractState.getMemoryByName('B2') + const B3 = ContractState.getMemoryByName('B3') + const B4 = ContractState.getMemoryByName('B4') + if (B1.value === 0n && B2.value === 0n && B3.value === 0n && B4.value === 0n) { + // Optimize: already all zero + return null + } + ContractState.zeroAndRevoke(B1) + ContractState.zeroAndRevoke(B2) + ContractState.zeroAndRevoke(B3) + ContractState.zeroAndRevoke(B4) + return true + } + }, + { + funName: 'clear_A_B', + opCode: 0x32, + execute (ContractState) { + const A1 = ContractState.getMemoryByName('A1') + const A2 = ContractState.getMemoryByName('A2') + const A3 = ContractState.getMemoryByName('A3') + const A4 = ContractState.getMemoryByName('A4') + const B1 = ContractState.getMemoryByName('B1') + const B2 = ContractState.getMemoryByName('B2') + const B3 = ContractState.getMemoryByName('B3') + const B4 = ContractState.getMemoryByName('B4') + if (A1.value === 0n && A2.value === 0n && A3.value === 0n && A4.value === 0n && + B1.value === 0n && B2.value === 0n && B3.value === 0n && B4.value === 0n) { + // Optimize: already all zero + return null + } + ContractState.zeroAndRevoke(A1) + ContractState.zeroAndRevoke(A2) + ContractState.zeroAndRevoke(A3) + ContractState.zeroAndRevoke(A4) + ContractState.zeroAndRevoke(B1) + ContractState.zeroAndRevoke(B2) + ContractState.zeroAndRevoke(B3) + ContractState.zeroAndRevoke(B4) + return true + } + }, + { + funName: 'copy_A_From_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'copy_B_From_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'swap_A_and_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisters() + return true + } + }, + { + funName: 'OR_A_with_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'OR_B_with_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'AND_A_with_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'AND_B_with_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'XOR_A_with_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'XOR_B_with_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'add_A_to_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'add_B_to_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'sub_A_from_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'sub_B_from_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'mul_A_by_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'mul_B_by_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'div_A_by_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'div_B_by_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'MD5_A_to_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'HASH160_A_to_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'SHA256_A_to_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'put_Last_Block_Hash_In_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + }, + { + funName: 'message_from_Tx_in_A_to_B', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'B_to_Address_of_Tx_in_A', + opCode: 0x32, + execute (ContractState) { + const B1 = ContractState.getMemoryByName('B1') + const B2 = ContractState.getMemoryByName('B2') + const B3 = ContractState.getMemoryByName('B3') + const B4 = ContractState.getMemoryByName('B4') + ContractState.unknownAndRevoke(B1) + ContractState.zeroAndRevoke(B2) + ContractState.zeroAndRevoke(B3) + ContractState.zeroAndRevoke(B4) + return true + } + }, + { + funName: 'B_to_Address_of_Creator', + opCode: 0x32, + execute (ContractState) { + const B1 = ContractState.getMemoryByName('B1') + const B2 = ContractState.getMemoryByName('B2') + const B3 = ContractState.getMemoryByName('B3') + const B4 = ContractState.getMemoryByName('B4') + ContractState.unknownAndRevoke(B1) + ContractState.zeroAndRevoke(B2) + ContractState.zeroAndRevoke(B3) + ContractState.zeroAndRevoke(B4) + return true + } + }, + { + funName: 'B_To_Assets_Of_Tx_In_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterB() + return true + } + }, + { + funName: 'send_All_to_Address_in_B', + opCode: 0x32, + execute (ContractState) { + return true + } + }, + { + funName: 'send_Old_to_Address_in_B', + opCode: 0x32, + execute (ContractState) { + return true + } + }, + { + funName: 'send_A_to_Address_in_B', + opCode: 0x32, + execute (ContractState) { + return true + } + }, + { + funName: 'Set_Map_Value_Keys_In_A', + opCode: 0x32, + execute (ContractState) { + return true + } + }, + { + funName: 'Mint_Asset', + opCode: 0x32, + execute (ContractState) { + return true + } + }, + { + funName: 'Distribute_To_Asset_Holders', + opCode: 0x32, + execute (ContractState) { + return true + } + }, + { + funName: 'Put_Last_Block_GSig_In_A', + opCode: 0x32, + execute (ContractState) { + ContractState.unknowSuperRegisterA() + return true + } + } + ] + + static EXT_FUN_DAT: T_EXT_FUN_DAT[] = [ + { + funName: 'set_A1', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('A1') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_A2', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('A2') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_A3', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('A3') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_A4', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('A4') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_B1', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('B1') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_B2', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('B2') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_B3', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('B3') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'set_B4', + opCode: 0x33, + execute (ContractState, ContentVar) { + const superReg = ContractState.getMemoryByName('B4') + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true + } + }, + { + funName: 'A_to_Tx_after_Timestamp', + opCode: 0x33, + execute (ContractState, value) { + const A1 = ContractState.getMemoryByName('A1') + const A2 = ContractState.getMemoryByName('A2') + const A3 = ContractState.getMemoryByName('A3') + const A4 = ContractState.getMemoryByName('A4') + ContractState.unknownAndRevoke(A1) + ContractState.zeroAndRevoke(A2) + ContractState.zeroAndRevoke(A3) + ContractState.zeroAndRevoke(A4) + return true + } + }, + { + funName: 'send_to_Address_in_B', + opCode: 0x33, + execute (ContractState, value) { + return true + } + } + ] + + static EXT_FUN_DAT_2: T_EXT_FUN_DAT_2[] = [ + { + funName: 'set_A1_A2', + opCode: 0x34, + execute (ContractState, ContentVar1, ContentVar2) { + const superReg1 = ContractState.getMemoryByName('A1') + const superReg2 = ContractState.getMemoryByName('A2') + if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && + (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { + // Optimize setting same variable/constant content + return null + } + ContractState.setAndRevoke(superReg1, ContentVar1) + ContractState.setAndRevoke(superReg2, ContentVar2) + return true + } + }, + { + funName: 'set_A3_A4', + opCode: 0x34, + execute (ContractState, ContentVar1, ContentVar2) { + const superReg1 = ContractState.getMemoryByName('A3') + const superReg2 = ContractState.getMemoryByName('A4') + if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && + (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { + // Optimize setting same variable/constant content + return null + } + ContractState.setAndRevoke(superReg1, ContentVar1) + ContractState.setAndRevoke(superReg2, ContentVar2) + return true + } + }, + { + funName: 'set_B1_B2', + opCode: 0x34, + execute (ContractState, ContentVar1, ContentVar2) { + const superReg1 = ContractState.getMemoryByName('B1') + const superReg2 = ContractState.getMemoryByName('B2') + if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && + (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { + // Optimize setting same variable/constant content + return null + } + ContractState.setAndRevoke(superReg1, ContentVar1) + ContractState.setAndRevoke(superReg2, ContentVar2) + return true + } + }, + { + funName: 'set_B3_B4', + opCode: 0x34, + execute (ContractState, ContentVar1, ContentVar2) { + const superReg1 = ContractState.getMemoryByName('B3') + const superReg2 = ContractState.getMemoryByName('B4') + if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && + (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { + // Optimize setting same variable/constant content + return null + } + ContractState.setAndRevoke(superReg1, ContentVar1) + ContractState.setAndRevoke(superReg2, ContentVar2) + return true + } + } + ] + + static EXT_FUN_RET: T_EXT_FUN_RET[] = [ + { + funName: 'get_A1', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('A1') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_A2', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('A2') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_A3', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('A3') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_A4', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('A4') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_B1', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('B1') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_B2', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('B2') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_B3', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('B3') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_B4', + opCode: 0x35, + execute (ContractState, RetVar) { + const superReg = ContractState.getMemoryByName('B4') + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'check_A_Is_Zero', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'check_B_Is_Zero', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'check_A_equals_B', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'check_MD5_A_with_B', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'check_HASH160_A_with_B', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'check_SHA256_A_with_B', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Check_Sig_B_With_A', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Block_Timestamp', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Creation_Timestamp', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Last_Block_Timestamp', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Type_for_Tx_in_A', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Amount_for_Tx_in_A', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Timestamp_for_Tx_in_A', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Ticket_Id_for_Tx_in_A', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Current_Balance', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'get_Previous_Balance', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Get_Code_Hash_Id', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Get_Map_Value_Keys_In_A', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Issue_Asset', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Get_Asset_Holders_Count', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Get_Activation_Fee', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + }, + { + funName: 'Get_Asset_Circulating', + opCode: 0x35, + execute (ContractState, RetVar) { + ContractState.unknownAndRevoke(RetVar) + return true + } + } + ] + + static EXT_FUN_RET_DAT_2: T_EXT_FUN_RET_DAT_2[] = [ + { + funName: 'add_Minutes_to_Timestamp', + opCode: 0x37, + execute (ContractState, timestamp, minutes) { + return true + } + } + ] +} diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts new file mode 100644 index 0000000..8afa854 --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts @@ -0,0 +1,624 @@ +import { Constants, CONTRACT, unknownValue, utils } from './index' +import { API_MICROCODE } from './api' + +interface CPU_MICROCODE { + name: string + stepFee: bigint + regex: RegExp + execute (ContractState: CONTRACT, regexParts: RegExpExecArray): boolean|null +} + +export class CPU { + static cpuMicrocode: CPU_MICROCODE[] = [ + { + name: 'blank', + stepFee: 0n, + regex: /^\s*$/, + execute (ContractState, regexParts) { + return false + } + }, + { + name: 'label', + stepFee: 0n, + regex: /^\s*(\w+):\s*$/, + execute (ContractState, regexParts) { + ContractState.unknowAll() + return false + } + }, + { + name: 'comment', + stepFee: 0n, + regex: /^\s*\^comment\s+(.*)/, + execute (ContractState, regexParts) { + return false + } + }, + { + name: 'declare', + stepFee: 0n, + regex: /^\s*\^declare\s+(\w+)\s*$/, + execute (ContractState, regexParts) { + if (ContractState.Memory.find(mem => mem.varName === regexParts[1]) === undefined) { + ContractState.Memory.push({ varName: regexParts[1], value: unknownValue, shadow: '' }) + } + return false + } + }, + { + name: 'const', + stepFee: 0n, + regex: /^\s*\^const\s+SET\s+@(\w+)\s+#([\da-f]{16})\b\s*$/, + execute (ContractState, regexParts) { + return false + } + }, + { + name: 'program', + stepFee: 0n, + regex: /^\s*\^program\s+(\w+)\s+([\s\S]+)$/, + execute (ContractState, regexParts) { + return false + } + }, + { + name: 'SET_VAL', + stepFee: 1n, + regex: /^\s*SET\s+@(\w+)\s+#([\da-f]{16})\b\s*$/, + execute (ContractState, regexParts) { + const variable = ContractState.getMemoryByName(regexParts[1]) + const val = BigInt('0x' + regexParts[2]) + if (variable.value !== unknownValue && variable.value === val) { + // Optimize set val same content + return null + } + variable.value = BigInt('0x' + regexParts[2]) + variable.shadow = '' + ContractState.revokeShadow(variable.varName) + return true + } + }, + { + name: 'SET_DAT', + stepFee: 1n, + regex: /^\s*SET\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable2 = ContractState.getMemoryByName(regexParts[2]) + if (variable1.value !== unknownValue && variable1.value === variable2.value) { + // Optimize: same content + return null + } + if (variable1.shadow === variable2.varName) { + // Optimize: already assigned before. Same content + return null + } + ContractState.setAndRevoke(variable1, variable2) + return true + } + }, + { + name: 'CLR', + stepFee: 1n, + regex: /^\s*CLR\s+@(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + if (variable1.value === 0n) { + // Optimize setting zero to something with zero + return null + } + ContractState.zeroAndRevoke(variable1) + return true + } + }, + { + name: 'INC', + stepFee: 1n, + regex: /^\s*INC\s+@(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + if (variable1.value !== unknownValue) { + variable1.value = (variable1.value + 1n) % 18446744073709551616n + } + variable1.shadow = '' + ContractState.revokeShadow(variable1.varName) + return true + } + }, + { + name: 'DEC', + stepFee: 1n, + regex: /^\s*DEC\s+@(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + if (variable1.value !== unknownValue) { + if (variable1.value === 0n) { + variable1.value = Constants.minus1 + } else { + variable1.value = variable1.value - 1n + } + } + variable1.shadow = '' + ContractState.revokeShadow(variable1.varName) + return true + } + }, + { + name: 'ADD', + stepFee: 1n, + regex: /^\s*ADD\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable2 = ContractState.getMemoryByName(regexParts[2]) + if (variable2.value === 0n) { + // Optimize adding zero + return null + } + if (variable1.value !== unknownValue && variable2.value !== unknownValue) { + variable1.value = (variable1.value + variable2.value) % Constants.pow2to64 + } + variable1.shadow = '' + ContractState.revokeShadow(variable1.varName) + return true + } + }, + { + name: 'SUB', + stepFee: 1n, + regex: /^\s*SUB\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable2 = ContractState.getMemoryByName(regexParts[2]) + if (variable2.value === 0n) { + // Optimize subtracting zero + return null + } + if (variable1.value !== unknownValue && variable2.value !== unknownValue) { + variable1.value = (Constants.pow2to64 + variable1.value - variable2.value) % Constants.pow2to64 + } + variable1.shadow = '' + ContractState.revokeShadow(variable1.varName) + return true + } + }, + { + name: 'MUL', + stepFee: 1n, + regex: /^\s*MUL\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable2 = ContractState.getMemoryByName(regexParts[2]) + if (variable2.value === 1n) { + // Optimize multiply by one + return null + } + if (variable1.value !== unknownValue && variable2.value !== unknownValue) { + variable1.value = (variable1.value * variable2.value) % Constants.pow2to64 + } + variable1.shadow = '' + ContractState.revokeShadow(variable1.varName) + return true + } + }, + { + name: 'DIV', + stepFee: 1n, + regex: /^\s*DIV\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable2 = ContractState.getMemoryByName(regexParts[2]) + if (variable2.value === 1n) { + // Optimize divide by one + return null + } + if (variable1.value !== unknownValue && variable2.value !== unknownValue) { + const val1 = utils.unsigned2signed(variable1.value) + const val2 = utils.unsigned2signed(variable2.value) + + variable1.value = utils.signed2unsigned(val1 / val2) + } + variable1.shadow = '' + ContractState.revokeShadow(variable1.varName) + return true + } + }, + { + name: 'BOR / AND / XOR', + stepFee: 1n, + regex: /^\s*(BOR|AND|XOR)\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'NOT', + stepFee: 1n, + regex: /^\s*NOT\s+@(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'SET_IND', + stepFee: 1n, + regex: /^\s*SET\s+@(\w+)\s+\$\(\$(\w+)\)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'SET_IDX', + stepFee: 1n, + regex: /^\s*SET\s+@(\w+)\s+\$\(\$(\w+)\s*\+\s*\$(\w+)\)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'PSH', + stepFee: 1n, + regex: /^\s*PSH\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + // TODO control also user stack + // const variable1 = ContractState.getMemoryByName(regexParts[1]) + // ContractState.UserStack.push(val1) + // if (ContractState.UserStack.length > 16 * ContractState.UserStackPages) { + // if (ContractState.ERR === null) { + // ContractState.dead = true + // ContractState.exception = 'User Stack buffer overflow' + // return true + // } + // ContractState.instructionPointer = ContractState.ERR + // return true + // } + return true + } + }, + { + name: 'POP', + stepFee: 1n, + regex: /^\s*POP\s+@(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + // TODO control also user stack + // const val1 = ContractState.UserStack.pop() + // if (val1 === undefined) { + // if (ContractState.ERR === null) { + // ContractState.dead = true + // ContractState.exception = 'User Stack buffer underflow' + // return true + // } + // ContractState.instructionPointer = ContractState.ERR + // return true + // } + // if (variable1 === undefined) { + // ContractState.Memory.push({ varName: regexParts[1], value: val1 }) + // } else { + // variable1.value = val1 + // } + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'JMP_SUB', + stepFee: 1n, + regex: /^\s*JSR\s+:(\w+)\s*$/, + execute (ContractState, regexParts) { + ContractState.unknowAll() + return true + } + }, + { + name: 'RET_SUB', + stepFee: 1n, + regex: /^\s*RET\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'IND_DAT', + stepFee: 1n, + regex: /^\s*SET\s+@\(\$(\w+)\)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable2 = ContractState.getMemoryByName(regexParts[2]) + const addr = Number(variable1.value) + if (variable1.value !== unknownValue) { + ContractState.Memory[addr].value = variable2.value + ContractState.Memory[addr].shadow = variable2.varName + return true + } + // It is not possible to know which variable was updated. Unknow to all memory variable. + ContractState.unknowMemory(true, true) + return true + } + }, + { + name: 'IDX_DAT', + stepFee: 1n, + regex: /^\s*SET\s+@\(\$(\w+)\s*\+\s*\$(\w+)\)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + // It is not possible to know which variable was updated. Unknow to all memory variable. + ContractState.unknowMemory(true, true) + return true + } + }, + { + name: 'MOD_DAT', + stepFee: 1n, + regex: /^\s*MOD\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'SHL / SHR', + stepFee: 1n, + regex: /^\s*(SHL|SHR)\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'POW_DAT', + stepFee: 1n, + regex: /^\s*POW\s+@(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'JMP_ADR', + stepFee: 1n, + regex: /^\s*JMP\s+:(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'BZR / BNZ', + stepFee: 1n, + regex: /^\s*(BZR|BNZ)\s+\$(\w+)\s+:(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'BGT / BLT / BGE / BLE / BEQ / BNE', + stepFee: 1n, + regex: /^\s*(BGT|BLT|BGE|BLE|BEQ|BNE)\s+\$(\w+)\s+\$(\w+)\s+:(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'SLP_DAT', + stepFee: 1n, + regex: /^\s*SLP\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'SLP_IMD', + stepFee: 1n, + regex: /^\s*SLP\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'FIZ_DAT', + stepFee: 1n, + regex: /^\s*FIZ\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'STZ_DAT', + stepFee: 1n, + regex: /^\s*STZ\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'FIN_IMD', + stepFee: 1n, + regex: /^\s*FIN\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'STP_IMD', + stepFee: 1n, + regex: /^\s*STP\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'ERR_ADR', + stepFee: 1n, + regex: /^\s*ERR\s+:(\w+)\s*$/, + execute (ContractState, regexParts) { + return true + } + }, + { + name: 'SET_PCS', + stepFee: 1n, + regex: /^\s*PCS\s*$/, + execute (ContractState, regexParts) { + ContractState.unknowAll() + // Program can restart with any values in memory + return true + } + }, + { + name: 'MDV_DAT', + stepFee: 1n, + regex: /^\s*MDV\s+@(\w+)\s+\$(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true + } + }, + { + name: 'EXT_FUN', + stepFee: 10n, + regex: /^\s*FUN\s+(\w+)\s*$/, + execute (ContractState, regexParts) { + const Api = API_MICROCODE.EXT_FUN.find(Obj => Obj.funName === regexParts[1]) + if (Api === undefined) { + throw new Error(`Unknow API Function ${regexParts[1]}`) + } + return Api.execute(ContractState) + } + }, + { + name: 'EXT_FUN_DAT', + stepFee: 10n, + regex: /^\s*FUN\s+(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const Api = API_MICROCODE.EXT_FUN_DAT.find(Obj => Obj.funName === regexParts[1]) + if (Api === undefined) { + throw new Error(`Unknow API Function ${regexParts[1]}`) + } + const variable1 = ContractState.getMemoryByName(regexParts[2]) + if (variable1 === undefined) { + throw new Error(`Undeclared variable '${regexParts[2]}'`) + } + return Api.execute(ContractState, variable1) + } + }, + { + name: 'EXT_FUN_DAT_2', + stepFee: 10n, + regex: /^\s*FUN\s+(\w+)\s+\$(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const Api = API_MICROCODE.EXT_FUN_DAT_2.find(Obj => Obj.funName === regexParts[1]) + if (Api === undefined) { + throw new Error(`Unknow API Function ${regexParts[1]}`) + } + const variable1 = ContractState.getMemoryByName(regexParts[2]) + const variable2 = ContractState.getMemoryByName(regexParts[3]) + return Api.execute(ContractState, variable1, variable2) + } + }, + { + name: 'EXT_FUN_RET', + stepFee: 10n, + regex: /^\s*FUN\s+@(\w+)\s+(\w+)\s*$/, + execute (ContractState, regexParts) { + const Api = API_MICROCODE.EXT_FUN_RET.find(Obj => Obj.funName === regexParts[2]) + if (Api === undefined) { + throw new Error(`Unknow API Function ${regexParts[1]}`) + } + const retVar = ContractState.getMemoryByName(regexParts[1]) + return Api.execute(ContractState, retVar) + } + }, + { + name: 'EXT_FUN_RET_DAT', + stepFee: 10n, + regex: /^\s*FUN\s+@(\w+)\s+(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + throw new Error(`Unknow API Function ${regexParts[2]}`) + } + }, + { + name: 'EXT_FUN_RET_DAT_2', + stepFee: 10n, + regex: /^\s*FUN\s+@(\w+)\s+(\w+)\s+\$(\w+)\s+\$(\w+)\s*$/, + execute (ContractState, regexParts) { + const Api = API_MICROCODE.EXT_FUN_RET_DAT_2.find(Obj => Obj.funName === regexParts[2]) + if (Api === undefined) { + throw new Error(`Unknow API Function ${regexParts[1]}`) + } + const variable1 = ContractState.getMemoryByName(regexParts[2]) + const variable2 = ContractState.getMemoryByName(regexParts[3]) + return Api.execute(ContractState, variable1, variable2) + } + }, + { + name: 'NOP', + stepFee: 1n, + regex: /^\s*NOP\s*$/, + execute (ContractState, regexParts) { + return true + } + } + ] + + /** Process one line of assembly code. + * @returns true if something was executed + * false if line is valid but nothing executed + * null if line can be optimized */ + static cpu (ContractState: CONTRACT, line: number) { + const currLine = ContractState.asmCodeArr[line] + + const InstructionObj = this.cpuMicrocode.find(currCode => { + if (currCode.regex.exec(currLine) === null) { + return false + } + return true + }) + + if (InstructionObj === undefined) { + throw new Error(`Wrong line of code: '${currLine}'`) + } + const currParts = InstructionObj.regex.exec(currLine) + if (currParts === null) { + throw new Error(`Wrong line of code: '${currLine}'`) + } + + return InstructionObj.execute(ContractState, currParts) + } + + /** + * Loop all lines colecting assembly directives and put + * instruction pointer at first instruction + * + * @param {CONTRACT} ContractState - Contract to execute function + * */ + static cpuDeploy (ContractState: CONTRACT) { + let lastExecResult: RegExpExecArray | null, currCode: CPU_MICROCODE | undefined + + ContractState.asmCodeArr.forEach(line => { + if (/^\s*\^.*/.exec(line) !== null) { + // visit all compiler directives to deploy contract + currCode = CPU.cpuMicrocode.find(instr => { + lastExecResult = instr.regex.exec(line) + if (lastExecResult === null) { + return false + } + return true + }) + if (currCode !== undefined && lastExecResult !== null) { + currCode.execute(ContractState, lastExecResult) + } + } + }) + } +} diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts new file mode 100644 index 0000000..2a25f19 --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts @@ -0,0 +1,179 @@ +import { CPU } from './cpu' + +export const unknownValue = -1n + +/** + * Object for memory entries + * + * @member {string} varName Variable name defined in assembly + * @member {bigint} value Variable value (64-bit unsigned) + * @member {string} shadow If content is the same as other variable, + * this will have the other variable name. + */ +export interface MemoryObj { + varName: string + value: bigint + shadow: string +} + +export const Constants = { + // do not change these + minus1: 18446744073709551615n, // -1 in 64-bit unsigned + pow2to64: 18446744073709551616n, // 2^64 + maxPositive: 9223372036854775807n, // (2^63)-1 + numberMaxPositive: 9223372036854775000 +} + +export const utils = { + unsigned2signed (unsigned: bigint): bigint { + unsigned %= 1n << 64n + if (unsigned >= (1n << 63n)) { + return unsigned - (1n << 64n) + } + return unsigned + }, + + signed2unsigned (signed: bigint): bigint { + signed %= 18446744073709551616n + if (signed < 0) { + return signed + 18446744073709551616n + } + return signed + } +} + +export class CONTRACT { + Memory: MemoryObj[] + asmCodeArr: string[] + // userStack: MemoryObj[] + + constructor (asmCode: string[]) { + this.Memory = [] + this.asmCodeArr = asmCode + // this.userStack = [] + CPU.cpuDeploy(this) + this.Memory.push( + { varName: 'A1', value: unknownValue, shadow: '' }, + { varName: 'A2', value: unknownValue, shadow: '' }, + { varName: 'A3', value: unknownValue, shadow: '' }, + { varName: 'A4', value: unknownValue, shadow: '' }, + { varName: 'B1', value: unknownValue, shadow: '' }, + { varName: 'B2', value: unknownValue, shadow: '' }, + { varName: 'B3', value: unknownValue, shadow: '' }, + { varName: 'B4', value: unknownValue, shadow: '' }) + } + + unknowAll () : void { + this.unknowMemory(false, false) + } + + unknowMemory (keepRegisters: boolean, keepSuperRegisters: boolean) : void { + this.Memory.forEach((Mem) => { + if (keepRegisters && /^r\d$/.test(Mem.varName)) { + return + } + if (keepSuperRegisters && /^[AB][1234]$/.test(Mem.varName)) { + return + } + if (/^n\d+$/.test(Mem.varName)) { + Mem.value = BigInt(Mem.varName.substring(1)) + Mem.shadow = '' + return + } + Mem.value = unknownValue + Mem.shadow = '' + }) + } + + unknowSuperRegisters () : void { + this.Memory.forEach((Mem) => { + if (/^[AB][1234]$/.test(Mem.varName)) { + Mem.value = unknownValue + Mem.shadow = '' + return + } + if (/^[AB][1234]$/.test(Mem.shadow)) { + Mem.shadow = '' + } + }) + } + + unknowSuperRegisterA () : void { + this.Memory.forEach((Mem) => { + if (/^[A][1234]$/.test(Mem.varName)) { + Mem.value = unknownValue + Mem.shadow = '' + return + } + if (/^[A][1234]$/.test(Mem.shadow)) { + Mem.shadow = '' + } + }) + } + + unknowSuperRegisterB () : void { + this.Memory.forEach((Mem) => { + if (/^[B][1234]$/.test(Mem.varName)) { + Mem.value = unknownValue + Mem.shadow = '' + return + } + if (/^[B][1234]$/.test(Mem.shadow)) { + Mem.shadow = '' + } + }) + } + + getMemoryByName (name: string): MemoryObj { + const RetObj = this.Memory.find(Mem => Mem.varName === name) + if (RetObj === undefined) { + throw new Error('Internal error') + } + return RetObj + } + + revokeShadow (changedVar: string) : void { + this.Memory.forEach((Mem) => { + if (Mem.shadow === changedVar) { + Mem.shadow = '' + } + }) + } + + unknownAndRevoke (Var: MemoryObj) { + Var.value = unknownValue + Var.shadow = '' + this.revokeShadow(Var.varName) + } + + setAndRevoke (AssignedVar: MemoryObj, Variable: MemoryObj) { + AssignedVar.value = Variable.value + AssignedVar.shadow = Variable.varName + this.revokeShadow(AssignedVar.varName) + } + + zeroAndRevoke (Var: MemoryObj) { + if (Var.value !== 0n) { + Var.value = 0n + Var.shadow = '' + this.revokeShadow(Var.varName) + } + } + + /** + * Runs only one instruction (step into) + * + * @return string indicating error/status. Empty string on success. + */ + optimize (): string[] { + let cpuExitCode: boolean|null + + this.asmCodeArr.forEach((code, line) => { + cpuExitCode = CPU.cpu(this, line) + if (cpuExitCode === null) { + this.asmCodeArr[line] = 'DELETE' + } + }) + return this.asmCodeArr.filter(code => code !== 'DELETE') + } +} diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 35187c7..150f26c 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -198,7 +198,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { Program.Config.reuseAssignedVar = bool return true case 'optimizationLevel': - if (num >= 0 && num <= 3) { + if (num >= 0 && num <= 4) { Program.Config.optimizationLevel = num return false } From c10c12c0520f9379cbc725eff4bbc1bfbc1d90bc Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 23 Jun 2022 14:37:39 -0300 Subject: [PATCH 084/112] Bump rc release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 68c779f..2e75619 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc6", + "version": "2.0.0-rc7", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 89345fffc37478e89cbb53d3decf7386287951fe Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 23 Jun 2022 23:08:06 -0300 Subject: [PATCH 085/112] Fix for detection of auxVars --- .../assemblyProcessor/createInstruction.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 3c2e0cd..4d78d33 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -73,7 +73,7 @@ export function toRegister ( ) : GENCODE_SOLVED_OBJECT { const retObj = flattenMemory(AuxVars, InSolved.SolvedMem, line) - if (retObj.FlatMem.type !== 'register') { + if (!AuxVars.isTemp(retObj.FlatMem.address)) { const inType = utils.getDeclarationFromMemory(InSolved.SolvedMem) const TmpMemObj = AuxVars.getNewRegister(line) retObj.asmCode += `SET @${TmpMemObj.asmName} $${retObj.FlatMem.asmName}\n` @@ -198,11 +198,11 @@ export function createBuiltInInstruction ( case 'getNextTxFromBlockheight': newJump = '__GNT_' + AstAuxVars.getNewJumpID(BuiltInToken.line) assemblyCode = tempArgsMem[0].asmCode - if (tempArgsMem[0].FlatMem.type !== 'register') { + if (AstAuxVars.isTemp(tempArgsMem[0].FlatMem.address)) { + AuxRegister = tempArgsMem[0].FlatMem + } else { AuxRegister = AstAuxVars.getNewRegister() assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` - } else { - AuxRegister = tempArgsMem[0].FlatMem } auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(32), BuiltInToken.line) assemblyCode += auxFlatMem.asmCode + @@ -302,11 +302,11 @@ export function createBuiltInInstruction ( break } assemblyCode += tempArgsMem[2].asmCode - if (tempArgsMem[2].FlatMem.type !== 'register') { + if (AstAuxVars.isTemp(tempArgsMem[2].FlatMem.address)) { + AuxRegister = tempArgsMem[2].FlatMem + } else { AuxRegister = AstAuxVars.getNewRegister() assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[2].FlatMem.asmName}\n` - } else { - AuxRegister = tempArgsMem[2].FlatMem } AuxRegisterA = AstAuxVars.getNewRegister() assemblyCode += @@ -360,11 +360,11 @@ export function createBuiltInInstruction ( 'FUN send_A_to_Address_in_B\n' break } - if (tempArgsMem[messageArg].FlatMem.type !== 'register') { + if (AstAuxVars.isTemp(tempArgsMem[messageArg].FlatMem.address)) { + AuxRegister = tempArgsMem[messageArg].FlatMem + } else { AuxRegister = AstAuxVars.getNewRegister() assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[messageArg].FlatMem.asmName}\n` - } else { - AuxRegister = tempArgsMem[messageArg].FlatMem } AuxRegisterA = AstAuxVars.getNewRegister() AuxRegisterB = AstAuxVars.getNewRegister() @@ -468,11 +468,11 @@ export function createBuiltInInstruction ( } AstAuxVars.freeRegister(tempArgsMem[0].FlatMem.address) assemblyCode += tempArgsMem[1].asmCode - if (tempArgsMem[1].FlatMem.type !== 'register') { + if (AstAuxVars.isTemp(tempArgsMem[1].FlatMem.address)) { + AuxRegister = tempArgsMem[1].FlatMem + } else { AuxRegister = AstAuxVars.getNewRegister() assemblyCode += `SET @${AuxRegister.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` - } else { - AuxRegister = tempArgsMem[1].FlatMem } AuxRegisterA = AstAuxVars.getNewRegister() assemblyCode += From 31e54019e03a49eda3676feacb06038e45194a93 Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 24 Jun 2022 11:08:30 -0300 Subject: [PATCH 086/112] Fix on reuseAssignedVar --- src/__tests__/fixed.a.spec.ts | 8 ++++---- src/__tests__/structs.b.spec.ts | 4 ++-- src/codeGenerator/astProcessor/binaryAsnProcessor.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/__tests__/fixed.a.spec.ts b/src/__tests__/fixed.a.spec.ts index 023f836..970a8d6 100644 --- a/src/__tests__/fixed.a.spec.ts +++ b/src/__tests__/fixed.a.spec.ts @@ -10,14 +10,14 @@ describe('Assignment', () => { }) it('should compile: = fixed/long', () => { const code = '#pragma optimizationLevel 0\nfixed a; long b; a=b;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 $b\nMUL @r0 $f100000000\nSET @a $r0\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a $b\nMUL @a $f100000000\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: = long/fixed', () => { const code = '#pragma optimizationLevel 0\nfixed a; long b; b=a;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 $a\nDIV @r0 $f100000000\nSET @b $r0\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @b $a\nDIV @b $f100000000\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) @@ -31,14 +31,14 @@ describe('Assignment', () => { }) it('should compile: = fixed/constantlong', () => { const code = '#pragma optimizationLevel 0\nfixed a; long b; a=55;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #0000000000000037\nMUL @r0 $f100000000\nSET @a $r0\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @a #0000000000000037\nMUL @a $f100000000\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: = long/constantfixed', () => { const code = '#pragma optimizationLevel 0\nfixed a; long b; b=32.3;' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #00000000c085e380\nDIV @r0 $f100000000\nSET @b $r0\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @b #00000000c085e380\nDIV @b $f100000000\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) diff --git a/src/__tests__/structs.b.spec.ts b/src/__tests__/structs.b.spec.ts index dc010f4..be8256a 100644 --- a/src/__tests__/structs.b.spec.ts +++ b/src/__tests__/structs.b.spec.ts @@ -17,7 +17,7 @@ a=pcar->collector; *c=pcar->collector; d[1]=pcar->collector; d[a]=pcar->collector;` - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000b\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000002\nSET @($pcar + $r1) $r0\nSET @($pcar) $a\nSET @r0 $($c)\nSET @($pcar) $r0\nSET @($pcar) $d_1\nSET @r0 $($d + $a)\nSET @($pcar) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($pcar) $r0\nSET @r0 #0000000000000001\nSET @a $($pcar + $r0)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($c) $r0\nSET @r0 #0000000000000001\nSET @d_1 $($pcar + $r0)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000b\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000002\nSET @($pcar + $r1) $r0\nSET @($pcar) $a\nSET @r0 $($c)\nSET @($pcar) $r0\nSET @($pcar) $d_1\nSET @r0 $($d + $a)\nSET @($pcar) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($pcar) $r0\nSET @a #0000000000000001\nSET @a $($pcar + $a)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($c) $r0\nSET @d_1 #0000000000000001\nSET @d_1 $($pcar + $d_1)\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) @@ -39,7 +39,7 @@ a=pcar->passenger[2]; *c=pcar->passenger[2]; d[1]=pcar->passenger[2]; d[a]=pcar->passenger[2];` - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare car_passenger_3\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000f\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @($pcar + $r0) $a\nSET @r0 $($c)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @($pcar + $r0) $d_1\nSET @r0 $($d + $a)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r1 #0000000000000004\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @a $($pcar + $r0)\nSET @r1 #0000000000000005\nSET @r0 $($pcar + $r1)\nSET @($c) $r0\nSET @r0 #0000000000000005\nSET @d_1 $($pcar + $r0)\nSET @r1 #0000000000000005\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare car_driver\n^declare car_collector\n^declare car_passenger\n^const SET @car_passenger #0000000000000006\n^declare car_passenger_0\n^declare car_passenger_1\n^declare car_passenger_2\n^declare car_passenger_3\n^declare pcar\n^declare a\n^declare b\n^declare c\n^declare d\n^const SET @d #000000000000000f\n^declare d_0\n^declare d_1\n\nSET @pcar #0000000000000003\nSET @r0 #000000000000655a\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @($pcar + $r0) $a\nSET @r0 $($c)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r0 #0000000000000005\nSET @($pcar + $r0) $d_1\nSET @r0 $($d + $a)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r1 #0000000000000001\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @r1 #0000000000000004\nSET @r0 $($pcar + $r1)\nSET @r1 #0000000000000005\nSET @($pcar + $r1) $r0\nSET @a #0000000000000005\nSET @a $($pcar + $a)\nSET @r1 #0000000000000005\nSET @r0 $($pcar + $r1)\nSET @($c) $r0\nSET @d_1 #0000000000000005\nSET @d_1 $($pcar + $d_1)\nSET @r1 #0000000000000005\nSET @r0 $($pcar + $r1)\nSET @($d + $a) $r0\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 768d637..b487d35 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -261,10 +261,10 @@ export default function binaryAsnProcessor ( jumpFalse: ScopeInfo.jumpFalse, jumpTrue: ScopeInfo.jumpTrue }) - AuxVars.registerInfo.shift() const registerFinalState = deepCopy(AuxVars.registerInfo) // if returning var is not the reused one, put it in that returning location and solve right side again if (RetGenObj.SolvedMem.address !== Left.address && AuxVars.isTemp(RetGenObj.SolvedMem.address)) { + AuxVars.registerInfo.shift() const index = RetGenObj.SolvedMem.address + 1 AuxVars.registerInfo = registerInitialState AuxVars.registerInfo.splice(index, 0, { inUse: false, Template: NewRegister }) From 1a5285c2f54fa9973937e347a6b766ccee2ad7a4 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 25 Jun 2022 21:34:32 -0300 Subject: [PATCH 087/112] Adding testcases for new built-in. Fixing wrong code. --- docs/1.5-Built-in-functions.md | 48 ++-- src/__tests__/functions.b.spec.ts | 238 ++++++++++++++++++ .../assemblyProcessor/createInstruction.ts | 66 +++-- src/shaper/shaper.ts | 2 +- src/shaper/templates.ts | 14 ++ 5 files changed, 329 insertions(+), 39 deletions(-) diff --git a/docs/1.5-Built-in-functions.md b/docs/1.5-Built-in-functions.md index 101ace8..6998781 100644 --- a/docs/1.5-Built-in-functions.md +++ b/docs/1.5-Built-in-functions.md @@ -10,7 +10,7 @@ When handling assets, all values are expressed as QNT. 1 QNT is the least quanti
-## Protypes summary +## Prototypes summary ```c @@ -35,7 +35,9 @@ void sendMessage(long * buffer, long accountId); void sendAmountAndMessage(long amount, long * buffer, long accountId); void sendAmountAndMessageFx(fixed amount, long * buffer, long accountId); void sendBalance(long accountId); -void sendQuantity(long assetId, long quantity, long accountId); +void sendQuantity(long quantity, long assetId, long accountId); +void sendQuantityAndAmount(long quantity, long assetId, long amount, long accountId); +void sendQuantityAndAmountFx(long quantity, long assetId, fixed amount, long accountId); // Blockchain details long getCurrentBlockheight(); @@ -246,10 +248,24 @@ Contract will halt execution (no gas). ### sendQuantity * Prototype: -`void sendQuantity(long assetId, long quantity, long accountId);` +`void sendQuantity(long quantity, long assetId, long accountId);` * Description: Sends a transaction to transfer 'quantity' of 'assetId' to 'accountId'. If contract balance of 'assetId' is lower than 'quantity', all balance of 'assetId' is sent. +If the same asset is transfered two times at same block, their quantities are added and only one transaction is sent. +Transactions from smart contracts can transfer only one asset. If two different assets are transfered in same block, two transactions will be sent. +No empty transactions are sent, they must transfer at least 1 QNT of some asset. + +### sendQuantityandAmount, sendQuantityandAmountFx +* Prototype: +`void sendQuantityandAmount(long quantity, long assetId, long amount, long accountId);` +* Fixed version prototype: +`void sendQuantityandAmountFx(long quantity, long assetId, fixed amount, long accountId);` +* Description: +Sends a transaction to transfer 'quantity' of 'assetId' and 'amount' of Signa to 'accountId'. +This function ensure the asset and Signa are sent in the same transaction and with optimized code. +If contract balance of 'assetId' is lower than 'quantity', all balance of 'assetId' is sent. +If contract balance is lower than 'amount', all Signa balance is sent. Transactions to transfer assets can not have messages or Signa attached. If the same asset is transfered two times at same block, their quantities are added and only one transaction is sent. Transactions from smart contracts can transfer only one asset. If two different assets are transfered in same block, two transactions will be sent. @@ -272,8 +288,9 @@ Returns the current blockheight when the instruction is executed. `long getWeakRandomNumber();` * Description: Returns a simple random number based on last block signature. -It is very unlikely someone to tamper this number, but can be done in theory. -Attention needed for contracts dealing big amount of coins. +It is very unlikely someone to tamper this number, but it can be done in theory. +Attention needed for contracts dealing with big amount of coins. +Return value can be negative, and negative number MOD positive number results in negative numbers. Hint: use shift right to get rid of negative values `positiveRnd = getWeakRandomNumber() >> 1;`.
@@ -299,6 +316,7 @@ If 'contractId' is not a contract, zero is returned. `long getCodeHashOf(long contractId);` * Description: Returns the code hash id of 'contractId'. +If 'contractId' is zero, it is returned the code hash from the contract itself. If 'contractId' is not a contract, zero is returned. ### getActivationOf, getActivationOfFx @@ -308,7 +326,7 @@ If 'contractId' is not a contract, zero is returned. `fixed getActivationOfFx(long contractId);` * Description: Returns the minimum amount of Signa needed activate 'contractId'. -If 'contractId' is zero, it is returned the min activation amount for current contract. +If 'contractId' is zero, it is returned the minimum activation amount from the contract itself. If 'contractId' is not a contract, zero is returned. ### getCurrentBalance, getCurrentBalanceFx @@ -325,7 +343,7 @@ Returns the contract balance (Signa) at the time the instruction is executed. `long getAssetBalance(long assetId);` * Description: Returns the contract balance of the given 'assetId' at the time the instruction is executed. -If 'assetId' is zero, it is returned value is the same as `getCurrentBalance`. +If 'assetId' is zero, the return value is the same as `getCurrentBalance`.
@@ -333,7 +351,7 @@ If 'assetId' is zero, it is returned value is the same as `getCurrentBalance`. ## Using maps -Maps offer 'unlimited' space to store values. Each value (long) can be found using two keys (also longs) to be read or written. +Maps offer 'unlimited' space to store values. Each stored value (64-bit long or fixed) can be found using two keys (64-bit longs) to be read or written. Any item that was not previously set, has zero value. No deletion is possible, just set to zero if needed. ### setMapValue, setMapValueFx @@ -358,7 +376,7 @@ Returns the value stored at the map 'currentContract[key1][key2]'. * Fixed version prototype: `fixed getExtMapValueFx(long key1, long key2, long contractId);` * Description: -Get the map stored at external contract 'contractId[key1][key2]'. +Gets the map stored at external contract 'contractId[key1][key2]'. If the contract has no map, or 'contractId' is not a contract, zero is returned. Unlike the contract memory, the map values from other contracts can be retrieved using this function.
@@ -382,7 +400,7 @@ long checkSignature( ``` * Description: Checks if the signature of the given 'accountId' in 'transaction' at 'page' and 'page+1' matches for the given 'message2..4'. -Returns 1 (true) if the message is valid, 0 otherwise. +Returns 1 (true) if the signature is valid, 0 otherwise.
@@ -403,12 +421,12 @@ It costs 150 Signa to issue an asset. The contract execution will be halted at t ### mintAsset * Prototype: -`void mintAsset(long assetId, long quantity);` +`void mintAsset(long quantity, long assetId);` * Description: Mint the 'quantity' of 'assetId'. The asset must be issued by the contract. -No negative quantity allowed. To burn them send to accountId 0. -Minted quantity is available just after the instruction. +No negative quantity allowed, send them send to accountId 0 to burn. +Minted quantity is available right after the instruction. ### distributeToHolders, distributeToHoldersFx * Prototype: @@ -433,7 +451,7 @@ void distributeToHoldersFx( ``` * Description: Distribute the Signa 'amountToDistribute' and 'quantityToDistribute' of 'assetToDistribute' to accounts that hold at least 'holdersAssetMinQuantity' of 'holdersAsset'. -If amountToDistribute and quantityToDistribute are zero, no distribution is done. +If 'amountToDistribute' and 'quantityToDistribute' are zero, no distribution is done. Both 'amountToDistribute' and 'quantityToDistribute' can be distributed in same transaction. Only the free balance is taken in account, this means, if there is quantity in sell orders, they will not be considered. If current block already has the maximum indirect transactions, no distribution is done. @@ -446,7 +464,7 @@ The 'assetToDistribute' can be the same as 'holdersAsset' and, in this case, the * Prototype: `long getAssetHoldersCount(long minimumQuantity, long assetId);` * Description: -Returns the number of holders that have at lease 'minimumQuantity' of 'assetId'. +Returns the number of holders that have at least 'minimumQuantity' of 'assetId'. Only the free balance is taken in account, this means, if there is quantity in sell orders, they will not be considered. ### getAssetCirculating diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index acad9ca..01b7df4 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -147,4 +147,242 @@ describe('Built-in functions', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: getNextTx()', () => { + const code = '#pragma optimizationLevel 0\n long currTxId = getNextTx(); if (currTxId == 0) currTxId++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare _counterTimestamp\n^declare currTxId\n\nFUN A_to_Tx_after_Timestamp $_counterTimestamp\nFUN @currTxId get_A1\nBZR $currTxId :__GNT_1\nFUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n__GNT_1:\nBNZ $currTxId :__if2_endif\n__if2_start:\nINC @currTxId\n__if2_endif:\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getNextTx() inside a function', () => { + const code = '#pragma optimizationLevel 0\n getNextTxDetails(); void getNextTxDetails(void) { long tx = getNextTx(); }' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare _counterTimestamp\n^declare getNextTxDetails_tx\n\nJSR :__fn_getNextTxDetails\nFIN\n\n__fn_getNextTxDetails:\nFUN A_to_Tx_after_Timestamp $_counterTimestamp\nFUN @getNextTxDetails_tx get_A1\nBZR $getNextTxDetails_tx :__GNT_1\nFUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n__GNT_1:\nRET\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getNextTx() inside a codecave', () => { + const code = '#pragma optimizationLevel 0\n long a, b, c; while ((a = getNextTx()) != 0) b++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare _counterTimestamp\n^declare a\n^declare b\n^declare c\n\n__loop1_continue:\nFUN A_to_Tx_after_Timestamp $_counterTimestamp\nFUN @a get_A1\nBZR $a :__GNT_2\nFUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n__GNT_2:\nBZR $a :__loop1_break\n__loop1_start:\nINC @b\nJMP :__loop1_continue\n__loop1_break:\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getNextTxFromBlockheight()', () => { + const code = '#pragma optimizationLevel 0\n long block; long currTxId = getNextTxFromBlockheight(100900); if (currTxId == 0) currTxId++; currTxId = getNextTxFromBlockheight(block);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare _counterTimestamp\n^declare block\n^declare currTxId\n\nSET @r0 #0000000000018a24\nSET @r1 #0000000000000020\nSHL @r0 $r1\nFUN A_to_Tx_after_Timestamp $r0\nFUN @currTxId get_A1\nBZR $currTxId :__GNT_1\nFUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n__GNT_1:\nBNZ $currTxId :__if2_endif\n__if2_start:\nINC @currTxId\n__if2_endif:\nSET @r0 $block\nSET @r1 #0000000000000020\nSHL @r0 $r1\nFUN A_to_Tx_after_Timestamp $r0\nFUN @currTxId get_A1\nBZR $currTxId :__GNT_3\nFUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n__GNT_3:\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getBlockheight()', () => { + const code = '#pragma optimizationLevel 0\n long block = getBlockheight(0xad);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare block\n\nSET @r0 #00000000000000ad\nFUN set_A1 $r0\nFUN @block get_Timestamp_for_Tx_in_A\nSET @r0 #0000000000000020\nSHR @block $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getCurrentBlockheight()', () => { + const code = '#pragma optimizationLevel 0\n long block = getCurrentBlockheight();' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare block\n\nFUN @block get_Block_Timestamp\nSET @r0 #0000000000000020\nSHR @block $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getAmount(); getAmountFx()', () => { + const code = '#pragma optimizationLevel 0\nlong la; fixed fa; la=getAmount(1234); fa=getAmountFx(0xfffe);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare fa\n\nSET @r0 #00000000000004d2\nCLR @r1\nFUN set_A1_A2 $r0 $r1\nFUN @la get_Amount_for_Tx_in_A\nSET @r0 #000000000000fffe\nCLR @r1\nFUN set_A1_A2 $r0 $r1\nFUN @fa get_Amount_for_Tx_in_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getSender()', () => { + const code = '#pragma optimizationLevel 0\n long a=getSender(1234);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #00000000000004d2\nFUN set_A1 $r0\nFUN B_to_Address_of_Tx_in_A\nFUN @a get_B1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getType()', () => { + const code = '#pragma optimizationLevel 0\n long a=getType(1234);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #00000000000004d2\nFUN set_A1 $r0\nFUN @a get_Type_for_Tx_in_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getCreator()', () => { + const code = '#pragma optimizationLevel 0\n long a=getCreator();' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nCLR @r0\nFUN set_B2 $r0\nFUN B_to_Address_of_Creator\nFUN @a get_B1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getCreatorOf()', () => { + const code = '#pragma optimizationLevel 0\n long a=getCreatorOf(1234);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #00000000000004d2\nFUN set_B2 $r0\nFUN B_to_Address_of_Creator\nFUN @a get_B1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getCodeHashOf()', () => { + const code = '#pragma optimizationLevel 0\n long a=getCodeHashOf(1234);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #00000000000004d2\nFUN set_B2 $r0\nFUN @a Get_Code_Hash_Id\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getWeakRandomNumber()', () => { + const code = '#pragma optimizationLevel 0\n long a=getWeakRandomNumber();' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nFUN Put_Last_Block_GSig_In_A\nFUN @a get_A2\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getActivationOf(); getActivationOfFx', () => { + const code = '#pragma optimizationLevel 0\n long a=getActivationOf(1234); fixed b=getActivationOfFx(1234);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #00000000000004d2\nFUN set_B2 $r0\nFUN @a Get_Activation_Fee\nSET @r0 #00000000000004d2\nFUN set_B2 $r0\nFUN @b Get_Activation_Fee\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getCurrentBalance(); getCurrentBalanceFx() ', () => { + const code = '#pragma optimizationLevel 0\n long a=getCurrentBalance(); fixed b=getCurrentBalanceFx();' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nCLR @r0\nFUN set_A2 $r0\nFUN @a get_Current_Balance\nCLR @r0\nFUN set_A2 $r0\nFUN @b get_Current_Balance\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: readMessage()', () => { + const code = '#pragma optimizationLevel 0\n long buffer[4], *bufPtr; readMessage(0xdede, 1, buffer); readMessage(0xfafa, 0, bufPtr); readMessage(0xfefe, 0, bufPtr+1);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare buffer\n^const SET @buffer #0000000000000004\n^declare buffer_0\n^declare buffer_1\n^declare buffer_2\n^declare buffer_3\n^declare bufPtr\n\nSET @r0 #000000000000dede\nSET @r1 #0000000000000001\nFUN set_A1_A2 $r0 $r1\nFUN message_from_Tx_in_A_to_B\nFUN @buffer_0 get_B1\nFUN @buffer_1 get_B2\nFUN @buffer_2 get_B3\nFUN @buffer_3 get_B4\nSET @r0 #000000000000fafa\nCLR @r1\nFUN set_A1_A2 $r0 $r1\nFUN message_from_Tx_in_A_to_B\nSET @r0 $bufPtr\nFUN @r1 get_B1\nSET @($r0) $r1\nFUN @r1 get_B2\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B3\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B4\nINC @r0\nSET @($r0) $r1\nSET @r0 $bufPtr\nINC @r0\nSET @r1 #000000000000fefe\nCLR @r2\nFUN set_A1_A2 $r1 $r2\nFUN message_from_Tx_in_A_to_B\nFUN @r1 get_B1\nSET @($r0) $r1\nFUN @r1 get_B2\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B3\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B4\nINC @r0\nSET @($r0) $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: sendMessage()', () => { + const code = '#pragma optimizationLevel 0\n#pragma verboseAssembly\nlong a, b, msg[4], *msgPtr;\nsendMessage(msg, getCreator());\nsendMessage(&msg[0], getCreator());\nsendMessage(&msg[a], getCreator());\nsendMessage(msgPtr, getCreator());\nsendMessage(&a, getCreator());' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare msg\n^const SET @msg #0000000000000006\n^declare msg_0\n^declare msg_1\n^declare msg_2\n^declare msg_3\n^declare msgPtr\n\n^comment line 4 sendMessage(msg, getCreator());\nCLR @r1\nFUN set_B2 $r1\nFUN B_to_Address_of_Creator\nFUN @r0 get_B1\nFUN set_B1 $r0\nFUN set_A1_A2 $msg_0 $msg_1\nFUN set_A3_A4 $msg_2 $msg_3\nFUN send_A_to_Address_in_B\n^comment line 5 sendMessage(&msg[0], getCreator());\nCLR @r1\nFUN set_B2 $r1\nFUN B_to_Address_of_Creator\nFUN @r0 get_B1\nFUN set_B1 $r0\nFUN set_A1_A2 $msg_0 $msg_1\nFUN set_A3_A4 $msg_2 $msg_3\nFUN send_A_to_Address_in_B\n^comment line 6 sendMessage(&msg[a], getCreator());\nSET @r0 $msg\nADD @r0 $a\nCLR @r2\nFUN set_B2 $r2\nFUN B_to_Address_of_Creator\nFUN @r1 get_B1\nFUN set_B1 $r1\nSET @r1 $($r0)\nINC @r0\nSET @r2 $($r0)\nFUN set_A1_A2 $r1 $r2\nINC @r0\nSET @r1 $($r0)\nINC @r0\nSET @r2 $($r0)\nFUN set_A3_A4 $r1 $r2\nFUN send_A_to_Address_in_B\n^comment line 7 sendMessage(msgPtr, getCreator());\nCLR @r1\nFUN set_B2 $r1\nFUN B_to_Address_of_Creator\nFUN @r0 get_B1\nFUN set_B1 $r0\nSET @r0 $msgPtr\nSET @r1 $($r0)\nINC @r0\nSET @r2 $($r0)\nFUN set_A1_A2 $r1 $r2\nINC @r0\nSET @r1 $($r0)\nINC @r0\nSET @r2 $($r0)\nFUN set_A3_A4 $r1 $r2\nFUN send_A_to_Address_in_B\n^comment line 8 sendMessage(&a, getCreator());\nCLR @r1\nFUN set_B2 $r1\nFUN B_to_Address_of_Creator\nFUN @r0 get_B1\nFUN set_B1 $r0\nFUN set_A1_A2 $a $b\nFUN set_A3_A4 $msg $msg_0\nFUN send_A_to_Address_in_B\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: sendAmountAndMessage()', () => { + const code = '#pragma optimizationLevel 0\n #pragma verboseAssembly\n long a, b, msg[4], *msgPtr;\n sendAmountAndMessage(1200, msg, 0xdede);\n sendAmountAndMessage(1200, msgPtr, 0xdede);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n^declare b\n^declare msg\n^const SET @msg #0000000000000006\n^declare msg_0\n^declare msg_1\n^declare msg_2\n^declare msg_3\n^declare msgPtr\n\n^comment line 4 sendAmountAndMessage(1200, msg, 0xdede);\nSET @r0 #00000000000004b0\nSET @r1 #000000000000dede\nCLR @r2\nFUN set_B1_B2 $r1 $r2\nFUN send_to_Address_in_B $r0\nFUN set_A1_A2 $msg_0 $msg_1\nFUN set_A3_A4 $msg_2 $msg_3\nFUN send_A_to_Address_in_B\n^comment line 5 sendAmountAndMessage(1200, msgPtr, 0xdede);\nSET @r0 #00000000000004b0\nSET @r1 #000000000000dede\nCLR @r2\nFUN set_B1_B2 $r1 $r2\nFUN send_to_Address_in_B $r0\nSET @r0 $msgPtr\nSET @r1 $($r0)\nINC @r0\nSET @r2 $($r0)\nFUN set_A1_A2 $r1 $r2\nINC @r0\nSET @r1 $($r0)\nINC @r0\nSET @r2 $($r0)\nFUN set_A3_A4 $r1 $r2\nFUN send_A_to_Address_in_B\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: sendAmount(); sendAmountFx()', () => { + const code = '#pragma optimizationLevel 0\n long a; fixed b; sendAmount(1_0000, 0xdede); sendAmountFx(0.2, 0xfafa);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nSET @r0 #0000000000002710\nSET @r1 #000000000000dede\nCLR @r2\nFUN set_B1_B2 $r1 $r2\nFUN send_to_Address_in_B $r0\nSET @r0 #0000000001312d00\nSET @r1 #000000000000fafa\nCLR @r2\nFUN set_B1_B2 $r1 $r2\nFUN send_to_Address_in_B $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: sendBalance()()', () => { + const code = '#pragma optimizationLevel 0\n sendBalance(0xdede);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nSET @r0 #000000000000dede\nFUN set_B1 $r0\nFUN send_All_to_Address_in_B\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getMapValue(); getMapValueFx()', () => { + const code = '#pragma optimizationLevel 0\n long a = getMapValue(0, 1); fixed b = getMapValueFx(2, 3);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nCLR @r0\nSET @r1 #0000000000000001\nCLR @r2\nFUN set_A1_A2 $r0 $r1\nFUN set_A3 $r2\nFUN @a Get_Map_Value_Keys_In_A\nSET @r0 #0000000000000002\nSET @r1 #0000000000000003\nCLR @r2\nFUN set_A1_A2 $r0 $r1\nFUN set_A3 $r2\nFUN @b Get_Map_Value_Keys_In_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getExtMapValue(); getExtMapValueFx()', () => { + const code = '#pragma optimizationLevel 0\n long a = getExtMapValue(0, 1, 0xdede); fixed b = getExtMapValueFx(2, 3, 0xfafa);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nCLR @r0\nSET @r1 #0000000000000001\nSET @r2 #000000000000dede\nFUN set_A1_A2 $r0 $r1\nFUN set_A3 $r2\nFUN @a Get_Map_Value_Keys_In_A\nSET @r0 #0000000000000002\nSET @r1 #0000000000000003\nSET @r2 #000000000000fafa\nFUN set_A1_A2 $r0 $r1\nFUN set_A3 $r2\nFUN @b Get_Map_Value_Keys_In_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: setMapValue(); setMapValueFx()', () => { + const code = '#pragma optimizationLevel 0\n setMapValue(0, 1, 1_0000); setMapValueFx(2, 3, 0.2222);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nCLR @r0\nSET @r1 #0000000000000001\nSET @r2 #0000000000002710\nFUN set_A1_A2 $r0 $r1\nFUN set_A4 $r2\nFUN Set_Map_Value_Keys_In_A\nSET @r0 #0000000000000002\nSET @r1 #0000000000000003\nSET @r2 #0000000001530ce0\nFUN set_A1_A2 $r0 $r1\nFUN set_A4 $r2\nFUN Set_Map_Value_Keys_In_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: issueAsset()', () => { + const code = '#pragma optimizationLevel 0\n long asset = issueAsset("ABCDEFGH", "IJ", 4);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare asset\n\nSET @r0 #4847464544434241\nSET @r1 #0000000000004a49\nSET @r2 #0000000000000004\nFUN set_A1_A2 $r0 $r1\nFUN set_B1 $r2\nFUN @asset Issue_Asset\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: mintAsset()', () => { + const code = '#pragma optimizationLevel 0\n mintAsset(1_0000, 0xa5531);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nSET @r0 #0000000000002710\nSET @r1 #00000000000a5531\nFUN set_B1_B2 $r1 $r0\nFUN Mint_Asset\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: sendQuantity()', () => { + const code = '#pragma optimizationLevel 0\n sendQuantity(1_000, 0xa5531, 0xdede);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nSET @r0 #00000000000003e8\nSET @r1 #00000000000a5531\nSET @r2 #000000000000dede\nFUN set_B1_B2 $r2 $r1\nFUN send_to_Address_in_B $r0\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: sendQuantityAndAmount(); sendQuantityAndAmountFx()', () => { + const code = '#pragma optimizationLevel 0\n sendQuantityAndAmount(1_000, 0xa5531, 22, 0xdede); sendQuantityAndAmountFx(1_000, 0xa5531, .02, 0xdede); ' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nSET @r0 #000000000000dede\nSET @r1 #00000000000a5531\nFUN set_B1_B2 $r0 $r1\nSET @r0 #0000000000000016\nSET @r1 #00000000000003e8\nFUN set_B3 $r0\nFUN send_to_Address_in_B $r1\nSET @r0 #000000000000dede\nSET @r1 #00000000000a5531\nFUN set_B1_B2 $r0 $r1\nSET @r0 #00000000001e8480\nSET @r1 #00000000000003e8\nFUN set_B3 $r0\nFUN send_to_Address_in_B $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getAssetBalance()', () => { + const code = '#pragma optimizationLevel 0\n long a = getAssetBalance(0xa5531);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #00000000000a5531\nFUN set_B2 $r0\nFUN @a get_Current_Balance\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: checkSignature()', () => { + const code = '#pragma optimizationLevel 0\n #pragma maxAuxVars 6\n long msg2, msg3, msg4, txId, page, creator; long result = checkSignature(msg2, msg3, msg4, txId, page, creator); asm { ^comment break } result = checkSignature("msg2", "msg3", "msg4", "txId", "page", "creator");' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare r3\n^declare r4\n^declare r5\n^declare msg2\n^declare msg3\n^declare msg4\n^declare txId\n^declare page\n^declare creator\n^declare result\n\nFUN set_A1_A2 $txId $page\nFUN set_A3 $creator\nFUN set_B2 $msg2\nFUN set_B3_B4 $msg3 $msg4\nFUN @result Check_Sig_B_With_A\n^comment break\nSET @r0 #0000000064497874\nSET @r1 #0000000065676170\nFUN set_A1_A2 $r0 $r1\nSET @r0 #00726f7461657263\nSET @r1 #000000003267736d\nFUN set_A3 $r0\nFUN set_B2 $r1\nSET @r0 #000000003367736d\nSET @r1 #000000003467736d\nFUN set_B3_B4 $r0 $r1\nFUN @result Check_Sig_B_With_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: distributeToHolders()', () => { + const code = '#pragma optimizationLevel 0\n #pragma maxAuxVars 5\n long holdersAssetMinQuantity, holdersAsset, amountToDistribute, assetToDistribute, quantityToDistribute; distributeToHolders(holdersAssetMinQuantity, holdersAsset, amountToDistribute, assetToDistribute, quantityToDistribute); asm { ^comment break } distributeToHoldersFx(1, 2, 3.3, 4, 5);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare r3\n^declare r4\n^declare holdersAssetMinQuantity\n^declare holdersAsset\n^declare amountToDistribute\n^declare assetToDistribute\n^declare quantityToDistribute\n\nFUN set_B1_B2 $holdersAssetMinQuantity $holdersAsset\nFUN set_A1 $amountToDistribute\nFUN set_A3_A4 $assetToDistribute $quantityToDistribute\nFUN Distribute_To_Asset_Holders\n^comment break\nSET @r0 #0000000000000001\nSET @r1 #0000000000000002\nFUN set_B1_B2 $r0 $r1\nSET @r0 #0000000013ab6680\nFUN set_A1 $r0\nSET @r0 #0000000000000004\nSET @r1 #0000000000000005\nFUN set_A3_A4 $r0 $r1\nFUN Distribute_To_Asset_Holders\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getAssetHoldersCount()', () => { + const code = '#pragma optimizationLevel 0\n long block = getAssetHoldersCount(1000, 0xa55e1);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare block\n\nSET @r0 #00000000000003e8\nSET @r1 #00000000000a55e1\nFUN set_B1_B2 $r0 $r1\nFUN @block Get_Asset_Holders_Count\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: readAssets()', () => { + const code = '#pragma optimizationLevel 0\n long txId, assets[4], *assetsPtr; readAssets(txId, assets); asm { ^comment b} readAssets(25, assets); asm { ^comment b} readAssets(25, assetsPtr); asm { ^comment c} readAssets(txId, assetsPtr + 1);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare txId\n^declare assets\n^const SET @assets #0000000000000005\n^declare assets_0\n^declare assets_1\n^declare assets_2\n^declare assets_3\n^declare assetsPtr\n\nFUN set_A1 $txId\nFUN B_To_Assets_Of_Tx_In_A\nFUN @assets_0 get_B1\nFUN @assets_1 get_B2\nFUN @assets_2 get_B3\nFUN @assets_3 get_B4\n^comment b\nSET @r0 #0000000000000019\nFUN set_A1 $r0\nFUN B_To_Assets_Of_Tx_In_A\nFUN @assets_0 get_B1\nFUN @assets_1 get_B2\nFUN @assets_2 get_B3\nFUN @assets_3 get_B4\n^comment b\nSET @r0 #0000000000000019\nFUN set_A1 $r0\nFUN B_To_Assets_Of_Tx_In_A\nSET @r0 $assetsPtr\nFUN @r1 get_B1\nSET @($r0) $r1\nFUN @r1 get_B2\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B3\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B4\nINC @r0\nSET @($r0) $r1\n^comment c\nSET @r0 $assetsPtr\nINC @r0\nFUN set_A1 $txId\nFUN B_To_Assets_Of_Tx_In_A\nFUN @r1 get_B1\nSET @($r0) $r1\nFUN @r1 get_B2\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B3\nINC @r0\nSET @($r0) $r1\nFUN @r1 get_B4\nINC @r0\nSET @($r0) $r1\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getQuantity()', () => { + const code = '#pragma optimizationLevel 0\n long txId, asset; long qty = getQuantity(txId, asset); asm { ^comment b} qty = getQuantity(1234, 0xA55E1);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare txId\n^declare asset\n^declare qty\n\nFUN set_A1_A2 $txId $asset\nFUN @qty get_Amount_for_Tx_in_A\n^comment b\nSET @r0 #00000000000004d2\nSET @r1 #00000000000a55e1\nFUN set_A1_A2 $r0 $r1\nFUN @qty get_Amount_for_Tx_in_A\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: getAssetCirculating()', () => { + const code = '#pragma optimizationLevel 0\n long a = getAssetCirculating(0xa55e1);' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nSET @r0 #00000000000a55e1\nFUN set_A2 $r0\nFUN @a Get_Asset_Circulating\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 4d78d33..0786437 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -130,6 +130,8 @@ export function createBuiltInInstruction ( case 'checkSignature': case 'distributeToHolders': case 'distributeToHoldersFx': + case 'sendQuantityAndAmount': + case 'sendQuantityAndAmountFx': return createBuiltIn4ArgsPlusInstruction(AstAuxVars, BuiltInToken, RetMem, argsMem) } @@ -252,9 +254,12 @@ export function createBuiltInInstruction ( `FUN @${RetMem.asmName} get_Type_for_Tx_in_A\n` break case 'getCreator': - assemblyCode = 'FUN clear_A\n' + + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) + assemblyCode = auxFlatMem.asmCode + + `FUN set_B2 $${auxFlatMem.FlatMem.asmName}\n` + 'FUN B_to_Address_of_Creator\n' + `FUN @${RetMem.asmName} get_B1\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) break case 'getCreatorOf': assemblyCode = tempArgsMem[0].asmCode + @@ -279,8 +284,11 @@ export function createBuiltInInstruction ( break case 'getCurrentBalance': case 'getCurrentBalanceFx': - assemblyCode = 'FUN clear_A\n' + + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) + assemblyCode = auxFlatMem.asmCode + + `FUN set_A2 $${auxFlatMem.FlatMem.asmName}\n` + `FUN @${RetMem.asmName} get_Current_Balance\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) break case 'readMessage': assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + @@ -336,18 +344,17 @@ export function createBuiltInInstruction ( recipientArg = 1 } if (amountArg !== -1) { - assemblyCode = 'FUN clear_A\n' + - tempArgsMem[recipientArg].asmCode + - `FUN set_B1 $${tempArgsMem[recipientArg].FlatMem.asmName}\n` + - tempArgsMem[amountArg].asmCode + + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) + assemblyCode = tempArgsMem[amountArg].asmCode + tempArgsMem[recipientArg].asmCode + auxFlatMem.asmCode + + `FUN set_B1_B2 $${tempArgsMem[recipientArg].FlatMem.asmName} $${auxFlatMem.FlatMem.asmName}\n` + `FUN send_to_Address_in_B $${tempArgsMem[amountArg].FlatMem.asmName}\n` AstAuxVars.freeRegister(tempArgsMem[amountArg].FlatMem.address) + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) } else { assemblyCode = tempArgsMem[recipientArg].asmCode + `FUN set_B1 $${tempArgsMem[recipientArg].FlatMem.asmName}\n` } AstAuxVars.freeRegister(tempArgsMem[recipientArg].FlatMem.address) - assemblyCode += tempArgsMem[messageArg].asmCode if (argsMem[messageArg].type === 'constant' || (argsMem[messageArg].type === 'array' && argsMem[messageArg].Offset === undefined)) { const theHexContent = assertNotUndefined(argsMem[messageArg].hexContent) const m1 = AstAuxVars.getMemoryObjectByLocation(theHexContent).asmName @@ -360,6 +367,7 @@ export function createBuiltInInstruction ( 'FUN send_A_to_Address_in_B\n' break } + assemblyCode += tempArgsMem[messageArg].asmCode if (AstAuxVars.isTemp(tempArgsMem[messageArg].FlatMem.address)) { AuxRegister = tempArgsMem[messageArg].FlatMem } else { @@ -387,9 +395,8 @@ export function createBuiltInInstruction ( case 'sendAmount': case 'sendAmountFx': auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) - assemblyCode = tempArgsMem[1].asmCode + auxFlatMem.asmCode + + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + auxFlatMem.asmCode + `FUN set_B1_B2 $${tempArgsMem[1].FlatMem.asmName} $${auxFlatMem.FlatMem.asmName}\n` + - tempArgsMem[0].asmCode + `FUN send_to_Address_in_B $${tempArgsMem[0].FlatMem.asmName}\n` AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) break @@ -400,31 +407,30 @@ export function createBuiltInInstruction ( break case 'getMapValue': case 'getMapValueFx': - assemblyCode = 'FUN clear_A\n' + - tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + auxFlatMem.asmCode + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + `FUN set_A3 $${auxFlatMem.FlatMem.asmName}\n` + `FUN @${RetMem.asmName} Get_Map_Value_Keys_In_A\n` + AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) break case 'getExtMapValue': case 'getExtMapValueFx': - assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + tempArgsMem[2].asmCode + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + - tempArgsMem[2].asmCode + `FUN set_A3 $${tempArgsMem[2].FlatMem.asmName}\n` + `FUN @${RetMem.asmName} Get_Map_Value_Keys_In_A\n` break case 'setMapValue': case 'setMapValueFx': - assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + tempArgsMem[2].asmCode + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + - tempArgsMem[2].asmCode + `FUN set_A4 $${tempArgsMem[2].FlatMem.asmName}\n` + 'FUN Set_Map_Value_Keys_In_A\n' break case 'issueAsset': - assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + tempArgsMem[2].asmCode + `FUN set_A1_A2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + - tempArgsMem[2].asmCode + `FUN set_B1 $${tempArgsMem[2].FlatMem.asmName}\n` + `FUN @${RetMem.asmName} Issue_Asset\n` break @@ -434,10 +440,9 @@ export function createBuiltInInstruction ( 'FUN Mint_Asset\n' break case 'sendQuantity': - assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[2].asmCode + - `FUN set_B1_B2 $${tempArgsMem[2].FlatMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + - tempArgsMem[1].asmCode + - `FUN send_to_Address_in_B $${tempArgsMem[1].FlatMem.asmName}\n` + assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + tempArgsMem[2].asmCode + + `FUN set_B1_B2 $${tempArgsMem[2].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + + `FUN send_to_Address_in_B $${tempArgsMem[0].FlatMem.asmName}\n` break case 'getAssetBalance': assemblyCode = tempArgsMem[0].asmCode + @@ -529,9 +534,8 @@ export function createBuiltIn4ArgsPlusInstruction ( AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) auxFlatMemA = flattenMemory(AstAuxVars, argsMem[5], BuiltInToken.line) auxFlatMemB = flattenMemory(AstAuxVars, argsMem[0], BuiltInToken.line) - assemblyCode += auxFlatMemA.asmCode + + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + `FUN set_A3 $${auxFlatMemA.FlatMem.asmName}\n` + - auxFlatMemB.asmCode + `FUN set_B2 $${auxFlatMemB.FlatMem.asmName}\n` AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) @@ -566,6 +570,22 @@ export function createBuiltIn4ArgsPlusInstruction ( AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) return assemblyCode + case 'sendQuantityAndAmount': + case 'sendQuantityAndAmountFx': + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[3], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[1], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + + `FUN set_B1_B2 $${auxFlatMemA.FlatMem.asmName} $${auxFlatMemB.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + auxFlatMemA = flattenMemory(AstAuxVars, argsMem[2], BuiltInToken.line) + auxFlatMemB = flattenMemory(AstAuxVars, argsMem[0], BuiltInToken.line) + assemblyCode += auxFlatMemA.asmCode + auxFlatMemB.asmCode + + `FUN set_B3 $${auxFlatMemA.FlatMem.asmName}\n` + + `FUN send_to_Address_in_B $${auxFlatMemB.FlatMem.asmName}\n` + AstAuxVars.freeRegister(auxFlatMemA.FlatMem.address) + AstAuxVars.freeRegister(auxFlatMemB.FlatMem.address) + return assemblyCode default: throw new Error('Internal error') } diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 150f26c..7f8e4f9 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -346,7 +346,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { if (Tkn.type === 'Variable' && (Tkn.value === 'getNextTx' || Tkn.value === 'getNextTxFromBlockheight')) { return true } - if (Tkn.type === 'CodeDomain') { + if (Tkn.type === 'CodeDomain' || Tkn.type === 'CodeCave') { if (autoCounterDetected(Tkn.params) === true) { return true } diff --git a/src/shaper/templates.ts b/src/shaper/templates.ts index 3043428..f25aa2c 100644 --- a/src/shaper/templates.ts +++ b/src/shaper/templates.ts @@ -337,6 +337,13 @@ export const BuiltInTemplate: SC_FUNCTION[] = [ sentences: [], name: 'sendQuantity' }, + { + argsMemObj: [longArg, longArg, longArg, longArg], + asmName: 'sendQuantityAndAmount', + declaration: 'void', + sentences: [], + name: 'sendQuantityAndAmount' + }, { argsMemObj: [longArg], asmName: 'getAssetBalance', @@ -444,6 +451,13 @@ export const BuiltInTemplate: SC_FUNCTION[] = [ sentences: [], name: 'setMapValueFx' }, + { + argsMemObj: [longArg, longArg, fixedArg, longArg], + asmName: 'sendQuantityAndAmountFx', + declaration: 'void', + sentences: [], + name: 'sendQuantityAndAmountFx' + }, { argsMemObj: [longArg, longArg, fixedArg, longArg, longArg], asmName: 'distributeToHoldersFx', From 601c2d3fe9f86c017e76a65c91b0201deb978e57 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 25 Jun 2022 21:42:46 -0300 Subject: [PATCH 088/112] Bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e75619..c47ea7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc7", + "version": "2.0.0-rc8", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 56bb4d79db73cd0f98dd35815b486d603c558b6e Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 11:26:13 -0300 Subject: [PATCH 089/112] Function argument (void) is optional. --- docs/1-Basis.md | 7 +++---- src/__tests__/functions.a.spec.ts | 6 +++--- src/shaper/shaper.ts | 10 ---------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/1-Basis.md b/docs/1-Basis.md index c08dda4..ba81270 100644 --- a/docs/1-Basis.md +++ b/docs/1-Basis.md @@ -16,7 +16,7 @@ Some keywords have the same meaning and use in C: `asm`, `break`, `continue`, `d There are also additional keywords: * `fixed`: Declares a variable that is a fixed point number. All fixed numbers have 8 decimals, so it is handyful to make Signa calculations with it. It supports positives values from 0.00000001 to 92,233,720,368.54775807 and negative from -0.00000001 to -92,233,720,368.54775808. They are internally a signed 64-bit number. * `sleep`: Puts the contract in 'sleep' mode and resumes contract execution on next block. Alternativelly it can have an argument to indicate the number of blocks to sleep and the argument can be an expression. This tree sentences have the same result `sleep;`, `sleep 0;`, and `sleep 1;`, but it is prefered the first one because the instruction is smaller. -* `exit`: Puts the contract in 'stop' mode and set program to restart from main function ('finished' mode). It will be inactive until a new transaction is received. Once a tx is received, it will start execution at `void main(void)` function. If main function is not defined, it will start again from beginning of code. `exit` takes no argument. If contract activation amount is zero, contract will resume execution on next block. +* `exit`: Puts the contract in 'stop' mode and set program to restart from main function ('finished' mode). It will be inactive until a new transaction is received. Once a tx is received, it will start execution at `void main()` function. If main function is not defined, the execution will start again from beginning of code, running again all global statements. If the main function is defined, the global statements will be executed only in the first activations of the contract. `exit` takes no argument. If contract activation amount is zero, contract will resume execution on next block (similar to `sleep`). * `halt`: Puts the contract in 'stop' mode. It will be inactive until a new transaction is received, then it will resume execution at next instruction. It takes no argument. If contract activation amount is zero, contract will resume execution on next block. Others keyword have no assembly support. They are disabled: `auto`, `double`, `float`, `register`, `volatile`. For future implementation these keywords can be added: `char`, `enum`, `extern`, `int`, `short`, `signed`, `static`, `typedef`, `union`, `unsigned`. @@ -45,7 +45,7 @@ The compiler will convert numbers and variables between fixed and long if used i Same as in C `fixedVariable = (fixed)longVariable`. The compiler will make the transformation. It is also possible to use some built-in functions if the desired transformation is just to copy the value in memory (memcopy) or use in arguments for functions (bcftol). Check chapter 1.5 Built-in functions. ### Functions -As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru preprocessor directives. There are two special functions: `void main(void)` explained before and `void catch(void)` explained at **Contract states** topic. It is not obligatory to use them. +As avaliable in C, the developer can make use of functions to make coding easier or reuse code from other projects. There is no need to put function prototypes at the beginning, the function can be used before it is declared, because their definitions are collected a step before the compiling process. Functions arguments and return values are passed using user stack. Recursive functions are allowed but developer must set manually and carefully a new size for "user stack pages" thru preprocessor directives. There are two special functions: `void main()` explained before and `void catch()` explained at **Contract states** topic. It is not obligatory to use them. Functions can return also arrays and structs; the returning values can be used directly: example `if ( arrFn(a)[2] == 25 )` or `b = structFn(a)->value;` ### Built-in functions @@ -66,7 +66,7 @@ All global statements are grouped at the beginning of assembly code (even if aft * Finished: Contract execution ended at a `exit` instruction or at the end of 'main' function. On next activation it will start at 'main'. * Stopped: Contract execution ended at a `halt` of `sleep` instruction. On next resume it will start just after current point. * Frozen: Execution was suspended because there was no more balance in contract account (no gas!). To resume execution, contract must receive a new transaction with an amount greater or equal its minimum activation. If transaction is below this amount, it will stay frozen even with some balance. -* Dead: Execution raised one of these exceptions: 1) division by zero; 2) trying to read/set a variable outside memory range; or 3) stack overflow/underflow for user/code stack. The default behaviour is all contract balance to be distributed as fee for current block forger. Also any next transaction to that dead contract will be transformed in fee. To avoid this situation, it is possible to define a special function `void catch(void)`. When the exception is found, the execution will jump to 'catch' function and a new entry point for next incoming transactions will be set. A use case for 'catch' function is to send all balance to creator to avoid losing contract balance. When using 'catch' function the contract will never reach dead state. +* Dead: Execution raised one of these exceptions: 1) division by zero; 2) trying to read/set a variable outside memory range; or 3) stack overflow/underflow for user/code stack. The default behaviour is all contract balance to be distributed as fee for current block forger. Also any next transaction to that dead contract will be transformed in fee. To avoid this situation, it is possible to define a special function `void catch()`. When the exception is found, the execution will jump to 'catch' function and a new entry point for next incoming transactions will be set. A use case for 'catch' function is to send all balance to creator to avoid losing contract balance. When using 'catch' function the contract will never reach dead state. ### Designing tips If you plan to use a number many times, declare it globally with `const` keyword and name it with `nVALUE`: example `const long n65535=65535`. @@ -83,7 +83,6 @@ This can save one instruction for each use and also make your code smaller. But * register: By default there are 3, from r0..r2. They can be used without declaration, but inspect assembly code to ensure they are not changed during other instructions. Different from registers in modern CPUs, these registers in SmartC are just regular variables created and used by compiler. ## Notes -* Run testcases to check tested operations. It shall be no failed cases. * Please report a bug if any strange behavior is found. [Back](./README.md) diff --git a/src/__tests__/functions.a.spec.ts b/src/__tests__/functions.a.spec.ts index b59c05a..30d9ec7 100644 --- a/src/__tests__/functions.a.spec.ts +++ b/src/__tests__/functions.a.spec.ts @@ -9,14 +9,14 @@ describe('Special functions', () => { expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: main() with return at end', () => { - const code = '#pragma optimizationLevel 0\nlong a; void main(void) { a++; return; }' + const code = '#pragma optimizationLevel 0\nlong a; void main() { a++; return; }' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nJMP :__fn_main\n\n__fn_main:\nPCS\nINC @a\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: main() with return at middle', () => { - const code = '#pragma optimizationLevel 0\nlong a; void main(void) { a++; return; a++; }' + const code = '#pragma optimizationLevel 0\nlong a; void main() { a++; return; a++; }' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare a\n\nJMP :__fn_main\n\n__fn_main:\nPCS\nINC @a\nFIN\nINC @a\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() @@ -30,7 +30,7 @@ describe('Special functions', () => { expect(compiler.getAssemblyCode()).toBe(assembly) }) it('should compile: catch() and no main function', () => { - const code = '#pragma optimizationLevel 0\nlong b, a = 0; while (true) { a++; } void catch(void) { long a++; }' + const code = '#pragma optimizationLevel 0\nlong b, a = 0; while (true) { a++; } void catch() { long a++; }' const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare b\n^declare a\n^declare catch_a\n\nERR :__fn_catch\nCLR @a\n__loop1_continue:\n__loop1_start:\nINC @a\nJMP :__loop1_continue\n__loop1_break:\nFIN\n\n__fn_catch:\nPCS\nINC @catch_a\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 7f8e4f9..fa81101 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -439,12 +439,6 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { * into argsMemObj and sentences properties */ function processFunctionCodeAndArguments (CurrentFunction: SC_FUNCTION, fnNum: number) { CurrentFunction.sentences = sentencesProcessor(AuxVars, CurrentFunction.code) - let expectVoid = false - if (CurrentFunction.arguments?.length === 1 && - CurrentFunction.arguments[0].type === 'Keyword' && - CurrentFunction.arguments[0].value === 'void') { - expectVoid = true - } AuxVars.currentScopeName = CurrentFunction.name AuxVars.currentPrefix = AuxVars.currentScopeName + '_' AuxVars.isFunctionArgument = true @@ -454,10 +448,6 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { `Wrong arguments for function '${CurrentFunction.name}'.`) } CurrentFunction.argsMemObj = memoryProcessor(Program.typesDefinitions, AuxVars, sentence[0].code) - if (CurrentFunction.argsMemObj.length === 0 && expectVoid === false) { - throw new Error(`At line: ${CurrentFunction.line}.` + - ` No variables in arguments for function '${CurrentFunction.name}'. Do you mean 'void'?`) - } Program.memory = Program.memory.concat(CurrentFunction.argsMemObj) AuxVars.isFunctionArgument = false delete Program.functions[fnNum].arguments From b89572f44f913e56962802ad0ad025b8c6b91bc1 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 11:34:23 -0300 Subject: [PATCH 090/112] Minimal maxAuxVars to zero. Improved error message. --- docs/1.2-Preprocessor-directives.md | 2 +- src/codeGenerator/astProcessor/setupGenCode.ts | 3 ++- src/shaper/shaper.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index 2f1fe55..ce9a7c4 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -165,7 +165,7 @@ Many arguments can be used. ## #pragma Special features used by compiler. -* `#pragma maxAuxVars N`: Used to tell compiler how many auxiliary variables will be available (they are used as registers). Default value is `3`, min value is `1` and max is `10`. If you are under memory pressure, try to reduce to minimal necessary for compiling. Simple contracts will use around 2 values, but this number depends on nested operations. +* `#pragma maxAuxVars N`: Used to tell compiler how many auxiliary variables will be available (they are used as registers). Default value is `3`, min value is `0` and max is `10`. If you are under memory pressure, try to reduce to minimal necessary for compiling. Simple contracts will use around 2 values, but this number depends on nested operations. * `#pragma maxConstVars N`: Compiler will create variable from 1 to maxConstVars. Variables will be named 'n1', 'n2', ... 'n10'. It is very usefull to use, because compiler will change all numbers references to these variables and optimize code, making code much much smaller! Default min value is `0` (deactivated) and max is `10`. * `#pragma optimizationLevel N`: Choose strategy for code optimizer. It can be between 0 and 3. * 0: No optimization. diff --git a/src/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts index 44929e6..94abd65 100644 --- a/src/codeGenerator/astProcessor/setupGenCode.ts +++ b/src/codeGenerator/astProcessor/setupGenCode.ts @@ -86,7 +86,8 @@ export default function setupGenCode ( const id = AuxVars.registerInfo.find(OBJ => OBJ.inUse === false) if (id === undefined) { throw new Error(`At line: ${line}. ` + - "No more registers available. Try to reduce nested operations or increase 'maxAuxVars'.") + 'No more registers available. ' + + `Increase the number with '#pragma maxAuxVars ${Globals.Program.Config.maxAuxVars + 1}' or try to reduce nested operations.`) } id.inUse = true return deepCopy(id.Template) diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index fa81101..53d4e29 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -183,7 +183,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { const num = parseInt(MacroToken.value) switch (MacroToken.property) { case 'maxAuxVars': - if (num >= 1 && num <= 10) { + if (num >= 0 && num <= 10) { Program.Config.maxAuxVars = num return false } From 4373dd4ff382bf8e37b9bfcc35681e5e627595ba Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 12:06:35 -0300 Subject: [PATCH 091/112] Improvements at optimizerVM --- src/__tests__/optimizations.a.spec.ts | 30 ++++++++++++- .../assemblyProcessor/optimizer.ts | 45 +++++++++++++++++++ .../assemblyProcessor/optimizerVM/api.ts | 16 +++++++ .../assemblyProcessor/optimizerVM/cpu.ts | 15 +++++-- .../assemblyProcessor/optimizerVM/index.ts | 1 + 5 files changed, 102 insertions(+), 5 deletions(-) diff --git a/src/__tests__/optimizations.a.spec.ts b/src/__tests__/optimizations.a.spec.ts index 8f209e2..fb8550a 100644 --- a/src/__tests__/optimizations.a.spec.ts +++ b/src/__tests__/optimizations.a.spec.ts @@ -162,14 +162,40 @@ describe('Optimizations level 2', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: get_B1 + set_B1', () => { + const code = '#pragma optimizationLevel 2\n sendBalance(getCreator());' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nCLR @r1\nFUN set_B2 $r1\nFUN B_to_Address_of_Creator\nFUN send_All_to_Address_in_B\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) + it('should compile: psh+pop same register', () => { + const code = '#pragma optimizationLevel 2\n asm {INC @a\nPSH $r0\nPOP @r0\nPSH $a\nPOP @a}' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nINC @a\nPSH $a\nPOP @a\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) +}) + +/* Please note that these optimizations are not well tested. Code generated by smartc +mostly have this safely coded during AST processing. */ +describe('Optimizations level 3', () => { + it('should compile: simple test', () => { + const code = '#pragma optimizationLevel 3\nlong txid; while ((txid = getNextTx()) != 0) { if (getSender(txid) != 0xfefe) continue; }' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare _counterTimestamp\n^declare txid\n\n__loop1_continue:\nFUN A_to_Tx_after_Timestamp $_counterTimestamp\nFUN @txid get_A1\nBZR $txid :__GNT_2\nFUN @_counterTimestamp get_Timestamp_for_Tx_in_A\n__GNT_2:\nBNZ $txid :__opt_1\nFIN\n__opt_1:\nFUN B_to_Address_of_Tx_in_A\nFUN @r0 get_B1\nSET @r1 #000000000000fefe\nBNE $r0 $r1 :__loop1_continue\nJMP :__loop1_continue\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) /* Please note that these optimizations are not well tested. Code generated by smartc mostly have this safely coded during AST processing. */ describe('Optimizations level 4', () => { it('should optimize: pop+set = pop', () => { - const code = 'SET @r0 #000000000000655a\nPOP @r0\nSET @pcar $r0\nFIN\n' - const assembly = 'SET @r0 #000000000000655a\nPOP @pcar\nFIN\n' + const code = '^declare r0\n^declare pcar\nSET @r0 #000000000000655a\nPOP @r0\nSET @pcar $r0\nFIN\n' + const assembly = '^declare r0\n^declare pcar\nSET @r0 #000000000000655a\nPOP @pcar\nFIN\n' const result = optimizer(4, code, []) expect(result).toBe(assembly) }) diff --git a/src/codeGenerator/assemblyProcessor/optimizer.ts b/src/codeGenerator/assemblyProcessor/optimizer.ts index b2b4e95..fb06795 100644 --- a/src/codeGenerator/assemblyProcessor/optimizer.ts +++ b/src/codeGenerator/assemblyProcessor/optimizer.ts @@ -32,6 +32,8 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri codeLines.forEach(jumpJumpOpt) codeLines.forEach(swapBranches) codeLines.forEach(notOpt) + codeLines.forEach(getSetSuper) + codeLines.forEach(pushPopRegister) codeLines.forEach(popPushRegister) codeLines.forEach(mdvOpt) codeLines = codeLines.flatMap(branchOpt) @@ -47,6 +49,7 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri } while (optimizedLines !== 0) const partialOptimized = codeLines.join('\n') if (O >= 3) { + // silent optimization const OptVM = new CONTRACT(codeLines) try { return OptVM.optimize().join('\n') @@ -281,6 +284,48 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri optimizedLines++ } + /** Optimizes get and set Superregisters in sequence with registers + * ``` + * FUN @r0 get_B1 -> DELETE + * FUN set_B1 $r0 -> DELETE + * ``` */ + function getSetSuper (value: string, index: number, array: string[]) : void { + const getSuper = /^\s*FUN\s+@(r\d+)\s+(get_[AB][1-4])\s*$/.exec(value) + if (getSuper === null) { + return + } + const setSuper = /^\s*FUN\s+(set_[AB][1-4])\s+\$(r\d+)\s*$/.exec(array[index + 1]) + if (setSuper === null) { + return + } + if (getSuper[1] === setSuper[2] && getSuper[2].slice(1) === setSuper[1].slice(1)) { + array[index] = 'DELETE' + array[index + 1] = 'DELETE' + optimizedLines++ + } + } + + /** Optimizes register poping and pushing in sequence + * ``` + * PSH $r0 -> DELETE + * POP @r0 -> DELETE + * ``` */ + function pushPopRegister (value: string, index: number, array: string[]) : void { + const pshdat = /^\s*PSH\s+\$(r\d+)\s*$/.exec(value) + if (pshdat === null) { + return + } + const popdat = /^\s*POP\s+@(r\d)\s*$/.exec(array[index + 1]) + if (popdat === null) { + return + } + if (pshdat[1] === popdat[1]) { + array[index] = 'DELETE' + array[index + 1] = 'DELETE' + optimizedLines++ + } + } + /** Optimizes register poping and pushing in sequence * ``` * POP @r0 -> DELETE diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts index c2510ca..4f77fef 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts @@ -593,6 +593,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -606,6 +608,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -619,6 +623,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -632,6 +638,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -645,6 +653,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -658,6 +668,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -671,6 +683,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, @@ -684,6 +698,8 @@ export class API_MICROCODE { return null } ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName return true } }, diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts index 8afa854..22bba7b 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts @@ -23,6 +23,11 @@ export class CPU { stepFee: 0n, regex: /^\s*(\w+):\s*$/, execute (ContractState, regexParts) { + if (regexParts[1].startsWith('__opt_') || regexParts[1].startsWith('__GNT_')) { + // Optimization with __opt just swap to RET or FIN, so no destruction inside this branch + // Same with __GNT_ that is a simple loop of getNextTx(). + return false + } ContractState.unknowAll() return false } @@ -41,7 +46,11 @@ export class CPU { regex: /^\s*\^declare\s+(\w+)\s*$/, execute (ContractState, regexParts) { if (ContractState.Memory.find(mem => mem.varName === regexParts[1]) === undefined) { - ContractState.Memory.push({ varName: regexParts[1], value: unknownValue, shadow: '' }) + let value = unknownValue + if (/^n\d+$/.test(regexParts[1])) { + value = BigInt(regexParts[1].substring(1)) + } + ContractState.Memory.push({ varName: regexParts[1], value, shadow: '' }) } return false } @@ -228,7 +237,7 @@ export class CPU { stepFee: 1n, regex: /^\s*(BOR|AND|XOR)\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable1 = ContractState.getMemoryByName(regexParts[2]) ContractState.unknownAndRevoke(variable1) return true } @@ -369,7 +378,7 @@ export class CPU { stepFee: 1n, regex: /^\s*(SHL|SHR)\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) + const variable1 = ContractState.getMemoryByName(regexParts[2]) ContractState.unknownAndRevoke(variable1) return true } diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts index 2a25f19..e853786 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts @@ -150,6 +150,7 @@ export class CONTRACT { AssignedVar.value = Variable.value AssignedVar.shadow = Variable.varName this.revokeShadow(AssignedVar.varName) + Variable.shadow = AssignedVar.varName } zeroAndRevoke (Var: MemoryObj) { From 7bfeb69bae4148d216f0620f57ba5486f5647da2 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 12:06:55 -0300 Subject: [PATCH 092/112] Bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c47ea7c..6b62306 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc8", + "version": "2.0.0-rc9", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 30d2e75ca2e9f74a6cb0f0bfcecd9ad6561eba4d Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 17:50:41 -0300 Subject: [PATCH 093/112] Added multi-error output and warnings. --- debug.html | 6 ++- src/__tests__/misc.a.spec.ts | 48 +++++++++++++++++++ src/assembler/assembler.ts | 1 + .../astProcessor/binaryAsnProcessor.ts | 5 ++ .../astProcessor/setupGenCode.ts | 2 + src/codeGenerator/codeGenerator.ts | 27 +++++++++-- src/codeGenerator/codeGeneratorTypes.ts | 6 +++ src/smartc.ts | 4 +- src/typings/contractTypes.ts | 4 ++ 9 files changed, 97 insertions(+), 6 deletions(-) diff --git a/debug.html b/debug.html index 1ea2876..936f307 100644 --- a/debug.html +++ b/debug.html @@ -16,7 +16,11 @@ const asmCode = compiler.getAssemblyCode(); const bcode = compiler.getMachineCode(); const t1 = new Date(); - document.getElementById('status').innerHTML = `Compile sucessfull!!! Done at ${t1.getHours()}:${t1.getMinutes()}:${t1.getSeconds()} in ${t1 - t0} ms.`; + let compileMessage = `Compile sucessfull!!! Done at ${t1.getHours()}:${t1.getMinutes()}:${t1.getSeconds()} in ${t1 - t0} ms.`; + if (bcode.Warnings.length != 0) { + compileMessage += `
${bcode.Warnings}`; + } + document.getElementById('status').innerHTML = compileMessage; document.getElementById('assembly').innerText = asmCode; document.getElementById('debug-info').innerHTML = JSON.stringify(bcode, null, ' '); } catch (e) { diff --git a/src/__tests__/misc.a.spec.ts b/src/__tests__/misc.a.spec.ts index 4e360f1..f1fe2bf 100644 --- a/src/__tests__/misc.a.spec.ts +++ b/src/__tests__/misc.a.spec.ts @@ -210,3 +210,51 @@ describe('Wrong code to check error safeguards', () => { }).toThrowError(/^At line/) }) }) + +describe('Warnings', () => { + it('should compile with warning: right side of operator', () => { + const code = 'long la, lb; fixed fa, fb; fa = fb - la;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare lb\n^declare fa\n^declare fb\n\nSET @fa $fb\nSET @r0 $la\nMUL @r0 $f100000000\nSUB @fa $r0\nFIN\n' + const warnings = "Warning: at line 1. Implicit type casting conversion on right side of operator '-'." + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + expect(compiler.getMachineCode().Warnings).toBe(warnings) + }) + it('should compile with warning: left side of operator', () => { + const code = 'long la, lb; fixed fa, fb; fa = la - fb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare lb\n^declare fa\n^declare fb\n\nSET @fa $la\nMUL @fa $f100000000\nSUB @fa $fb\nFIN\n' + const warnings = "Warning: at line 1. Implicit type casting conversion on left side of operator '-'." + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + expect(compiler.getMachineCode().Warnings).toBe(warnings) + }) + it('should compile with warning: rigth side of comparision', () => { + const code = 'long la, lb; fixed fa, fb; if(fa < lb) la++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare lb\n^declare fa\n^declare fb\n\nSET @r0 $lb\nMUL @r0 $f100000000\nBLT $fa $r0 :__opt_1\nFIN\n__opt_1:\nINC @la\nFIN\n' + const warnings = "Warning: at line 1. Implicit type casting conversion on right side of comparision '<'." + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + expect(compiler.getMachineCode().Warnings).toBe(warnings) + }) + it('should compile with warning: left side of comparision', () => { + const code = 'long la, lb; fixed fa, fb; if(la < fb) la++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare lb\n^declare fa\n^declare fb\n\nSET @r0 $la\nMUL @r0 $f100000000\nBLT $r0 $fb :__opt_1\nFIN\n__opt_1:\nINC @la\nFIN\n' + const warnings = "Warning: at line 1. Implicit type casting conversion on left side of comparision '<'." + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + expect(compiler.getMachineCode().Warnings).toBe(warnings) + }) + it('should compile with warning: right side of assignment', () => { + const code = 'long la, lb; fixed fa, fb; la = fb;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare la\n^declare lb\n^declare fa\n^declare fb\n\nSET @la $fb\nDIV @la $f100000000\nFIN\n' + const warnings = "Warning: at line 1. Implicit type casting conversion on right side of assignment '='." + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + expect(compiler.getMachineCode().Warnings).toBe(warnings) + }) +}) diff --git a/src/assembler/assembler.ts b/src/assembler/assembler.ts index ec10ba7..7d19b30 100644 --- a/src/assembler/assembler.ts +++ b/src/assembler/assembler.ts @@ -536,6 +536,7 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { const codepages = Math.ceil(AsmObj.bytecode.length / (32 * 16)) const minimumfee = (cspages + uspages + datapages + codepages) * 10000000 return { + Warnings: '', DataPages: datapages, CodeStackPages: cspages, UserStackPages: uspages, diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index b487d35..6ebfb9e 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -100,9 +100,11 @@ export default function binaryAsnProcessor ( const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) switch (castSide) { case 'left': + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on left side of operator '${CurrentNode.Operation.value}'.`) LGenObj = typeCasting(AuxVars, LGenObj, rightDeclaration, CurrentNode.Operation.line) break case 'right': { + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of operator '${CurrentNode.Operation.value}'.`) const oldAsm = RGenObj.asmCode RGenObj = typeCasting(AuxVars, RGenObj, leftDeclaration, CurrentNode.Operation.line) // append only the diff @@ -178,6 +180,7 @@ export default function binaryAsnProcessor ( case 'left': throw new Error('Internal error') case 'right': + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of assignment '='.`) RGenObj = typeCasting(AuxVars, RGenObj, lDecl, CurrentNode.Operation.line) } // Create instruction @@ -565,9 +568,11 @@ export default function binaryAsnProcessor ( const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) switch (castSide) { case 'left': + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on left side of comparision '${CurrentNode.Operation.value}'.`) LGenObj = typeCasting(AuxVars, LGenObj, rightDeclaration, CurrentNode.Operation.line) break case 'right': + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of comparision '${CurrentNode.Operation.value}'.`) RGenObj = typeCasting(AuxVars, RGenObj, leftDeclaration, CurrentNode.Operation.line) } assemblyCode = LGenObj.asmCode + RGenObj.asmCode diff --git a/src/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts index 94abd65..80bb001 100644 --- a/src/codeGenerator/astProcessor/setupGenCode.ts +++ b/src/codeGenerator/astProcessor/setupGenCode.ts @@ -18,6 +18,7 @@ export default function setupGenCode ( isLeftSideOfAssignment: false, isConstSentence: false, hasVoidArray: false, + warnings: [], isTemp: auxvarsIsTemp, getNewRegister: auxvarsGetNewRegister, freeRegister: auxvarsFreeRegister, @@ -47,6 +48,7 @@ export default function setupGenCode ( validateReturnedVariable(CodeGenInfo.InitialAST, code.SolvedMem) code.asmCode += AuxVars.postOperations Globals.jumpId = AuxVars.jumpId + Globals.Program.warnings.push(...AuxVars.warnings) // Check throw conditions that were out-of-scope const analysyCode = code.asmCode.split('\n') code.asmCode = analysyCode.map(line => { diff --git a/src/codeGenerator/codeGenerator.ts b/src/codeGenerator/codeGenerator.ts index d2f4c6a..d3bb304 100644 --- a/src/codeGenerator/codeGenerator.ts +++ b/src/codeGenerator/codeGenerator.ts @@ -17,6 +17,8 @@ export default function codeGenerator (Program: CONTRACT) { latestLoopId: [], jumpId: 0, assemblyCode: '', + errors: '', + warnings: '', currFunctionIndex: -1, currSourceLine: 0, getNewJumpID: function (line: number) { @@ -70,6 +72,10 @@ export default function codeGenerator (Program: CONTRACT) { } functionTailGenerator() }) + // Inspect if there were errros and throw now + if (GlobalCodeVars.errors.length !== 0) { + throw new Error(GlobalCodeVars.errors) + } return optimizer( Program.Config.optimizationLevel, GlobalCodeVars.assemblyCode, @@ -100,6 +106,10 @@ export default function codeGenerator (Program: CONTRACT) { GlobalCodeVars.assemblyCode += lines } + function addError (erroMessage: string) { + GlobalCodeVars.errors += erroMessage + '\n' + } + /** Add content of macro 'program' information to assembly code */ function configDeclarationGenerator () { if (Program.Config.PName !== '') { @@ -183,10 +193,19 @@ export default function codeGenerator (Program: CONTRACT) { let assemblyCode: string switch (Sentence.type) { case 'phrase': - writeAsmCode( - setupGenCode(GlobalCodeVars, { InitialAST: Sentence.CodeAST }, Sentence.line), - Sentence.line - ) + try { + writeAsmCode( + setupGenCode(GlobalCodeVars, { InitialAST: Sentence.CodeAST }, Sentence.line), + Sentence.line + ) + } catch (err) { + if (err instanceof Error) { + addError(err.message) + break + } + // Fatal error + throw err + } break case 'ifEndif': sentenceID = '__if' + GlobalCodeVars.getNewJumpID(Sentence.line) diff --git a/src/codeGenerator/codeGeneratorTypes.ts b/src/codeGenerator/codeGeneratorTypes.ts index abd77b1..d2724e8 100644 --- a/src/codeGenerator/codeGeneratorTypes.ts +++ b/src/codeGenerator/codeGeneratorTypes.ts @@ -10,6 +10,10 @@ export type GLOBAL_AUXVARS = { jumpId: number /** Assembly code being created */ assemblyCode: string + /** Errors found */ + errors: string + /** Warnings found */ + warnings: string /** Current function being processed */ currFunctionIndex: number /** Line counter for source code */ @@ -64,6 +68,8 @@ export type GENCODE_AUXVARS = { isConstSentence: boolean /** Flag to inform lower level AST that there are an void array assignment */ hasVoidArray: boolean + /** Warnings found */ + warnings: string[] /** Verifies if a variable at loc address is register or temporary reused var */ isTemp(loc: number): boolean /** Get a new register variable */ diff --git a/src/smartc.ts b/src/smartc.ts index 96d8b1a..fa8ef99 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -68,7 +68,8 @@ export class SmartC { PCodeStackPages: 0, PCodeHashId: '', verboseAssembly: false - } + }, + warnings: [] } constructor (Options: { language: 'C' | 'Assembly', sourceCode: string }) { @@ -103,6 +104,7 @@ export class SmartC { throw new Error('Invalid usage. Language must be "C" or "Assembly".') } this.MachineCode = assembler(this.preAssemblyCode) + this.MachineCode.Warnings = this.Program.warnings.join('\n') return this } diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index 88916bd..470b1bb 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -95,9 +95,13 @@ export type CONTRACT = { typesDefinitions: TYPE_DEFINITIONS[], /** Compiler configurations */ Config: SC_CONFIG, + /** Compilation warnings */ + warnings: string[], } export type MACHINE_OBJECT = { + /** Warnings found */ + Warnings: string /** Number of data pages (Memory size) */ DataPages: number /** Number of code stack pages (code stack size) */ From fe5dddb1c9b6b510df4f364de4b13074e28f9e4f Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 17:51:17 -0300 Subject: [PATCH 094/112] Fix on built-in mintAsset --- src/__tests__/functions.b.spec.ts | 2 +- src/codeGenerator/assemblyProcessor/createInstruction.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index 01b7df4..0ec1d82 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -317,7 +317,7 @@ describe('Built-in functions', () => { }) it('should compile: mintAsset()', () => { const code = '#pragma optimizationLevel 0\n mintAsset(1_0000, 0xa5531);' - const assembly = '^declare r0\n^declare r1\n^declare r2\n\nSET @r0 #0000000000002710\nSET @r1 #00000000000a5531\nFUN set_B1_B2 $r1 $r0\nFUN Mint_Asset\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n\nSET @r0 #0000000000002710\nSET @r1 #00000000000a5531\nFUN set_B1_B2 $r0 $r1\nFUN Mint_Asset\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 0786437..47281de 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -436,7 +436,7 @@ export function createBuiltInInstruction ( break case 'mintAsset': assemblyCode = tempArgsMem[0].asmCode + tempArgsMem[1].asmCode + - `FUN set_B1_B2 $${tempArgsMem[1].FlatMem.asmName} $${tempArgsMem[0].FlatMem.asmName}\n` + + `FUN set_B1_B2 $${tempArgsMem[0].FlatMem.asmName} $${tempArgsMem[1].FlatMem.asmName}\n` + 'FUN Mint_Asset\n' break case 'sendQuantity': From 37a6947879a1a54e282a13fc828933ac220bcb71 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sun, 26 Jun 2022 17:53:31 -0300 Subject: [PATCH 095/112] bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b62306..17a090d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc9", + "version": "2.0.0-rc10", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 2af0fbe5d240e80af94330094417d9471e1dc652 Mon Sep 17 00:00:00 2001 From: deleterium Date: Mon, 27 Jun 2022 11:24:16 -0300 Subject: [PATCH 096/112] Fix getCurrentBalance code... --- src/__tests__/functions.b.spec.ts | 2 +- src/codeGenerator/assemblyProcessor/createInstruction.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/functions.b.spec.ts b/src/__tests__/functions.b.spec.ts index 0ec1d82..30696f0 100644 --- a/src/__tests__/functions.b.spec.ts +++ b/src/__tests__/functions.b.spec.ts @@ -247,7 +247,7 @@ describe('Built-in functions', () => { }) it('should compile: getCurrentBalance(); getCurrentBalanceFx() ', () => { const code = '#pragma optimizationLevel 0\n long a=getCurrentBalance(); fixed b=getCurrentBalanceFx();' - const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nCLR @r0\nFUN set_A2 $r0\nFUN @a get_Current_Balance\nCLR @r0\nFUN set_A2 $r0\nFUN @b get_Current_Balance\nFIN\n' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare f100000000\n^const SET @f100000000 #0000000005f5e100\n^declare a\n^declare b\n\nCLR @r0\nFUN set_B2 $r0\nFUN @a get_Current_Balance\nCLR @r0\nFUN set_B2 $r0\nFUN @b get_Current_Balance\nFIN\n' const compiler = new SmartC({ language: 'C', sourceCode: code }) compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) diff --git a/src/codeGenerator/assemblyProcessor/createInstruction.ts b/src/codeGenerator/assemblyProcessor/createInstruction.ts index 47281de..75162c6 100644 --- a/src/codeGenerator/assemblyProcessor/createInstruction.ts +++ b/src/codeGenerator/assemblyProcessor/createInstruction.ts @@ -286,7 +286,7 @@ export function createBuiltInInstruction ( case 'getCurrentBalanceFx': auxFlatMem = flattenMemory(AstAuxVars, utils.createConstantMemObj(0n), BuiltInToken.line) assemblyCode = auxFlatMem.asmCode + - `FUN set_A2 $${auxFlatMem.FlatMem.asmName}\n` + + `FUN set_B2 $${auxFlatMem.FlatMem.asmName}\n` + `FUN @${RetMem.asmName} get_Current_Balance\n` AstAuxVars.freeRegister(auxFlatMem.FlatMem.address) break From c7346d2261baf86cb34bd79b2de04483f695ceb5 Mon Sep 17 00:00:00 2001 From: deleterium Date: Mon, 27 Jun 2022 11:27:27 -0300 Subject: [PATCH 097/112] Bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17a090d..03c03c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc10", + "version": "2.0.0-rc11", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 4faa4523abe48e1f8d170ea5ad1933bbdab6a83c Mon Sep 17 00:00:00 2001 From: deleterium Date: Mon, 27 Jun 2022 16:44:59 -0300 Subject: [PATCH 098/112] Fix in detecting registers --- src/__tests__/bugfixes.a.spec.ts | 7 +++++++ src/codeGenerator/astProcessor/setupGenCode.ts | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/__tests__/bugfixes.a.spec.ts b/src/__tests__/bugfixes.a.spec.ts index 0cb0919..6038006 100644 --- a/src/__tests__/bugfixes.a.spec.ts +++ b/src/__tests__/bugfixes.a.spec.ts @@ -255,4 +255,11 @@ describe('Tests for bugfixes', () => { compiler.compile() }).toThrowError(/^At line/) }) + it('should compile: bug 32 Registers always registers even if not in use', () => { + const code = '#pragma optimizationLevel 0\nlong auxJ = 1; long auxTemp = 0; long squad;\n for (long auxI = 0; auxI < 3; auxI++) { r1 = squad & 0xFF; r1 &= 0xF; auxTemp += r1 * auxJ; auxJ *= 5; squad >>= 8; }' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare auxJ\n^declare auxTemp\n^declare squad\n^declare auxI\n\nSET @auxJ #0000000000000001\nCLR @auxTemp\nCLR @auxI\n__loop1_condition:\nSET @r0 #0000000000000003\nBGE $auxI $r0 :__loop1_break\n__loop1_start:\nSET @r0 #00000000000000ff\nAND @r0 $squad\nSET @r1 $r0\nSET @r0 #000000000000000f\nAND @r1 $r0\nMUL @r1 $auxJ\nADD @auxTemp $r1\nSET @r0 #0000000000000005\nMUL @auxJ $r0\nSET @r0 #0000000000000008\nSHR @squad $r0\n__loop1_continue:\nINC @auxI\nJMP :__loop1_condition\n__loop1_break:\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) diff --git a/src/codeGenerator/astProcessor/setupGenCode.ts b/src/codeGenerator/astProcessor/setupGenCode.ts index 80bb001..43f6c97 100644 --- a/src/codeGenerator/astProcessor/setupGenCode.ts +++ b/src/codeGenerator/astProcessor/setupGenCode.ts @@ -78,10 +78,10 @@ export default function setupGenCode ( function auxvarsIsTemp (loc: number) : boolean { if (loc === -1) return false const id = AuxVars.registerInfo.find(OBJ => OBJ.Template.address === loc) - if (id?.inUse === true) { - return true + if (id === undefined) { + return false } - return false + return true } function auxvarsGetNewRegister (line: number = sentenceLine): MEMORY_SLOT { From ab86fdd0443bb96ea572f42d39942bd91c97f129 Mon Sep 17 00:00:00 2001 From: deleterium Date: Mon, 27 Jun 2022 16:45:34 -0300 Subject: [PATCH 099/112] FIX: NULL is void pointer zero --- src/preprocessor/preprocessor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preprocessor/preprocessor.ts b/src/preprocessor/preprocessor.ts index 99cefe0..e0831a5 100644 --- a/src/preprocessor/preprocessor.ts +++ b/src/preprocessor/preprocessor.ts @@ -40,7 +40,7 @@ export default function preprocessor (sourcecode: string) : string { let preprocessorReplacements: REPLACEMENTS[] = [ { cname: 'true', regex: /\btrue\b/, value: '1' }, { cname: 'false', regex: /\bfalse\b/, value: '0' }, - { cname: 'NULL', regex: /\bNULL\b/, value: '0' }, + { cname: 'NULL', regex: /\bNULL\b/, value: '(void *)(0)' }, { cname: 'SMARTC', regex: /\bSMARTC\b/, value: '' } ] const ifActive: IF_INFO[] = [{ active: true, flipped: false }] From fddf28e307201bec18dae955d77ef07aa3814be8 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 28 Jun 2022 00:21:55 -0300 Subject: [PATCH 100/112] Removed warning when both sides are pointers --- .../astProcessor/binaryAsnProcessor.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 6ebfb9e..53c9d17 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -100,11 +100,15 @@ export default function binaryAsnProcessor ( const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) switch (castSide) { case 'left': - AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on left side of operator '${CurrentNode.Operation.value}'.`) + if (!(leftDeclaration.endsWith('_ptr') && rightDeclaration.endsWith('_ptr'))) { + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on left side of operator '${CurrentNode.Operation.value}'.`) + } LGenObj = typeCasting(AuxVars, LGenObj, rightDeclaration, CurrentNode.Operation.line) break case 'right': { - AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of operator '${CurrentNode.Operation.value}'.`) + if (!(leftDeclaration.endsWith('_ptr') && rightDeclaration.endsWith('_ptr'))) { + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of operator '${CurrentNode.Operation.value}'.`) + } const oldAsm = RGenObj.asmCode RGenObj = typeCasting(AuxVars, RGenObj, leftDeclaration, CurrentNode.Operation.line) // append only the diff @@ -180,7 +184,9 @@ export default function binaryAsnProcessor ( case 'left': throw new Error('Internal error') case 'right': - AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of assignment '='.`) + if (!(lDecl.endsWith('_ptr') && rDecl.endsWith('_ptr'))) { + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of assignment '='.`) + } RGenObj = typeCasting(AuxVars, RGenObj, lDecl, CurrentNode.Operation.line) } // Create instruction @@ -568,11 +574,15 @@ export default function binaryAsnProcessor ( const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) switch (castSide) { case 'left': - AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on left side of comparision '${CurrentNode.Operation.value}'.`) + if (!(leftDeclaration.endsWith('_ptr') && rightDeclaration.endsWith('_ptr'))) { + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on left side of comparision '${CurrentNode.Operation.value}'.`) + } LGenObj = typeCasting(AuxVars, LGenObj, rightDeclaration, CurrentNode.Operation.line) break case 'right': - AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of comparision '${CurrentNode.Operation.value}'.`) + if (!(leftDeclaration.endsWith('_ptr') && rightDeclaration.endsWith('_ptr'))) { + AuxVars.warnings.push(`Warning: at line ${CurrentNode.Operation.line}. Implicit type casting conversion on right side of comparision '${CurrentNode.Operation.value}'.`) + } RGenObj = typeCasting(AuxVars, RGenObj, leftDeclaration, CurrentNode.Operation.line) } assemblyCode = LGenObj.asmCode + RGenObj.asmCode From 2eda163e89ce54609eadd250a951655e86464eaf Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 28 Jun 2022 00:41:17 -0300 Subject: [PATCH 101/112] bugfix 33 verboseAssembly breaking some optimizations --- src/__tests__/bugfixes.a.spec.ts | 7 ++ .../assemblyProcessor/optimizer.ts | 65 +++++++++++-------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/__tests__/bugfixes.a.spec.ts b/src/__tests__/bugfixes.a.spec.ts index 6038006..cc6b00c 100644 --- a/src/__tests__/bugfixes.a.spec.ts +++ b/src/__tests__/bugfixes.a.spec.ts @@ -262,4 +262,11 @@ describe('Tests for bugfixes', () => { compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: bug 33 Adding verbose assembly breaks some optimizations', () => { + const code = '#pragma verboseAssembly\n #pragma optimizationLevel 2\n long txid, creator;\n while (txid != 0) {\n if (getSender(txid) != creator) {\n continue;\n }\n creator++;\n }\n creator++;' + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare txid\n^declare creator\n\n^comment line 4 while (txid != 0) {\n__loop1_continue:\nBZR $txid :__loop1_break\n^comment line 5 if (getSender(txid) != creator) {\nFUN set_A1 $txid\nFUN B_to_Address_of_Tx_in_A\nFUN @r0 get_B1\nBNE $r0 $creator :__loop1_continue\n^comment line 6 continue;\n^comment line 8 creator++;\nINC @creator\nJMP :__loop1_continue\n__loop1_break:\n^comment line 10 creator++;\nINC @creator\nFIN\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) diff --git a/src/codeGenerator/assemblyProcessor/optimizer.ts b/src/codeGenerator/assemblyProcessor/optimizer.ts index fb06795..11e6e0c 100644 --- a/src/codeGenerator/assemblyProcessor/optimizer.ts +++ b/src/codeGenerator/assemblyProcessor/optimizer.ts @@ -103,20 +103,14 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri if (jmpto === null) { return } - let i = index - while (++i < array.length - 1) { - const nextLabel = /^\s*(\w+):\s*$/.exec(array[i]) - if (nextLabel === null) { - if (isUntouchable(array[i])) { - continue - } - break - } - if (jmpto[1] === nextLabel[1]) { - array[index] = 'DELETE' - optimizedLines++ - return - } + const ip = getNextInstruction(index) + const nextLabel = /^\s*(\w+):\s*$/.exec(array[ip]) + if (nextLabel === null) { + return + } + if (jmpto[1] === nextLabel[1]) { + array[index] = 'DELETE' + optimizedLines++ } } @@ -174,18 +168,20 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri if (branchdat === null) { return } - const label = /^\s*(\w+):\s*$/.exec(array[index + 2]) - if (label === null || branchdat[4] !== label[1]) { + const ip = getNextInstruction(index) + const jmpto = /^\s*JMP\s+:(\w+)\s*$/.exec(array[ip]) + if (jmpto === null) { return } - const jmpto = /^\s*JMP\s+:(\w+)\s*$/.exec(array[index + 1]) - if (jmpto === null) { + const ipp = getNextInstruction(ip) + const label = /^\s*(\w+):\s*$/.exec(array[ipp]) + if (label === null || branchdat[4] !== label[1]) { return } array[index] = value .replace(branchdat[1], inverseBranch(branchdat[1])) .replace(branchdat[4], jmpto[1]) - array[index + 1] = 'DELETE' + array[ip] = 'DELETE' optimizedLines++ } @@ -260,13 +256,14 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri if (muldat === null) { return } - const divdat = /^\s*DIV\s+@(\w+)\s+\$(\w+)\s*$/.exec(array[index + 1]) + const ip = getNextInstruction(index) + const divdat = /^\s*DIV\s+@(\w+)\s+\$(\w+)\s*$/.exec(array[ip]) if (divdat === null) { return } if (muldat[1] === divdat[1]) { array[index] = `MDV @${muldat[1]} $${muldat[2]} $${divdat[2]}` - array[index + 1] = 'DELETE' + array[ip] = 'DELETE' optimizedLines++ } } @@ -294,13 +291,14 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri if (getSuper === null) { return } - const setSuper = /^\s*FUN\s+(set_[AB][1-4])\s+\$(r\d+)\s*$/.exec(array[index + 1]) + const ip = getNextInstruction(index) + const setSuper = /^\s*FUN\s+(set_[AB][1-4])\s+\$(r\d+)\s*$/.exec(array[ip]) if (setSuper === null) { return } if (getSuper[1] === setSuper[2] && getSuper[2].slice(1) === setSuper[1].slice(1)) { array[index] = 'DELETE' - array[index + 1] = 'DELETE' + array[ip] = 'DELETE' optimizedLines++ } } @@ -315,13 +313,14 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri if (pshdat === null) { return } - const popdat = /^\s*POP\s+@(r\d)\s*$/.exec(array[index + 1]) + const ip = getNextInstruction(index) + const popdat = /^\s*POP\s+@(r\d)\s*$/.exec(array[ip]) if (popdat === null) { return } if (pshdat[1] === popdat[1]) { array[index] = 'DELETE' - array[index + 1] = 'DELETE' + array[ip] = 'DELETE' optimizedLines++ } } @@ -336,13 +335,14 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri if (popdat === null) { return } - const pshslpdat = /^\s*PSH\s+\$(r\d+)\s*$/.exec(array[index + 1]) + const ip = getNextInstruction(index) + const pshslpdat = /^\s*PSH\s+\$(r\d+)\s*$/.exec(array[ip]) if (pshslpdat === null) { return } if (pshslpdat[1] === popdat[1]) { array[index] = 'DELETE' - array[index + 1] = 'DELETE' + array[ip] = 'DELETE' optimizedLines++ } } @@ -386,6 +386,17 @@ export default function optimizer (O: number, assemblyCode: string, labels: stri return false } + /** Starting from line, returns the next line that is a valid instruction. + * Valid instructions are labels or codes. + */ + function getNextInstruction (line: number) : number { + line++ + while (isUntouchable(codeLines[line])) { + line++ + } + return line + } + function inverseBranch (branchOperator: string) : string { switch (branchOperator) { case 'BGT': return 'BLE' From c11c9d260d6feaea0fb300bc37ae82cc5d53e3b8 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 28 Jun 2022 11:59:19 -0300 Subject: [PATCH 102/112] Fix sizeof + struct declaration inside function --- src/__tests__/structs.b.spec.ts | 16 ++++++++++++++++ .../astProcessor/endAsnProcessor.ts | 13 +++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/__tests__/structs.b.spec.ts b/src/__tests__/structs.b.spec.ts index be8256a..5400240 100644 --- a/src/__tests__/structs.b.spec.ts +++ b/src/__tests__/structs.b.spec.ts @@ -184,6 +184,22 @@ if (a<=pcar->collector) { b--; }` compiler.compile() expect(compiler.getAssemblyCode()).toBe(assembly) }) + it('should compile: struct declaration inside function', () => { + const code = `search(2); +struct PLAYER * search(long playerAddress) { + struct PLAYER { + long address, balance, VDLS; + } *playerPtr, players[2]; + long nPlayers; + struct PLAYER * foundPlayer; + nPlayers = sizeof(struct PLAYER); + return NULL; +}` + const assembly = '^declare r0\n^declare r1\n^declare r2\n^declare search_playerAddress\n^declare search_playerPtr\n^declare search_players\n^const SET @search_players #0000000000000006\n^declare search_players_0_address\n^declare search_players_0_balance\n^declare search_players_0_VDLS\n^declare search_players_1_address\n^declare search_players_1_balance\n^declare search_players_1_VDLS\n^declare search_nPlayers\n^declare search_foundPlayer\n\nSET @r0 #0000000000000002\nPSH $r0\nJSR :__fn_search\nPOP @r0\nFIN\n\n__fn_search:\nPOP @search_playerAddress\nSET @search_nPlayers #0000000000000003\nCLR @r0\nPSH $r0\nRET\n' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode()).toBe(assembly) + }) }) describe('structs (pointer / arrays) wrong usage', () => { diff --git a/src/codeGenerator/astProcessor/endAsnProcessor.ts b/src/codeGenerator/astProcessor/endAsnProcessor.ts index 2ac00d5..8f8227b 100644 --- a/src/codeGenerator/astProcessor/endAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/endAsnProcessor.ts @@ -107,11 +107,20 @@ export default function endAsnProcessor ( } } case 'struct': { - const StructTypeDefinition = Program.typesDefinitions.find( + let StructTypeDefinition = Program.typesDefinitions.find( Obj => Obj.type === 'struct' && Obj.name === CurrentNode.Token.extValue ) as STRUCT_TYPE_DEFINITION | undefined + if (StructTypeDefinition === undefined && AuxVars.CurrentFunction !== undefined) { + StructTypeDefinition = Program.typesDefinitions.find( + Obj => Obj.type === 'struct' && Obj.name === AuxVars.CurrentFunction?.name + '_' + CurrentNode.Token.extValue + ) as STRUCT_TYPE_DEFINITION | undefined + } + if (StructTypeDefinition === undefined) { + throw new Error(`At line: ${CurrentNode.Token.line}. ` + + `Struct type definition for '${CurrentNode.Token.extValue}' not found.`) + } return { - SolvedMem: assertNotUndefined(StructTypeDefinition).MemoryTemplate, + SolvedMem: StructTypeDefinition.MemoryTemplate, asmCode: '' } } From 445d6652eb01d1f5104b566d8704aba271a1e2c4 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 28 Jun 2022 12:28:09 -0300 Subject: [PATCH 103/112] No warnings when add or sub pointers with longs. --- src/__tests__/warnings.a.spec.ts | 11 +++++++++++ .../astProcessor/binaryAsnProcessor.ts | 18 +++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 src/__tests__/warnings.a.spec.ts diff --git a/src/__tests__/warnings.a.spec.ts b/src/__tests__/warnings.a.spec.ts new file mode 100644 index 0000000..629394d --- /dev/null +++ b/src/__tests__/warnings.a.spec.ts @@ -0,0 +1,11 @@ +import { SmartC } from '../smartc' + +describe('Warnings', () => { + it('should not warn: add or sub pointers with longs values (struct_ptr)', () => { + const code = 'search(2);\nstruct PLAYER { long address, balance, VDLS; } *playerPtr, players[2];\nstruct PLAYER * search(long playerAddress) {\nlong nPlayers;\n struct PLAYER * foundPlayer;\n foundPlayer = &players[0];\n for (long auxI = 0; auxI < nPlayers; auxI++) {\n if (foundPlayer->address == playerAddress) {\n return foundPlayer;\n }\n foundPlayer += (sizeof(struct PLAYER));\n foundPlayer = foundPlayer + (sizeof(struct PLAYER));\n foundPlayer++;\n }\n return NULL;\n}' + const warnings = '' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getMachineCode().Warnings).toBe(warnings) + }) +}) diff --git a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts index 53c9d17..7eb604f 100644 --- a/src/codeGenerator/astProcessor/binaryAsnProcessor.ts +++ b/src/codeGenerator/astProcessor/binaryAsnProcessor.ts @@ -97,6 +97,9 @@ export default function binaryAsnProcessor ( // Prepare return object LGenObj = toRegister(AuxVars, LGenObj, CurrentNode.Operation.line) // implicit type casting tests and operations + if (isPointerAddOrSub(CurrentNode.Operation.value, leftDeclaration, rightDeclaration)) { + utils.setMemoryDeclaration(LGenObj.SolvedMem, rightDeclaration) + } const castSide = implicitTypeCastingTest(CurrentNode.Operation.value, leftDeclaration, rightDeclaration) switch (castSide) { case 'left': @@ -404,17 +407,17 @@ export default function binaryAsnProcessor ( throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of assigment does not match. Types are '${lDecl}' and '${rDecl}'.`) case '+=': case '-=': - if (lDecl === rDecl + '_ptr') { + if (lDecl.endsWith('_ptr') && rDecl === 'long') { return 'none' } throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) case '+': case '-': if (lDecl.includes('_ptr') && rDecl === 'long') { - return 'right' + return 'none' } if (rDecl.includes('_ptr') && lDecl === 'long') { - return 'left' + return 'none' } throw new Error(`At line ${CurrentNode.Operation.line}. Left and right side of ${operVal} does not match. Types are '${lDecl}' and '${rDecl}'.`) case '==': @@ -669,5 +672,14 @@ export default function binaryAsnProcessor ( return false } + /** Checks if its a pointer addition or subtractions. + * @returns true if it is needed to change the LEFT SIDE declaration to avoid type error */ + function isPointerAddOrSub (operator : string, lDecl : DECLARATION_TYPES, rDecl : DECLARATION_TYPES) : boolean { + if ((operator === '+' || operator === '-') && lDecl === 'long' && rDecl.endsWith('_ptr')) { + return true + } + return false + } + return binaryAsnProcessorMain() } From f7f68a1c17ce810a132f6b6c9d88b9e3a5932376 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 28 Jun 2022 12:29:23 -0300 Subject: [PATCH 104/112] Bump rc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 03c03c7..469e48e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc11", + "version": "2.0.0-rc12", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", From 632cb256c9b86cd404151c5605d067db654419a0 Mon Sep 17 00:00:00 2001 From: deleterium Date: Tue, 28 Jun 2022 19:42:26 -0300 Subject: [PATCH 105/112] Dropping need for '#pragma version' --- docs/1.2-Preprocessor-directives.md | 2 +- src/assembler/assembler.ts | 2 +- src/shaper/shaper.ts | 36 ++++------------------------- src/smartc.ts | 3 +-- src/typings/contractTypes.ts | 3 --- 5 files changed, 7 insertions(+), 39 deletions(-) diff --git a/docs/1.2-Preprocessor-directives.md b/docs/1.2-Preprocessor-directives.md index ce9a7c4..d875b32 100644 --- a/docs/1.2-Preprocessor-directives.md +++ b/docs/1.2-Preprocessor-directives.md @@ -174,7 +174,7 @@ Special features used by compiler. * 3: Use a VM to trace variable's content and remove redundant code. Beta feature, to be included as default once more tests are done. Can generate a good optimization reducing the number of calls to API functions. * 4: Dangerous optimizations no well tested. Result must be inspected by developer. * `#pragma reuseAssignedVar [true/false/1/0/]`: When set, compiler will try to use a variable on left side of and `Assignment` as a register. If variable is also used on right side, the compiler will not reuse it. This can save one assembly instruction for every expression used! Default value is `true` and it is highly recomended to maintain it active. -* `#pragma version N`: Informs which compiler's version the code was developed. Must be set if not using development version. To skip this check, set it to `dev`. +* `#pragma version VALUE`: Informs which compiler's version the code was developed. This is optional but can help future generations. VALUE can be any string or remarks. * `#pragma verboseAssembly [true/false/1/0/]`: Adds a comment in assembly output with the corresponding line number and the source code. Very usefull for debug. ### Escaping new line diff --git a/src/assembler/assembler.ts b/src/assembler/assembler.ts index 7d19b30..34ae45a 100644 --- a/src/assembler/assembler.ts +++ b/src/assembler/assembler.ts @@ -295,7 +295,7 @@ export default function assembler (assemblyCode: string): MACHINE_OBJECT { line[AsmObj.PCodeHashIdLine] = `^program codeHashId ${AsmObj.codeHashId}` } if (AsmObj.PCodeHashId !== '' && AsmObj.PCodeHashId !== AsmObj.codeHashId) { - throw new Error(`assembler() error #8. This compilation did not produce expected machine code hash id. Expected: ${AsmObj.PCodeHashId} Generated: ${AsmObj.codeHashId}.`) + throw new Error(`assembler() error #8. This compilation did not produce expected machine code hash id. Maybe the source code was changed or the program need to be compiled in another version of SmartC compiler. Code hash id expected: ${AsmObj.PCodeHashId}, generated: ${AsmObj.codeHashId}.`) } AsmObj.assembledCode = line.join('\n') return buildRetObj() diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index 53d4e29..f3b9a76 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -31,7 +31,6 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { function shapeMain () : void { splitCode() Program.Global.macros.forEach(processMacroControl) - checkCompilerVersion() Program.typesDefinitions = [ getTypeDefinitionTemplate('register'), getTypeDefinitionTemplate('long'), @@ -204,7 +203,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { } throw new Error(`At line: ${MacroToken.line}. Value out of permitted range 0..3.`) case 'version': - Program.Config.sourcecodeVersion = MacroToken.value + // Nothing to do. 'version' is a reminder for programmers. return false case 'verboseAssembly': Program.Config.verboseAssembly = bool @@ -263,6 +262,9 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { } throw new Error(`At line: ${MacroToken.line}.` + ' Program code hash id must be a decimal number. Use 0 to let compiler fill the value at assembly output.') + case 'compilerVersion': + // Nothing to do. compilerVersion is a reminder for programmers. + break default: throw new Error(`At line: ${MacroToken.line}.` + ` Unknow macro property: '#${MacroToken.type} ${MacroToken.property}'.` + @@ -270,36 +272,6 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { } } - /** Checks sourcecodeVersion and compiler current version. - * @throws {Error} if not pass rules checks. - */ - function checkCompilerVersion () : void { - try { - if (process.env.JEST === 'true') { - return - } - } catch (err) { - // On browser, continue - } - // Running on browser OR Runing on node, but it is not jest - if (Program.Config.sourcecodeVersion === '') { - if (!Program.Config.compilerVersion.includes('dev')) { - throw new Error('Compiler version not set.' + - ' Pin current compiler version in your program' + - ` adding '#pragma version ${Program.Config.compilerVersion}' to code.`) - } - Program.Config.sourcecodeVersion = Program.Config.compilerVersion - } - if (Program.Config.sourcecodeVersion !== Program.Config.compilerVersion) { - if (Program.Config.sourcecodeVersion !== 'dev') { - throw new Error(`This compiler is version '${Program.Config.compilerVersion}'.` + - ` File needs a compiler version '${Program.Config.sourcecodeVersion}'.` + - " Update '#pragma version' macro or run another SmartC version.") - } - Program.Config.sourcecodeVersion = Program.Config.compilerVersion - } - } - function addRegistersInMemory (howMany: number) : MEMORY_SLOT[] { const RegisterTD = getRegisterTypeDefinition() const retObj: MEMORY_SLOT[] = [] diff --git a/src/smartc.ts b/src/smartc.ts index fa8ef99..8d32845 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -51,12 +51,11 @@ export class SmartC { typesDefinitions: [], // Default configuration for compiler Config: { - compilerVersion: '2.0-dev', + compilerVersion: '2.0.0-rc12', maxAuxVars: 3, maxConstVars: 0, optimizationLevel: 2, reuseAssignedVar: true, - sourcecodeVersion: '', APIFunctions: false, fixedAPIFunctions: false, PName: '', diff --git a/src/typings/contractTypes.ts b/src/typings/contractTypes.ts index 470b1bb..34a300e 100644 --- a/src/typings/contractTypes.ts +++ b/src/typings/contractTypes.ts @@ -11,9 +11,6 @@ export type SC_CONFIG = { optimizationLevel: number, /** Try to reuse variable at left side of assigment: #pragma reuseAssignedVar */ reuseAssignedVar: boolean, - /** Default version for user's programs. If not on a dev version, user must - * specify #pragma version to set source code version */ - sourcecodeVersion: string, /** Support for API Functions: #include APIFunctions */ APIFunctions: boolean, /** Support for API Functions with fixed numbers: #include fixedAPIFunctions */ From 11a28e9201089fb53b34e35d738b9cbe63a4b862 Mon Sep 17 00:00:00 2001 From: deleterium Date: Wed, 29 Jun 2022 22:36:04 -0300 Subject: [PATCH 106/112] v2.0 Commemorative contract --- docs/commemorative/README.md | 6 + docs/commemorative/v2.0_The_Mining_Game.md | 279 +++++++++++++++++++++ 2 files changed, 285 insertions(+) create mode 100644 docs/commemorative/v2.0_The_Mining_Game.md diff --git a/docs/commemorative/README.md b/docs/commemorative/README.md index 6344290..ed5e1d2 100644 --- a/docs/commemorative/README.md +++ b/docs/commemorative/README.md @@ -9,3 +9,9 @@ Avoid eavesdroppers to track your transactions and add a layer of obfuscation in ## v1.0 - SmartC NFT with muscles Upgraded version of SmartC NFT, featuring dividends distribuiton for owners. Dividends will be provided by NFT sell/transfer fee and from future projects. This smart contract replaces the old one and owners have to migrate. [Details](./v1.0_SmartC_NFT.md) + +## v2.0 - The Mining Game +Every hour one TMG token is mined by smart contracts deployed by players. +Holders of TMG can even receive Signa from the game. +A kind of "proof-of-donation", where more you donate to players, more chance to mine a block. +[Details](./v2.0_The_Mining_Game.md) diff --git a/docs/commemorative/v2.0_The_Mining_Game.md b/docs/commemorative/v2.0_The_Mining_Game.md new file mode 100644 index 0000000..9cffe82 --- /dev/null +++ b/docs/commemorative/v2.0_The_Mining_Game.md @@ -0,0 +1,279 @@ +# The Mining Game +Did you ever though about a token that is mined by smart contract? And proof-of-donation? + +## How it works +The system consists in two types of smart contracts: TMGMiner and TMGPicker. Check the concepts: + +### Miner +This smart contract is deployed by users. After add balance to the contract it will start to send deadlines to the main Picker contract. By default it will start by mining with the least amount possible (0.32 Signa per hour or 7.6 Signa per day). The creator can change the mining intensity. Send at least 0.5 Signa and add a plain message with the new value. Ex: `1.344`. The contract will continue the loop until there is no more balance. At any time creator can send some amount of Signa to top up the balance and the mining intesity will continue the same. To stop the contract and receive the remaining balance, send a transaction with amount over 0.5 and the plain text `stop`. In less than one hour the contract will be activated again and the balance will be sent back. + +### Picker +Smart contract deployed by deleterium, will centralize all received deadlines, pick the best, forge one token and send directly to the creator of that Miner. The picker will inspect the contract that send the deadline to ensure it is a valid Miner contract, to avoid deadline tampering. When a new deadline is submited after 15 or more blocks from previous forging, the contract will mint one token and transfer to the creator of the contract that sent the best deadline. This process will cause balance to build up in the contract and once a day it will be distributed to the holders of TMG asset, if the balance is greater than 250 Signa. + +### Deadlines +The miner contract will send a transaction to the picker. This transaction has an ID that can not be controlled by the creators. It depends on the time that the block was forged, so it is suposed to be random (note 1). To calculate the deadline, the Picker will: +1. Get the transaction ID value and divide by two. This is the base deadline. Division is needed to avoid negative values internally. +2. Get the transaction amount (mining intensity) and divide by the minimum amount (0.32 Signa). This factor (always greater or equal one) is called mining factor. +3. The final deadline is the base deadline divided by the mining factor. So the greater the mining factor, lower the deadline. +In this way, users can adjust the mining intensity to increase change to win a block, and with bigger overall mining intensity, more Signa will be distributed to TMG token holders. + +### Signa distribution +Once per day the Picker will check the accumulated balance in the contract. If this amount is greater than 250 Signa, 98% of it will be distributed to holders that have at least 1.0 TMG available in account (not on sell orders!). There is also a creator fee of 2%, that will be forwarded to SmartC NFT contract and distributed to the holders of SmartC Keywords. + +### Burned fees +When the contracts are running at the least mining intensity, almost all Signa will be consumed by contract execution. This is the way the smart contracts work, because each machine code instructions costs 0.001 Signa. With more players with bigger mining intensity, more balance will accumulate in the Picker contract to be distributed. + +## The web site +In the future a web site will show the network status, the the current overall mining factor, best deadline, last winner, last winner and more! Users will have option to link their accounts and deploy, check and control their Miner. + +## Notes: +1. In theory the transaction ID from a smart contract can be manipulated during an attack from a bad actor with more than 50% Signum mining power. This is unlikely and, if done, the entire blockchain will be compromised. For this game purpose this situation is negligible. + +## Contracts source code + +### Miner +```c +// Select the picker contract accordingly: +// 999 for SIMULATOR +// 8749786126809286749 for TESTNET +// YYY for MAINNET +#define PICKER_CONTRACT 8749786126809286749 +// #pragma verboseAssembly + +/* Do not change below this line */ + +/* Details for carbon copy TESTNET + * Fullhash: 7ab1ed13566118fb8f36c05e25963d184875b4f0651d234f754161da5fd88059 + * feeNQT: 10000000 + */ + +#define ACTIVATION_AMOUNT .5 + +#program name TMGminer +#program description The Mining Game - Standard miner smart contract +#program activationAmount ACTIVATION_AMOUNT +#program creator 123124 +#program codeHashId 5817622329198284865 + +#pragma maxConstVars 1 +#pragma optimizationLevel 3 +#pragma version 2.0 + +#define CLOCK 15 +#define DEFAULT_MINING_INTENSITY .32 + +// Constants initialization +const long pickerContract = PICKER_CONTRACT; +const fixed defaultIntensity = DEFAULT_MINING_INTENSITY; +const long n8 = 8, n10 = 10, n15 = 15, n16 = 16, n32 = 32, n46 = 46; +const long n48 = 48, n57 = 57; +const long n255 = 255, n100000000 = 100000000; + + +// Other variables +fixed miningIntensity, availableBalance; +long txid, message[4]; +fixed messageIntensity; + +// Initialization +miningIntensity = defaultIntensity; + +while (true){ + while ((txid = getNextTx()) != 0) { + // process transaction + if (getSender(txid) != getCreator()) { + // only process transactions from creator + continue; + } + readMessage(txid, 0, message); + if (message[0] == 'stop') { + miningIntensity = defaultIntensity; + sendBalance(getCreator()); + continue; + } + // start of decodeAmountInMessage + long multiplier = 1_0000_0000; + long retVal = 0; + long ch; + long decimals = false; + for (long i = 0; i < 16; i++) { + ch = message[i / 8] >> ((i % 8) * 8); + ch &= 0xff; + if (ch == 0 || ch == ' ') break; + if (ch == '.') { + decimals = true; + continue; + } + if (ch < '0' || ch > '9' ) { + // invalid char + retVal = 0; + break; + } + if (decimals) { + multiplier /= 10; + } else { + retVal *= 10; + } + ch &= 0xF; + ch *= multiplier; + retVal += ch; + } + memcopy(&messageIntensity, &retVal); + // end of decodeAmountInMessage + if (messageIntensity < defaultIntensity) { + // Error decoding, no message sent or value too low + continue; + } + miningIntensity = messageIntensity; + } + sendAmountFx(miningIntensity, pickerContract); + sleep CLOCK; +} +``` + +### Picker +```c +// Choose the target (only one of ): +//#define SIMULATOR +//#define TESTNET + #define MAINNET + +// #pragma verboseAssembly + +/* Do not change below this line */ + +#program name TMGpicker +#program description The Mining Game - Picker smart contract +#define ACTIVATION_AMOUNT 0.32 +#program activationAmount ACTIVATION_AMOUNT + +#define CLOCK 15 +#define GAME_FEE .02 +#define MINIMUM_AMOUNT_TO_DISTRIBUTE 250.0 +#define DIVIDENDS_MSG 0x83CDA47900000000 +#define authorizedCodeHashId 5817622329198284865 + +#ifdef SIMULATOR + #program codeHashId 1136995200036281707 + #define SMARTCNFT 12341234 + #define TRY_DISTRIBUTION_INTERVAL 1 +#endif +#ifdef TESTNET +#program codeHashId 13677852211975617521 + #define SMARTCNFT "TS-J8X4-6WB2-62W5-6ZTGZ" + #define TRY_DISTRIBUTION_INTERVAL 24 +#endif +#ifdef MAINNET + #program codeHashId 18180423945324926420 + #define SMARTCNFT "S-NFT2-6MA4-KLA2-DNM8T" + #define TRY_DISTRIBUTION_INTERVAL 24 +#endif + +#pragma maxConstVars 2 +#pragma maxAuxVars 3 +#pragma optimizationLevel 3 +// #pragma version 2.0.0 + +const long n0 = 0, n100 = 100, n100000000 = 100000000; +const long maxPositive = 0x7fffffffffffffff; +const fixed activationAmount = ACTIVATION_AMOUNT; + +long tokenId; +long dividendsMessage[4]; + +struct TXINFO { + long txId, + baseDeadline, + sender; + fixed miningIntensity; +} currentTX; + +struct BEST { + long deadline; + long sender; +} best; + +struct STATS { + fixed overallMiningFactor, + lastOverallMiningFactor; + long processedDeadlines, + currentHeight, + lastWinnerId, + lastWinnerDeadline; +} stats; + +// startUp routine +tokenId = issueAsset("TMG", "", 2); +best.deadline = maxPositive; +dividendsMessage[] = DIVIDENDS_MSG; + +void main() { + while ((currentTX.txId = getNextTx()) != 0) { + // Get transaction details + currentTX.sender = getSender(currentTX.txId); + currentTX.miningIntensity = getAmountFx(currentTX.txId) + activationAmount; + // base deadline is unsigned long txId divided by two + currentTX.baseDeadline = currentTX.txId / 2; + if (currentTX.baseDeadline < 0) { + currentTX.baseDeadline += maxPositive; + currentTX.baseDeadline++; + } + processTX(); + } + // All transactions processed, try to forge new token + forgeTokens(); +} + +void processTX() { + fixed miningFactor = currentTX.miningIntensity / activationAmount; + long currentDeadline = mdv(currentTX.baseDeadline, 100000000, bcftol(miningFactor)); + stats.processedDeadlines++; + stats.overallMiningFactor += miningFactor; + if (currentDeadline < best.deadline) { + if (getCodeHashOf(currentTX.sender) != authorizedCodeHashId) { + // Avoid deadline tampering + return; + } + best.deadline = currentDeadline; + best.sender = currentTX.sender; + } +} + +void forgeTokens() { + long lastForging; + long currentBlock = getCurrentBlockheight(); + if (best.deadline == maxPositive || currentBlock - lastForging < CLOCK ) { + return; + } + // Mint new token and send to winner + stats.lastOverallMiningFactor = stats.overallMiningFactor; + stats.lastWinnerDeadline = best.deadline; + lastForging = currentBlock; + stats.lastWinnerId = getCreatorOf(best.sender); + mintAsset(100, tokenId); + sendQuantity(100, tokenId, stats.lastWinnerId); + // Try distribuition + if (stats.currentHeight % TRY_DISTRIBUTION_INTERVAL == 0) { + distributeBalance(); + } + // Prepare variables for next round + best.deadline = maxPositive; + best.sender = 0; + stats.overallMiningFactor = 0.0; + stats.currentHeight++; +} + +void distributeBalance() { + fixed currentAvailableBalance = getCurrentBalanceFx() - activationAmount; + if (currentAvailableBalance < MINIMUM_AMOUNT_TO_DISTRIBUTE) { + return; + } + distributeToHoldersFx(100, tokenId, currentAvailableBalance * (1.0 - GAME_FEE), n0, n0); + if (getCurrentBalanceFx() > currentAvailableBalance / 2) { + // Do not pay fee if the distribution was unsucessful + return; + } + // Pay Game Fee + sendAmountAndMessageFx(currentAvailableBalance * GAME_FEE, dividendsMessage, SMARTCNFT); +} +``` From 113c6da5c36ba2faf4e286c831c116eb0e2e5707 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 30 Jun 2022 14:47:41 -0300 Subject: [PATCH 107/112] Fix on fixed number detection --- src/__tests__/fixed.b.spec.ts | 15 +++++++++++++++ src/shaper/shaper.ts | 22 ++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/__tests__/fixed.b.spec.ts b/src/__tests__/fixed.b.spec.ts index a177368..18a007f 100644 --- a/src/__tests__/fixed.b.spec.ts +++ b/src/__tests__/fixed.b.spec.ts @@ -137,3 +137,18 @@ describe('Arrays', () => { }) }) }) + +describe('Detection of fixed numbers', () => { + it('should detect: fixed inside CodeDomain', () => { + const code = 'struct TXINFO { long txid; long sender; fixed amount; long message[4]; } currentTX; currentTX.sender++;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode().split('\n')).toContain('^declare f100000000') + }) + it('should detect: fixed inside CodeCave', () => { + const code = 'long a, b; a=(b+2.3)/5; b++;' + const compiler = new SmartC({ language: 'C', sourceCode: code }) + compiler.compile() + expect(compiler.getAssemblyCode().split('\n')).toContain('^declare f100000000') + }) +}) diff --git a/src/shaper/shaper.ts b/src/shaper/shaper.ts index f3b9a76..b2fd9ba 100644 --- a/src/shaper/shaper.ts +++ b/src/shaper/shaper.ts @@ -38,7 +38,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { ] Program.memory.push(...addRegistersInMemory(Program.Config.maxAuxVars)) Program.memory.push(...addConstantsInMemory(Program.Config.maxConstVars)) - if (Program.Config.fixedAPIFunctions || fixedDetected()) { + if (Program.Config.fixedAPIFunctions || fixedDetected(tokenAST)) { Program.memory.push(fixedBaseTemplate) } if (autoCounterDetected(tokenAST)) { @@ -305,10 +305,18 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { } /** Detects if fixed point calculations will be needed */ - function fixedDetected () : boolean { - return !!tokenAST.find((Tkn) => ( - (Tkn.type === 'Keyword' && Tkn.value === 'fixed') || - (Tkn.type === 'Constant' && Tkn.extValue === 'fixed'))) + function fixedDetected (tokenTrain: TOKEN[] | undefined) : boolean { + if (tokenTrain === undefined) return false + return !!tokenTrain.find((Tkn) => { + if ((Tkn.type === 'Keyword' && Tkn.value === 'fixed') || + (Tkn.type === 'Constant' && Tkn.extValue === 'fixed')) { + return true + } + if (Tkn.type === 'CodeDomain' || Tkn.type === 'CodeCave') { + return fixedDetected(Tkn.params) + } + return false + }) } /** Detects if hidden variable for timestamp loop will be needed */ @@ -319,9 +327,7 @@ export default function shaper (Program: CONTRACT, tokenAST: TOKEN[]): void { return true } if (Tkn.type === 'CodeDomain' || Tkn.type === 'CodeCave') { - if (autoCounterDetected(Tkn.params) === true) { - return true - } + return autoCounterDetected(Tkn.params) } return false }) From c7ad07eb6bfca99947bd34c0c73ebdece8d54ac5 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 30 Jun 2022 20:11:27 -0300 Subject: [PATCH 108/112] Update docs for new built-in functions --- docs/3-Learning-with-examples.md | 309 ++++++++++++++----------------- docs/4-Functions-repository.md | 250 +++++++++++++------------ docs/5-Comprehensive-example.md | 297 +---------------------------- 3 files changed, 274 insertions(+), 582 deletions(-) diff --git a/docs/3-Learning-with-examples.md b/docs/3-Learning-with-examples.md index 1d8d92f..697f5e9 100644 --- a/docs/3-Learning-with-examples.md +++ b/docs/3-Learning-with-examples.md @@ -3,53 +3,67 @@ # Lessons and examples to create smart contracts in Signum network Following guide will show examples with progressive complexity and comments how they works. It is expected that you know C language. It is a good idea to read all docs from SmartC. If you plan to be expert, read ciyam official documentation available [here](https://ciyam.org/at/) and Signum [SIP-37](https://github.com/signum-network/SIPs/blob/master/SIP/sip-37.md), [SIP-38](https://github.com/signum-network/SIPs/blob/master/SIP/sip-38.md), [SIP-39](https://github.com/signum-network/SIPs/blob/master/SIP/sip-39.md) for major changes introduced in JUN/2022. There is also some videos compiling these examples at my [personal Youtube channel](https://www.youtube.com/playlist?list=PLyu0NNtb1eg3Gcg2JCrOle8MjtuFPb-Gi). -## Basic contracts +
+ -### Always Running, doing nothing -```c -#pragma version dev +## Always Running, doing nothing + +```c #program name alwaysRuning #program description Always Running, doing nothing -#pragma maxAuxVars 1 +#program activationAmount 0 +#pragma maxAuxVars 0 while (true) { - sleep 1; + sleep; } ``` * This contract has no functions, API, nor variable declared. -* Macro `#pragma version` is very important to pin source code with a compiler version. It is to ensure the compiled code will result in the same machine code. Not needed if working in 'dev' branch. -* Macro `#pragma` can set some specific behaviour of compiler, in this case it will set compiler to use only one auxiliary variable (they act as registers for operations). Default value is 3, but here we will use the minimum allowed. +* Macro `#pragma` can set some specific behaviour of compiler, in this case it will set compiler to use no auxiliary variable (they act as registers for operations). Default value is 3, but here we do not need any. * Only one global statement, `while (true)` is used to make an infinite loop. * Keyword `sleep 1` will stop the contract process at current block and resumes execution at the next block. -* It will keep in this loop until there is no more balance at the contract, then it will be frozen until it receives a new activation. +* It will keep in this loop until there is no more balance at the contract, then it will be frozen until it receives more balance. +* Activation amount zero means that the contract will be always active, even if there was a `exit` statement. +
+
+ -### Counting transactions, easy way -```c -#pragma version dev +## Counting transactions, easy way + +```c #program name CountingTxDelayed #program description Counting transactions, easy way +#program activationAmount 0.1 void main(void) { - long counter; + long counter, txid; + getNextTx(); counter++; } ``` -* The `main` function is the entry point when contract gets an activation. Contract can be finished via `return`, `exit` or closing main function. +* The `main` function is the entry point when contract gets an activation. Contract can be finished in this function via `return`, `exit` or at the end of function. * If two transactions are received by this contract, the first one will be processed and the contract will enter finished state. In the next block it will be activated again with the second transaction that was not processed in previous block height. This means, if this contract receives 10 messages at some block, it will take 10 blocks to finish counting them. * When the contract is created, all memory is set to zero. So variable counter will start from zero and keep increasing every block it has received TXs. +* Activation amount 0.1 means that the contract will only count the transactions that send at least this amount. If a transaction with .99999999 is received, the balance will the added to the contract but it will not be counted. +
+
+ -### Counting transactions without delay. -```c -#pragma version dev +## Counting transactions without delay. + +```c #program name CountingTx #program description Counting transactions without delay -#include APIFunctions +#program activationAmount 0.1 + +long counter; void main(void) { - while (getNextTxDetails()) { + long txid; + while ((txid = getNextTx() != 0) { // Process transaction in a specific function processTX(); } @@ -58,190 +72,143 @@ void main(void) { } void processTX(void){ - const long counter = 10; + const counter = 10; counter++; } - -struct TXINFO { - long timestamp, - sender, - amount, - message[4]; -} currentTX; - -/* Checks if there is a new transaction. If there is, fill currentTX struct - and returns true. Returns false otherwise. */ -long getNextTxDetails(void) { - // Do not change the value of currentTX.timestamp on your code!!! - A_To_Tx_After_Timestamp(currentTX.timestamp); - if (Get_A1() == 0) { - return false; - } - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - currentTX.amount = Get_Amount_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0]=Get_B1(); - currentTX.message[1]=Get_B2(); - currentTX.message[2]=Get_B3(); - currentTX.message[3]=Get_B4(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; -} ``` -* To get details from incoming transaction, we will use the API functions. Tell the compiler you will need them with macro `#include APIFunctions`. -* It is presented the function `getTxDetails()` that will get all details from incoming message to a global variable `currentTX`. This struct has members to store information that can be retrieved from a TX. Remember to comment values not needed you your code, because every API call costs 0.01 signa to be executed. -* The `main` function will loop thru all TX received in same block. When the API `A_To_Tx_After_Timestamp` returns timestamp zero or -1, it means there is no more pending transactions, so the contract can be finished. -* Counter value will be set to 10 during contract deployment (keyword const!). Then it will be increased for each new valid tx received. -* Global variable is used because it needs less instructions to make same thing. It is important to note, because every assembly instructions will be charged a fee of 0.001 signa for execution and there are limitations for code and memory sizes when deploying an smart contract in the blockchain. +* It is presented the built-in function `getNextTx()` that will return the transaction Id of the next transaction. It stores internally the timestamp of last received transaction and returns zero if there is no more pending transactions. +* The while loop will be executed for all pending messages. When txid is zero, the contract can be finished. +* Counter value will be set to 10 during contract deployment (keyword const!). Then it will be increased for each new valid tx received. Const expressions are 'executed' only at the deployment. +* counter is global variable just to show how to declare it. It is more effective to have a global variable than sending it to functions. If a variable is used only in one function, use the local scope. +
+
+ -### Sending signa -```c -#pragma version dev - -#program name SendSigna -#program description Using a function to send signa. -#program activationAmount 0.3 - -#include APIFunctions -#include fixedAPIFunctions +## Echo signa + -B_To_Address_Of_Creator(); -long creatorId = Get_B1(); +```c +#program name EchoSigna +#program description Returns the received amount to the sender. +#program activationAmount 0.5 -void main(void) { - const fixed cashBackPercent = 0.05; - while (getNextTxDetails()) { - if (currentTX.amount > 5.2) { - // If TX is bigger than 5.2 signa, refund 5% to sender - // CashBack to sender. - Set_B1_B2(currentTX.sender, 0); - F_Send_To_Address_In_B(currentTX.amount * cashBackPercent); - // Remaining to creator - Set_B1_B2(creatorId, 0); - F_Send_To_Address_In_B(currentTX.amount * (1.0 - cashBackPercent)); - } else { - // Low amount, no cashBack. - Set_B1_B2(creatorId, 0); - F_Send_To_Address_In_B(currentTX.amount); - } +while (true) { + long txid; + while ((txid = getNextTx() != 0) { + sendAmount(getAmount(txid), getSender(txid)) } // After all transactions processed - if (F_Get_Current_Balance() > 1.0) { - Set_B1_B2(creatorId, 0); - F_Send_To_Address_In_B(.7); - } + sendBalance(getCreator()); } +``` +* `#program activationAmount 0.5` ensures that only transactions with an amount greater or equal 0.5 signa will be processed. The returned amount will be only the value above activation amount. +* For every transaction processed, some unspent balance will build up in the contract. To avoid this situation, after all transactions were processed in current block, the contract sends all remaining balance to the creator. +* `getAmount`: returns the amount in NQT of a given transaction id. +* `getSender`: returns the account id of sender of a given transaction id. +* `sendAmount`: sends a given amount of Signa to a recipient. +* `sendBalance`: sends all contract balance to a recipient. The execution is halted after the transaction is sent. +
+
+ + +## Echo message + + +```c +#program name EchoMessage +#program description Reads first page of message (32 bytes) and sends back to sender. \ + Also sends back 95% of the amount sent. +#program activationAmount 0.5 struct TXINFO { - long timestamp; + long txid; long sender; fixed amount; + long message[4]; } currentTX; -/* Checks if there is a new transaction. If there is, fill currentTX struct - and returns true. Returns false otherwise. */ -long getNextTxDetails(void) { - // Do not change the value of currentTX.timestamp on your code!!! - A_To_Tx_After_Timestamp(currentTX.timestamp); - if (Get_A1() == 0) { - return false; +void main () { + while ((currentTX.txid = getNextTx()) != 0) { + getDetails(); + processTX(); } - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - currentTX.amount = F_Get_Amount_For_Tx_In_A(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; + // After all transactions processed + // cleanUp(); +} + +void getDetails() { + currentTX.sender = getSender(currentTX.txid); + currentTX.amount = getAmountFx(currentTX.txid); + readMessage(currentTX.txid, 0, currentTX.message); } +void processTX() { + sendAmountAndMessageFx( + currentTX.amount * 0.95, + currentTX.message, + currentTX.sender + ); +} ``` -* In this contract the Signa amount is handled with fixed point variables. They have the same 8 decimal numbers the people is used to and can be calculated with operators + - * / >> and <<. -* Compiler will throw error when trying to use fixed values in the original API functions. So there is a new fixedAPIFunctions that will handle fixed numbers. -* `#program activationAmount 0.3` ensures that only transactions with an amount greater or equal 0.3 signa will be processed. -* For every transaction, if value is greater than 5.2 signa, contract sends 5 percent back to sender and the remaining 95% is sent to the creator. If the value is lower or equal to 5.2 sends all incoming amount to creator. This amount has discounted the activationAmount, so user will need to send 5.5 signa to get the cashback. -* Every transaction processed, some unspent balance will build up in the contract. To avoid this situation, when all transactions were processed, contract checks if current balance is greater than 1 signum and then sends 0.7 signa to creator. -* If not using fixed numbers, signum quantity is always specified in NQT. 1 signum is 100000000 NQT. I prefer to group the 'decimal amount' in in two parts with 4 zeros for easier counting. Signa is plural of signum. - -### Sending a message -```c -#pragma version dev +* In this contract the Signa amount is handled with fixed point variables. They have the same 8 decimal numbers the people is used to and can be calculated with operators + - * / >> and <<. Useful to make calculations. All built-in functions that handle Signa balance have a fixed point version that ends with Fx. +* Balance will build up in the contract because there is no cleanUp function defined. +
+
+ -#program name SendMessage -#program description Easy way to send messages -#program activationAmount 2000_0000 +## Echo token + -#include APIFunctions +```c +#program name EchoToken +#program description Returns the assets received. +#program activationAmount 0.5 -// main loop -while (true) { - while (getNextTxDetails()) { +struct TXINFO { + long txid; + long sender; + long assets[4]; +} currentTX; - // Process TX - send_message.recipient = currentTX.sender; - send_message.message[]="Thanks for donation!"; - Send_Message(); +void main () { + while ((currentTX.txid = getNextTx()) != 0) { + getDetails(); + processTX(); } - // After all processed, send all balance to creator. - Clear_B(); - B_To_Address_Of_Creator(); - Send_All_To_Address_In_B(); + // After all transactions processed + cleanUp(); } -struct SENDMESSAGE { - long recipient; - long message[4]; -} send_message; - -void Send_Message(void) { - Set_B1(send_message.recipient); - Set_A1_A2(send_message.message[0], send_message.message[1]); - Set_A3_A4(send_message.message[2], send_message.message[3]); - Send_A_To_Address_In_B(); +void getDetails() { + currentTX.sender = getSender(currentTX.txid); + readAssets(currentTX.txid, currentTX.assets); } -struct TXINFO { - long timestamp; - long sender; - long amount; -} currentTX; - -/* Checks if there is a new transaction. If there is, fill currentTX struct - and returns true. Returns false otherwise. */ -long getNextTxDetails(void) { - // Do not change the value of currentTX.timestamp on your code!!! - A_To_Tx_After_Timestamp(currentTX.timestamp); - if (Get_A1() == 0) { - return false; +void processTX() { + for (long i = 0; i < 4; i++) { + if (currentTX.assets[i] == 0) { + // Zero means no more assets in incoming transaction + return; + } + sendQuantity( + getQuantity(currentTX.txid, currentTX.assets[i]), + currentTX.assets[i], + currentTX.sender + ); } - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - currentTX.amount = Get_Amount_For_Tx_In_A(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; } -``` -* Presenting function `Send_Message()` thats sends a message with content in global variable `send_message`. -* If the contract sends two messages to same recipient in same block, recipient will receive the concatenation of messages. -* Messages are added in pages, each page has 32 bytes, the size of superregister A. Text is encoded with UTF-8, so some characters need more than one byte. -* There is no main function. The main loop will process transactions and then send all contract balance to creator. When the API `Send_All_To_Address_In_B` sends all balance, then the contract execution will stop because there is no more balance to run it (it will be frozen). When a new transaction above activation amoun is received, contract resumes execution and process all incoming transactions again. -### Sending a message and signa -```c -//function and global variable shown -struct SENDMESSAGESIGNA { - long recipient; - long message[4]; -} send_message; - -void Send_Message_And_Signa(long amount) { - Set_B1(send_message.recipient); - Set_A1_A2(send_message.message[0], send_message.message[1]); - Set_A3_A4(send_message.message[2], send_message.message[3]); - Send_A_To_Address_In_B(); - Send_To_Address_In_B(amount); +void cleanUp() { + fixed excessBalance; + excessBalance = getCurrentBalanceFx() - 0.5; + if (excessBalance > 0) { + sendAmountFx(excessBalance, getCreator()); + } } ``` -* Easy, just join the API call to send message and send signa. Function and global variable is show in example. -* Signum node will join message and signa instructions and recipient will receive only one transaction. +* Assets amount is called "quantity" and always returned as long (QNT), because it is not possible to know how many decimals they have. +* To avoid balance build up in the contract, any Signa amount and unspent activation amount is sent to creator if more than 0.5 Signa. +* If `sendBalance` is used in cleanUp, the contract would also stop execution. But the next transaction will reactivate the contract and it will reach the end of void function, so halting again. Only when another transaction is received, the contract will start again at the main function and process the two enqueued transactions. +
[Back](./README.md) diff --git a/docs/4-Functions-repository.md b/docs/4-Functions-repository.md index 6bb96f2..c025012 100644 --- a/docs/4-Functions-repository.md +++ b/docs/4-Functions-repository.md @@ -2,13 +2,17 @@ # Functions repository These functions and macros can be added to projects and speed up development time! +
+ ## Macros -Macro functions are elaborated substitutions done during compilation. Check some options: + + +Macro functions are elaborated substitutions done during compilation. Use for very simple functions: ```c -#define getCurrentBlock() (Get_Block_Timestamp() >> 32) +#define add2(val) (val + 2) #define sendSigna(recipient, amount) (\ Set_B1_B2(recipient, 0), \ @@ -20,16 +24,14 @@ Macro functions are elaborated substitutions done during compilation. Check some Set_A1(m1), \ Send_A_To_Address_In_B()) -#define sendMessage4(recipient, m1, m2, m3, m4) (\ - Set_B1_B2(recipient, 0), \ - Set_A1_A2(m1, m2), \ - Set_A3_A4(m3, m4), \ - Send_A_To_Address_In_B()) - // You got it! ``` +
+
+ -## Text to number: atol() +## Text to long: atol() + ```c // ASCII to Long (base10 positive and less than 100.000.000) @@ -52,7 +54,13 @@ long atol(long val) return ret; } ``` -## Number to text: ltoa() +
+
+ + +## Long to text: ltoa() + + ```c // Integer to ASCII (base10 positive and less than 100.000.000) // Iterative function to implement itoa() clone function in C @@ -74,125 +82,133 @@ long ltoa(long val) return ret; } ``` +
+
+ -## Splitting a text array into fields: split() -```c -// Split string function in C -// Expects: -// 'separator' to be used (only LSB will be used). -// 'source' is the array with text to be splitted. -// 'source_length' is the size of source (or the numbers of longs that -// will be processed -// 'ret' is return buffer array. -// 'ret_length' is the size of return buffer, to avoid buffer overflow -// Returns: number of fields filled -// The function will keep adding chars until fill return buffer. If a -// string is bigger than 8 chars, only 8 last chars will be returned -// at that field. -const long n8 = 8, n255 = 0xff; -long split(long separator, long * source, long source_length, long * ret, long ret_length) -{ - long field, i_act_arg, i_ret, i_param, act_arg, chr ; - - //clear destination buffer - for (i_ret = 0; i_ret < ret_length; i_ret++) { - ret[i_ret] = 0; - } +## Text to fixed: decodeAmount() + - i_act_arg = 0; //cycle bytes in actual string beeing processed(param buffer) (0 to 8) - i_param = 0; //current element in param buffer (0 to 4) - field = 0; //current element in return buffer (ret)(0 to 10 in this example) - i_ret = 0; //var to cycle bytes for each return buffer (from 0 to 8 ) - - while (i_param < source_length) { - act_arg = source[i_param]; - chr = act_arg & 0xff; - while (chr != 0) { - if (chr == separator){ - field++; - i_ret = 0; - } else { - if (i_ret == 8) { // ret[i_ret] is full, shift and continue - ret[field] >>= 8; - i_ret--; - } - ret[field] += chr << (8 * i_ret); - i_ret++; - } - i_act_arg++; - if (field == ret_length) { // End of destination buffer, go to end - return ++field; - } - if (i_act_arg == 8) { //end of actual va_arg, go to next va_arg - break; //break second while loop - } else { // prepare char for next merge - chr = act_arg & (0xff << (8 * i_act_arg)); - chr >>= 8 * i_act_arg; - } +```c +// ASCII to fixed (base10 positive) +// Expects a string in currentTX.message. If any byte is not a char numeric +// representation or decimal point, then stop and return. Only positive +// numbers, base10 are converted. Returns zero if no number was processed. +fixed decodeAmountInMessage(long startingAt) { + long multiplier = 1_0000_0000; + long retVal = 0; + long ch; + long decimals = false; + for (long i = long startingAt; i < 32; i++) { + ch = currentTX.message[i / 8] >> ((i % 8) * 8); + ch &= 0xff; + if (ch == 0 || ch == ' ') break; + if (ch == '.') { + decimals = true; + continue; + } + if (ch < '0' || ch > '9' ) { + // invalid char + retVal = 0; + break; } - i_param++; - i_act_arg = 0; + if (decimals) { + multiplier /= 10; + } else { + retVal *= 10; + } + ch &= 0xF; + ch *= multiplier; + retVal += ch; } - - return ++field; + return bcltof(retVal); } ``` +
+
+ -## Concatenate text into a text array: concat() -```c -// String concatenation function in C -// Expects: -// 'source' is an array with content -// 'source_length' is size of source (in longs) or the numbers of longs to be processed -// 'ret' is return buffer array. -// 'ret_length' is the size of ret (in longs) to avoid buffer overflow. -// Function returns the number of bytes processed. A number equal ret_length*8 -// can denote that buffer was too short for the content in 'source'. -const long n8 = 8, n255 = 0xff; -long concat(long * source, long source_length, long * ret, long ret_length) -{ - long i_param, act_arg, chr, i_ret, i_buffer, i_act_arg; - - //clear destination buffer - for (i_buffer = 0; i_buffer < ret_length; i_buffer++) { - ret[i_buffer] = 0; - } +## RS-Address to accounId: decodeRS() + - i_ret = 0; //var to cycle bytes for each return buffer (from 0 to 8 ) - i_buffer = 0; //var to cycle for each buffer available (from 0 to ret_length) - i_param = 0; //var to cycle for each source items provided (from 0 to source_length) - i_act_arg= 0; //var to cycle bytes in actual source(long) beeing processed (0 to 8) - - while (i_param < source_length) { //loop thru source_length - act_arg = source[i_param]; // access source - chr = act_arg & 0xff; //this always first char, no need to shift - - while (chr != 0) { //loop bytes in va_arg beeing processed (act_arg) - ret[i_buffer] += chr << (8 * i_ret); - i_act_arg++; - i_ret++; - - if (i_ret == 8) { // ret[i_buffer] is full, go to next ret value - i_buffer++; - i_ret = 0; - if (i_buffer == ret_length) { // End of destination buffer, go to end - goto all_loops_end; //break 2 loops - } - } - if (i_act_arg == 8) { //end of actual va_arg, go to next va_arg - break; //break second while loop - } else { // prepare char for next merge - chr = act_arg & ( 0xff << (8 * i_act_arg) ); - chr >>= 8 * i_act_arg; - } +```c +// RS-Address to accountId +// Expects a string containing an address in currentTX.message +// starting at index zero. +// Ex: S-AAAA-BBBB-CCCC-DDDDD. +// On error returns -1. +// Actually the first group can be any text, so matches 'S', 'TS' +// or 'BURST'. +// No error checks!! + +/** Decode an RS address at currentTX.message + * returns -1 if there is an error on decoding. + * This function does not verify error correction bytes + * */ +long decodeRS(void) { + long position = 0, ch, group = 0; + long idPosition, value, result = 0; + for (i = 0; i < 32; i++) { + ch = currentTX.message[i / 8] >> ((i % 8) * 8); + ch &= 0xff; + if (ch == '-') { + group++; + continue; + } + if (group == 0 || group == 3) { + continue; + } + value = rscharToIndex(ch); + if (value == minus1) { + // ERROR + return minus1; + } + idPosition = (codeword_map >> (position * 4)) & 15; + result |= value << (idPosition * 5); + position++; + if (position == 13) { + return result; } - i_param++; - i_act_arg = 0; } + return minus1; +} - all_loops_end: - return i_ret + (8 * i_buffer); +const long codeword_map = + 3 + + 2 *16 + + 1 *16*16 + + 0 *16*16*16 + + 7 *16*16*16*16 + + 6 *16*16*16*16*16 + + 5 *16*16*16*16*16*16 + + 4 *16*16*16*16*16*16*16 + + 12 *16*16*16*16*16*16*16*16 + + 8 *16*16*16*16*16*16*16*16*16 + + 9 *16*16*16*16*16*16*16*16*16*16 + + 10 *16*16*16*16*16*16*16*16*16*16*16 + + 11 *16*16*16*16*16*16*16*16*16*16*16*16; + +long rscharToIndex(long in) { + switch (true) { + case (in < '2'): + case (in == 'O'): + case (in == 'I'): + return minus1; + case (in <= '9'): + return in - '2'; + case (in < 'A'): + return minus1; + case (in < 'I'): + return in - '9'; + case (in < 'O'): + return in - ':'; + case (in <= 'Z'): + return in - ';'; + default: + return minus1; + } } ``` +
[Back](./README.md) diff --git a/docs/5-Comprehensive-example.md b/docs/5-Comprehensive-example.md index cb5d29b..6788a55 100644 --- a/docs/5-Comprehensive-example.md +++ b/docs/5-Comprehensive-example.md @@ -1,298 +1,7 @@ [Back](./README.md) -```c -/* ****************************************************************** * - * Program: calculator.c - * Author: Rui Deleterium - * - * A previous version of this contract is online at - * S-6CPX-Y8EH-6G3E-FW3R3. Currently it was upgraded to SmartC v2.0 - * - * Contract expects a message with 3 arguments: Number Operator Number. - * Arguments must have only one space between them. - * Numbers >= 0, base 10 and < 100.000.000 - * Operator can be: + - * / - * If no message is given, contract thanks the donation. - * If message was not undestood, contract sends an explanation - * If message was undestood, contract sends a message with operation - * and the result MOD 100.000.000 - * ****************************************************************** */ -#pragma version dev - -#program name Calculator -#program description Do operations as requested by message. -#program activationAmount 10000000 - -#include APIFunctions - -#pragma maxAuxVars 3 - -long ONE_SIGNUM = 1_0000_0000; -long n8 = 8, n10 = 10, n255 = 0xff; - -void main(void) { - while (getNextTxDetails()) { - process_TX(); - } - //clean_up(); -} - -struct TXINFO { - long timestamp; - long sender; - long amount; - long message[4]; -} currentTX; - -/* Checks if there is a new transaction. If there is, fill currentTX struct - and returns true. Returns false otherwise. */ -long getNextTxDetails(void) { - // Do not change the value of currentTX.timestamp on your code!!! - A_To_Tx_After_Timestamp(currentTX.timestamp); - if (Get_A1() == 0) { - return false; - } - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - currentTX.amount = Get_Amount_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0]=Get_B1(); - currentTX.message[1]=Get_B2(); - currentTX.message[2]=Get_B3(); - currentTX.message[3]=Get_B4(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; -} - -void process_TX(void) { - long values[3], beauty_msg[7], result; - - if (currentTX.message[0] == 0) { //no message - send_message.recipient = currentTX.sender; - beauty_msg[0]="Thanks "; - beauty_msg[1]="for "; - beauty_msg[2]=ltoa(currentTX.amount / ONE_SIGNUM ); - beauty_msg[3]=" signum "; - beauty_msg[4]="donation"; - beauty_msg[5]="!"; - concat(beauty_msg, 6, send_message.message, 4); - Send_Message(); - return; - } - - if (split(" ", currentTX.message, 4, values, 3) != 3) { - send_message.recipient = currentTX.sender; - send_message.message[]="Send: number [+-*/] number."; - Send_Message(); - return; - } - - switch (values[1]) { - case "+": - result = ltoa(atol(values[0]) + atol(values[2])); - break; - case "*": - result = ltoa(atol(values[0]) * atol(values[2])); - break; - case "-": - result = atol(values[0]) - atol(values[2]); - if (result < 0){ - beauty_msg[0] = '-'; - beauty_msg[1] = ltoa(-result); - concat(beauty_msg, 2, &result, 1); - } else { - result = ltoa(result); - } - break; - case "/": - result = atol(values[2]); - if (result == 0) { - result = "div/0"; - } else { - result = ltoa(atol(values[0]) / result); - } - break; - default: - send_message.recipient = currentTX.sender; - send_message.message[] = "Unknow operator. Use +-*/"; - Send_Message(); - return; - } - - beauty_msg[0] = values[0]; - beauty_msg[1] = " "; - beauty_msg[2] = values[1]; - beauty_msg[3] = " "; - beauty_msg[4] = values[2]; - beauty_msg[5] = " = "; - beauty_msg[6] = result; - - send_message.recipient = currentTX.sender; - concat(beauty_msg, 7, send_message.message, 4); - Send_Message(); -} - -struct SENDMESSAGE { - long recipient; - long message[4]; -} send_message; - -void Send_Message(void) { - Set_B1(send_message.recipient); - Set_A1_A2(send_message.message[0], send_message.message[1]); - Set_A3_A4(send_message.message[2], send_message.message[3]); - Send_A_To_Address_In_B(); -} - -// Split string function in C -// Expects: -// 'separator' to be used (only LSB will be used). -// 'source' is the array with text to be splitted. -// 'source_length' is the size of source (or the numbers of longs that -// will be processed -// 'ret' is return buffer array. -// 'ret_length' is the size of return buffer, to avoid buffer overflow -// Returns: number of fields filled -// The function will keep adding chars until fill return buffer. If a -// string is bigger than 8 chars, only 8 last chars will be returned -// at that field. -long split(long separator, long * source, long source_length, long * ret, long ret_length) -{ - long field, i_act_arg, i_ret, i_param, act_arg, chr ; - - //clear destination buffer - for (i_ret = 0; i_ret < ret_length; i_ret++) { - ret[i_ret] = 0; - } - - i_act_arg = 0; //cycle bytes in actual string beeing processed(param buffer) (0 to 8) - i_param = 0; //current element in param buffer (0 to 4) - field = 0; //current element in return buffer (ret)(0 to 10 in this example) - i_ret = 0; //var to cycle bytes for each return buffer (from 0 to 8 ) - - while (i_param < source_length) { - act_arg = source[i_param]; - chr = act_arg & 0xff; - while (chr != 0) { - if (chr == separator){ - field++; - i_ret = 0; - } else { - if (i_ret == 8) { // ret[i_ret] is full, shift and continue - ret[field] >>= 8; - i_ret--; - } - ret[field] += chr << (8 * i_ret); - i_ret++; - } - i_act_arg++; - if (field == ret_length) { // End of destination buffer, go to end - return ++field; - } - if (i_act_arg == 8) { //end of actual va_arg, go to next va_arg - break; //break second while loop - } else { // prepare char for next merge - chr = act_arg & (0xff << (8 * i_act_arg)); - chr >>= 8 * i_act_arg; - } - } - i_param++; - i_act_arg = 0; - } - - return ++field; -} - -// String concatenation function in C -// Expects: -// 'source' is an array with content -// 'source_length' is size of source (in longs) or the numbers of longs to be processed -// 'ret' is return buffer array. -// 'ret_length' is the size of ret (in longs) to avoid buffer overflow. -// Function returns the number of bytes processed. A number equal ret_length*8 -// can denote that buffer was too short for the content in 'source'. -long concat(long * source, long source_length, long * ret, long ret_length) -{ - long i_param, act_arg, chr, i_ret, i_buffer, i_act_arg; - - //clear destination buffer - for (i_buffer = 0; i_buffer < ret_length; i_buffer++) { - ret[i_buffer] = 0; - } - - i_ret = 0; //var to cycle bytes for each return buffer (from 0 to 8 ) - i_buffer = 0; //var to cycle for each buffer available (from 0 to ret_length) - i_param = 0; //var to cycle for each source items provided (from 0 to source_length) - i_act_arg= 0; //var to cycle bytes in actual source(long) beeing processed (0 to 8) - - while (i_param < source_length) { //loop thru source_length - act_arg = source[i_param]; // access source - chr = act_arg & 0xff; //this always first char, no need to shift - - while (chr != 0) { //loop bytes in va_arg beeing processed (act_arg) - ret[i_buffer] += chr << (8 * i_ret); - i_act_arg++; - i_ret++; - - if (i_ret == 8) { // ret[i_buffer] is full, go to next ret value - i_buffer++; - i_ret = 0; - if (i_buffer == ret_length) { // End of destination buffer, go to end - goto all_loops_end; //break 2 loops - } - } - if (i_act_arg == 8) { //end of actual va_arg, go to next va_arg - break; //break second while loop - } else { // prepare char for next merge - chr = act_arg & ( 0xff << (8 * i_act_arg) ); - chr >>= 8 * i_act_arg; - } - } - i_param++; - i_act_arg = 0; - } - - all_loops_end: - return i_ret + (8 * i_buffer); -} - -// ASCII to Long (base10 positive and less than 100.000.000) -// Iterative function to implement atoi() clone function in C -// Expects a long containing a string. If any byte is not a char numeric -// representation, then stop and return. Only positive numbers, base10, -// and integers are converted. Returns zero if no number was processed. -long atol(long val) -{ - long ret = 0, chr; - do { - chr = (0xff & val) - '0'; - if (chr < 0 || chr >= 10) - break; - ret *= 10; - ret += chr; - val >>= 8; - } while (true); - return ret; -} - -// Integer to ASCII (base10 positive and less than 100.000.000) -// Iterative function to implement itoa() clone function in C -// Expects a long. If number is negative or bigger than MAX_LTOA -// (it will not fit in a long), returns long meaning "#error". -#define MAX_LTOA 99999999 -long ltoa(long val) -{ - long ret; - if (val < 0 || val > MAX_LTOA) - return "#error"; - ret = 0; - do { - ret <<= 8; - ret += '0' + val % 10; - val /= 10; - } while (val != 0); - return ret; -} -``` +## More examples +* Check [samples](https://github.com/deleterium/SmartC/tree/main/samples) on github. +* Check [commemorative](./commemorative/README.md) contracts. [Back](./README.md) From 5e3a237e92591b6f225dfd71ea65ea5cd88925f9 Mon Sep 17 00:00:00 2001 From: deleterium Date: Thu, 30 Jun 2022 20:24:45 -0300 Subject: [PATCH 109/112] Bump stable release --- package.json | 2 +- src/smartc.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 469e48e..c25691e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartc-signum-compiler", - "version": "2.0.0-rc12", + "version": "2.0.0", "description": "C Compiler for smart contracts on Signum network", "main": "dist/smartc.js", "types": "dist/smartc.d.ts", diff --git a/src/smartc.ts b/src/smartc.ts index 8d32845..b2050bd 100644 --- a/src/smartc.ts +++ b/src/smartc.ts @@ -51,7 +51,7 @@ export class SmartC { typesDefinitions: [], // Default configuration for compiler Config: { - compilerVersion: '2.0.0-rc12', + compilerVersion: '2.0.0', maxAuxVars: 3, maxConstVars: 0, optimizationLevel: 2, From c89b682eb3704710cb6f1fd0f5bbc0a031006f15 Mon Sep 17 00:00:00 2001 From: deleterium Date: Fri, 1 Jul 2022 12:38:07 -0300 Subject: [PATCH 110/112] API testcases for optimizerVM --- .../__tests__/optimizerVM.a.spec.ts | 257 +++++++ .../__tests__/optimizerVM.b.spec.ts | 255 +++++++ .../__tests__/optimizerVM.c.spec.ts | 326 +++++++++ .../assemblyProcessor/optimizerVM/api.ts | 650 ++++-------------- .../assemblyProcessor/optimizerVM/cpu.ts | 9 +- .../assemblyProcessor/optimizerVM/index.ts | 13 - 6 files changed, 984 insertions(+), 526 deletions(-) create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts new file mode 100644 index 0000000..e5a8a91 --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts @@ -0,0 +1,257 @@ +import { CONTRACT } from '../index' + +describe('Assembly compilation:', () => { + it('should optimize: all api T_EXT_FUN', () => { + /* this is source code for test: + #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 1: // Clear_A\n Clear_A();\n Set_A2(0);\n Clear_A();\n break;\ncase 2: // Clear_B\n Clear_B();\n Set_B4(0);\n Clear_B();\ncase 3: // Clear_A_And_B\n Set_A1_A2(0, 0); Set_A3_A4(0, 0); Clear_B();\n Clear_A_And_B();\n Clear_B();\n break;\ncase 4: // Swap_A_and_B\n Clear_A_And_B();\n a++;\n Swap_A_and_B();\n a++;\n Set_B4(0);\n Set_A3(0);\n break;\ncase 5: // metaDoNothing\n Clear_A_And_B();\n Send_All_To_Address_In_B();\n Clear_A_And_B();\n break;\ncase 6: // metaUnknowSuperRegisterA\n Set_A3(a); Set_B3(a);\n Put_Last_Block_GSig_In_A();\n Set_A3(a); Set_B3(a);\n break;\ncase 7: // metaUnknowSuperRegisterB\n Set_A3(a); Set_B3(a);\n OR_B_with_A();\n Set_A3(a); Set_B3(a);\n break;\ncase 8: // metaUB1ZB2ZB3ZB4\n Set_B1_B2(a, 0);\n B_To_Address_Of_Tx_In_A();\n Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);\n break;\n}\n + */ + const code = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_0', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000003', + 'BEQ $testID $r0 :__switch1_2', + 'SET @r0 #0000000000000004', + 'BEQ $testID $r0 :__switch1_3', + 'SET @r0 #0000000000000005', + 'BEQ $testID $r0 :__switch1_4', + 'SET @r0 #0000000000000006', + 'BEQ $testID $r0 :__switch1_5', + 'SET @r0 #0000000000000007', + 'BEQ $testID $r0 :__switch1_6', + 'SET @r0 #0000000000000008', + 'BEQ $testID $r0 :__switch1_7', + 'FIN', + '^comment line 8 case 1: // Clear_A', + '__switch1_0:', + '^comment line 9 Clear_A();', + 'FUN clear_A', + '^comment line 10 Set_A2(0);', + 'CLR @r0', + 'FUN set_A2 $r0', + '^comment line 11 Clear_A();', + 'FUN clear_A', + '^comment line 12 break;', + 'FIN', + '^comment line 13 case 2: // Clear_B', + '__switch1_1:', + '^comment line 14 Clear_B();', + 'FUN clear_B', + '^comment line 15 Set_B4(0);', + 'CLR @r0', + 'FUN set_B4 $r0', + '^comment line 16 Clear_B();', + 'FUN clear_B', + '^comment line 17 case 3: // Clear_A_And_B', + '__switch1_2:', + '^comment line 18 Set_A1_A2(0', + 'CLR @r0', + 'CLR @r1', + 'FUN set_A1_A2 $r0 $r1', + 'CLR @r0', + 'CLR @r1', + 'FUN set_A3_A4 $r0 $r1', + 'FUN clear_B', + '^comment line 19 Clear_A_And_B();', + 'FUN clear_A_B', + '^comment line 20 Clear_B();', + 'FUN clear_B', + '^comment line 21 break;', + 'FIN', + '^comment line 22 case 4: // Swap_A_and_B', + '__switch1_3:', + '^comment line 23 Clear_A_And_B();', + 'FUN clear_A_B', + '^comment line 24 a++;', + 'INC @a', + '^comment line 25 Swap_A_and_B();', + 'FUN swap_A_and_B', + '^comment line 26 a++;', + 'INC @a', + '^comment line 27 Set_B4(0);', + 'CLR @r0', + 'FUN set_B4 $r0', + '^comment line 28 Set_A3(0);', + 'CLR @r0', + 'FUN set_A3 $r0', + '^comment line 29 break;', + 'FIN', + '^comment line 30 case 5: // metaDoNothing', + '__switch1_4:', + '^comment line 31 Clear_A_And_B();', + 'FUN clear_A_B', + '^comment line 32 Send_All_To_Address_In_B();', + 'FUN send_All_to_Address_in_B', + '^comment line 33 Clear_A_And_B();', + 'FUN clear_A_B', + '^comment line 34 break;', + 'FIN', + '^comment line 35 case 6: // metaUnknowSuperRegisterA', + '__switch1_5:', + '^comment line 36 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + 'FUN set_B3 $a', + '^comment line 37 Put_Last_Block_GSig_In_A();', + 'FUN Put_Last_Block_GSig_In_A', + '^comment line 38 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + 'FUN set_B3 $a', + '^comment line 39 break;', + 'FIN', + '^comment line 40 case 7: // metaUnknowSuperRegisterB', + '__switch1_6:', + '^comment line 41 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + 'FUN set_B3 $a', + '^comment line 42 OR_B_with_A();', + 'FUN OR_B_with_A', + '^comment line 43 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + 'FUN set_B3 $a', + '^comment line 44 break;', + 'FIN', + '^comment line 45 case 8: // metaUB1ZB2ZB3ZB4', + '__switch1_7:', + '^comment line 46 Set_B1_B2(a, 0);', + 'CLR @r0', + 'FUN set_B1_B2 $a $r0', + '^comment line 47 B_To_Address_Of_Tx_In_A();', + 'FUN B_to_Address_of_Tx_in_A', + '^comment line 48 Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);', + 'FUN set_B1 $a', + 'CLR @r0', + 'FUN set_B2 $r0', + 'CLR @r0', + 'FUN set_B3 $r0', + 'CLR @r0', + 'FUN set_B4 $r0', + '^comment line 49 break;', + 'FIN' + ] + const optCode = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_0', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000003', + 'BEQ $testID $r0 :__switch1_2', + 'SET @r0 #0000000000000004', + 'BEQ $testID $r0 :__switch1_3', + 'SET @r0 #0000000000000005', + 'BEQ $testID $r0 :__switch1_4', + 'SET @r0 #0000000000000006', + 'BEQ $testID $r0 :__switch1_5', + 'SET @r0 #0000000000000007', + 'BEQ $testID $r0 :__switch1_6', + 'SET @r0 #0000000000000008', + 'BEQ $testID $r0 :__switch1_7', + 'FIN', + '^comment line 8 case 1: // Clear_A', + '__switch1_0:', + '^comment line 9 Clear_A();', + 'FUN clear_A', + '^comment line 10 Set_A2(0);', + 'CLR @r0', + '^comment line 11 Clear_A();', + '^comment line 12 break;', + 'FIN', + '^comment line 13 case 2: // Clear_B', + '__switch1_1:', + '^comment line 14 Clear_B();', + 'FUN clear_B', + '^comment line 15 Set_B4(0);', + 'CLR @r0', + '^comment line 16 Clear_B();', + '^comment line 17 case 3: // Clear_A_And_B', + '__switch1_2:', + '^comment line 18 Set_A1_A2(0', + 'CLR @r0', + 'CLR @r1', + 'FUN set_A1_A2 $r0 $r1', + 'FUN set_A3_A4 $r0 $r1', + 'FUN clear_B', + '^comment line 19 Clear_A_And_B();', + '^comment line 20 Clear_B();', + '^comment line 21 break;', + 'FIN', + '^comment line 22 case 4: // Swap_A_and_B', + '__switch1_3:', + '^comment line 23 Clear_A_And_B();', + 'FUN clear_A_B', + '^comment line 24 a++;', + 'INC @a', + '^comment line 25 Swap_A_and_B();', + 'FUN swap_A_and_B', + '^comment line 26 a++;', + 'INC @a', + '^comment line 27 Set_B4(0);', + 'CLR @r0', + 'FUN set_B4 $r0', + '^comment line 28 Set_A3(0);', + 'FUN set_A3 $r0', + '^comment line 29 break;', + 'FIN', + '^comment line 30 case 5: // metaDoNothing', + '__switch1_4:', + '^comment line 31 Clear_A_And_B();', + 'FUN clear_A_B', + '^comment line 32 Send_All_To_Address_In_B();', + 'FUN send_All_to_Address_in_B', + '^comment line 33 Clear_A_And_B();', + '^comment line 34 break;', + 'FIN', + '^comment line 35 case 6: // metaUnknowSuperRegisterA', + '__switch1_5:', + '^comment line 36 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + 'FUN set_B3 $a', + '^comment line 37 Put_Last_Block_GSig_In_A();', + 'FUN Put_Last_Block_GSig_In_A', + '^comment line 38 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + '^comment line 39 break;', + 'FIN', + '^comment line 40 case 7: // metaUnknowSuperRegisterB', + '__switch1_6:', + '^comment line 41 Set_A3(a); Set_B3(a);', + 'FUN set_A3 $a', + 'FUN set_B3 $a', + '^comment line 42 OR_B_with_A();', + 'FUN OR_B_with_A', + '^comment line 43 Set_A3(a); Set_B3(a);', + 'FUN set_B3 $a', + '^comment line 44 break;', + 'FIN', + '^comment line 45 case 8: // metaUB1ZB2ZB3ZB4', + '__switch1_7:', + '^comment line 46 Set_B1_B2(a, 0);', + 'CLR @r0', + 'FUN set_B1_B2 $a $r0', + '^comment line 47 B_To_Address_Of_Tx_In_A();', + 'FUN B_to_Address_of_Tx_in_A', + '^comment line 48 Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);', + 'FUN set_B1 $a', + '^comment line 49 break;', + 'FIN' + ] + const result = new CONTRACT(code).optimize() + expect(result).toEqual(optCode) + }) +}) diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts new file mode 100644 index 0000000..2c529ca --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts @@ -0,0 +1,255 @@ +import { CONTRACT } from '../index' + +describe('Assembly compilation:', () => { + it('should optimize: all api EXT_FUN_DAT', () => { + /* this is source code for test: + #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 0: // Same content\n Set_A1(25);\n a=25;\n Set_A1(a);\n break;\ncase 1: // Same unknown var\n Set_A2(a);\n b++;\n Set_A2(a);\n break;\ncase 2: // Operation destroys same\n Set_A3(a);\n a++;\n Set_A3(a);\n break;\ncase 3: // Operation destroys same\n Set_A4(a);\n a^=b;\n Set_A4(a);\n break;\ncase 4: // Same content\n Set_B1(25);\n a=25;\n Set_B1(a);\n break;\ncase 5: // Same unknown var\n Set_B2(a);\n b++;\n Set_B2(a);\n break;\ncase 6: // Operation destroys same\n Set_B3(a);\n a++;\n Set_B3(a);\n break;\ncase 7: // Operation destroys same\n Set_B4(a);\n a|=b;\n Set_B4(a);\n break;\ncase 8: // A_to_Tx_after_Timestamp\n Set_B1_B2(a, 0);\n B_To_Address_Of_Tx_In_A();\n Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);\n break;\n\n}\n + */ + const code = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'SET @r0 #0000000000000003', + 'BEQ $testID $r0 :__switch1_3', + 'SET @r0 #0000000000000004', + 'BEQ $testID $r0 :__switch1_4', + 'SET @r0 #0000000000000005', + 'BEQ $testID $r0 :__switch1_5', + 'SET @r0 #0000000000000006', + 'BEQ $testID $r0 :__switch1_6', + 'SET @r0 #0000000000000007', + 'BEQ $testID $r0 :__switch1_7', + 'SET @r0 #0000000000000008', + 'BEQ $testID $r0 :__switch1_8', + 'FIN', + '^comment line 8 case 0: // Same content', + '__switch1_0:', + '^comment line 9 Set_A1(25);', + 'SET @r0 #0000000000000019', + 'FUN set_A1 $r0', + '^comment line 10 a=25;', + 'SET @a #0000000000000019', + '^comment line 11 Set_A1(a);', + 'FUN set_A1 $a', + '^comment line 12 break;', + 'FIN', + '^comment line 13 case 1: // Same unknown var', + '__switch1_1:', + '^comment line 14 Set_A2(a);', + 'FUN set_A2 $a', + '^comment line 15 b++;', + 'INC @b', + '^comment line 16 Set_A2(a);', + 'FUN set_A2 $a', + '^comment line 17 break;', + 'FIN', + '^comment line 18 case 2: // Operation destroys same', + '__switch1_2:', + '^comment line 19 Set_A3(a);', + 'FUN set_A3 $a', + '^comment line 20 a++;', + 'INC @a', + '^comment line 21 Set_A3(a);', + 'FUN set_A3 $a', + '^comment line 22 break;', + 'FIN', + '^comment line 23 case 3: // Operation destroys same', + '__switch1_3:', + '^comment line 24 Set_A4(a);', + 'FUN set_A4 $a', + '^comment line 25 a^=b;', + 'XOR @a $b', + '^comment line 26 Set_A4(a);', + 'FUN set_A4 $a', + '^comment line 27 break;', + 'FIN', + '^comment line 28 case 4: // Same content', + '__switch1_4:', + '^comment line 29 Set_B1(25);', + 'SET @r0 #0000000000000019', + 'FUN set_B1 $r0', + '^comment line 30 a=25;', + 'SET @a #0000000000000019', + '^comment line 31 Set_B1(a);', + 'FUN set_B1 $a', + '^comment line 32 break;', + 'FIN', + '^comment line 33 case 5: // Same unknown var', + '__switch1_5:', + '^comment line 34 Set_B2(a);', + 'FUN set_B2 $a', + '^comment line 35 b++;', + 'INC @b', + '^comment line 36 Set_B2(a);', + 'FUN set_B2 $a', + '^comment line 37 break;', + 'FIN', + '^comment line 38 case 6: // Operation destroys same', + '__switch1_6:', + '^comment line 39 Set_B3(a);', + 'FUN set_B3 $a', + '^comment line 40 a++;', + 'INC @a', + '^comment line 41 Set_B3(a);', + 'FUN set_B3 $a', + '^comment line 42 break;', + 'FIN', + '^comment line 43 case 7: // Operation destroys same', + '__switch1_7:', + '^comment line 44 Set_B4(a);', + 'FUN set_B4 $a', + '^comment line 45 a|=b;', + 'BOR @a $b', + '^comment line 46 Set_B4(a);', + 'FUN set_B4 $a', + '^comment line 47 break;', + 'FIN', + '^comment line 48 case 8: // A_to_Tx_after_Timestamp', + '__switch1_8:', + '^comment line 49 Set_B1_B2(a, 0);', + 'CLR @r0', + 'FUN set_B1_B2 $a $r0', + '^comment line 50 B_To_Address_Of_Tx_In_A();', + 'FUN B_to_Address_of_Tx_in_A', + '^comment line 51 Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);', + 'FUN set_B1 $a', + 'CLR @r0', + 'FUN set_B2 $r0', + 'CLR @r0', + 'FUN set_B3 $r0', + 'CLR @r0', + 'FUN set_B4 $r0', + '^comment line 52 break;', + 'FIN' + ] + const optCode = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'SET @r0 #0000000000000003', + 'BEQ $testID $r0 :__switch1_3', + 'SET @r0 #0000000000000004', + 'BEQ $testID $r0 :__switch1_4', + 'SET @r0 #0000000000000005', + 'BEQ $testID $r0 :__switch1_5', + 'SET @r0 #0000000000000006', + 'BEQ $testID $r0 :__switch1_6', + 'SET @r0 #0000000000000007', + 'BEQ $testID $r0 :__switch1_7', + 'SET @r0 #0000000000000008', + 'BEQ $testID $r0 :__switch1_8', + 'FIN', + '^comment line 8 case 0: // Same content', + '__switch1_0:', + '^comment line 9 Set_A1(25);', + 'SET @r0 #0000000000000019', + 'FUN set_A1 $r0', + '^comment line 10 a=25;', + 'SET @a #0000000000000019', + '^comment line 11 Set_A1(a);', + '^comment line 12 break;', + 'FIN', + '^comment line 13 case 1: // Same unknown var', + '__switch1_1:', + '^comment line 14 Set_A2(a);', + 'FUN set_A2 $a', + '^comment line 15 b++;', + 'INC @b', + '^comment line 16 Set_A2(a);', + '^comment line 17 break;', + 'FIN', + '^comment line 18 case 2: // Operation destroys same', + '__switch1_2:', + '^comment line 19 Set_A3(a);', + 'FUN set_A3 $a', + '^comment line 20 a++;', + 'INC @a', + '^comment line 21 Set_A3(a);', + 'FUN set_A3 $a', + '^comment line 22 break;', + 'FIN', + '^comment line 23 case 3: // Operation destroys same', + '__switch1_3:', + '^comment line 24 Set_A4(a);', + 'FUN set_A4 $a', + '^comment line 25 a^=b;', + 'XOR @a $b', + '^comment line 26 Set_A4(a);', + 'FUN set_A4 $a', + '^comment line 27 break;', + 'FIN', + '^comment line 28 case 4: // Same content', + '__switch1_4:', + '^comment line 29 Set_B1(25);', + 'SET @r0 #0000000000000019', + 'FUN set_B1 $r0', + '^comment line 30 a=25;', + 'SET @a #0000000000000019', + '^comment line 31 Set_B1(a);', + '^comment line 32 break;', + 'FIN', + '^comment line 33 case 5: // Same unknown var', + '__switch1_5:', + '^comment line 34 Set_B2(a);', + 'FUN set_B2 $a', + '^comment line 35 b++;', + 'INC @b', + '^comment line 36 Set_B2(a);', + '^comment line 37 break;', + 'FIN', + '^comment line 38 case 6: // Operation destroys same', + '__switch1_6:', + '^comment line 39 Set_B3(a);', + 'FUN set_B3 $a', + '^comment line 40 a++;', + 'INC @a', + '^comment line 41 Set_B3(a);', + 'FUN set_B3 $a', + '^comment line 42 break;', + 'FIN', + '^comment line 43 case 7: // Operation destroys same', + '__switch1_7:', + '^comment line 44 Set_B4(a);', + 'FUN set_B4 $a', + '^comment line 45 a|=b;', + 'BOR @a $b', + '^comment line 46 Set_B4(a);', + 'FUN set_B4 $a', + '^comment line 47 break;', + 'FIN', + '^comment line 48 case 8: // A_to_Tx_after_Timestamp', + '__switch1_8:', + '^comment line 49 Set_B1_B2(a, 0);', + 'CLR @r0', + 'FUN set_B1_B2 $a $r0', + '^comment line 50 B_To_Address_Of_Tx_In_A();', + 'FUN B_to_Address_of_Tx_in_A', + '^comment line 51 Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);', + 'FUN set_B1 $a', + '^comment line 52 break;', + 'FIN' + ] + const result = new CONTRACT(code).optimize() + expect(result).toEqual(optCode) + }) +}) diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts new file mode 100644 index 0000000..85a3b52 --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts @@ -0,0 +1,326 @@ +import { CONTRACT } from '../index' + +describe('Assembly compilation:', () => { + it('should optimize: all api EXT_FUN_DAT_2', () => { + /* this is source code for test: + #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 0: // Same content\n Set_A1_A2(25, 13);\n a=25;\n b=13;\n Set_A1_A2(a, b);\n break;\ncase 1: // Same var\n Set_A3_A4(a, b);\n Set_A3_A4(a, b);\n break;\ncase 2: // content+var\n Set_B1_B2(25, b);\n a=25;\n Set_B1_B2(a, b);\n break;\ncase 3: // var+content\n Set_B3_B4(a, 13);\n b=13;\n Set_B3_B4(a, b);\n break;\n}\n + */ + const code = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'SET @r0 #0000000000000003', + 'BEQ $testID $r0 :__switch1_3', + 'FIN', + '^comment line 8 case 0: // Same content', + '__switch1_0:', + '^comment line 9 Set_A1_A2(25, 13);', + 'SET @r0 #0000000000000019', + 'SET @r1 #000000000000000d', + 'FUN set_A1_A2 $r0 $r1', + '^comment line 10 a=25;', + 'SET @a #0000000000000019', + '^comment line 11 b=13;', + 'SET @b #000000000000000d', + '^comment line 12 Set_A1_A2(a, b);', + 'FUN set_A1_A2 $a $b', + '^comment line 13 break;', + 'FIN', + '^comment line 14 case 1: // Same var', + '__switch1_1:', + '^comment line 15 Set_A3_A4(a, b);', + 'FUN set_A3_A4 $a $b', + '^comment line 16 Set_A3_A4(a, b);', + 'FUN set_A3_A4 $a $b', + '^comment line 17 break;', + 'FIN', + '^comment line 18 case 2: // content+var', + '__switch1_2:', + '^comment line 19 Set_B1_B2(25, b);', + 'SET @r0 #0000000000000019', + 'FUN set_B1_B2 $r0 $b', + '^comment line 20 a=25;', + 'SET @a #0000000000000019', + '^comment line 21 Set_B1_B2(a, b);', + 'FUN set_B1_B2 $a $b', + '^comment line 22 break;', + 'FIN', + '^comment line 23 case 3: // var+content', + '__switch1_3:', + '^comment line 24 Set_B3_B4(a, 13);', + 'SET @r0 #000000000000000d', + 'FUN set_B3_B4 $a $r0', + '^comment line 25 b=13;', + 'SET @b #000000000000000d', + '^comment line 26 Set_B3_B4(a, b);', + 'FUN set_B3_B4 $a $b', + '^comment line 27 break;', + 'FIN' + ] + const optCode = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'SET @r0 #0000000000000003', + 'BEQ $testID $r0 :__switch1_3', + 'FIN', + '^comment line 8 case 0: // Same content', + '__switch1_0:', + '^comment line 9 Set_A1_A2(25, 13);', + 'SET @r0 #0000000000000019', + 'SET @r1 #000000000000000d', + 'FUN set_A1_A2 $r0 $r1', + '^comment line 10 a=25;', + 'SET @a #0000000000000019', + '^comment line 11 b=13;', + 'SET @b #000000000000000d', + '^comment line 12 Set_A1_A2(a, b);', + '^comment line 13 break;', + 'FIN', + '^comment line 14 case 1: // Same var', + '__switch1_1:', + '^comment line 15 Set_A3_A4(a, b);', + 'FUN set_A3_A4 $a $b', + '^comment line 16 Set_A3_A4(a, b);', + '^comment line 17 break;', + 'FIN', + '^comment line 18 case 2: // content+var', + '__switch1_2:', + '^comment line 19 Set_B1_B2(25, b);', + 'SET @r0 #0000000000000019', + 'FUN set_B1_B2 $r0 $b', + '^comment line 20 a=25;', + 'SET @a #0000000000000019', + '^comment line 21 Set_B1_B2(a, b);', + '^comment line 22 break;', + 'FIN', + '^comment line 23 case 3: // var+content', + '__switch1_3:', + '^comment line 24 Set_B3_B4(a, 13);', + 'SET @r0 #000000000000000d', + 'FUN set_B3_B4 $a $r0', + '^comment line 25 b=13;', + 'SET @b #000000000000000d', + '^comment line 26 Set_B3_B4(a, b);', + '^comment line 27 break;', + 'FIN' + ] + const result = new CONTRACT(code).optimize() + expect(result).toEqual(optCode) + }) + it('should optimize: EXT_FUN_RET Get_[AB1-4]', () => { + /* this is source code for test: + #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 0: // Same content\n Set_A1_A2(1, 5);\n Set_A3_A4(2, 6);\n a=1;\n a=Get_A1();\n a=5;\n a=Get_A2();\n a=2;\n a=Get_A3();\n a=6;\n a=Get_A4();\n break;\ncase 1: // Same var\n Set_B1_B2(a, b);\n Set_B3_B4(a, b);\n a=Get_B1();\n b=Get_B2();\n a=Get_B3();\n b=Get_B4();\n break;\ncase 2: // get+set\n a=Get_B1();\n b++;\n Set_B1(a);\n break;\n}\n + */ + const code = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'FIN', + '^comment line 8 case 0: // Same content', + '__switch1_0:', + '^comment line 9 Set_A1_A2(1, 5);', + 'SET @r0 #0000000000000001', + 'SET @r1 #0000000000000005', + 'FUN set_A1_A2 $r0 $r1', + '^comment line 10 Set_A3_A4(2, 6);', + 'SET @r0 #0000000000000002', + 'SET @r1 #0000000000000006', + 'FUN set_A3_A4 $r0 $r1', + '^comment line 11 a=1;', + 'SET @a #0000000000000001', + '^comment line 12 a=Get_A1();', + 'FUN @a get_A1', + '^comment line 13 a=5;', + 'SET @a #0000000000000005', + '^comment line 14 a=Get_A2();', + 'FUN @a get_A2', + '^comment line 15 a=2;', + 'SET @a #0000000000000002', + '^comment line 16 a=Get_A3();', + 'FUN @a get_A3', + '^comment line 17 a=6;', + 'SET @a #0000000000000006', + '^comment line 18 a=Get_A4();', + 'FUN @a get_A4', + '^comment line 19 break;', + 'FIN', + '^comment line 20 case 1: // Same var', + '__switch1_1:', + '^comment line 21 Set_B1_B2(a, b);', + 'FUN set_B1_B2 $a $b', + '^comment line 22 Set_B3_B4(a, b);', + 'FUN set_B3_B4 $a $b', + '^comment line 23 a=Get_B1();', + 'FUN @a get_B1', + '^comment line 24 b=Get_B2();', + 'FUN @b get_B2', + '^comment line 25 a=Get_B3();', + 'FUN @a get_B3', + '^comment line 26 b=Get_B4();', + 'FUN @b get_B4', + '^comment line 27 break;', + 'FIN', + '^comment line 28 case 2: // get+set', + '__switch1_2:', + '^comment line 29 a=Get_B1();', + 'FUN @a get_B1', + '^comment line 30 b++;', + 'INC @b', + '^comment line 31 Set_B1(a);', + 'FUN set_B1 $a', + '^comment line 32 break;', + 'FIN' + ] + const optCode = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 7 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'FIN', + '^comment line 8 case 0: // Same content', + '__switch1_0:', + '^comment line 9 Set_A1_A2(1, 5);', + 'SET @r0 #0000000000000001', + 'SET @r1 #0000000000000005', + 'FUN set_A1_A2 $r0 $r1', + '^comment line 10 Set_A3_A4(2, 6);', + 'SET @r0 #0000000000000002', + 'SET @r1 #0000000000000006', + 'FUN set_A3_A4 $r0 $r1', + '^comment line 11 a=1;', + 'SET @a #0000000000000001', + '^comment line 12 a=Get_A1();', + '^comment line 13 a=5;', + 'SET @a #0000000000000005', + '^comment line 14 a=Get_A2();', + '^comment line 15 a=2;', + 'SET @a #0000000000000002', + '^comment line 16 a=Get_A3();', + '^comment line 17 a=6;', + 'SET @a #0000000000000006', + '^comment line 18 a=Get_A4();', + '^comment line 19 break;', + 'FIN', + '^comment line 20 case 1: // Same var', + '__switch1_1:', + '^comment line 21 Set_B1_B2(a, b);', + 'FUN set_B1_B2 $a $b', + '^comment line 22 Set_B3_B4(a, b);', + 'FUN set_B3_B4 $a $b', + '^comment line 23 a=Get_B1();', + '^comment line 24 b=Get_B2();', + '^comment line 25 a=Get_B3();', + '^comment line 26 b=Get_B4();', + '^comment line 27 break;', + 'FIN', + '^comment line 28 case 2: // get+set', + '__switch1_2:', + '^comment line 29 a=Get_B1();', + 'FUN @a get_B1', + '^comment line 30 b++;', + 'INC @b', + '^comment line 31 Set_B1(a);', + '^comment line 32 break;', + 'FIN' + ] + const result = new CONTRACT(code).optimize() + expect(result).toEqual(optCode) + }) + it('should optimize: Remaining EXT_FUN_RET and EXT_FUN_RET_DAT_2 ', () => { + const code = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 6 if (a) {', + 'BZR $a :__if1_endif', + '^comment line 7 Set_B1(a);', + 'FUN set_B1 $a', + '^comment line 8 a=Get_Activation_Fee();', + 'FUN @a Get_Activation_Fee', + '^comment line 9 Set_B1(a);', + 'FUN set_B1 $a', + '__if1_endif:', + '^comment line 12 Set_B1_B2(b, a);', + 'FUN set_B1_B2 $b $a', + '^comment line 13 a=Add_Minutes_To_Timestamp(testID, b);', + 'FUN @a add_Minutes_to_Timestamp $testID $b', + '^comment line 14 Set_B1(b);', + 'FUN set_B1 $b', + '^comment line 15 Set_B2(a);', + 'FUN set_B2 $a', + 'FIN' + ] + const optCode = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare testID', + '^declare a', + '^declare b', + '', + '^comment line 6 if (a) {', + 'BZR $a :__if1_endif', + '^comment line 7 Set_B1(a);', + 'FUN set_B1 $a', + '^comment line 8 a=Get_Activation_Fee();', + 'FUN @a Get_Activation_Fee', + '^comment line 9 Set_B1(a);', + 'FUN set_B1 $a', + '__if1_endif:', + '^comment line 12 Set_B1_B2(b, a);', + 'FUN set_B1_B2 $b $a', + '^comment line 13 a=Add_Minutes_To_Timestamp(testID, b);', + 'FUN @a add_Minutes_to_Timestamp $testID $b', + '^comment line 14 Set_B1(b);', + '^comment line 15 Set_B2(a);', + 'FUN set_B2 $a', + 'FIN' + ] + const result = new CONTRACT(code).optimize() + expect(result).toEqual(optCode) + }) +}) diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts index 4f77fef..1867f57 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts @@ -2,7 +2,6 @@ import { CONTRACT, MemoryObj, unknownValue } from './index' interface T_EXT { funName: string - opCode: number } interface T_EXT_FUN extends T_EXT{ execute(ContractState: CONTRACT): boolean|null @@ -17,14 +16,76 @@ interface T_EXT_FUN_RET extends T_EXT{ execute(ContractState: CONTRACT, RetVar: MemoryObj): boolean|null } interface T_EXT_FUN_RET_DAT_2 extends T_EXT{ - execute(ContractState: CONTRACT, value1: MemoryObj, value2: MemoryObj): boolean|null + execute(ContractState: CONTRACT, RetVar: MemoryObj, value1: MemoryObj, value2: MemoryObj): boolean|null +} + +function metaUnknowSuperRegisterA (ContractState: CONTRACT) : boolean { + ContractState.unknowSuperRegisterA() + return true +} +function metaUnknowSuperRegisterB (ContractState: CONTRACT) : boolean { + ContractState.unknowSuperRegisterB() + return true +} +function metaDoNothing () : boolean { + return true +} +function metaUB1ZB2ZB3ZB4 (ContractState: CONTRACT) : boolean { + const B1 = ContractState.getMemoryByName('B1') + const B2 = ContractState.getMemoryByName('B2') + const B3 = ContractState.getMemoryByName('B3') + const B4 = ContractState.getMemoryByName('B4') + ContractState.unknownAndRevoke(B1) + ContractState.zeroAndRevoke(B2) + ContractState.zeroAndRevoke(B3) + ContractState.zeroAndRevoke(B4) + return true +} +function metaSetAndRevokeVariable (ContractState: CONTRACT, ContentVar: MemoryObj, variableName: string) : boolean|null { + const superReg = ContractState.getMemoryByName(variableName) + if (superReg.shadow === ContentVar.varName) { + // Optimize setting same variable content + return null + } + if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { + // Optimize setting same constant content + return null + } + ContractState.setAndRevoke(superReg, ContentVar) + return true +} +function metaDoubleSetSuperregister (ContractState: CONTRACT, ContentVar1: MemoryObj, ContentVar2: MemoryObj, reg1: string, reg2: string) : boolean|null { + const superReg1 = ContractState.getMemoryByName(reg1) + const superReg2 = ContractState.getMemoryByName(reg2) + if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && + (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { + // Optimize setting same variable/constant content + return null + } + ContractState.setAndRevoke(superReg1, ContentVar1) + ContractState.setAndRevoke(superReg2, ContentVar2) + return true +} +function metaUnknowAndRevokeVariable (ContractState: CONTRACT, RetVar: MemoryObj) : boolean { + ContractState.unknownAndRevoke(RetVar) + return true +} +function metaGetSuperregister (ContractState: CONTRACT, RetVar: MemoryObj, reg: string) : boolean|null { + const superReg = ContractState.getMemoryByName(reg) + if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { + // Optimize same content + return null + } + ContractState.unknownAndRevoke(RetVar) + RetVar.shadow = superReg.varName + superReg.shadow = RetVar.varName + return true } export class API_MICROCODE { static EXT_FUN: T_EXT_FUN[] = [ { funName: 'clear_A', - opCode: 0x32, execute (ContractState) { const A1 = ContractState.getMemoryByName('A1') const A2 = ContractState.getMemoryByName('A2') @@ -43,7 +104,6 @@ export class API_MICROCODE { }, { funName: 'clear_B', - opCode: 0x32, execute (ContractState) { const B1 = ContractState.getMemoryByName('B1') const B2 = ContractState.getMemoryByName('B2') @@ -62,7 +122,6 @@ export class API_MICROCODE { }, { funName: 'clear_A_B', - opCode: 0x32, execute (ContractState) { const A1 = ContractState.getMemoryByName('A1') const A2 = ContractState.getMemoryByName('A2') @@ -90,410 +149,189 @@ export class API_MICROCODE { }, { funName: 'copy_A_From_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'copy_B_From_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'swap_A_and_B', - opCode: 0x32, execute (ContractState) { - ContractState.unknowSuperRegisters() + ContractState.unknowSuperRegisterA() + ContractState.unknowSuperRegisterB() return true } }, { funName: 'OR_A_with_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'OR_B_with_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'AND_A_with_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'AND_B_with_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'XOR_A_with_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'XOR_B_with_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'add_A_to_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'add_B_to_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'sub_A_from_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'sub_B_from_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'mul_A_by_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'mul_B_by_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'div_A_by_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'div_B_by_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'MD5_A_to_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'HASH160_A_to_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'SHA256_A_to_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'put_Last_Block_Hash_In_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA }, { funName: 'message_from_Tx_in_A_to_B', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'B_to_Address_of_Tx_in_A', - opCode: 0x32, - execute (ContractState) { - const B1 = ContractState.getMemoryByName('B1') - const B2 = ContractState.getMemoryByName('B2') - const B3 = ContractState.getMemoryByName('B3') - const B4 = ContractState.getMemoryByName('B4') - ContractState.unknownAndRevoke(B1) - ContractState.zeroAndRevoke(B2) - ContractState.zeroAndRevoke(B3) - ContractState.zeroAndRevoke(B4) - return true - } + execute: metaUB1ZB2ZB3ZB4 }, { funName: 'B_to_Address_of_Creator', - opCode: 0x32, - execute (ContractState) { - const B1 = ContractState.getMemoryByName('B1') - const B2 = ContractState.getMemoryByName('B2') - const B3 = ContractState.getMemoryByName('B3') - const B4 = ContractState.getMemoryByName('B4') - ContractState.unknownAndRevoke(B1) - ContractState.zeroAndRevoke(B2) - ContractState.zeroAndRevoke(B3) - ContractState.zeroAndRevoke(B4) - return true - } + execute: metaUB1ZB2ZB3ZB4 }, { funName: 'B_To_Assets_Of_Tx_In_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterB() - return true - } + execute: metaUnknowSuperRegisterB }, { funName: 'send_All_to_Address_in_B', - opCode: 0x32, - execute (ContractState) { - return true - } + execute: metaDoNothing }, { funName: 'send_Old_to_Address_in_B', - opCode: 0x32, - execute (ContractState) { - return true - } + execute: metaDoNothing }, { funName: 'send_A_to_Address_in_B', - opCode: 0x32, - execute (ContractState) { - return true - } + execute: metaDoNothing }, { funName: 'Set_Map_Value_Keys_In_A', - opCode: 0x32, - execute (ContractState) { - return true - } + execute: metaDoNothing }, { funName: 'Mint_Asset', - opCode: 0x32, - execute (ContractState) { - return true - } + execute: metaDoNothing }, { funName: 'Distribute_To_Asset_Holders', - opCode: 0x32, - execute (ContractState) { - return true - } + execute: metaDoNothing }, { funName: 'Put_Last_Block_GSig_In_A', - opCode: 0x32, - execute (ContractState) { - ContractState.unknowSuperRegisterA() - return true - } + execute: metaUnknowSuperRegisterA } ] static EXT_FUN_DAT: T_EXT_FUN_DAT[] = [ { funName: 'set_A1', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('A1') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'A1') } }, { funName: 'set_A2', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('A2') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'A2') } }, { funName: 'set_A3', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('A3') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'A3') } }, { funName: 'set_A4', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('A4') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'A4') } }, { funName: 'set_B1', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('B1') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'B1') } }, { funName: 'set_B2', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('B2') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'B2') } }, { funName: 'set_B3', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('B3') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'B3') } }, { funName: 'set_B4', - opCode: 0x33, execute (ContractState, ContentVar) { - const superReg = ContractState.getMemoryByName('B4') - if (superReg.shadow === ContentVar.varName) { - // Optimize setting same variable content - return null - } - if (superReg.value !== unknownValue && superReg.value === ContentVar.value) { - // Optimize setting same constant content - return null - } - ContractState.setAndRevoke(superReg, ContentVar) - return true + return metaSetAndRevokeVariable(ContractState, ContentVar, 'B4') } }, { funName: 'A_to_Tx_after_Timestamp', - opCode: 0x33, execute (ContractState, value) { const A1 = ContractState.getMemoryByName('A1') const A2 = ContractState.getMemoryByName('A2') @@ -508,76 +346,33 @@ export class API_MICROCODE { }, { funName: 'send_to_Address_in_B', - opCode: 0x33, - execute (ContractState, value) { - return true - } + execute: metaDoNothing } ] static EXT_FUN_DAT_2: T_EXT_FUN_DAT_2[] = [ { funName: 'set_A1_A2', - opCode: 0x34, execute (ContractState, ContentVar1, ContentVar2) { - const superReg1 = ContractState.getMemoryByName('A1') - const superReg2 = ContractState.getMemoryByName('A2') - if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && - (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { - // Optimize setting same variable/constant content - return null - } - ContractState.setAndRevoke(superReg1, ContentVar1) - ContractState.setAndRevoke(superReg2, ContentVar2) - return true + return metaDoubleSetSuperregister(ContractState, ContentVar1, ContentVar2, 'A1', 'A2') } }, { funName: 'set_A3_A4', - opCode: 0x34, execute (ContractState, ContentVar1, ContentVar2) { - const superReg1 = ContractState.getMemoryByName('A3') - const superReg2 = ContractState.getMemoryByName('A4') - if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && - (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { - // Optimize setting same variable/constant content - return null - } - ContractState.setAndRevoke(superReg1, ContentVar1) - ContractState.setAndRevoke(superReg2, ContentVar2) - return true + return metaDoubleSetSuperregister(ContractState, ContentVar1, ContentVar2, 'A3', 'A4') } }, { funName: 'set_B1_B2', - opCode: 0x34, execute (ContractState, ContentVar1, ContentVar2) { - const superReg1 = ContractState.getMemoryByName('B1') - const superReg2 = ContractState.getMemoryByName('B2') - if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && - (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { - // Optimize setting same variable/constant content - return null - } - ContractState.setAndRevoke(superReg1, ContentVar1) - ContractState.setAndRevoke(superReg2, ContentVar2) - return true + return metaDoubleSetSuperregister(ContractState, ContentVar1, ContentVar2, 'B1', 'B2') } }, { funName: 'set_B3_B4', - opCode: 0x34, execute (ContractState, ContentVar1, ContentVar2) { - const superReg1 = ContractState.getMemoryByName('B3') - const superReg2 = ContractState.getMemoryByName('B4') - if ((superReg1.shadow === ContentVar1.varName || (superReg1.value !== unknownValue && superReg1.value === ContentVar1.value)) && - (superReg2.shadow === ContentVar2.varName || (superReg2.value !== unknownValue && superReg2.value === ContentVar2.value))) { - // Optimize setting same variable/constant content - return null - } - ContractState.setAndRevoke(superReg1, ContentVar1) - ContractState.setAndRevoke(superReg2, ContentVar2) - return true + return metaDoubleSetSuperregister(ContractState, ContentVar1, ContentVar2, 'B3', 'B4') } } ] @@ -585,309 +380,146 @@ export class API_MICROCODE { static EXT_FUN_RET: T_EXT_FUN_RET[] = [ { funName: 'get_A1', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('A1') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'A1') } }, { funName: 'get_A2', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('A2') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'A2') } }, { funName: 'get_A3', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('A3') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'A3') } }, { funName: 'get_A4', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('A4') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'A4') } }, { funName: 'get_B1', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('B1') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'B1') } }, { funName: 'get_B2', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('B2') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'B2') } }, { funName: 'get_B3', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('B3') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'B3') } }, { funName: 'get_B4', - opCode: 0x35, execute (ContractState, RetVar) { - const superReg = ContractState.getMemoryByName('B4') - if (superReg.shadow === RetVar.varName || (superReg.value !== unknownValue && superReg.value === RetVar.value)) { - // Optimize same content - return null - } - ContractState.unknownAndRevoke(RetVar) - RetVar.shadow = superReg.varName - superReg.shadow = RetVar.varName - return true + return metaGetSuperregister(ContractState, RetVar, 'B4') } }, { funName: 'check_A_Is_Zero', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'check_B_Is_Zero', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'check_A_equals_B', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'check_MD5_A_with_B', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'check_HASH160_A_with_B', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'check_SHA256_A_with_B', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Check_Sig_B_With_A', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Block_Timestamp', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Creation_Timestamp', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Last_Block_Timestamp', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Type_for_Tx_in_A', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Amount_for_Tx_in_A', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Timestamp_for_Tx_in_A', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Ticket_Id_for_Tx_in_A', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Current_Balance', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'get_Previous_Balance', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Get_Code_Hash_Id', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Get_Map_Value_Keys_In_A', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Issue_Asset', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Get_Asset_Holders_Count', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Get_Activation_Fee', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable }, { funName: 'Get_Asset_Circulating', - opCode: 0x35, - execute (ContractState, RetVar) { - ContractState.unknownAndRevoke(RetVar) - return true - } + execute: metaUnknowAndRevokeVariable } ] static EXT_FUN_RET_DAT_2: T_EXT_FUN_RET_DAT_2[] = [ { funName: 'add_Minutes_to_Timestamp', - opCode: 0x37, - execute (ContractState, timestamp, minutes) { - return true - } + execute: metaUnknowAndRevokeVariable } ] } diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts index 22bba7b..118e176 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts @@ -563,11 +563,12 @@ export class CPU { execute (ContractState, regexParts) { const Api = API_MICROCODE.EXT_FUN_RET_DAT_2.find(Obj => Obj.funName === regexParts[2]) if (Api === undefined) { - throw new Error(`Unknow API Function ${regexParts[1]}`) + throw new Error(`Unknow API Function ${regexParts[2]}`) } - const variable1 = ContractState.getMemoryByName(regexParts[2]) - const variable2 = ContractState.getMemoryByName(regexParts[3]) - return Api.execute(ContractState, variable1, variable2) + const retVar = ContractState.getMemoryByName(regexParts[1]) + const variable1 = ContractState.getMemoryByName(regexParts[3]) + const variable2 = ContractState.getMemoryByName(regexParts[4]) + return Api.execute(ContractState, retVar, variable1, variable2) } }, { diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts index e853786..fd47f0e 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts @@ -85,19 +85,6 @@ export class CONTRACT { }) } - unknowSuperRegisters () : void { - this.Memory.forEach((Mem) => { - if (/^[AB][1234]$/.test(Mem.varName)) { - Mem.value = unknownValue - Mem.shadow = '' - return - } - if (/^[AB][1234]$/.test(Mem.shadow)) { - Mem.shadow = '' - } - }) - } - unknowSuperRegisterA () : void { this.Memory.forEach((Mem) => { if (/^[A][1234]$/.test(Mem.varName)) { From f245ea995fa450a44a33a8a4c61b588be7fca1d3 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 2 Jul 2022 14:57:51 -0300 Subject: [PATCH 111/112] CPU testcases for optimizerVM --- .../__tests__/optimizerVM.a.spec.ts | 2 +- .../__tests__/optimizerVM.b.spec.ts | 34 +-- .../__tests__/optimizerVM.c.spec.ts | 2 +- .../__tests__/optimizerVM.d.spec.ts | 204 +++++++++++++++ .../assemblyProcessor/optimizerVM/api.ts | 60 ++--- .../assemblyProcessor/optimizerVM/cpu.ts | 247 ++++-------------- .../assemblyProcessor/optimizerVM/index.ts | 22 +- 7 files changed, 311 insertions(+), 260 deletions(-) create mode 100644 src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.d.spec.ts diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts index e5a8a91..54dd3e5 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.a.spec.ts @@ -1,6 +1,6 @@ import { CONTRACT } from '../index' -describe('Assembly compilation:', () => { +describe('optimzeVM:', () => { it('should optimize: all api T_EXT_FUN', () => { /* this is source code for test: #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 1: // Clear_A\n Clear_A();\n Set_A2(0);\n Clear_A();\n break;\ncase 2: // Clear_B\n Clear_B();\n Set_B4(0);\n Clear_B();\ncase 3: // Clear_A_And_B\n Set_A1_A2(0, 0); Set_A3_A4(0, 0); Clear_B();\n Clear_A_And_B();\n Clear_B();\n break;\ncase 4: // Swap_A_and_B\n Clear_A_And_B();\n a++;\n Swap_A_and_B();\n a++;\n Set_B4(0);\n Set_A3(0);\n break;\ncase 5: // metaDoNothing\n Clear_A_And_B();\n Send_All_To_Address_In_B();\n Clear_A_And_B();\n break;\ncase 6: // metaUnknowSuperRegisterA\n Set_A3(a); Set_B3(a);\n Put_Last_Block_GSig_In_A();\n Set_A3(a); Set_B3(a);\n break;\ncase 7: // metaUnknowSuperRegisterB\n Set_A3(a); Set_B3(a);\n OR_B_with_A();\n Set_A3(a); Set_B3(a);\n break;\ncase 8: // metaUB1ZB2ZB3ZB4\n Set_B1_B2(a, 0);\n B_To_Address_Of_Tx_In_A();\n Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);\n break;\n}\n diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts index 2c529ca..50e7ba4 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.b.spec.ts @@ -1,9 +1,9 @@ import { CONTRACT } from '../index' -describe('Assembly compilation:', () => { +describe('optimzeVM:', () => { it('should optimize: all api EXT_FUN_DAT', () => { /* this is source code for test: - #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 0: // Same content\n Set_A1(25);\n a=25;\n Set_A1(a);\n break;\ncase 1: // Same unknown var\n Set_A2(a);\n b++;\n Set_A2(a);\n break;\ncase 2: // Operation destroys same\n Set_A3(a);\n a++;\n Set_A3(a);\n break;\ncase 3: // Operation destroys same\n Set_A4(a);\n a^=b;\n Set_A4(a);\n break;\ncase 4: // Same content\n Set_B1(25);\n a=25;\n Set_B1(a);\n break;\ncase 5: // Same unknown var\n Set_B2(a);\n b++;\n Set_B2(a);\n break;\ncase 6: // Operation destroys same\n Set_B3(a);\n a++;\n Set_B3(a);\n break;\ncase 7: // Operation destroys same\n Set_B4(a);\n a|=b;\n Set_B4(a);\n break;\ncase 8: // A_to_Tx_after_Timestamp\n Set_B1_B2(a, 0);\n B_To_Address_Of_Tx_In_A();\n Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);\n break;\n\n}\n + #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 0: // Same content\n Set_A1(25);\n a=25;\n Set_A1(a);\n break;\ncase 1: // Same unknown var\n Set_A2(a);\n b++;\n Set_A2(a);\n break;\ncase 2: // Operation destroys same\n Set_A3(a);\n a++;\n Set_A3(a);\n break;\ncase 3: // Operation destroys same\n Set_A4(a);\n a^=b;\n Set_A4(a);\n break;\ncase 4: // Same content\n Set_B1(25);\n a=25;\n Set_B1(a);\n break;\ncase 5: // Same unknown var\n Set_B2(a);\n b++;\n Set_B2(a);\n break;\ncase 6: // Operation destroys same\n Set_B3(a);\n a++;\n Set_B3(a);\n break;\ncase 7: // Operation destroys same\n Set_B4(a);\n a|=b;\n Set_B4(a);\n break;\ncase 8: // A_to_Tx_after_Timestamp\n Set_A1_A2(a, 0);\n A_To_Tx_After_Timestamp(b);\n Set_A1(a); Set_A2(0); Set_A3(0); Set_A4(0);\n break;\n\n}\n */ const code = [ '^declare r0', @@ -116,19 +116,19 @@ describe('Assembly compilation:', () => { 'FIN', '^comment line 48 case 8: // A_to_Tx_after_Timestamp', '__switch1_8:', - '^comment line 49 Set_B1_B2(a, 0);', + '^comment line 49 Set_A1_A2(a, 0);', 'CLR @r0', - 'FUN set_B1_B2 $a $r0', - '^comment line 50 B_To_Address_Of_Tx_In_A();', - 'FUN B_to_Address_of_Tx_in_A', - '^comment line 51 Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);', - 'FUN set_B1 $a', + 'FUN set_A1_A2 $a $r0', + '^comment line 50 A_to_Tx_after_Timestamp(b);', + 'FUN A_to_Tx_after_Timestamp $b', + '^comment line 51 Set_A1(a); Set_A2(0); Set_A3(0); Set_A4(0);', + 'FUN set_A1 $a', 'CLR @r0', - 'FUN set_B2 $r0', + 'FUN set_A2 $r0', 'CLR @r0', - 'FUN set_B3 $r0', + 'FUN set_A3 $r0', 'CLR @r0', - 'FUN set_B4 $r0', + 'FUN set_A4 $r0', '^comment line 52 break;', 'FIN' ] @@ -239,13 +239,13 @@ describe('Assembly compilation:', () => { 'FIN', '^comment line 48 case 8: // A_to_Tx_after_Timestamp', '__switch1_8:', - '^comment line 49 Set_B1_B2(a, 0);', + '^comment line 49 Set_A1_A2(a, 0);', 'CLR @r0', - 'FUN set_B1_B2 $a $r0', - '^comment line 50 B_To_Address_Of_Tx_In_A();', - 'FUN B_to_Address_of_Tx_in_A', - '^comment line 51 Set_B1(a); Set_B2(0); Set_B3(0); Set_B4(0);', - 'FUN set_B1 $a', + 'FUN set_A1_A2 $a $r0', + '^comment line 50 A_to_Tx_after_Timestamp(b);', + 'FUN A_to_Tx_after_Timestamp $b', + '^comment line 51 Set_A1(a); Set_A2(0); Set_A3(0); Set_A4(0);', + 'FUN set_A1 $a', '^comment line 52 break;', 'FIN' ] diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts index 85a3b52..5c8a1cf 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.c.spec.ts @@ -1,6 +1,6 @@ import { CONTRACT } from '../index' -describe('Assembly compilation:', () => { +describe('optimzeVM:', () => { it('should optimize: all api EXT_FUN_DAT_2', () => { /* this is source code for test: #include APIFunctions\n#pragma verboseAssembly\n// #pragma optimizationLevel 3\n\nlong testID, a, b;\n\nswitch (testID) {\ncase 0: // Same content\n Set_A1_A2(25, 13);\n a=25;\n b=13;\n Set_A1_A2(a, b);\n break;\ncase 1: // Same var\n Set_A3_A4(a, b);\n Set_A3_A4(a, b);\n break;\ncase 2: // content+var\n Set_B1_B2(25, b);\n a=25;\n Set_B1_B2(a, b);\n break;\ncase 3: // var+content\n Set_B3_B4(a, 13);\n b=13;\n Set_B3_B4(a, b);\n break;\n}\n diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.d.spec.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.d.spec.ts new file mode 100644 index 0000000..fd227a4 --- /dev/null +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/__tests__/optimizerVM.d.spec.ts @@ -0,0 +1,204 @@ +import { CONTRACT } from '../index' + +describe('optimzeVM:', () => { + it('should optimize: cpu opcodes (1)', () => { + /* this is source code for test: + #include APIFunctions\n#pragma verboseAssembly\n#pragma optimizationLevel 3\n\nconst long n3 = 3;\n\nlong testID, a, b, c, d;\n\nswitch (testID) {\ncase 0: // label __GNT\n b=testID;\n a=getNextTx();\n b=testID;\n break;\ncase 1: // label _opt\n b=testID;\n if (b) {\n b=testID;\n }\n break;\ncase 2: // SET_VAL\n b=9;\n b=9; //optimize same content\n break;\ncase 3: // SET_DAT\n b=9; a=9;\n b=a; //optimize same content\n c=d;\n d=c; //optimize same var\n break;\ncase 4: // CLR\n a=0;\n asm { SET @b #0000000000000000 }\n b=0; //optimize same content\n a=b; //optimize same content\n break;\ncase 5: // INC DEC\n a=0;\n b=10;\n a++; b--;\n a=1; //optimize same content\n b=9; //optimize same content\n break;\n} + */ + const code = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare _counterTimestamp', + '^declare n3', + '^declare testID', + '^declare a', + '^declare b', + '^declare c', + '^declare d', + '', + '^comment line 5 const long n3 = 3;', + '^const SET @n3 #0000000000000003', + '^comment line 9 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'BEQ $testID $n3 :__switch1_3', + 'SET @r0 #0000000000000004', + 'BEQ $testID $r0 :__switch1_4', + 'SET @r0 #0000000000000005', + 'BEQ $testID $r0 :__switch1_5', + 'FIN', + '^comment line 10 case 0: // label __GNT', + '__switch1_0:', + '^comment line 11 b=testID;', + 'SET @b $testID', + '^comment line 12 a=getNextTx();', + 'FUN A_to_Tx_after_Timestamp $_counterTimestamp', + 'FUN @a get_A1', + 'BZR $a :__GNT_2', + 'FUN @_counterTimestamp get_Timestamp_for_Tx_in_A', + '__GNT_2:', + '^comment line 13 b=testID;', + 'SET @b $testID', + '^comment line 14 break;', + 'FIN', + '^comment line 15 case 1: // label _opt', + '__switch1_1:', + '^comment line 16 b=testID;', + 'SET @b $testID', + '^comment line 17 if (b) {', + 'BNZ $b :__opt_1', + 'FIN', + '__opt_1:', + '^comment line 18 b=testID;', + 'SET @b $testID', + '^comment line 20 break;', + 'FIN', + '^comment line 21 case 2: // SET_VAL', + '__switch1_2:', + '^comment line 22 b=9;', + 'SET @b #0000000000000009', + '^comment line 23 b=9; //optimize same content', + 'SET @b #0000000000000009', + '^comment line 24 break;', + 'FIN', + '^comment line 25 case 3: // SET_DAT', + '__switch1_3:', + '^comment line 26 b=9; a=9;', + 'SET @b #0000000000000009', + 'SET @a #0000000000000009', + '^comment line 27 b=a; //optimize same content', + 'SET @b $a', + '^comment line 28 c=d;', + 'SET @c $d', + '^comment line 29 d=c; //optimize same var', + 'SET @d $c', + '^comment line 30 break;', + 'FIN', + '^comment line 31 case 4: // CLR', + '__switch1_4:', + '^comment line 32 a=0;', + 'CLR @a', + '^comment line 33 asm { SET @b #0000000000000000 }', + 'SET @b #0000000000000000', + '^comment line 34 b=0; //optimize same content', + 'CLR @b', + '^comment line 35 a=b; //optimize same content', + 'SET @a $b', + '^comment line 36 break;', + 'FIN', + '^comment line 37 case 5: // INC DEC', + '__switch1_5:', + '^comment line 38 a=0;', + 'CLR @a', + '^comment line 39 b=10;', + 'SET @b #000000000000000a', + '^comment line 40 a++; b--;', + 'INC @a', + 'DEC @b', + '^comment line 41 a=1; //optimize same content', + 'SET @a #0000000000000001', + '^comment line 42 b=9; //optimize same content', + 'SET @b #0000000000000009', + '^comment line 43 break;', + 'FIN' + ] + const optCode = [ + '^declare r0', + '^declare r1', + '^declare r2', + '^declare _counterTimestamp', + '^declare n3', + '^declare testID', + '^declare a', + '^declare b', + '^declare c', + '^declare d', + '', + '^comment line 5 const long n3 = 3;', + '^const SET @n3 #0000000000000003', + '^comment line 9 switch (testID) {', + 'BZR $testID :__switch1_0', + 'SET @r0 #0000000000000001', + 'BEQ $testID $r0 :__switch1_1', + 'SET @r0 #0000000000000002', + 'BEQ $testID $r0 :__switch1_2', + 'BEQ $testID $n3 :__switch1_3', + 'SET @r0 #0000000000000004', + 'BEQ $testID $r0 :__switch1_4', + 'SET @r0 #0000000000000005', + 'BEQ $testID $r0 :__switch1_5', + 'FIN', + '^comment line 10 case 0: // label __GNT', + '__switch1_0:', + '^comment line 11 b=testID;', + 'SET @b $testID', + '^comment line 12 a=getNextTx();', + 'FUN A_to_Tx_after_Timestamp $_counterTimestamp', + 'FUN @a get_A1', + 'BZR $a :__GNT_2', + 'FUN @_counterTimestamp get_Timestamp_for_Tx_in_A', + '__GNT_2:', + '^comment line 13 b=testID;', + '^comment line 14 break;', + 'FIN', + '^comment line 15 case 1: // label _opt', + '__switch1_1:', + '^comment line 16 b=testID;', + 'SET @b $testID', + '^comment line 17 if (b) {', + 'BNZ $b :__opt_1', + 'FIN', + '__opt_1:', + '^comment line 18 b=testID;', + '^comment line 20 break;', + 'FIN', + '^comment line 21 case 2: // SET_VAL', + '__switch1_2:', + '^comment line 22 b=9;', + 'SET @b #0000000000000009', + '^comment line 23 b=9; //optimize same content', + '^comment line 24 break;', + 'FIN', + '^comment line 25 case 3: // SET_DAT', + '__switch1_3:', + '^comment line 26 b=9; a=9;', + 'SET @b #0000000000000009', + 'SET @a #0000000000000009', + '^comment line 27 b=a; //optimize same content', + '^comment line 28 c=d;', + 'SET @c $d', + '^comment line 29 d=c; //optimize same var', + '^comment line 30 break;', + 'FIN', + '^comment line 31 case 4: // CLR', + '__switch1_4:', + '^comment line 32 a=0;', + 'CLR @a', + '^comment line 33 asm { SET @b #0000000000000000 }', + 'SET @b #0000000000000000', + '^comment line 34 b=0; //optimize same content', + '^comment line 35 a=b; //optimize same content', + '^comment line 36 break;', + 'FIN', + '^comment line 37 case 5: // INC DEC', + '__switch1_5:', + '^comment line 38 a=0;', + 'CLR @a', + '^comment line 39 b=10;', + 'SET @b #000000000000000a', + '^comment line 40 a++; b--;', + 'INC @a', + 'DEC @b', + '^comment line 41 a=1; //optimize same content', + '^comment line 42 b=9; //optimize same content', + '^comment line 43 break;', + 'FIN' + ] + const result = new CONTRACT(code).optimize() + expect(result).toEqual(optCode) + }) +}) diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts index 1867f57..a987239 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/api.ts @@ -19,15 +19,15 @@ interface T_EXT_FUN_RET_DAT_2 extends T_EXT{ execute(ContractState: CONTRACT, RetVar: MemoryObj, value1: MemoryObj, value2: MemoryObj): boolean|null } -function metaUnknowSuperRegisterA (ContractState: CONTRACT) : boolean { - ContractState.unknowSuperRegisterA() +function metaUnknownSuperRegisterA (ContractState: CONTRACT) : boolean { + ContractState.unknownSuperRegisterA() return true } -function metaUnknowSuperRegisterB (ContractState: CONTRACT) : boolean { - ContractState.unknowSuperRegisterB() +function metaUnknownSuperRegisterB (ContractState: CONTRACT) : boolean { + ContractState.unknownSuperRegisterB() return true } -function metaDoNothing () : boolean { +export function metaDoNothing () : boolean { return true } function metaUB1ZB2ZB3ZB4 (ContractState: CONTRACT) : boolean { @@ -149,95 +149,95 @@ export class API_MICROCODE { }, { funName: 'copy_A_From_B', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'copy_B_From_A', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'swap_A_and_B', execute (ContractState) { - ContractState.unknowSuperRegisterA() - ContractState.unknowSuperRegisterB() + ContractState.unknownSuperRegisterA() + ContractState.unknownSuperRegisterB() return true } }, { funName: 'OR_A_with_B', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'OR_B_with_A', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'AND_A_with_B', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'AND_B_with_A', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'XOR_A_with_B', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'XOR_B_with_A', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'add_A_to_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'add_B_to_A', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'sub_A_from_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'sub_B_from_A', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'mul_A_by_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'mul_B_by_A', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'div_A_by_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'div_B_by_A', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'MD5_A_to_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'HASH160_A_to_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'SHA256_A_to_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'put_Last_Block_Hash_In_A', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA }, { funName: 'message_from_Tx_in_A_to_B', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'B_to_Address_of_Tx_in_A', @@ -249,7 +249,7 @@ export class API_MICROCODE { }, { funName: 'B_To_Assets_Of_Tx_In_A', - execute: metaUnknowSuperRegisterB + execute: metaUnknownSuperRegisterB }, { funName: 'send_All_to_Address_in_B', @@ -277,7 +277,7 @@ export class API_MICROCODE { }, { funName: 'Put_Last_Block_GSig_In_A', - execute: metaUnknowSuperRegisterA + execute: metaUnknownSuperRegisterA } ] diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts index 118e176..d77d09f 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/cpu.ts @@ -1,26 +1,31 @@ import { Constants, CONTRACT, unknownValue, utils } from './index' -import { API_MICROCODE } from './api' +import { API_MICROCODE, metaDoNothing } from './api' interface CPU_MICROCODE { name: string - stepFee: bigint regex: RegExp - execute (ContractState: CONTRACT, regexParts: RegExpExecArray): boolean|null + execute (ContractState: CONTRACT, regexParts: RegExpExecArray) : boolean|null +} + +function metaUnknowAndRevokeVariableAtOne (ContractState: CONTRACT, regexParts: RegExpExecArray) { + const variable1 = ContractState.getMemoryByName(regexParts[1]) + ContractState.unknownAndRevoke(variable1) + return true +} +function metaReset (ContractState: CONTRACT) : boolean|null { + ContractState.unknownMemory(false, false) + return true } export class CPU { static cpuMicrocode: CPU_MICROCODE[] = [ { name: 'blank', - stepFee: 0n, regex: /^\s*$/, - execute (ContractState, regexParts) { - return false - } + execute: metaDoNothing }, { name: 'label', - stepFee: 0n, regex: /^\s*(\w+):\s*$/, execute (ContractState, regexParts) { if (regexParts[1].startsWith('__opt_') || regexParts[1].startsWith('__GNT_')) { @@ -28,21 +33,16 @@ export class CPU { // Same with __GNT_ that is a simple loop of getNextTx(). return false } - ContractState.unknowAll() - return false + return metaReset(ContractState) } }, { name: 'comment', - stepFee: 0n, regex: /^\s*\^comment\s+(.*)/, - execute (ContractState, regexParts) { - return false - } + execute: metaDoNothing }, { name: 'declare', - stepFee: 0n, regex: /^\s*\^declare\s+(\w+)\s*$/, execute (ContractState, regexParts) { if (ContractState.Memory.find(mem => mem.varName === regexParts[1]) === undefined) { @@ -57,23 +57,16 @@ export class CPU { }, { name: 'const', - stepFee: 0n, regex: /^\s*\^const\s+SET\s+@(\w+)\s+#([\da-f]{16})\b\s*$/, - execute (ContractState, regexParts) { - return false - } + execute: metaDoNothing }, { name: 'program', - stepFee: 0n, regex: /^\s*\^program\s+(\w+)\s+([\s\S]+)$/, - execute (ContractState, regexParts) { - return false - } + execute: metaDoNothing }, { name: 'SET_VAL', - stepFee: 1n, regex: /^\s*SET\s+@(\w+)\s+#([\da-f]{16})\b\s*$/, execute (ContractState, regexParts) { const variable = ContractState.getMemoryByName(regexParts[1]) @@ -90,7 +83,6 @@ export class CPU { }, { name: 'SET_DAT', - stepFee: 1n, regex: /^\s*SET\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -100,7 +92,7 @@ export class CPU { return null } if (variable1.shadow === variable2.varName) { - // Optimize: already assigned before. Same content + // Optimize: Same variable return null } ContractState.setAndRevoke(variable1, variable2) @@ -109,7 +101,6 @@ export class CPU { }, { name: 'CLR', - stepFee: 1n, regex: /^\s*CLR\s+@(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -123,7 +114,6 @@ export class CPU { }, { name: 'INC', - stepFee: 1n, regex: /^\s*INC\s+@(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -137,7 +127,6 @@ export class CPU { }, { name: 'DEC', - stepFee: 1n, regex: /^\s*DEC\s+@(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -155,7 +144,6 @@ export class CPU { }, { name: 'ADD', - stepFee: 1n, regex: /^\s*ADD\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -174,7 +162,6 @@ export class CPU { }, { name: 'SUB', - stepFee: 1n, regex: /^\s*SUB\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -193,7 +180,6 @@ export class CPU { }, { name: 'MUL', - stepFee: 1n, regex: /^\s*MUL\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -212,7 +198,6 @@ export class CPU { }, { name: 'DIV', - stepFee: 1n, regex: /^\s*DIV\s+@(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -234,110 +219,46 @@ export class CPU { }, { name: 'BOR / AND / XOR', - stepFee: 1n, - regex: /^\s*(BOR|AND|XOR)\s+@(\w+)\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[2]) - ContractState.unknownAndRevoke(variable1) - return true - } + regex: /^\s*(?:BOR|AND|XOR)\s+@(\w+)\s+\$(\w+)\s*$/, + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'NOT', - stepFee: 1n, regex: /^\s*NOT\s+@(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'SET_IND', - stepFee: 1n, regex: /^\s*SET\s+@(\w+)\s+\$\(\$(\w+)\)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'SET_IDX', - stepFee: 1n, regex: /^\s*SET\s+@(\w+)\s+\$\(\$(\w+)\s*\+\s*\$(\w+)\)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'PSH', - stepFee: 1n, regex: /^\s*PSH\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - // TODO control also user stack - // const variable1 = ContractState.getMemoryByName(regexParts[1]) - // ContractState.UserStack.push(val1) - // if (ContractState.UserStack.length > 16 * ContractState.UserStackPages) { - // if (ContractState.ERR === null) { - // ContractState.dead = true - // ContractState.exception = 'User Stack buffer overflow' - // return true - // } - // ContractState.instructionPointer = ContractState.ERR - // return true - // } - return true - } + execute: metaDoNothing }, { name: 'POP', - stepFee: 1n, regex: /^\s*POP\s+@(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - // TODO control also user stack - // const val1 = ContractState.UserStack.pop() - // if (val1 === undefined) { - // if (ContractState.ERR === null) { - // ContractState.dead = true - // ContractState.exception = 'User Stack buffer underflow' - // return true - // } - // ContractState.instructionPointer = ContractState.ERR - // return true - // } - // if (variable1 === undefined) { - // ContractState.Memory.push({ varName: regexParts[1], value: val1 }) - // } else { - // variable1.value = val1 - // } - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'JMP_SUB', - stepFee: 1n, regex: /^\s*JSR\s+:(\w+)\s*$/, - execute (ContractState, regexParts) { - ContractState.unknowAll() - return true - } + execute: metaReset }, { name: 'RET_SUB', - stepFee: 1n, regex: /^\s*RET\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'IND_DAT', - stepFee: 1n, regex: /^\s*SET\s+@\(\$(\w+)\)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const variable1 = ContractState.getMemoryByName(regexParts[1]) @@ -349,153 +270,96 @@ export class CPU { return true } // It is not possible to know which variable was updated. Unknow to all memory variable. - ContractState.unknowMemory(true, true) + ContractState.unknownMemory(true, true) return true } }, { name: 'IDX_DAT', - stepFee: 1n, regex: /^\s*SET\s+@\(\$(\w+)\s*\+\s*\$(\w+)\)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { // It is not possible to know which variable was updated. Unknow to all memory variable. - ContractState.unknowMemory(true, true) + ContractState.unknownMemory(true, true) return true } }, { name: 'MOD_DAT', - stepFee: 1n, regex: /^\s*MOD\s+@(\w+)\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'SHL / SHR', - stepFee: 1n, - regex: /^\s*(SHL|SHR)\s+@(\w+)\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[2]) - ContractState.unknownAndRevoke(variable1) - return true - } + regex: /^\s*(?:SHL|SHR)\s+@(\w+)\s+\$(\w+)\s*$/, + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'POW_DAT', - stepFee: 1n, regex: /^\s*POW\s+@(\w+)\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'JMP_ADR', - stepFee: 1n, regex: /^\s*JMP\s+:(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'BZR / BNZ', - stepFee: 1n, regex: /^\s*(BZR|BNZ)\s+\$(\w+)\s+:(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'BGT / BLT / BGE / BLE / BEQ / BNE', - stepFee: 1n, regex: /^\s*(BGT|BLT|BGE|BLE|BEQ|BNE)\s+\$(\w+)\s+\$(\w+)\s+:(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'SLP_DAT', - stepFee: 1n, regex: /^\s*SLP\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'SLP_IMD', - stepFee: 1n, regex: /^\s*SLP\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'FIZ_DAT', - stepFee: 1n, regex: /^\s*FIZ\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'STZ_DAT', - stepFee: 1n, regex: /^\s*STZ\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'FIN_IMD', - stepFee: 1n, regex: /^\s*FIN\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'STP_IMD', - stepFee: 1n, regex: /^\s*STP\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'ERR_ADR', - stepFee: 1n, regex: /^\s*ERR\s+:(\w+)\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing }, { name: 'SET_PCS', - stepFee: 1n, regex: /^\s*PCS\s*$/, - execute (ContractState, regexParts) { - ContractState.unknowAll() - // Program can restart with any values in memory - return true - } + execute: metaReset }, { name: 'MDV_DAT', - stepFee: 1n, regex: /^\s*MDV\s+@(\w+)\s+\$(\w+)\s+\$(\w+)\s*$/, - execute (ContractState, regexParts) { - const variable1 = ContractState.getMemoryByName(regexParts[1]) - ContractState.unknownAndRevoke(variable1) - return true - } + execute: metaUnknowAndRevokeVariableAtOne }, { name: 'EXT_FUN', - stepFee: 10n, regex: /^\s*FUN\s+(\w+)\s*$/, execute (ContractState, regexParts) { const Api = API_MICROCODE.EXT_FUN.find(Obj => Obj.funName === regexParts[1]) @@ -507,7 +371,6 @@ export class CPU { }, { name: 'EXT_FUN_DAT', - stepFee: 10n, regex: /^\s*FUN\s+(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const Api = API_MICROCODE.EXT_FUN_DAT.find(Obj => Obj.funName === regexParts[1]) @@ -515,15 +378,11 @@ export class CPU { throw new Error(`Unknow API Function ${regexParts[1]}`) } const variable1 = ContractState.getMemoryByName(regexParts[2]) - if (variable1 === undefined) { - throw new Error(`Undeclared variable '${regexParts[2]}'`) - } return Api.execute(ContractState, variable1) } }, { name: 'EXT_FUN_DAT_2', - stepFee: 10n, regex: /^\s*FUN\s+(\w+)\s+\$(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const Api = API_MICROCODE.EXT_FUN_DAT_2.find(Obj => Obj.funName === regexParts[1]) @@ -537,7 +396,6 @@ export class CPU { }, { name: 'EXT_FUN_RET', - stepFee: 10n, regex: /^\s*FUN\s+@(\w+)\s+(\w+)\s*$/, execute (ContractState, regexParts) { const Api = API_MICROCODE.EXT_FUN_RET.find(Obj => Obj.funName === regexParts[2]) @@ -550,7 +408,6 @@ export class CPU { }, { name: 'EXT_FUN_RET_DAT', - stepFee: 10n, regex: /^\s*FUN\s+@(\w+)\s+(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { throw new Error(`Unknow API Function ${regexParts[2]}`) @@ -558,7 +415,6 @@ export class CPU { }, { name: 'EXT_FUN_RET_DAT_2', - stepFee: 10n, regex: /^\s*FUN\s+@(\w+)\s+(\w+)\s+\$(\w+)\s+\$(\w+)\s*$/, execute (ContractState, regexParts) { const Api = API_MICROCODE.EXT_FUN_RET_DAT_2.find(Obj => Obj.funName === regexParts[2]) @@ -573,18 +429,14 @@ export class CPU { }, { name: 'NOP', - stepFee: 1n, regex: /^\s*NOP\s*$/, - execute (ContractState, regexParts) { - return true - } + execute: metaDoNothing } ] /** Process one line of assembly code. - * @returns true if something was executed - * false if line is valid but nothing executed - * null if line can be optimized */ + * @returns true or false for no optimization + * null if line can be optimized (deleted) */ static cpu (ContractState: CONTRACT, line: number) { const currLine = ContractState.asmCodeArr[line] @@ -607,8 +459,7 @@ export class CPU { } /** - * Loop all lines colecting assembly directives and put - * instruction pointer at first instruction + * Loop all lines colecting assembly directives * * @param {CONTRACT} ContractState - Contract to execute function * */ diff --git a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts index fd47f0e..d207782 100644 --- a/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts +++ b/src/codeGenerator/assemblyProcessor/optimizerVM/index.ts @@ -2,6 +2,8 @@ import { CPU } from './cpu' export const unknownValue = -1n +// TODO: Add stack inspection. It will be needed to save the line of the PUSH, +// so optimizing POP also delete the respective PUSH. /** * Object for memory entries * @@ -45,12 +47,10 @@ export const utils = { export class CONTRACT { Memory: MemoryObj[] asmCodeArr: string[] - // userStack: MemoryObj[] constructor (asmCode: string[]) { this.Memory = [] this.asmCodeArr = asmCode - // this.userStack = [] CPU.cpuDeploy(this) this.Memory.push( { varName: 'A1', value: unknownValue, shadow: '' }, @@ -63,11 +63,7 @@ export class CONTRACT { { varName: 'B4', value: unknownValue, shadow: '' }) } - unknowAll () : void { - this.unknowMemory(false, false) - } - - unknowMemory (keepRegisters: boolean, keepSuperRegisters: boolean) : void { + unknownMemory (keepRegisters: boolean, keepSuperRegisters: boolean) : void { this.Memory.forEach((Mem) => { if (keepRegisters && /^r\d$/.test(Mem.varName)) { return @@ -85,7 +81,7 @@ export class CONTRACT { }) } - unknowSuperRegisterA () : void { + unknownSuperRegisterA () : void { this.Memory.forEach((Mem) => { if (/^[A][1234]$/.test(Mem.varName)) { Mem.value = unknownValue @@ -98,7 +94,7 @@ export class CONTRACT { }) } - unknowSuperRegisterB () : void { + unknownSuperRegisterB () : void { this.Memory.forEach((Mem) => { if (/^[B][1234]$/.test(Mem.varName)) { Mem.value = unknownValue @@ -114,7 +110,7 @@ export class CONTRACT { getMemoryByName (name: string): MemoryObj { const RetObj = this.Memory.find(Mem => Mem.varName === name) if (RetObj === undefined) { - throw new Error('Internal error') + throw new Error(`optimizerVM: getMemoryByName: Variable '${name}' not declared.`) } return RetObj } @@ -127,20 +123,20 @@ export class CONTRACT { }) } - unknownAndRevoke (Var: MemoryObj) { + unknownAndRevoke (Var: MemoryObj) : void { Var.value = unknownValue Var.shadow = '' this.revokeShadow(Var.varName) } - setAndRevoke (AssignedVar: MemoryObj, Variable: MemoryObj) { + setAndRevoke (AssignedVar: MemoryObj, Variable: MemoryObj) : void { AssignedVar.value = Variable.value AssignedVar.shadow = Variable.varName this.revokeShadow(AssignedVar.varName) Variable.shadow = AssignedVar.varName } - zeroAndRevoke (Var: MemoryObj) { + zeroAndRevoke (Var: MemoryObj) : void { if (Var.value !== 0n) { Var.value = 0n Var.shadow = '' From b3b7466990d8edf2e64ff1dd057dab1d9d82c629 Mon Sep 17 00:00:00 2001 From: deleterium Date: Sat, 2 Jul 2022 21:41:02 -0300 Subject: [PATCH 112/112] More documentation update --- CHANGELOG.md | 13 ++++ README.md | 15 +++-- docs/commemorative/v0.1_SmartC_NFT.md | 4 ++ .../v0.2_PromotionalRaffle227.md | 4 ++ docs/commemorative/v0.3_Hive_The_Tumbler.md | 4 ++ docs/commemorative/v1.0_SmartC_NFT.md | 4 ++ samples/ConfigurableTimer.md | 4 ++ samples/DeadSmartContract.md | 2 +- samples/EchoAnySize.md | 65 +++++-------------- samples/GetATCreatorID.md | 62 +++++------------- samples/PublicMethodsOnSmartC.md | 38 +++++------ samples/RSHall.md | 4 ++ samples/XmasContest.smartc.c | 6 ++ samples/dropper.smartc.c | 19 ++---- samples/get3random.smartc.c | 6 ++ 15 files changed, 116 insertions(+), 134 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3bf3d9..445e67f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## [v2.0](https://github.com/deleterium/SmartC/tree/v2.0) (2022-07-03) + +[Commits](https://github.com/deleterium/SmartC/commits/v2.0) + +- **Support all new features from Signum Rainbow Hard Fork** +- New 42 built-in functions: **easy use of Signum API** +- Documentation updated with refactored examples, devs must read it again +- **Fixed point numbers** to handle balance, much easier in calculations +- Checks for **type castings** are stronger and issuing warnings for implicit conversions +- Optimization level 3 uses VM to trace variables values (beta version, not default) +- Showing many errors after failed compilations (if possible) +- Many changes in `#pragma` and `#program` to allow **integration with SC-Simulator** + ## [v1.0](https://github.com/deleterium/SmartC/tree/v1.0) (2022-01-16) [Commits](https://github.com/deleterium/SmartC/commits/v1.0) diff --git a/README.md b/README.md index d2b4c4a..c0abc56 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,13 @@ npm install smartc-signum-compiler The stable version is released under tag `@latest` and the development under `@next`. # Usage + +## Web User Interface +A web user interface project is available at https://github.com/deleterium/smartc-web-ui If you want just to code with SmartC use https://deleterium.info/SmartC/ + +## Documentation / FAQ / Lessons +Docs files can be found in this repo, at `doc` folder. + ## Node ```ts import { SmartC } from 'smartc-signum-compiler'; @@ -40,7 +47,7 @@ try { ## Browser Import the minified javascript file. SmartC will be imported as global. ```html - + ``` Then in your javascript file, just use it: @@ -60,12 +67,6 @@ try { } ``` -## Web User Interface -A web user interface is available at https://github.com/deleterium/smartc-web-ui This is the main way to use SmartC and can be used at https://deleterium.info/SmartC/ - -## Documentation / FAQ / Lessons -Docs files can be found in this repo, at `doc` folder. - ## Changelog Find [here](https://deleterium.github.io/SmartC/CHANGELOG) major upgrades between releases. diff --git a/docs/commemorative/v0.1_SmartC_NFT.md b/docs/commemorative/v0.1_SmartC_NFT.md index dbd7f52..a377da0 100644 --- a/docs/commemorative/v0.1_SmartC_NFT.md +++ b/docs/commemorative/v0.1_SmartC_NFT.md @@ -1,3 +1,7 @@ +**DEPRECATION NOTICE:** + +This contract may be or not be compatible with SmartC version greater or equal 2 because Signum Rainbow Hard Fork broke some compatibilities. Test before use or convert the API calls to new built-in functions. + # SmartC NFT Be owner of SmartC keywords, support the project and also make an investment! The first multi function and multi items smart contract on Signum blockchain diff --git a/docs/commemorative/v0.2_PromotionalRaffle227.md b/docs/commemorative/v0.2_PromotionalRaffle227.md index 730b7ff..008aea4 100644 --- a/docs/commemorative/v0.2_PromotionalRaffle227.md +++ b/docs/commemorative/v0.2_PromotionalRaffle227.md @@ -1,3 +1,7 @@ +**DEPRECATION NOTICE:** + +This contract may be or not be compatible with SmartC version greater or equal 2 because Signum Rainbow Hard Fork broke some compatibilities. Test before use or convert the API calls to new built-in functions. + # Promotional Raffle 227 Advertise your brand making a fair raffle on signum blockchain! Contract online at S-GWV4-S4EK-HAG3-EWCJV. **This is a promotional raffle, where the raffle starter or contract creator does not earn any fee!** diff --git a/docs/commemorative/v0.3_Hive_The_Tumbler.md b/docs/commemorative/v0.3_Hive_The_Tumbler.md index c603404..106a6d8 100644 --- a/docs/commemorative/v0.3_Hive_The_Tumbler.md +++ b/docs/commemorative/v0.3_Hive_The_Tumbler.md @@ -1,3 +1,7 @@ +**DEPRECATION NOTICE:** + +This contract may be or not be compatible with SmartC version greater or equal 2 because Signum Rainbow Hard Fork broke some compatibilities. Test before use or convert the API calls to new built-in functions. + # Hive, the tumbler The tumbler objective is to split and bounce transactions, making dificult to trace back transactions. **This contract swarm does not make the payments anonymous, but it adds a layer of obfuscation against eavesdroppers** diff --git a/docs/commemorative/v1.0_SmartC_NFT.md b/docs/commemorative/v1.0_SmartC_NFT.md index 452f9f2..4806b99 100644 --- a/docs/commemorative/v1.0_SmartC_NFT.md +++ b/docs/commemorative/v1.0_SmartC_NFT.md @@ -1,3 +1,7 @@ +**DEPRECATION NOTICE:** + +This contract may be or not be compatible with SmartC version greater or equal 2 because Signum Rainbow Hard Fork broke some compatibilities. Test before use or convert the API calls to new built-in functions. + # SmartC NFT with muscles Be owner of SmartC keyword and receive dividends for this and future projects! diff --git a/samples/ConfigurableTimer.md b/samples/ConfigurableTimer.md index 1d2add5..664d8e6 100644 --- a/samples/ConfigurableTimer.md +++ b/samples/ConfigurableTimer.md @@ -1,3 +1,7 @@ +**DEPRECATION NOTICE:** + +This contract may be or not be compatible with SmartC version greater or equal 2 because Signum Rainbow Hard Fork broke some compatibilities. Test before use or convert the API calls to new built-in functions. + # Configurable timer The contract will act as a timer for any incoming transactions, dispatching all balance to target address on next block that is multiple of a configurable number. Creator must configure target address with a message. diff --git a/samples/DeadSmartContract.md b/samples/DeadSmartContract.md index 5c27521..4f9acda 100644 --- a/samples/DeadSmartContract.md +++ b/samples/DeadSmartContract.md @@ -1,5 +1,5 @@ # Dead Smart Contract -Just a dead smart contract. Any balance sent to this address will be included as fee on the next block. Useful to tip a random miner. Online at `S-DEAD-DTMA-RY8B-FWL3D` +Just a dead smart contract. ~~Any balance sent to this address will be included as fee on the next block. Useful to tip a random miner.~~ Signum Rainbow Hard Fork (june 2022) introduced a change where the contract fees are burned, so this contract now only can be used for burning Signa. Online at `S-DEAD-DTMA-RY8B-FWL3D` ## Source code Very simple source, can be compiled and deployed by SmartC if changed C to Assembly source code. diff --git a/samples/EchoAnySize.md b/samples/EchoAnySize.md index 5b02859..202d036 100644 --- a/samples/EchoAnySize.md +++ b/samples/EchoAnySize.md @@ -2,29 +2,33 @@ Simple contract that reads the incoming text message until a zero byte is found on last byte of last page read. Clears the rest of message buffer and then send the "same message" to sender. Smart contracts only can send 32 bytes each time, so expect the received message to be multiple of 32, padded with zero bytes. Online at tesnet `TS-LZYH-PE75-JZTB-FJ88Y`. Note that there is no API to get the message size, so the program must handle the input end in some way. Activation amount is huge because the fees to read/send info for a smart contract are much higher than sending manually and the contract must handle input text up the 1000 bytes, the current blockchain limit. ## Source code -Note that this contract is currently not working on stable. It is for reference only and to be updated when the hard fork is online. -```c -#include APIFunctions +```c #program name EchoAnySize #program description Reads the incoming message until a zero byte\ is found on last byte of last page read. Clears the rest of buffer\ and then send the same message to sender. Expect text messages. #program activationAmount 5_0000_0000 -#pragma maxConstVars 1 +struct TXINFO { + long txId; + long sender; + long amount; + long message[132]; +} currentTX; long zero; -B_To_Address_Of_Creator(); -long CREATOR = Get_B1(); while (true) { - while (getNextTxDetails()) { + while ((currentTX.txId = getNextTx()) != 0) { + currentTX.sender = getSender(currentTX.txId); + currentTX.amount = getAmount(currentTX.txId); + readMessage(currentTX.txId, 0, currentTX.message); + processTX(); } - Set_B1(CREATOR); - Send_All_To_Address_In_B(); + sendBalance(getCreator()); } // just echoes a received message back to sender. @@ -40,12 +44,8 @@ void processTX(void) { break; } messagePage = currentLong / 4; - Set_A1_A2(currentTX.txId, messagePage); - Message_From_Tx_In_A_To_B(); - currentTX.message[currentLong++] = Get_B1(); - currentTX.message[currentLong++] = Get_B2(); - currentTX.message[currentLong++] = Get_B3(); - currentTX.message[currentLong++] = Get_B4(); + readMessage(currentTX.txId, messagePage, currentTX.message + currentLong); + currentLong += 4; } while (currentLong < currentTX.message.length) { // clear the rest of buffer. @@ -54,41 +54,10 @@ void processTX(void) { currentTX.message[currentLong++] = zero; currentTX.message[currentLong++] = zero; } - Set_B1(currentTX.sender); currentLong = 0; do { - Set_A1_A2(currentTX.message[currentLong], currentTX.message[currentLong + 1]); - currentLong += 2; - Set_A3_A4(currentTX.message[currentLong], currentTX.message[currentLong + 1]); - currentLong += 2; - Send_A_To_Address_In_B(); + // send message loop + sendMessage(currentTX.message + currentLong, currentTX.sender); } while (((currentTX.message[currentLong - 1]) >> 56) != 0 && currentLong < currentTX.message.length); } - -struct TXINFO { - long txId; - long timestamp; - long sender; - long amount; - long message[132]; -} currentTX; - -long getNextTxDetails(void) -{ - A_To_Tx_After_Timestamp(currentTX.timestamp); - currentTX.txId = Get_A1(); - if (currentTX.txId == 0) { - return false; - } - currentTX.amount = Get_Amount_For_Tx_In_A(); - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0] = Get_B1(); - currentTX.message[1] = Get_B2(); - currentTX.message[2] = Get_B3(); - currentTX.message[3] = Get_B4(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; -} ``` diff --git a/samples/GetATCreatorID.md b/samples/GetATCreatorID.md index 1af3cd1..22852e2 100644 --- a/samples/GetATCreatorID.md +++ b/samples/GetATCreatorID.md @@ -4,75 +4,49 @@ Simple contract that receives a message with some AT ID (text message in decimal ## Source code Note that this contract is currently not working on stable. It is for reference only and to be updated when the hard fork is online. ```c -#include APIFunctions - #program name GetATCreator #program description Receives a message with some AT ID and return to sender a\ message with the creator`s ID of that AT. #program activationAmount 1_5000_0000 -#pragma maxConstVars 1 +struct TXINFO { + long txId; + long sender; + long amount; + long message[4]; +} currentTX; -B_To_Address_Of_Creator(); -long CREATOR = Get_B1(); +long messageToSend[4]; while (true) { - while (getNextTxDetails()) { + while ((currentTX.txId = getNextTx()) != 0) { + currentTX.sender = getSender(currentTX.txId); + currentTX.amount = getAmount(currentTX.txId); + readMessage(currentTX.txId, 0, currentTX.message); + processTX(); } - Set_B1(CREATOR); - Send_All_To_Address_In_B(); + sendBalance(getCreator()); } // Return to sender the creator of a given AT. void processTX(void) { long atId = messageToId(); - Set_B2(atId); - B_To_Address_Of_Creator(); - long creatorID = Get_B1(); + long creatorID = getCreatorOf(atId); IdToMessage(creatorID); - Set_B1_B2(currentTX.sender, 0); - Set_A1_A2(currentTX.message[0], currentTX.message[1]); - Set_A3_A4(currentTX.message[2], currentTX.message[3]); - Send_A_To_Address_In_B(); + sendMessage(messageToSend, currentTX.sender); } -struct TXINFO { - long txId; - long timestamp; - long sender; - long amount; - long message[4]; -} currentTX; - -long getNextTxDetails(void) -{ - A_To_Tx_After_Timestamp(currentTX.timestamp); - currentTX.txId = Get_A1(); - if (currentTX.txId == 0) { - return false; - } - currentTX.amount = Get_Amount_For_Tx_In_A(); - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0] = Get_B1(); - currentTX.message[1] = Get_B2(); - currentTX.message[2] = Get_B3(); - currentTX.message[3] = Get_B4(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; -} long i, auxDiv, auxShift, auxMask, auxNum; const long n8 = 8, n10 = 10, n15 = 15, n48 = 48, n57 = 57, n255 = 255; void IdToMessage(long id){ long currDiv = 10; - currentTX.message[] = "00000000000000000000 "; + messageToSend[] = "00000000000000000000 "; // using i as temp var; i = (id >> 1) / 5; - currentTX.message[2] |= (id - (i * 10)) << 24; + messageToSend[2] |= (id - (i * 10)) << 24; id = i; for (i = 18; id != 0; i--) { @@ -81,7 +55,7 @@ void IdToMessage(long id){ auxDiv = i/8; auxShift = (i % 8) * 8; auxMask = 0xff << auxShift; - currentTX.message[i/8] |= auxNum << auxShift; + messageToSend[i/8] |= auxNum << auxShift; } } diff --git a/samples/PublicMethodsOnSmartC.md b/samples/PublicMethodsOnSmartC.md index 48fd961..9b18836 100644 --- a/samples/PublicMethodsOnSmartC.md +++ b/samples/PublicMethodsOnSmartC.md @@ -33,9 +33,6 @@ To automate the process you can use CyberChef with the recipe https://gchq.githu ## SmartC program skeleton ```c -#include APIFunctions -#pragma version 1.0 - // global variables, will be available in all functions long myVar; @@ -57,7 +54,11 @@ constructor(); void main(void) { blockStarted(); - while (getNewTxDetails()) { + while ((currentTX.txId = getNextTx()) != 0) { + currentTX.sender = getSender(currentTX.txId); + currentTX.amount = getAmount(currentTX.txId); + readMessage(currentTX.txId, 0, currentTX.message); + switch (currentTX.message[0]) { case GET_SNACKS: GetSnacks(currentTX.message[1]); @@ -71,35 +72,23 @@ void main(void) { } blockFinished(); } - -long getNewTxDetails(void) { - A_To_Tx_After_Timestamp(currentTX.timestamp); - currentTX.txId = Get_A1(); - if (currentTX.txId == 0) { - return false; - } - currentTX.amount = Get_Amount_For_Tx_In_A(); - currentTX.timestamp = Get_Timestamp_For_Tx_In_A(); - Message_From_Tx_In_A_To_B(); - currentTX.message[0] = Get_B1(); - currentTX.message[1] = Get_B2(); - currentTX.message[2] = Get_B3(); - currentTX.message[3] = Get_B4(); - B_To_Address_Of_Tx_In_A(); - currentTX.sender = Get_B1(); - return true; -} // ****** end of hidden part ****** // ****** These are public methods in SmartJ ****** void GetSnacks(long bites) { // Do your stuff + myPrivateMethod(); } void GetDrinks(long type, long quantity) { // Do your stuff } +// ****** These are private methods in SmartJ ****** +void myPrivateMethod() { + // Do your stuff +} + // ****** These are protected methods in SmartJ ****** void constructor(void) { // this function will be called only once on first activation. @@ -167,8 +156,13 @@ public class Skeleton extends Contract { */ public void GetDrinks(long type, long quantity) { // Do your stuff + myPrivateMethod(); } + private void myPrivateMethod() { + // Do your stuff + } + /** * Iterates over every transaction received */ diff --git a/samples/RSHall.md b/samples/RSHall.md index 6eeb70d..23b390e 100644 --- a/samples/RSHall.md +++ b/samples/RSHall.md @@ -1,3 +1,7 @@ +**DEPRECATION NOTICE:** + +This contract may be not compatible with SmartC version greater or equal 2 because Signum Rainbow Hard Fork broke some compatibilities. Test before use or convert the API calls to new built-in functions. + # Hall of RS-Addresses Check neat addresses generated by other people. Latest 180 registered addresses and the top 10 most voted will be listed on site. diff --git a/samples/XmasContest.smartc.c b/samples/XmasContest.smartc.c index 90d9ab3..d446758 100644 --- a/samples/XmasContest.smartc.c +++ b/samples/XmasContest.smartc.c @@ -1,3 +1,9 @@ +/* DEPRECATION NOTICE: + * This contract may be not compatible with SmartC version greater or equal 2 + * because Signum Rainbow Hard Fork broke some compatibilities. Test before + * use or convert the API calls to new built-in functions. + */ + #program name XmasContest #program description Creator adds up balance to the contest, by sending transactions\ without message. Participants send theirs messages, suposed to be right answer.\ diff --git a/samples/dropper.smartc.c b/samples/dropper.smartc.c index ef6cdce..e929bad 100644 --- a/samples/dropper.smartc.c +++ b/samples/dropper.smartc.c @@ -1,28 +1,23 @@ #program name Dropper #program description Sends a fixed amount of signa to a defined account every N blocks. -#program activationAmount 0_2000_0000 - -#pragma maxAuxVars 1 -#pragma globalOptimization - -#include APIFunctions +#program activationAmount 0.2 // Configure how many blocks to sleep until next send. -const long SLP_BLOCKS = 2; +#define SLP_BLOCKS 2 // Configure balance to stay on contract -const long CONTRACT_MIN_BALANCE = 1_0000_0000; +#define CONTRACT_MIN_BALANCE 1.0 // Configure the amount to send every time -const long sendEachBlockNQT = 2000_0000; +#define EACH_BLOCK .2 // Set the desired account -Set_B1 ("S-3A2N-ZD7P-KZKU-FPWKQ"); +#define RECIPIENT "S-3A2N-ZD7P-KZKU-FPWKQ" // Endless loop while (true) { - if (Get_Current_Balance() < CONTRACT_MIN_BALANCE) { + if (getCurrentBalanceFx() < CONTRACT_MIN_BALANCE) { // Stops contracts before it hits end of balance halt; } else { - Send_To_Address_In_B(sendEachBlockNQT); + sendAmountFx(EACH_BLOCK, RECIPIENT); sleep SLP_BLOCKS; } } diff --git a/samples/get3random.smartc.c b/samples/get3random.smartc.c index 5109207..f2b3652 100644 --- a/samples/get3random.smartc.c +++ b/samples/get3random.smartc.c @@ -1,3 +1,9 @@ +/* DEPRECATION NOTICE: + * This contract may be not compatible with SmartC version greater or equal 2 + * because Signum Rainbow Hard Fork broke some compatibilities. Test before + * use or convert the API calls to new built-in functions. + */ + #program name Get3Random #program description When a message arrives, the program tries to parse a number\ from message. Number must be bigger or equal 5 and lower or equal 9999999. If\