Array Tools

Post here if you want to announce new wiki modules, projects or articles

Moderators: David Barker, Jerry Messina

Post Reply
Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Array Tools

Post by Doj » Wed Sep 19, 2007 2:54 pm

While learning about strings and arrays in Swordfish I found the need to search for a known string in an array of data, I have made this module to contain routines for further tools pertaining to array manipulation.

This first version has one tool "FIND_STRING".
It allow an array to be searched for a particular string of data with variable start and end positions for the search, it returns with the position of the character immediately following the last character of the search string.

The module has detailed notes on the use and how it works along with an example and the data produced when tested.

I hope to add tools as I use them in my code.

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Thu Sep 20, 2007 1:45 pm

As with all works in progress I have found a small error that corrupts a string if it has less characters than the one previously called, the compare string will always be the size of the largest search string passed through the routine in the time the PIC has been powered(resrved in RAM no doubt) I am working out how to reset its size or clear the values to 0, the terminator, but to no avail yet, I also am trying Left in the "String.bas" module and hope it should work.

Version1.1 soon!

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Fri Sep 21, 2007 11:01 am

Note to myself, new tools written and being tested along with new FIND_STRING routine, posting soon.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Fri Sep 21, 2007 11:07 am

Doj wrote:Note to myself,
hehe ... Doj stop thinking loudly on the forum :o :o :o

regards
Octal

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Sat Sep 22, 2007 1:01 am

So, I am not the only one to talk to myself!

I am reminding myself that it is hard to make code error free, my routine works great with any length of string(within compiler boundarys) as long as any string sent consecutively is not the same length, what i have to do at the moment is send a dummy read with a 1 length string (which will never happen in the calling routine) then send the needed string and its fine, when my current panic is over I will ask why.

Post Reply