mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2003
Posts: 426
Fjord artisan
OP Offline
Fjord artisan
Joined: Apr 2003
Posts: 426
Howdy.


Just a simple request for an overlooked feature.

I was wondering if it would be possible to add in a feature that would list all running hash tables and their state/properties.

Eg:

/hlist -w <name to match> <size to match>


The simple explanation:

/hlist works just like /hmake. It lists all hash tables in use (when used as just /hlist, or, it will list all tables matching a certain name/text or size).

The output would be something similar to:

/hlist -w hash_conf 100
*Showing hash tables matching: hash_conf - size: 100

hash_configuration - 100
hash_confused - 100
hash_conf_oplist - 100

*End of matching hash tables



This would be useful for displaying a list of all hash tables that are currently open (useful for debugging, or freeing tables).
I know one could use if $hget(name) to find out if a table exists or not, but it isn't exactly suited for mass searching/listing.


One could then add this extension to the /hfree command, which would list all the tables it will delete (kind of like what it does now).


--------
mIRC - fun for all the family (except grandma and grandpa)
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
$hget(name) isn't suited for mass searching/listing, but $hget(N) is. All you need to do is loop through $hget(N) to get the name of the Nth hash table and use the .size property to get its size. Here's a scripted /hlist:
Code:
alias hlist {
  var %i = 1, %a
  if $1 != -w || $0 == 1 {
    echo -aiec info * Showing all hash tables
    while $hget(%i) { 
      echo -ac info2 $ifmatch - $hget($ifmatch).size
      inc %i 
    }
    goto end
  }
  echo -aiec info * Showing hash tables matching: $2 - size: $3
  if $3 !isnum 1- {
    while $hget(%i) {
      %a = $ifmatch
      if $2 iswm %a { echo -ac info2 %a - $hget(%a).size }
      inc %i 
    }
    goto end
  } 
  while $hget(%i) {
    %a = $ifmatch
    if $3 == $hget(%a).size &amp;&amp; $2 iswm %a { echo -ac info2 %a - $3 }
    inc %i
  }
  :end
  echo -aiec info * End of matching hash tables list
}
I'm not sure whether you want /hlist to do a wildcard search or an "isin" one; the -w switch implies "wildcard", but your example uses the "isin" method, ie /hlist checks if the 2nd parameter is included in a hash table name. I chose the first way, ie wildcards. This means that to list all hash tables of size 100 that contain hash_conf, you should type
/hlist -w *hash_conf* 100
and not
/hlist -w hash_conf 100
If you don't want the "wildcard" search, just change every occurance of iswm to isin.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Apr 2003
Posts: 426
Fjord artisan
OP Offline
Fjord artisan
Joined: Apr 2003
Posts: 426
Wildcard implies that it should search for whatever the string is, with or without a wildcard character.

Eg, if I tell it to search for conf it should locate the following (if they exist):

confsystem
configure
confused
conf_new

In fact, this is what frustrates me about mIRC, is that it doesn't do that, and you have to further specify a wildcard character such as a * to make it search through the list.

An example of this is /hfree -sw

Anyway, this is a minor point, and personal preference too.


--------
mIRC - fun for all the family (except grandma and grandpa)
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
This is easily scriptable too:
Code:
alias hlist {
  var %i = 1
  if $1 != -w || $0 == 1 {
    echo -aiec info * Showing all hash tables
    while $hget(%i) { 
      echo -ac info2 $ifmatch - $hget($ifmatch).size
      inc %i 
    }
    goto end
  }
  var %a, %w = $iif(* isin $2 || ? isin $2,$2,* $+ $2*)
  echo -aiec info * Showing hash tables matching: $2 - size: $3
  if $3 !isnum 1- {
    while $hget(%i) {
      %a = $ifmatch
      if %w iswm %a { echo -ac info2 %a - $hget(%a).size }
      inc %i 
    }
    goto end
  } 
  while $hget(%i) {
    %a = $ifmatch
    if $3 == $hget(%a).size &amp;&amp; %w iswm %a { echo -ac info2 %a - $3 }
    inc %i
  }
  :end
  echo -aiec info * End of matching hash tables list
}


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Oct 2003
Posts: 7
B
B0P Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Oct 2003
Posts: 7
Eek, a goto loop.

For some reason I thought mIRC had this built in, but I guess not. It would be worthwhile to add then, heck, we've got /ulist don't we?

Anyway....

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
There is no goto loop in the code, only a goto jump at the end of the alias, to avoid writing the /echo string twice.


Quote:
It would be worthwhile to add then, heck, we've got /ulist don't we?

Maybe. I didn't comment on the usefulness of a built-in /hlist, if that's what you thought. The scripted /hlist was a reply to neophyte's first post where he said "I know one could use if $hget(name) to find out if a table exists or not, but it isn't exactly suited for mass searching/listing."


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jan 2003
Posts: 119
A
AKO Offline
Vogon poet
Offline
Vogon poet
A
Joined: Jan 2003
Posts: 119
yeah, a function of /hlist could prove useful. I wouldn't see why not.

I mean it's not a dire "I must have this now" function, but hey it sounds logical.


Link Copied to Clipboard