Exemplo n.º 1
0
        /// <summary>
        /// Sets the value of a field occurrence in an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// new field occurrence value.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="occ">
        /// The field occurrence number.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field occurrence, as a byte, short, int,
        /// float, double, string or byte[].
        /// </param>
        ///
        /// <remarks>
        /// The given value is converted to match the type of the field
        /// using the conversion rules summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFchg32(3fml) manual page.
        /// </exception>

        public void Fchg(ref ByteBuffer fbfrRef, int fldid, int occ, object value)
        {
            while (!FML32.SFchg(fbfrRef, fldid, occ, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 2
0
        /*----------------*/
        /* Fadd() methods */
        /*----------------*/

        /// <summary>
        /// Adds a field to an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// added field.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field, as a byte.
        /// </param>
        ///
        /// <remarks>
        /// The given byte value is converted to match the type of the field
        /// using the conversion rules for FML source type char summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFadd32(3fml) manual page.
        /// </exception>

        public void FaddByte(ref ByteBuffer fbfrRef, int fldid, byte value)
        {
            while (!FML32.SFaddByte(fbfrRef, fldid, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a field to an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// added field.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field, as a byte, short, int,
        /// float, double, string or byte[].
        /// </param>
        ///
        /// <remarks>
        /// The given value is converted to match the type of the field
        /// using the conversion rules summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFadd32(3fml) manual page.
        /// </exception>

        public void Fadd(ref ByteBuffer fbfrRef, int fldid, object value)
        {
            while (!FML32.SFadd(fbfrRef, fldid, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a field to an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// added field.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field, as a string.
        /// </param>
        ///
        /// <remarks>
        /// The given string value is converted to match the type of the field
        /// using the conversion rules for FML source type string summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFadd32(3fml) manual page.
        /// </exception>

        public void FaddString(ref ByteBuffer fbfrRef, int fldid, string value)
        {
            while (!FML32.SFaddString(fbfrRef, fldid, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds a field to an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// added field.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field, as a float.
        /// </param>
        ///
        /// <remarks>
        /// The given float value is converted to match the type of the field
        /// using the conversion rules for FML source type float summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFadd32(3fml) manual page.
        /// </exception>

        public void FaddFloat(ref ByteBuffer fbfrRef, int fldid, float value)
        {
            while (!FML32.SFaddFloat(fbfrRef, fldid, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 6
0
    static void Init()
    {
        TUXDIR = TUX.tuxgetenv("TUXDIR");
        if (TUXDIR == null)
        {
            Console.WriteLine("ERROR: Environment variable TUXDIR not set");
            Environment.Exit(1);
        }

        APPDIR = Environment.CurrentDirectory;

        hasWSL = File.Exists(TUXDIR + "\\bin\\WSL.exe");

        TUXCONFIG = APPDIR + "\\TUXCONFIG";
        if (File.Exists(TUXCONFIG))
        {
            File.Delete(TUXCONFIG);
        }

        TLOG = APPDIR + "\\TLOG";
        if (File.Exists(TLOG))
        {
            File.Delete(TLOG);
        }

        QSPACE = APPDIR + "\\QSPACE";
        if (File.Exists(QSPACE))
        {
            File.Delete(QSPACE);
        }

        TUX.tuxputenv("TUXCONFIG=" + TUXCONFIG);

        FML32.AddFieldTable(TUXDIR + "\\udataobj\\tpadm");
    }
Exemplo n.º 7
0
    static void Set(string cls, string state, string[] attributes)
    {
        ByteBuffer fbfr = ATMI.tpalloc("FML32", null, 1024);

        try {
            TPFBuilder.I.FaddString(ref fbfr, TMIB.TA_OPERATION, "SET");
            TPFBuilder.I.FaddString(ref fbfr, TMIB.TA_CLASS, cls);
            if (state != null)
            {
                TPFBuilder.I.FaddString(ref fbfr, TMIB.TA_STATE, state);
                if (state.Equals("CLEANING"))
                {
                    TPFBuilder.I.FaddInt(ref fbfr, TMIB.TA_FLAGS, TMIB.QMIB_FORCECLOSE);
                }
            }
            foreach (string attribute in attributes)
            {
                int    eqPos   = attribute.IndexOf('=');
                string key     = attribute.Substring(0, eqPos);
                string val     = attribute.Substring(eqPos + 1);
                int    fieldID = FML32.Fldid(key);
                TPFBuilder.I.FaddString(ref fbfr, fieldID, val);
            }
            try {
                Console.WriteLine("INFO: Executing " + cls + ".SET(" + state + ", "
                                  + ToString(attributes) + ")");
                ATMI.tpadmcall(fbfr, ref fbfr, 0);
            } catch (TPEMIB) {
                Console.WriteLine("ERROR: " + FML32.ToString(fbfr));
                Environment.Exit(1);
            }
        } finally {
            ATMI.tpfree(fbfr);
        }
    }
Exemplo n.º 8
0
        /// <summary>
        /// Sets the value of a field occurrence in an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// new field occurrence value.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="occ">
        /// The field occurrence number.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field occurrence, as a byte[].
        /// </param>
        ///
        /// <remarks>
        /// The given byte[] value is converted to match the type of the field
        /// using the conversion rules for FML source type carray summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFchg32(3fml) manual page.
        /// </exception>

        public void FchgBytes(ref ByteBuffer fbfrRef, int fldid, int occ,
                              byte[] value)
        {
            while (!FML32.SFchgBytes(fbfrRef, fldid, occ, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Sets the value of a field occurrence in an FML32 buffer.
        /// </summary>
        ///
        /// <param name="fbfrRef">
        /// The FML32 buffer.
        /// Gets reallocated if needed to accomodate the
        /// new field occurrence value.
        /// </param>
        ///
        /// <param name="fldid">
        /// The field identifier.
        /// </param>
        ///
        /// <param name="occ">
        /// The field occurrence number.
        /// </param>
        ///
        /// <param name="value">
        /// The value of the field occurrence, as a double.
        /// </param>
        ///
        /// <remarks>
        /// The given double value is converted to match the type of the field
        /// using the conversion rules for FML source type double summarized in Table 5-2 of
        /// the Tuxedo FML programming guide.
        /// </remarks>
        ///
        /// <exception cref="FException">
        /// See the Tuxedo CFchg32(3fml) manual page.
        /// </exception>

        public void FchgDouble(ref ByteBuffer fbfrRef, int fldid, int occ,
                               double value)
        {
            while (!FML32.SFchgDouble(fbfrRef, fldid, occ, value))
            {
                grow(ref fbfrRef);
            }
        }
Exemplo n.º 10
0
    public static void Main(string[] args)
    {
        if (args.Length == 0)
        {
            Console.WriteLine("Usage: SimpleFML32Client <field>=<value> ...");
            Environment.Exit(1);
        }

        ATMI.tpinit(null);
        try
        {
            ByteBuffer fbfr = ATMI.tpalloc("FML32", null, 512);
            try
            {
                foreach (string arg in args)
                {
                    int    eqPos = arg.IndexOf('=');
                    string key   = arg.Substring(0, eqPos);
                    string val   = arg.Substring(eqPos + 1);
                    int    fldid = FML32.Fldid(key);
                    TPFBuilder.I.FaddString(ref fbfr, fldid, val);
                }

                int len;
                ATMI.tpcall("FML32_TOUPPER", fbfr, 0, ref fbfr, out len, 0);

                Console.WriteLine("Returned FML32 buffer is: " + FML32.ToString(fbfr));
            }
            finally
            {
                ATMI.tpfree(fbfr);
            }
        }
        finally
        {
            ATMI.tpterm();
        }
    }
Exemplo n.º 11
0
    public static void FML32_TOUPPER(TPSVCINFO rqst)
    {
        ByteBuffer fbfr = rqst.data;

        int fldid = FML32.FIRSTFLDID;
        int occ   = 0;

        while (FML32.Fnext(fbfr, ref fldid, ref occ))
        {
            int occur = FML32.Foccur(fbfr, fldid);
            if (FML32.Fldtype(fldid) == FML32.FLD_STRING)
            {
                for (int i = 0; i < occur; i++)
                {
                    string s = FML32.FgetString(fbfr, fldid, i);
                    s = s.ToUpper();
                    FML32.Fchg(fbfr, fldid, i, s);
                }
            }
            occ = occur; // Skip to next field id
        }

        ATMI.tpreturn(ATMI.TPSUCCESS, 0, fbfr, 0, 0);
    }
Exemplo n.º 12
0
 private void grow(ref ByteBuffer fbfrRef)
 {
     fbfrRef = realloc(fbfrRef, (int)(FML32.Fsizeof(fbfrRef) * 1.5));
 }