Skip to content

Implementation of get_line_elements() in sources analyze.c

Camille Briand edited this page Mar 9, 2017 · 1 revision

We first tried to implement a the line by line interpreter and so the necessity to implement a function to divide a string onto substrings came on the first days of the project thinking: hence we implemented the function "get_line_elements()" (located in sources/analyze.c) which basically do the same thing as string.h's "strtok()" but also determines the types of the different elements typed by the user. The types of the elements are numerical values and the elements of the line originally typed are divided onto substrings in the 2 dimensional char array "elements".

This function actually was one of the hardest to develop but we did it. There are still a few memory leaks that occurs because of this function, and we're tying to fix them, but the most important is that this function works pretty properly and whenever the user made a syntax error, this function is most often able to detect where the error is so that it is then displayed and the user can correct the error by himself.

Clone this wiki locally