flat assembler
Message board for the users of flat assembler.

Index > Main > Fasm Standard Library concept by vid

Goto page Previous  1, 2

Do you accept my concept for library?
Yes
83%
 83%  [ 10 ]
No
16%
 16%  [ 2 ]
Total Votes : 12

Author
Thread Post new topic Reply to topic
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 20 Jun 2005, 09:29
vid wrote:

No user is one who decides, otherwise it is a bad program.

Then all text editors i have used are bad programs.
Can you tell me about a text editor that if you enter
tab space space tab A tab enter
will output : db 9,32,32,9,65,9,13,10
instead of : db 9,9,65,13,10

Quote:

Did you thik about integrating privalov's preprocessor module into your asm?

yes,but i don´t like the idea, i prefer to port fasm to my OS (when i have time) for those that don´t like octasm. And the problem is not my assembler, all assemblers are incompatibles mostly because the preprocessor, but if macros are not used ,they become very compatibles, and the asm library would be more useful and more developpers will contribute if is not restricted to only one assembler or only one OS (windows)
Post 20 Jun 2005, 09:29
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 20 Jun 2005, 11:32
Quote:

if some subroutine already exits on some HLL library we can use the same name like: malloc printf

...except when these are badly designed. Printf isn't too nice (it's often designed with a limited output format buffer, and often doesn't have buffer overflow checking), and the C standard library string functions are awful.
Post 20 Jun 2005, 11:32
View user's profile Send private message Visit poster's website Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 20 Jun 2005, 13:07
f0dder wrote:
...except when these are badly designed. Printf isn't too nice and the C standard library string functions are awful.

Yes, some libraries are useless because don´t do error checking,and i like more pascal style,when i talk about 'printf' i don´t mean to do exactly
the C implementation, but some generic output routine , if you know something better post it.
Post 20 Jun 2005, 13:07
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 20 Jun 2005, 14:31
But you can't negate that printf (and especially sprintf) functions are very usefull sometimes, when you have to format complex message:
Code:
invoke sprintf, buf,format,[packets],[bytes],[seconds]

buf rb 100h
format db 'Status: %d packets recived (total %d bytes) in %d seconds.', 0    
Post 20 Jun 2005, 14:31
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 20 Jun 2005, 15:28
Octavio: exactly - don't use the "printf" name if it doesn't do exactly the same, though, or people will be confused.

decard: (s)printf is indeed useful, but it needs either an argument that specifies how large the buffer is, or the standard library should be written to use dynamic length strings (which, IMHO, would be a very good idea).
Post 20 Jun 2005, 15:28
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 21 Jun 2005, 10:47
I have an idea about problem if module should include stuff it needs itself or leave it on user. I think this might be solved by letting user decide, by defining or not defining some constant (let's call it "fasmlib_auto_include", all names here are temporary of course).

Every module will have list of macros and modules it uses, like
Code:
uses_macropacks proc, import
uses_modules winapi, opengl
    


Macros "uses_macropacks" and "uses_modules" will then decide whether to include file (if "fasmlib_auto_include" was defined and file isn't included already), or warn user if file isn't already included. This requires each module and macropack to have kind-of header which defines equate ("__included_#name-of-module"), that will be checked in "uses_" stuff.
Code:
macro header module
{
  match =__included_#module,YES  ;is module already included
  { 
    preprocessor_time_error 'Module '#`module#' included twice'
  }
  __included_#module equ YES
  restore __current_module
  __current_module equ module
}

macro uses [module]
{forward
  match =__included_#module,__included_#module ;if file isn't included already (if it is we don't bother)
  {
    local DONE
    DONE equ NO
    match =fasmlib_auto_include,fasmlib_auto_include ;if auto including isn't enabled
    { 
      preprocessor_time_error 'Module '#`module#' must be included for module '#__current_module 
      DONE equ YES  
    }
    match =NO,DONE ;if autoincluding is enabled 
    {
      include `module#'.inc' ;include module
    }
  }
}    
I was also thinking about using revolution's "define" macros instead of ugly DONE trick, but there would be strange behavior (for user) if "fasmlib_auto_include" is defined to unknown value. This way user can define it to any value (except for it's name of course).

Only problems is with the "preprocessor_time_error" thing. Any idea how to do this?
Post 21 Jun 2005, 10:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 07 Jul 2005, 17:11
hey... no more comments?
Post 07 Jul 2005, 17:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.