SPO600(Project Part 2.1)

My code can be found here: https://github.com/a-martin94/Spo600/blob/main/tool.py


As part two of the project I needed to put my plan in action and so that required a bit revision. Instead of writing in the code in C++ or Node I opted to pick python instead as this was a recommendation from our professor if we had used the language before because it is very good at parsing which is essentially what this project needs to do the most in order to get the expected output. I sadly had never used python before so I found myself learning a lot on the fly, luckily python is some what of an easy language to grasp but having to learn some new syntax and and other tools that python offers was some what harder to do. I do like python in the sense that you can just start coding not really to much third party installs required.

I found part two of this project to be very hard. I started off with the idea that I was going to take some tester code that our professor has provided for us and dissect the code by using an open() method I was able to then start to rip apart the strings required in order to get the function prototype and name. this was quite a challenge and got messy fast. I just found void and extracted the function name like so.


Once I found the string the next step was to copy the string to the file, so I had the code produce a file called header.c and that would to the file and place the extracted function prototype to the top of the header.c file. After It started to work, I then needed to get the name of the function in the test code that was the adjustChannels and add the prefix to the name in order to choose between the three different options sve,sve2,asmid. For this portion of the project is where it got messy, I was running out of time and and needed to write the name of the new adjustchannel function with its prefix to the header.c file. To do this I wanted to make a for loop and just loop through adding a prefix each time and also doing more parsing in order to extract certain elements in the array that I ripped apart. Sadly I got a bit lost in my messy code and did need to go back in order to do it the way I just mentioned atm it is partly hard coded. As such here is the output when written to a file:


For this part I had to hard code the include portion then store the new name with its suffex then hard code the for loop which is not what I wanted to do but again going to fix this in a later iteration. 

I did not test on isreal yet as I am not done making the full tool. I have been using VS code and the cmd line in order to test the code. I am currently testing my for loop idea but for now this will have to do. This project only works the exact tester code that was provided and only for void, this needs to be fixed moving forward.

I added the code in the partTwo2.2 post incase the github link at the top of this page wont work.

For it to work just copy and paste the code in VS code and get the tester file from 

After that just make sure you have python installed and call the file tool.py and you can paste the code there or pull from my github its not much code so you can probably copy and paste it to the file then run the file in the command line and it will produce a new file called header.c with the output.

Comments

Popular posts from this blog

SPO600 Lab1

SPO600(Project 3.2 FInal Post and thoughts on project and course)