flat assembler
Message board for the users of flat assembler.

Index > Windows > new version of dynamic string library

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
decard wrote:
do you mean something like this:...


I mean (and I think scientica too) following:
Code:
;**********************************************************
; proc SubStr, str, index, len
; Copy the part of [str] from [index] with lenght in [len]
; Returns handle to new created string.
;**********************************************************    


decard wrote:
Now StrLib has almost 20 functions, and they are described in source, so it is quite easy to miss some feature. In next release I will try to create some .txt file and put there description of all routines, and general information about StrLib.

AFAIK, now scientica works on help system, that will extract help information directly from the source. So there is not necessary to write separate docs.

Regards.
Post 27 Sep 2003, 09:44
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
Oh.... now I understand Smile

btw: one suggestion for the proc macros: maybe you could change them that they will not generate 'push ebp/mov ebp,esp' if function has no parameters nor local variables...

regards
Post 27 Sep 2003, 09:53
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
decard wrote:
btw: one suggestion for the proc macros: maybe you could change them that they will not generate 'push ebp/mov ebp,esp' if function has no parameters nor local variables...


I will. Smile
Post 27 Sep 2003, 10:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
JohnFound wrote:
I mean (and I think scientica too) following:
Code:
;**********************************************************
; proc SubStr, str, index, len
; Copy the part of [str] from [index] with lenght in [len]
; Returns handle to new created string.
;**********************************************************    

Correct Very Happy

I'm soon redy to post my draft -- last minute adjsutments.

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 27 Sep 2003, 12:01
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
I've uploaded current version of StrLib (with John's fixes). What's new:
- added two new low-level NumToStr routines: NumToStrF and NumToStrUF (by John Found)
- NumToStr was rewriten
- some bugfixes & modifications were done.
- added StrExtract

Actually it is not a new version, I just have done some bugfixes...

By now it doesn't use new set of macros (but it uses "if used" statements). I will add those macros in new version Smile.

regards,
Decard
Post 27 Sep 2003, 16:09
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
That's version 1.1.4 of StrLib...
- library was rewtiten to use John Found's stdcall macros
- added two new low-level NumToStr routines: NumToStrF and NumToStrUF
- NumToStr rewriten
- some small bugfixes & modifications
- added StrExtract (it's a requested SubStr routine, but wanted all names in lib begin with 'Str', and StrSub didn't sound nice to me Very HappyVery Happy )

[EDIT]outdated attachment removed. Now StrLib can be found in Fresh Package.[/EDIT][/b]


Last edited by decard on 18 Oct 2003, 17:56; edited 2 times in total
Post 29 Sep 2003, 14:24
View user's profile Send private message Visit poster's website Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
Something has changed, and it causes me to get an "unexpected" output.

With verison 1.1.3 I get this out put:
Code:
[D:\Dev\FASM\harsyra]harsyra
-Harsyra- v0.1
Copyright (C) Fredrik Klasson (aka scientica) 2003.
®®DEBUG¯¯
struc TFile{
  .spFile        dd 00000001h (1) => 00072E08h (470536) => "test.asm",0
  .spName        dd 00000000h (0) => FFFFFFFFh (-1) => "[NULL POINTER!]",0
  .spDescription dd 00000000h (0) => FFFFFFFFh (-1) => "[NULL POINTER!]",0
  .ddFileSize    dd 000008B1h (2225)
  .ddLines       dd 00000000h (0)
  .ddComments    dd 00000000h (0)
  .lpComments    dd 000751E8h (479720)
  .lpRaw         dd 00074928h (477480)
}
®®DEBUG¯¯
®®DEBUG¯¯
struc TComment{
  .pThis       dd 004040CCh (4210892)
  .pNextTC     dd 00000000h (0)
  .pPreviousTC dd 00000000h (0)
  .ddStarLine  dd 00000000h (0)
  .ddEndLine   dd 00000000h (0)
  .pFile       dd 00000001h (1) => 00072E08h (470536) => "test.asm",0
  .RawOffset   dd 00000000h (0)
}
®®DEBUG¯¯
®®DEBUG¯¯
ESI: 0007492Dh (477485):
Test File®®DEBUG¯¯

®®DEBUG¯¯
ESI: 0007493Dh (477501):
; This is a test File (and a test description)
; it spans a few lines for
; fun :®®DEBUG¯¯

®®DEBUG¯¯
struc TFile{
  .spFile        dd 00000001h (1) => 00072E08h (470536) => "test.asm",0
  .spName        dd 00000002h (2) => 00075AA8h (481960) => "Test File",0
  .spDescription dd 00000003h (3) => 00075AC8h (481992) => "; This is a test File (and a test description)
; it spans a few lines for
; fun :)",0
  .ddFileSize    dd 000008B1h (2225)
  .ddLines       dd 00000000h (0)
  .ddComments    dd 00000000h (0)
  .lpComments    dd 000751E8h (479720)
  .lpRaw         dd 00074928h (477480)
}
®®DEBUG¯¯    

but with version 1.1.4:
Code:
-Harsyra- v0.1
Copyright (C) Fredrik Klasson (aka scientica) 2003.
®®D®®D®®D    


I'll run a diff on the strlib and see what has changed - it wouldn't suprise me if the error is in my code (using some bug/"un-doc-feature" to work). Does any other experiance somethig similar?

btw, yes the output is from harsyra, as you can see I'm using the strlib :)
the source is a mayham - still got remains of the old non-strlib code, which soon will "disappear".

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 29 Sep 2003, 17:31
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
I've really no idea what could cause this strange output Sad My small test routine works just fine... But I didn't test all of the routines that I've changed, maybe this could make it happen. Can you write more about the problem (which functions are you using, etc...)? I will try to test all routines in StrLib and see if something is wrong... Unfortunately I can't do it today as I have to learn for tomorrow's German test (Arghhhhh Mad)...

regards,
decard
Post 29 Sep 2003, 18:15
View user's profile Send private message Visit poster's website Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
decard wrote:
Unfortunately I can't do it today as I have to learn for tomorrow's German test (Arghhhhh Mad)...

I know, rember them, but luckily Swedish has some similarities with German (so I could guess the meaning of some germain words). Good luck Smile

With risc of this beeing to little, but these are what I've used (I've excluded a few calls which are basically the same as the listed). I haven't had time to check the code again (a few RL matters to tend to), but I'm about to take look now.
Code:
Functions from strlib.asm used by Harsyra.asm:
  call    InitStrings
  call    FreeStrings
  stdcall StrPos, esi, szFileComment ; search for ';<<<'...
  stdcall StrNew, [ebx+TFile.spName]
  stdcall StrCopy, eax, esi      ; copy/set the filename
  stdcall StrPtr, [ebx+TFile.spFile]
section '.data' data readable writeable
...
  StrTable TStrTable    

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 29 Sep 2003, 20:06
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
It was a VERY stupid bug in StrLen Evil or Very Mad I wonder how could I miss it? I wasn't testing StrLen, but some other functions that use it... Now I'm suprised how they even worked...

Now it should work OK...
Post 30 Sep 2003, 13:18
View user's profile Send private message Visit poster's website Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
Ok, works fine now. (a few days late but, I thought it was best to sya that it works Smile)

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 03 Oct 2003, 14:10
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
Well.... better later than never Very HappyVery HappyVery Happy
Nice to hear that scientica, and thanks for the bug raport Smile
Post 04 Oct 2003, 06:39
View user's profile Send private message Visit poster's website Reply with quote
0x004549554F4C



Joined: 16 Mar 2004
Posts: 14
0x004549554F4C
newb questions:
Whats the string handle is it different from a pointer how?
Post 18 Mar 2004, 06:00
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
0x004549554F4C wrote:
newb questions:
Whats the string handle is it different from a pointer how?


Hi.
This library handles dynamic strings - they can be dynamically resized during runtime.
The main idea for string handles instead of pointers is that handle remains constant, while the pointer may be changed when the string length is changed.
Of course, the most of StrLib functions work fine with static pointers as well.

You have to read "freshguide.chm" from Fresh package for more details. There is very good description of whole library by Decard.

Regards.
Post 18 Mar 2004, 07:06
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
0x004549554F4C



Joined: 16 Mar 2004
Posts: 14
0x004549554F4C
do you have a mid string function to take only part of a string (ie in the middle)
str1 db 'BlaH',0
strbuffer rb 0xF000
MIDSTR str1, 3, 2, strbuffer
strbuffer = 'a','H'

MIDSTR Mstr, Start, Len, Buffer
Mov ESI, Mstr
Mov EBX, Buffer
Add ESI, Start
Mov ECX, FFFFFFFFh
LBL1:
Inc ECX
Mov AL, byte[ESI+ECX]
Mov [EBX+ECX], AL
Cmp ECX, Len
JL LBL1

Something along those lines [pretty sure the above will NOT compile]
Post 19 Mar 2004, 04:30
View user's profile Send private message Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro
You could also have a look at my try for fasm standard library, there's currently 23 string functions if i counted them right. Including StrMid.
http://board.flatassembler.net/topic.php?t=1107
Post 19 Mar 2004, 10:06
View user's profile Send private message Reply with quote
0x004549554F4C



Joined: 16 Mar 2004
Posts: 14
0x004549554F4C
aaro your library is great, keep up the good work. Just skimming through it i've learned tons about assembler.

the most impressive part of it is the efficiency in the code. you squeezed every byte Very Happy
Post 20 Mar 2004, 04:48
View user's profile Send private message Reply with quote
mario29



Joined: 07 Sep 2010
Posts: 5
mario29
Can someone please post the download link for this.
Post 06 Nov 2010, 19:39
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
mario29 wrote:
Can someone please post the download link for this.
decard wrote:
[EDIT]outdated attachment removed. Now StrLib can be found in Fresh Package.[/EDIT][/b]
Try here:

http://board.flatassembler.net/topic.php?p=121677#121677
Post 06 Nov 2010, 22:25
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, 3

< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.