コード例 #1
0
ファイル: symbols.cs プロジェクト: jtmueller/frotzcore
 internal static int PrintPropertyName(ulong property_names_base, int prop_no)
 {
     if (property_names_base > 0)
     {
         return(InfInfo.PrintInformAttributeName(property_names_base, prop_no));
     }
     else if ((prop_no < property_entries) && property_names_table[prop_no].symtype == SymTypes.sym_property)
     {
         txio.TxPrint(property_names_table[prop_no].name);
         return(1);
     }
     return(0);
 }
コード例 #2
0
ファイル: symbols.cs プロジェクト: jtmueller/frotzcore
        /*
         * print_attribute_name
         *
         * Prints the name of the attribute, if known.
         */

        internal static int PrintAttributeName(ulong attr_names_base, int attr_no)
        {
            if (attr_names_base > 0)
            {
                return(InfInfo.PrintInformAttributeName(attr_names_base, attr_no));
            }
            else if ((attr_no < attribute_entries) && attribute_names_table[attr_no].symtype == SymTypes.sym_attribute)
            {
                txio.TxPrint(attribute_names_table[attr_no].name);
                return(1);
            }
            return(0);
        }
コード例 #3
0
ファイル: showobj.cs プロジェクト: jtmueller/frotzcore
        }/* configure_object_tables */

        /*
         * show_objects
         *
         * List all objects and property data.
         */

        internal static void show_objects(int symbolic)
        {
            ulong object_address, address;
            uint  data, pobj, nobj, cobj;
            int   i, j, k, list;
            ulong class_numbers_base;
            ulong property_names_base;
            ulong attr_names_base;


            /* Get objects configuration */

            ConfigureObjectTables(out int obj_count, out ulong obj_table_base, out ulong obj_table_end,
                                  out ulong obj_data_base, out ulong obj_data_end);

            if (symbolic != 0)
            {
                InfInfo.ConfigureInformTables(obj_data_end, out ushort inform_version, out class_numbers_base, out ulong class_numbers_end,
                                              out property_names_base, out ulong property_names_end, out attr_names_base, out ulong attr_names_end);
            }
            else
            {
                attr_names_base = property_names_base = class_numbers_base = 0;
            }

            txio.TxPrint("\n    **** Objects ****\n\n");
            txio.TxPrintf("  Object count = {0}\n", obj_count);

            /* Iterate through each object */

            for (i = 1; (uint)i <= obj_count; i++)
            {
                txio.TxPrint('\n');

                /* Get address of object */

                object_address = (ulong)GetObjectAddress(i);

                /* Display attributes */
                if (txio.header is null)
                {
                    throw new InvalidOperationException("txio header was not initialized");
                }

                txio.TxPrintf("{0:d3}. Attributes: ", (int)i);
                list = 0;
                for (j = 0; j < (((uint)txio.header.version < TxH.V4) ? 4 : 6); j++)
                {
                    data = txio.ReadDataByte(ref object_address);
                    for (k = 7; k >= 0; k--)
                    {
                        if (((data >> k) & 1) > 0)
                        {
                            txio.TxPrint((System.ReadOnlySpan <char>)((list++) > 0 ? ", " : ""));
                            if (Symbols.PrintAttributeName(attr_names_base, (j * 8) + (7 - k)) > 0)
                            {
                                txio.TxPrintf("({0:d})", (int)((j * 8) + (7 - k)));
                            }
                            else
                            {
                                txio.TxPrintf("{0:d}", (int)((j * 8) + (7 - k)));
                            }
                        }
                    }
                }
                if (list == 0)
                {
                    txio.TxPrint("None");
                }
                txio.TxPrint('\n');

                /* Get object linkage information */

                if ((uint)txio.header.version < TxH.V4)
                {
                    pobj = txio.ReadDataByte(ref object_address);
                    nobj = txio.ReadDataByte(ref object_address);
                    cobj = txio.ReadDataByte(ref object_address);
                }
                else
                {
                    pobj = txio.ReadDataWord(ref object_address);
                    nobj = txio.ReadDataWord(ref object_address);
                    cobj = txio.ReadDataWord(ref object_address);
                }
                address = txio.ReadDataWord(ref object_address);
                txio.TxPrintf("     Parent object: {0:d3}  ", (int)pobj);
                txio.TxPrintf("Sibling object: {0:d3}  ", (int)nobj);
                txio.TxPrintf("Child object: {0:d3}\n", (int)cobj);
                txio.TxPrintf("     Property address: {0:X4}\n", (ulong)address);
                txio.TxPrint("         Description: \"");

                /* If object has a description then display it */

                if ((uint)txio.ReadDataByte(ref address) > 0)
                {
                    txio.DecodeText(ref address);
                }
                txio.TxPrint("\"\n");

                /* Print property list */

                txio.TxPrint("          Properties:\n");
                PrintPropertyList(ref address, property_names_base);
            }
        }/* show_objects */