소스 검색

Funções matemáticas disponibilizadas

Igor 5 년 전
부모
커밋
5683c231f9

+ 9 - 9
grammar/en/langFunctions.js

@@ -19,15 +19,15 @@ export default {
   $castInt: "como_inteiro",
   $castBool: "como_logico",
   $castString: "como_cadeia",
-  $sin: "sen",
+  $sin: "sin",
   $cos: "cos",
   $tan: "tan",
-  $sqrt: "raiz_quadrada",
-  $pow: "pot",
+  $sqrt: "sqrt",
+  $pow: "pow",
   $log: "log",
-  $abs: "modulo",
-  $negate: "trocar_sinal",
-  $invert: "inverter_valor",
-  $max: "maximo",
-  $min: "minimo"
-}
+  $abs: "abs",
+  $negate: "negate",
+  $invert: "invert",
+  $max: "maximum",
+  $min: "minimum"
+}

+ 1 - 1
grammar/en/langLibs.js

@@ -2,7 +2,7 @@
  * This is the dictionary of the language defined libraries
  */
 export default {
-  $mathLib: "Matematica",
+  $mathLib: "Mathematic",
   $ioLib: "ES",
   $strLib: "Texto",
   $arrayLib: "Arranjo",

+ 8 - 8
grammar/es/langFunctions.js

@@ -19,15 +19,15 @@ export default {
   $castInt: "como_inteiro",
   $castBool: "como_logico",
   $castString: "como_cadeia",
-  $sin: "sen",
+  $sin: "sin",
   $cos: "cos",
   $tan: "tan",
-  $sqrt: "raiz_quadrada",
-  $pow: "pot",
+  $sqrt: "sqrt",
+  $pow: "pow",
   $log: "log",
-  $abs: "modulo",
-  $negate: "trocar_sinal",
-  $invert: "inverter_valor",
-  $max: "maximo",
-  $min: "minimo"
+  $abs: "abs",
+  $negate: "negate",
+  $invert: "invert",
+  $max: "maximum",
+  $min: "minimum"
 }

+ 1 - 1
grammar/es/langLibs.js

@@ -2,7 +2,7 @@
  * This is the dictionary of the language defined libraries
  */
 export default {
-  $mathLib: "Matematica",
+  $mathLib: "Mathematic",
   $ioLib: "ES",
   $strLib: "Texto",
   $arrayLib: "Arranjo",

+ 6 - 6
grammar/pt/langFunctions.js

@@ -19,15 +19,15 @@ export default {
   $castInt: "como_inteiro",
   $castBool: "como_logico",
   $castString: "como_cadeia",
-  $sin: "sen",
-  $cos: "cos",
-  $tan: "tan",
+  $sin: "seno",
+  $cos: "cosseno",
+  $tan: "tangente",
   $sqrt: "raiz_quadrada",
-  $pow: "pot",
-  $log: "log",
+  $pow: "potencia",
+  $log: "logaritmo",
   $abs: "modulo",
   $negate: "trocar_sinal",
   $invert: "inverter_valor",
   $max: "maximo",
   $min: "minimo"
-}
+}

+ 16 - 3
i18n/en/ui.json

@@ -72,7 +72,7 @@
   "text_teacher_test_case_actions": "Actions",
   "text_teacher_test_case_add": "Add test cases",
   "text_header_ivprog_functions": "iVProg Functions",
-  "text_menu_functions_math":"Mathematics",
+  "text_menu_functions_math":"Mathematic",
   "text_menu_functions_text":"Text",
   "text_menu_functions_arrangement":"Arrangement",
   "text_menu_functions_conversion":"Conversion",
@@ -92,6 +92,19 @@
   "var_menu_select_all": "Select",
   "var_menu_select_function": "Select a function",
   "expression_menu_select": "Select an expression",
-  "$sin": "Matematica.sen"
-
+  "math": "Mathematic",
+  "text": "Text",
+  "arrangement": "Arrangement",
+  "conversion": "Conversion",
+  "$sin": "sin",
+  "$cos": "cos",
+  "$tan": "tan",
+  "$sqrt": "sqrt",
+  "$pow": "pow",
+  "$log": "log",
+  "$abs": "abs",
+  "$negate": "negate",
+  "$invert": "invert",
+  "$max": "maximum",
+  "$min": "minimum"
 }

+ 21 - 1
i18n/es/ui.json

@@ -91,5 +91,25 @@
   "var_menu_select_var": "Select a var",
   "var_menu_select_all": "Select",
   "var_menu_select_function": "Select a function",
-  "expression_menu_select": "Select an expression"
+  "expression_menu_select": "Select an expression",
+  "$sin": "sen",
+  "math": "Mathematic",
+  "text": "Text",
+  "arrangement": "Arrangement",
+  "conversion": "Conversion",
+  "math": "Mathematic",
+  "text": "Text",
+  "arrangement": "Arrangement",
+  "conversion": "Conversion",
+  "$sin": "sin",
+  "$cos": "cos",
+  "$tan": "tan",
+  "$sqrt": "sqrt",
+  "$pow": "pow",
+  "$log": "log",
+  "$abs": "abs",
+  "$negate": "negate",
+  "$invert": "invert",
+  "$max": "maximum",
+  "$min": "minimum"
 }

+ 17 - 1
i18n/pt/ui.json

@@ -92,5 +92,21 @@
   "var_menu_select_var": "Selecione uma variável",
   "var_menu_select_all": "Selecione",
   "var_menu_select_function": "Selecione uma função",
-  "expression_menu_select": "Selecione uma expressão"
+  "expression_menu_select": "Selecione uma expressão",
+  "$sin": "sen",
+  "math": "Matematica",
+  "text": "Texto",
+  "arrangement": "Arranjo",
+  "conversion": "Conversao",
+  "$sin": "seno",
+  "$cos": "cosseno",
+  "$tan": "tangente",
+  "$sqrt": "raiz_quadrada",
+  "$pow": "potencia",
+  "$log": "logaritmo",
+  "$abs": "modulo",
+  "$negate": "trocar_sinal",
+  "$invert": "inverter_valor",
+  "$max": "maximo",
+  "$min": "minimo"
 }

+ 1 - 1
js/visualUI/code_generator.js

@@ -618,7 +618,7 @@ function variableValueMenuCode (variable_obj) {
 		if (variable_obj.function_called.name) {
 			ret += variable_obj.function_called.name + ' ( ';
 		} else {
-			ret += LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
+			ret += LocalizedStrings.getUI(variable_obj.function_called.category)+'.'+LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
 		}
 
 		if (variable_obj.parameters_list) {

+ 4 - 4
js/visualUI/commands/variable_value_menu.js

@@ -202,7 +202,7 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			if (variable_obj.function_called.name) {
 				parameters_menu = '<div class="parameters_function_called"> '+variable_obj.function_called.name+' <span> ( </span>';
 			} else {
-				parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(variable_obj.function_called.identifier)+'</i> <span> ( </span>';
+				parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(variable_obj.function_called.category)+'.'+LocalizedStrings.getUI(variable_obj.function_called.identifier)+'</i> <span> ( </span>';
 			}
 
 			parameters_menu += '<span> ) </span></div>';
@@ -260,7 +260,7 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			if (variable_obj.function_called.name) {
 				parameters_menu = '<div class="parameters_function_called"> '+variable_obj.function_called.name+' <span> ( </span>';
 			} else {
-				parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(variable_obj.function_called.identifier)+'</i> <span> ( </span>';
+				parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(variable_obj.function_called.category)+'.'+LocalizedStrings.getUI(variable_obj.function_called.identifier)+'</i> <span> ( </span>';
 			}
 
 			for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
@@ -724,7 +724,7 @@ function openInputToFunction (command, ref_object, dom_object, menu_var_or_value
 		if (function_selected.name) {
 			parameters_menu = '<div class="parameters_function_called"> '+function_selected.name+' <span> ( </span>';
 		} else {
-			parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(function_selected.identifier)+'</i> <span> ( </span>';
+			parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(function_selected.category)+'.'+LocalizedStrings.getUI(function_selected.identifier)+'</i> <span> ( </span>';
 		}
 		for (var j = 0; j < function_selected.parameters_list.length; j++) {
 			parameters_menu += '<div class="render_style_param parameter_'+j+'"></div>';
@@ -794,7 +794,7 @@ function openInputToFunction (command, ref_object, dom_object, menu_var_or_value
 		if (function_selected.name) {
 			parameters_menu = '<div class="parameters_function_called"> '+function_selected.name+' <span> ( </span>';
 		} else {
-			parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(function_selected.identifier)+'</i> <span> ( </span>';
+			parameters_menu = '<div class="parameters_function_called"> <i>'+LocalizedStrings.getUI(function_selected.category)+'.'+LocalizedStrings.getUI(function_selected.identifier)+'</i> <span> ( </span>';
 		}
 		
 		parameters_menu += '<span> ) </span></div>';

+ 21 - 2
js/visualUI/functions.js

@@ -27,8 +27,27 @@ const program = new Models.Program();
 
 window.system_functions = [];
 window.system_functions.push(new Models.SystemFunction('$sin', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
-  "seno de um número", Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
-
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$cos', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$tan', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$sqrt', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$pow', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$log', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$abs', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$negate', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$invert', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$max', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
+window.system_functions.push(new Models.SystemFunction('$min', Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)],
+  null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
 /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
 const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
 const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));