Core: registro de metadados de blocos (tb_meta) + testes; metadados declarados nas libraries
This commit is contained in:
1 parent
22ae18f508
commit
036162280d
14 files changed
+397
-2
No files matched your search
@@ -36,6 +36,12 @@ static bool appearance_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("IO.Print", "eval_print",
|
||||
"Mostra um texto e um valor na saida");
|
||||
TB_BLOCK_META("IO.PrintInt", "eval_print_int",
|
||||
"Mostra um numero inteiro na saida");
|
||||
|
||||
static const TinyBlocks_SlotDesc print_in[] = {{"label", TB_VALUE_TEXT}, {"value", TB_VALUE_NONE}};
|
||||
static const TinyBlocks_SlotDesc one_int[] = {{"n", TB_VALUE_INTEGER}};
|
||||
|
||||
|
||||
@@ -26,6 +26,16 @@ static bool control_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Control.Repeat", "eval_noop",
|
||||
"Repete o corpo do bloco o numero de vezes indicado");
|
||||
TB_BLOCK_META("Control.RepeatUntil", "eval_noop",
|
||||
"Repete o corpo enquanto a condicao for falsa");
|
||||
TB_BLOCK_META("Control.If", "eval_noop",
|
||||
"Executa o corpo se a condicao for verdadeira");
|
||||
TB_BLOCK_META("Control.IfElse", "eval_noop",
|
||||
"Executa o corpo 'entao' ou 'senao' conforme a condicao");
|
||||
|
||||
static const TinyBlocks_SlotDesc times_in[] = {{"vezes", TB_VALUE_INTEGER}};
|
||||
static const TinyBlocks_SlotDesc cond_in[] = {{"condição", TB_VALUE_INTEGER}};
|
||||
return reg(rt, lib, "Control.Repeat", times_in, 1)
|
||||
|
||||
@@ -503,6 +503,14 @@ static bool markdown_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
{ 55/255.f, 71/255.f, 79/255.f, 1.f},
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Markdown.ToHtml", "eval_html",
|
||||
"Converte Markdown para HTML");
|
||||
TB_BLOCK_META("Markdown.ToXml", "eval_xml",
|
||||
"Converte Markdown para XML");
|
||||
TB_BLOCK_META("Markdown.ToSvg", "eval_svg",
|
||||
"Converte Markdown para uma imagem SVG");
|
||||
static const TinyBlocks_SlotDesc in_md[] = {{"markdown", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc out_text[] = {{"texto", TB_VALUE_TEXT}};
|
||||
return reg(rt, lib, "Markdown.ToHtml", in_md, 1, out_text, 1, eval_html)
|
||||
|
||||
@@ -363,6 +363,20 @@ static bool opentype_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("OpenType.Load", "eval_load",
|
||||
"Carrega uma fonte OpenType/TrueType");
|
||||
TB_BLOCK_META("OpenType.UnitsPerEm", "eval_upem",
|
||||
"Unidades por em da fonte");
|
||||
TB_BLOCK_META("OpenType.GlyphCount", "eval_glyphs",
|
||||
"Numero de glifos da fonte");
|
||||
TB_BLOCK_META("OpenType.Advance", "eval_advance",
|
||||
"Largura em pixels de um texto");
|
||||
TB_BLOCK_META("OpenType.Outline", "eval_outline",
|
||||
"Contornos de um caractere (pontos JSON)");
|
||||
TB_BLOCK_META("OpenType.Render", "eval_render",
|
||||
"Rasteriza um texto numa imagem");
|
||||
|
||||
static const TinyBlocks_SlotDesc load_in[] = {{"caminho", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc font_in[] = {{"fonte", TB_VALUE_REAL}};
|
||||
static const TinyBlocks_SlotDesc adv_in[] = {{"fonte", TB_VALUE_REAL}, {"texto", TB_VALUE_TEXT}, {"tamanho", TB_VALUE_REAL}};
|
||||
|
||||
@@ -179,6 +179,48 @@ static bool operators_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Operators.Lt", "eval_op_lt",
|
||||
"Verdadeiro se A for menor que B");
|
||||
TB_BLOCK_META("Operators.Eq", "eval_op_eq",
|
||||
"Verdadeiro se A for igual a B");
|
||||
TB_BLOCK_META("Operators.Gt", "eval_op_gt",
|
||||
"Verdadeiro se A for maior que B");
|
||||
TB_BLOCK_META("Operators.And", "eval_op_and",
|
||||
"Verdadeiro se ambos os lados forem verdadeiros");
|
||||
TB_BLOCK_META("Operators.Or", "eval_op_or",
|
||||
"Verdadeiro se ao menos um lado for verdadeiro");
|
||||
TB_BLOCK_META("Operators.Not", "eval_op_not",
|
||||
"Inverte o valor logico");
|
||||
TB_BLOCK_META("Operators.Random", "eval_op_random",
|
||||
"Numero inteiro aleatorio entre A e B");
|
||||
TB_BLOCK_META("Math.Add", "eval_add",
|
||||
"Soma dois numeros");
|
||||
TB_BLOCK_META("Math.Sub", "eval_sub",
|
||||
"Subtrai B de A");
|
||||
TB_BLOCK_META("Math.Mul", "eval_mul",
|
||||
"Multiplica dois numeros");
|
||||
TB_BLOCK_META("Math.Div", "eval_div",
|
||||
"Divide A por B");
|
||||
TB_BLOCK_META("Math.Mod", "eval_mod",
|
||||
"Resto da divisao de A por B");
|
||||
TB_BLOCK_META("Math.Abs", "eval_abs",
|
||||
"Valor absoluto de um numero");
|
||||
TB_BLOCK_META("Math.Max", "eval_max",
|
||||
"Maior entre dois numeros");
|
||||
TB_BLOCK_META("Math.Min", "eval_min",
|
||||
"Menor entre dois numeros");
|
||||
TB_BLOCK_META("Text.Concat", "eval_concat",
|
||||
"Junta dois textos");
|
||||
TB_BLOCK_META("Text.Length", "eval_len",
|
||||
"Numero de caracteres de um texto");
|
||||
TB_BLOCK_META("Literal.Integer", "eval_lit_int",
|
||||
"Valor inteiro digitado");
|
||||
TB_BLOCK_META("Literal.Real", "eval_lit_real",
|
||||
"Valor real (decimal) digitado");
|
||||
TB_BLOCK_META("Literal.Text", "eval_lit_text",
|
||||
"Valor de texto digitado");
|
||||
|
||||
static const TinyBlocks_SlotDesc any2[] = {{"a", TB_VALUE_NONE}, {"b", TB_VALUE_NONE}};
|
||||
static const TinyBlocks_SlotDesc bool2[] = {{"a", TB_VALUE_INTEGER}, {"b", TB_VALUE_INTEGER}};
|
||||
static const TinyBlocks_SlotDesc bool1[] = {{"a", TB_VALUE_INTEGER}};
|
||||
|
||||
@@ -70,6 +70,24 @@ static bool pen_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Stage.Clear", "eval_clear",
|
||||
"Limpa o palco");
|
||||
TB_BLOCK_META("Stage.Background", "eval_background",
|
||||
"Define a cor de fundo do palco");
|
||||
TB_BLOCK_META("Stage.PenColor", "eval_pen_color",
|
||||
"Define a cor da caneta");
|
||||
TB_BLOCK_META("Stage.PenSize", "eval_pen_size",
|
||||
"Define a espessura da caneta");
|
||||
TB_BLOCK_META("Stage.Line", "eval_line",
|
||||
"Desenha uma linha entre dois pontos");
|
||||
TB_BLOCK_META("Stage.Rect", "eval_rect",
|
||||
"Desenha um retangulo");
|
||||
TB_BLOCK_META("Stage.Circle", "eval_circle",
|
||||
"Desenha um circulo");
|
||||
TB_BLOCK_META("Stage.Text", "eval_text",
|
||||
"Escreve um texto no palco");
|
||||
|
||||
static const TinyBlocks_SlotDesc rgb[] = {{"r", TB_VALUE_REAL}, {"g", TB_VALUE_REAL}, {"b", TB_VALUE_REAL}};
|
||||
static const TinyBlocks_SlotDesc size[] = {{"tamanho", TB_VALUE_REAL}};
|
||||
static const TinyBlocks_SlotDesc line[] = {{"x1", TB_VALUE_REAL}, {"y1", TB_VALUE_REAL},
|
||||
|
||||
@@ -292,6 +292,24 @@ static bool regex_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Regex.Test", "eval_test",
|
||||
"Verdadeiro se o padrao ocorre no texto");
|
||||
TB_BLOCK_META("Regex.Match", "eval_match",
|
||||
"Verdadeiro se o padrao casa o texto inteiro");
|
||||
TB_BLOCK_META("Regex.Find", "eval_find",
|
||||
"Primeiro trecho do texto que casa o padrao");
|
||||
TB_BLOCK_META("Regex.Group", "eval_group",
|
||||
"Conteudo do grupo N do primeiro casamento");
|
||||
TB_BLOCK_META("Regex.Count", "eval_count",
|
||||
"Quantas vezes o padrao ocorre no texto");
|
||||
TB_BLOCK_META("Regex.Groups", "eval_groups",
|
||||
"Numero de grupos do padrao");
|
||||
TB_BLOCK_META("Regex.Replace", "eval_replace",
|
||||
"Substitui as ocorrencias ($1..$9 como retorno)");
|
||||
TB_BLOCK_META("Regex.Split", "eval_split",
|
||||
"Divide o texto pelo padrao (lista JSON)");
|
||||
|
||||
static const TinyBlocks_SlotDesc two[] = {{"texto", TB_VALUE_TEXT}, {"padrao", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc three[] = {{"texto", TB_VALUE_TEXT}, {"padrao", TB_VALUE_TEXT}, {"com", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc grp[] = {{"texto", TB_VALUE_TEXT}, {"padrao", TB_VALUE_TEXT}, {"grupo", TB_VALUE_REAL}};
|
||||
|
||||
@@ -483,6 +483,14 @@ static bool syntax_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Syntax.Highlight", "eval_highlight",
|
||||
"Realca a sintaxe de um texto (XML)");
|
||||
TB_BLOCK_META("Syntax.Inline", "eval_inline",
|
||||
"Realca uma unica linha de codigo (XML)");
|
||||
TB_BLOCK_META("Syntax.Languages", "eval_languages",
|
||||
"Lista as linguagens suportadas");
|
||||
|
||||
static const TinyBlocks_SlotDesc hl_in[] = {{"texto", TB_VALUE_TEXT}, {"linguagem", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc out_text_s[] = {{"xml", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc out_list_s[] = {{"linguagens", TB_VALUE_TEXT}};
|
||||
|
||||
@@ -127,6 +127,14 @@ static bool variables_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
};
|
||||
tb_library_set_category(lib, &cat);
|
||||
|
||||
/* Metadados dos blocos (tooltip do editor: Alt + hover). */
|
||||
TB_BLOCK_META("Variables.Set", "eval_var_set",
|
||||
"Define o valor de uma variavel");
|
||||
TB_BLOCK_META("Variables.Change", "eval_var_change",
|
||||
"Altera (incrementa) o valor de uma variavel");
|
||||
TB_BLOCK_META("Variables.Get", "eval_var_get",
|
||||
"Le o valor de uma variavel");
|
||||
|
||||
static const TinyBlocks_SlotDesc var_in[] = {{"variável", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc var_set[] = {{"variável", TB_VALUE_TEXT}, {"valor", TB_VALUE_NONE}};
|
||||
static const TinyBlocks_SlotDesc any_out[] = {{"valor", TB_VALUE_NONE}};
|
||||
|
||||
Reference in new issue
Block a user