Provide uniform isXxx functions in the standard modules.

With this patch, the following param functions are provided that test
whether the argument is or is of the corresponding type:

  isVoid
  isBool
  isInt
  isUint
  isReal
  isImag
  isComplex
  isString

  isEnum
  isTuple
  isHomogeneousTuple

  isClass
  isRecord
  isUnion

  isRange
  isDomain
  isArray
  isDmap    // a dmap-wrapped distribution

  isSync
  isSingle
  isAtomic

The following aggregate queries are also provided:

  isFloat       // real, imag
  isIntegral    // int, uint
  isNumeric     // int, uint, real, imag, complex

  isPrimitive   // primitive type as defined by the spec:
                // void, bool, int, uint, real, imag, complex, string

Each function has a version that takes a 'type' argument
and a version that takes a non-type argument, typically by blank intent.
There are also the corresponding isXxxType() and isXxxValue varieties.
For example:

  proc isRecord(type t)     param  return isRecordType(t);
  proc isRecord(e)          param  return isRecordValue(e);
  proc isRecordType(type t) param ...
  proc isRecordValue(e)     param ...

isHomogeneousTupleValue() is defined on tuples only,
to preserve the existing behavior of isHomogeneousTuple().

Also added the following queries:

  isType  - true when the argument is a type,  false otherwise
  isParam - true when the argument is a param, false otherwise

I inlined (then deleted) a couple of _isXxx functions that had single uses.

I replaced chpl__isRange() with isRange(), and analogously
for a couple of others.

There are a few other functions whose names start with _
that I did not address in this commit.

TODO: handle _isPrimitiveType - Brad has a patch for it.


DETAILED NOTES

The above functions on types have all been there already, so this
patch renames some of them -- see the script below for details -- plus
reorganizes them somewhat.

The above functions on values were mostly missing, so this patch
adds them, plus reorganizes and/or renames a couple of them.

I added the pragma "no instantiation limit" to the type-oriented queries
for consistency with what has been in Types.chpl already.
We might need to add it to the value-oriented queries.

I needed to change chpl__isType -> isType in the compiler.
The other subdirs, e.g. spec or runtime, did not seem to need it.

Most diffs in this commit are due to uses of the above functions.
The diffs due to definition changes are mostly in:

modules/internal/ChapelBase.chpl  (at the bottom of the diffs)
modules/internal/ChapelSyncvar.chpl
modules/internal/ChapelTuple.chpl
modules/standard/Types.chpl  (most def changes are here)


For archiving purposes - I used this script to do the renaming:

---------------------------------
#!/usr/bin/env python

import sys, os, shutil, subprocess, string, signal
import re

verbose = True
vv = False
vrepl = True

# Pairs "from name", "to name".
# Ordered by the "to name". Aggregate queries are all at the bottom.
#
replspec = [
#  ("isArrayType",       "isArray"),
#  ("isAtomicType",      "isAtomic"),
  ("_isBooleanType",    "isBoolType"),
#  ("isClassType",       "isClass"),
  ("_isComplexType",    "isComplexType"),
#  ("isDmapType",        "isDmap"),
#  ("isDomainType",      "isDomain"),
  ("_isEnumeratedType", "isEnumType"),
  ("_isImagType",       "isImagType"),
  ("_isSignedType",     "isIntType"),
#  ("isRangeType",       "isRange"),
  ("_isRealType",       "isRealType"),
#  ("isRecordType",      "isRecord"),
  ("_isSingleType",     "isSingleType"),
  ("_isSingle",         "isSingle"),
  ("_isSyncType",       "isSyncType"),
  ("_isSync",           "isSync"),
#  ("isTupleType",       "isTuple"),
  ("_isUnsignedType",   "isUintType"),
#  ("isUnionType",       "isUnion"),
#
  ("_isIntegralType",   "isIntegralType"),
  ("_isFloatType",      "isFloatType"),
  ("_isNumericType",    "isNumericType"),
#
  ("chpl__isType",      "isType"),
  ("chpl__isRange",  "isRange"),
  ("chpl__isDomain", "isDomain"),
  ("chpl__isArray",  "isArray"),
  ("chpl__isDmap",   "isDmap"),
]

if vv:
  print replspec

def REPL(sfrom, sto):
  sfromW = '\\b' + sfrom + '\\b'
  global srcContents
  (srcContents, cnt) = re.subn(sfromW, sto, srcContents)
  if cnt > 0 and vrepl:
    sys.stdout.write("%4d  %20s -> %10s\n"%(cnt, sfrom, sto))
  return cnt

print "starting", "\n"

# invoke from CHPL_HOME
# I also ran similar incantations on subdirs: compiler runtime spec
sourcesStream = os.popen("find modules* test -name \\*.chpl")
for srcName in sourcesStream:
  srcName = srcName.rstrip()
  if os.path.isdir(srcName):
    print "=== ", srcName, " ===  directory"
    continue
  print "=== ", srcName, " ==="
  srcFile = open(srcName)
  srcContents = srcFile.read()
  srcFile.close()
  if vv:
    print srcContents
  cnt = 0
  for replPair in replspec:
    cnt += REPL(replPair[0], replPair[1])

  if vv:
    print "totalreplaced: ", cnt
    print srcContents

  if cnt > 0:
    sys.stdout.write("updating%5d  repls  %s\n"%(cnt, srcName))
    shutil.move(srcName, srcName+".bak")
    srcRepl = open(srcName, 'w')
    srcRepl.write(srcContents)
    srcRepl.close()
    

print "done"
sourcesStream.close()
---------------------------------