Author Topic: Addon  (Read 6559 times)

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Addon
« on: February 20, 2015, 12:47:29 PM »
Hello, is it possible to write an addon/program, and run it with nasm for modify his comportment while reading the source code, like integrated some new special syntax ?

Offline Zefferon

  • Jr. Member
  • *
  • Posts: 13
Re: Addon
« Reply #1 on: March 30, 2015, 08:44:08 PM »
What do you want the addon to do?
My solution to the problem was to write a preprocessor:
http://www.shallizar.com/nasmcollection/Linux/Shallizar/Apps/FileProcessors/PreprocWidgets.html

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: Addon
« Reply #2 on: March 30, 2015, 09:09:29 PM »
For example, add parenthesis around macro's parameters for look like C-function, give the possibility to write multi instruction in single line without pass through macro*, add new feature support of nasm project (nasm will able to read special configuration file who listed all files it needed to assemble), ...

*: http://forum.nasm.us/index.php?topic=2020.msg9050#msg9050

Unfortunately I don't use Linux.
« Last Edit: March 30, 2015, 09:14:06 PM by shaynox »

Offline Zefferon

  • Jr. Member
  • *
  • Posts: 13
Re: Addon
« Reply #3 on: March 30, 2015, 10:47:46 PM »
You want to hack NASM's preprocessor, to give it the ability to call your custom functions.
The current version of NASM does not have "hooks" for that.

Modifying NASM is not that difficult. It is one of the tasks I have planned when I get the time.
I need to add support for user-defined types.

If you do hack NASM, just make sure it is crystal clear that a user knows he is using your upgrade.

I WARN all programmers to resist the temptation to indulge in what I call MACRO MADNESS.
Sure, you can write a macro to mimic just about anything in an HLL, but such macros turn into
programs unto themselves. This can seriously set back someone trying to get something done quickly, but
they have to wade through huge macros to understand how to use them. I try to keep my macros as short
as possible, and leave the argument juggling to the called procedure.