AminetAminet
Search:
84782 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/e/FR-Modules.lha

Mirror:Random
Showing: i386-amithlon icongeneric icon
No screenshot available
Short:FASTEST FGets() replacement, quick sort, hex view, ansi2text, SetFunction() modules
Author: fredinou at bigfoot.com (FR)
Uploader:
Type:dev/e
Architecture:m68k-amigaos
Date:2000-06-26
Requires:kickstart 2.0+
Download:dev/e/FR-Modules.lha - View contents
Readme:dev/e/FR-Modules.readme
Downloads:676

Here are some modules I made 2 years ago for my own programs.

summary
~~~~~~~
FGets() AmigaDOS replacement (about 5 times faster)
Quick sort (for sorting arrays and make fast sort programs)
Hex view (to view better binary files)
Ansi to text (removes escape sequences)
SetFunction() AmigaDOS replacement (SetFunction object)
CON window size (How many lines of text it may contain)
strtok() equivalent (like the C function)
Me
It's freeware
Quit
============================================================================
readline()
----------------------------------------------------------------------------
Synopsis:

Replaces the AmigaDOS FGets() function.
About 5 times faster.
About 30 times faster than the ReadStr E function.

readline(object)
readlinefrom(filehandle)
endrealine(object)

You don't need to know what object is. It's a pointer to something and
is just used for the endreadline() function.
You get the line read with ^o.

Example :

  DEF fh,o,buf[256]:STRING,i
  IF fh:=Open('xpke.e',OLDFILE)
    o:=readlinefrom(fh)
    WHILE readline(o)
      printF("\s\n", ^o)
    ENDWHILE
    endreadline(o)
    Close(fh)
  ENDIF
============================================================================
insertinorder()
----------------------------------------------------------------------------
Synopsis:

Insert an element in a sorted array using quick sort algorithm.

insertinorder(arrayptr,len,element,comparisonfunction,userdata)

arrayptr : pointer to an array
           the array may be empty but allocated.
len : length of the array
element : pointer to the element to insert in the array
comparisonfunction : pointer to your function of comparison
userdata : parameters of the comparison function

comparison function :
cmpfunction(element, newelement, userdata : PTR TO LONG)

return TRUE if element and newelement are comparable.
newelement is the element to insert which you compare with an ordinary
element of your array.
============================================================================
hex()
----------------------------------------------------------------------------
Synopsis:

Display a binary string in hex view form.

hex(estring,binstring,len)

estring : returned hex view string
binstring : binary data in memory
len : length of binary data

Example of view:

464F524D 00000046 50524546 50524844    FORM...FPREFPRHD
00000006 00000000 0000494E 50540000    ..........INPT..
002C6600 61310000 00000000 00000000    .,f.a1..........
00000001 00000001 0007A120 00000000    ..........ยก ....
============================================================================
noansi()
----------------------------------------------------------------------------
Synopsis:

Removes the escape sequences from string.

noansi(string)

Example:
Strcopy(str, "\e[33mtext\e[31m")
noansi(str)
PrintF(str)

Output:
text
============================================================================
nblineswin()
----------------------------------------------------------------------------
Synopsis:

Returns the number of lines of text displayable on the window.

nblineswin(PTR TO window)

============================================================================
setf()
----------------------------------------------------------------------------
Synopsis:

SetFunction() object in E.

setf(libbase,offset,newfunc)

Constructor.
libbase : pointer to library
offset : offset of the function to patch (See asm includes).
newfunc : pointer to the new function for replacement.

enabled()

Returns TRUE is patch is enabled.

disable()

Disables the patch.

enable()

Reenables the patch.

patched()

Returns TRUE is the function has been patched by another process.

end()

Destructor.

oldfunc()

Returns the pointer to the old function.

Example:
#define OFFSET -30 (Open)
#define BASE dosbase

MODULE 'tools/geta4'

PROC main()
  NEW setf.setf(BASE,OFFSET,{new})
  storea4()
  WHILE CtrlC()<>TRUE DO Delay(10)
  IF setf.attemptend()=FALSE THEN WriteF('Someone patched your function\n')
  WHILE setf.attemptend()=FALSE DO Delay(10)
  END setf
ENDPROC

PROC new()
  DEF name,mode,fh
  MOVE.L D1,name
  MOVE.L D2,mode
  geta4()
  WriteF('\s opened with mode \s\n',name,IF mode=NEWFILE THEN 'NEWFILE' ELSE 'OLDFILE')  MOVE.L name,D1
  MOVE.L mode,D2
  fh:=setf.oldfunc()
  WriteF('fh: \d\n',fh)
ENDPROC fh
============================================================================
readtoken()
----------------------------------------------------------------------------
Synopsis:

strtok() equivalent.

readtokenfrom(string,separators=NIL,oneonly=FALSE)

constructor

string : a string
separators : a string of separators
oneonly : treat subsequent separators as one separator

readtoken(o)

return the next token

endreadtoken(o)

destructor

nbtoken(o)

returns the number of tokens in the string

Example:

DEF o

o := readtokenfrom("token1;token2;token3.token4", ".;")
WHILE readtoken(o)
  PrintF("%s\n", ^o)
ENDWHILE
endreadtoken(o)
============================================================================
Talking about me ...
----------------------------------------------------------------------------
There was 2 years I made these proggies and never take the time to spread
it. So here it is for your convenience. Hope you will use it.

You may reach me by email if u want.

fredinou@bigfoot.com
============================================================================
Legal stuff
----------------------------------------------------------------------------
These modules and source are freeware. Do whatever you want with it.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
============================================================================


Contents of dev/e/FR-Modules.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  249     351  70.9% -lh5- 74cc Oct  1  1997 ansi.e
[generic]                 1334    2962  45.0% -lh5- b570 Oct  4  1997 boyer.e
[generic]                  179     248  72.2% -lh5- a3f8 Sep 26  1997 geta4.e
[generic]                  333     542  61.4% -lh5- 853f Oct  4  1997 hex.e
[generic]                  372     748  49.7% -lh5- 20f7 Oct  4  1997 insertinorder.e
[generic]                 2261    5073  44.6% -lh5- dedd May 20  1999 Modules.guide
[generic]                  202     263  76.8% -lh5- aaab Oct  4  1997 nblineswin.e
[generic]                  837    2014  41.6% -lh5- 8d31 Oct  4  1997 readline.e
[generic]                  552    1308  42.2% -lh5- e8f7 Oct  4  1997 readlinetest.e
[generic]                  650    1751  37.1% -lh5- 2b87 Nov 16  1997 readtoken.e
[generic]                  371     920  40.3% -lh5- 58cb Sep 26  1997 setf.e
[generic]                  547    1222  44.8% -lh5- f0f8 Jun 15  1997 setftest.e
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        12 files    7887   17402  45.3%            Jun 26  2000
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>