Filipe Saraiva's blog

Tecnologia, sociedade e política.

Archive for the ‘gsoc2011-scilab-backend’ tag

Google Rewards

without comments

 

Okay, now just the cycle of Google Summer of Code for me in this year. Arrived today in my apartment the shirt and certificate. Successfully was completed the project of early the Scilab backend to Cantor, my GSoC work.

Also out today a post in Scilab page with a final report on the activities of the students who worked on projects related to Scilab, as is my case. There is a quick summary of what I did and some links.

I still will post a note with the current state of the backend. I promise it to soon. :-D

Written by Filipe Saraiva

October 7th, 2011 at 2:10 am

Google Prêmios

without comments

 

Pronto, agora acabou o ciclo do Google Summer of Code deste ano. Chegaram hoje em meu apartamento a camisa e o certificado de que terminei com sucesso o projeto de início do backend do Scilab no Cantor, meu trabalho no GSoC.

Também saiu hoje um post na página do Scilab com um relatório final das atividades dos estudantes que trabalharam em projetos relacionados ao Scilab, como é o meu caso. Lá tem um rápido resumo do que fiz e alguns links importantes.

Ainda estou devendo o post com o estado atual do backend que criei. Prometo-o para logo. :-D

Written by Filipe Saraiva

October 7th, 2011 at 2:00 am

Scilab Backend to Cantor: Syntax Highlight and Tab Complete

with 2 comments

I bring in this post some news about the Scilab backend to Cantor, my Google Summer of Code project in this year.

After the last weeks of work, two interesting features were implemented in the Scilab backend: syntax highlighting and tab complete for predefined functions and variables. These features are cool because they are present in most IDEs, and they, together with other features, are what make us want to write lines of code in IDEs, no in conventional text editors. :-)

These features were developed based on how they are implemented in Maxima backend: using XML file that lists all predefined functions and variables.

Some screenshots to demonstrate the operation of them. Below is the syntax highlighting in SciNotes, the Scilab default editor:

Syntax highlight in SciNotes

To find all the keywords of predefined functions names and variables, I used getscilabkeywords, a function that lists all the Scilab keywords. With it in hand, I could create the XML file with these data. Below is the syntax highlighting in Cantor:

      Syntax highlight in Cantor

There’s one detail to complete this feature: the highlight of predefined variables. But I’m talking with Alex Rieder to finish it.

Below, as a curiosity, the Scilab syntax highlighting in Cantor and SciNotes, side by side:

Syntax Highlight in Cantor and SciNotes

The other feature is the tab complete, which makes the Cantor suggest names of predefined functions or variables for the developer writing the code. In Cantor, simply enter any character and press the TAB key (default for this feature in this software).

In the picture below we have the autocomplete function names suggested for the word “plot” (the function of generating graphics in Scilab):

      Tab complete in action!

Unlike the syntax highlighting, the autocomplete is also working to predefined variables.

The code for this is Cantor repository, currently in scilab-backend branch. Feel free to test, but do not forget: you must compile Scilab also for try this backend!

Well, that’s it for now! The project is well advanced and, perhaps, we will support the Scilab in Cantor in KDE SC 4.8 version? ;-)

And who goes to Berlin we’ll see you there!

Written by Filipe Saraiva

July 18th, 2011 at 4:42 am

Backend do Cantor para Scilab: Destaque de Sintaxe e Autocomplete

without comments

Trago neste post algumas novidades sobre o suporte ao Scilab no Cantor, meu projeto do Google Summer of Code deste ano.

Após as últimas semanas de trabalho, duas interessantes funcionalidades do backend foram implementadas: o destaque de sintaxe e o autocomplete para funções e variáveis pré-definidas. Estas funcionalidades são legais pois estão presentes na maioria das IDEs e elas, em conjunto com outras características, são o que nos fazem preferir a escrever linhas de código em IDEs do que em editores de texto convencionais. :-)

Essas funcionalidades foram desenvolvidas baseadas na forma como estão implementadas para o backend de Maxima: usando arquivo XML que lista todas as funções e variáveis pré-definidas.

Alguns screenshots para demonstrar o funcionamento delas. Abaixo, temos o destaque de sintaxe do Scilab no SciNotes, o editor padrão do Scilab:

Destaque de sintaxe no SciNotes

Para encontrar todas as palavras-chave de funcionalidades e variáveis pré-definidas, usei a função getscilabkeywords que lista todas as palavras chaves do Scilab. Com ela em mãos, pude criar o arquivo XML com estes dados. Abaixo vemos o destaque de sintaxe no Cantor:

Destaque de sintaxe no Cantor

Ainda falta um detalhe para completar esta funcionalidade: o destaque de variáveis pré-definidas. Mas estou conversando com o Alex Rieder para terminarmos isso.

Abaixo, como curiosidade, o destaque de sintaxe do Scilab no Cantor e no SciNotes, lado-a-lado:

Destaque de sintaxe no Cantor e SciNotes

A outra funcionalidade é o autocomplete, que faz com que o Cantor sugira nomes de funções ou variáveis pré-definidas ao desenvolvedor durante a escrita do código. No Cantor, basta após qualquer caractere digitar a tecla TAB (padrão neste software para esta funcionalidade).

Na imagem abaixo temos o autocomplete sugerindo nomes de função para a palavra “plot” (a função de gerar gráficos no Scilab):

Autocomplete em ação!

Ao contrário do destaque de sintaxe, o autocomplete também está funcionando para as variáveis pré-definidas.

O código deste backend está no repositório do Cantor, atualmente no branch scilab-backend. Fique a vontade para testar, mas não se esqueça: você deve compilar também o Scilab caso queira experimentar o suporte no Cantor!

Bem, por enquanto é isso! O projeto está bem avançado e, quem sabe, teremos o suporte ao Scilab no Cantor versão KDE SC 4.8? ;-)

E para quem for à Berlim: nos veremos por lá!

Written by Filipe Saraiva

July 18th, 2011 at 4:06 am

Scilab says: “Hello Cantor!”

with 5 comments

…and also makes calculations!

In recent weeks, I worked primarily with the communication between Cantor and Scilab, via the backend that I am developing. The task was very interesting because in the project, the technology chosen for implementation, was changed.

Before, I had proposed to use the API call_scilab, which makes the communication between the C/C++ and Scilab. But, studying the code of Cantor, I realized that other backends uses KProcess class (or QProcess), which allows Qt code to initialize a thread of other software and make communication with him via the standard streams stdout, stderr and stdin.

However, Scilab originally did not use these streams. So, talking to my mentor Ledru, we decided to implement this functionality.

After a few days and further studies, could provide support to these outputs in Scilab! And, voilá, Scilab says “Hello Cantor!” via backend! Click images to enlarge:

The backend is actually functional, although, of course, missing a few details. Now we have many screenshots. :-)

Backend for Cantor Scilab making calculations:

Add variables, uses pre-defined functions and allows various calculations in the same workspace:

Works with multiple workspaces simultaneously:

Emits error messages in the workspace:

That’s it! Well, let’s now a great resume with quick information about this project:

What’s missing?

  • Management charting. Nowadays, the backend generates the chart of Scilab in another window. This will add the possibility of generating the chart in the workspace of the Cantor;
  • Syntax highlighting;
  • Auto-complete of the native Scilab functions;
  • Working the character encoding of the output;
  • Manage large outputs. When Scilab is a calculation and will print stuff on screen, the environment shows only a portion of the output and asks if the user wants to see more. In the backend it does not work, because when the first part of the output is shown, it is impossible to send another entry to Scilab. Below, in the image:

I can test this backend?

The backend code is in the branch scilab-backend Cantor repository, and performs all the functions described here. However, it needs the Scilab repository version to work, because I had to implement support for streams standards – ie, you must download the Scilab code and compile it. Another time, I’ll write a post with some tips on compiling Scilab.

For those who do not want to venture into the process of compiling Scilab, the way is to wait for the next version of Scilab to be launched in September. Just as it does in Scilab backend for Cantor function.

So that’s friends, who have to read the text here and stay tuned for more news. And do not forget to comment here about what you’re thinking of this project. ;-)

Written by Filipe Saraiva

June 3rd, 2011 at 6:52 pm