Example #1
0
    public short IDClass(string name)
    {
        byte[] bytes = ByteArrayManager.GetCString(name);
        fixed(byte *c = bytes)
        {
            short imax = numClasses;
            short imin = 1;

            while (imax >= imin)
            {
                short icur = (short)((imin + imax) / 2);
                long  icmp = ByteArrayManager.strcmp(classes[icur].className, c);
                if (icmp == 0)
                {
                    return(icur);
                }
                if (icmp > 0)
                {
                    imax = (short)(icur - 1);
                }
                else
                {
                    imin = (short)(icur + 1);
                }
            }

            return(0);
        }
    }
Example #2
0
    public short IDMethodName(string name)
    {
        byte[] bytes = ByteArrayManager.GetCString(name);
        fixed(byte *m = bytes)
        {
            short imax = numMethodNames;
            short imin = 1;

            while (imax >= imin)
            {
                short icur = (short)((imin + imax) / 2);
                long  icmp = ByteArrayManager.strcmp(methodNames[icur], m);
                if (icmp == 0)
                {
                    return(icur);
                }
                if (icmp > 0)
                {
                    imax = (short)(icur - 1);
                }
                else
                {
                    imin = (short)(icur + 1);
                }
            }

            return(0);
        }
    }
Example #3
0
    public short IDType(string type)
    {
        byte[] bytes = ByteArrayManager.GetCString(type);
        fixed(byte *t = bytes)
        {
            short imax = numTypes;
            short imin = 1;

            while (imax >= imin)
            {
                short icur = (short)((imin + imax) / 2);
                long  icmp = ByteArrayManager.strcmp(types[icur].name, t);
                if (icmp == 0)
                {
                    return(icur);
                }

                if (icmp > 0)
                {
                    imax = (short)(icur - 1);
                }
                else
                {
                    imin = (short)(icur + 1);
                }
            }

            return(0);
        }
    }