Author Topic: Uni-Include Program  (Read 2512 times)

Offline nasm32

  • Jr. Member
  • *
  • Posts: 25
Uni-Include Program
« on: September 09, 2014, 07:37:58 PM »
Universal Include File Library

If there is something I've learned over the years, is if you're an assembly programmer, you most likely use several assembler's and use several other languages. One of the problems i've discovered over the years, is that to get the include files you want is more than a plague. It's a disease.

All assembly authors, all assembly programmers should come together and start writing all include files in a universal include-file program that stores equates and structures in a universal format. The idea is that you can feed a very simple format file to the program and it will output any include file you want in any format you want by simple "macro" text replacement.

Each author of any assembly project could create his own very simple "format file" so that users can "extract" any include file they want by using that format file, for any assembler out there.

I propose the name "UniInclude" as the name for the program. And if such a program will ever be made, I encourage asm programmers to write all their include files in the universal format. This is not just an idea, it's about "survival". The future will bring more and more api's and we need to come together and shape a standard for include files.

Imagine what we can do if all assembly include files were available in a common format, and all you need to do is apply a simple format file and it will output that include file for you in the format your assembler needs.

Offline nasm32

  • Jr. Member
  • *
  • Posts: 25
Re: Uni-Include Program
« Reply #1 on: September 15, 2014, 07:50:51 AM »
I had to use regular expressions to convert include files from a different assembler to nasm. Here is what I had to produce, please bare in mind that I'm fairly inexperienced with regular expressions

Code: [Select]
step1: Replace "struct" with "struc" (match whole words)
Step2: Replace "ends" with "endstruc" (match whole words)
step3: Replace "db ?" "dw ?" and "dd ?" with resb,resw,resd 1

step4: Replace all instances of db x dup (?) with resb x
---------------------------------------------------------
Find What: \s*db\s([0-9]*)[\s]*dup[\s]*\([\s]*\?[\s]*\).*$
Replace with: \t\t\tresb \1

step5: Replace all instances of db x(+-)y dup (?) with resb x(+-)y
------------------------------------------------------------------
Find What: \s*db\s([0-9]*[\s]*[+-][\s]*[0-9]*)[\s]*dup[\s]*\([\s]*\?[\s]*\).*$
Replace with: \t\t\tresb \1

step6: Replace all = characters with EQU using normal replace

This was just to convert data types in structure definitions and EQU's. It can be educative but in my opinion it is unacceptable. We need to attack the include file problem on all fronts and try to standardize it, a full cavalry attack on all fronts.