Several fixes

This commit is contained in:
mterwoord_cp 2008-08-16 14:06:00 +00:00
parent 26c019f790
commit b4837bc07d
9 changed files with 67 additions and 22 deletions

View file

@ -18,9 +18,9 @@ namespace Cosmos.Playground.Kudzu {
//System.Diagnostics.Debugger.Break();
Console.WriteLine("Boot complete");
//PCITest.Test();
PCITest.Test();
//Tests.DoAll();
RTL8139.Test();
//RTL8139.Test();
//TODO: Make this automatically called after Init if no other shut downs are called
Cosmos.Sys.Deboot.Halt();

View file

@ -6775,7 +6775,7 @@ namespace Cosmos.Hardware {
}
else if ((address & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY)
{
UInt32 size = ~(PCI_BASE_ADDRESS_MEM_MASK & flags)+1;
UInt32 size = (~(PCI_BASE_ADDRESS_MEM_MASK & flags))+1;
IOMaps[i] = new Kernel.MemoryAddressSpace(address, size);
//Console.WriteLine("register " + i + " - " + size + "b mem");
@ -6834,7 +6834,7 @@ namespace Cosmos.Hardware {
/// <summary>
/// Is this a multifunction device?
/// </summary>
public bool IsMultiFunction { get { return (Read8(0x0e) & 0x80) != 0; } }
public bool IsMultiFunction { get { return (Read8(0x0e) & 0xF0) != 0; } }
/// <summary>
/// The Vendor ID

View file

@ -91,6 +91,41 @@ namespace Cosmos.Kernel.Plugs {
return new global::System.String(xChars);
}
public static int IndexOf(string aThis, string aSubStr, int aStart, int aLength, StringComparison aComparison) {
int xEndIdx = aStart + aLength;
for (int i = aStart; i < xEndIdx; i++) {
bool xFound = true;
for (int j = 0; j < aSubStr.Length; j++) {
if (aThis[i + j] != aSubStr[j]) {
xFound = false;
break;
}
}
if (xFound) {
return i;
}
}
return -1;
}
public static bool EndsWith(string aThis, string aSubStr, StringComparison aComparison) {
int xLastIdx = aThis.Length - aSubStr.Length - 1;
for(int i = 0; i < aSubStr.Length; i++) {
if(aThis[xLastIdx+i] != aSubStr[i]) {
return false;
}
}
return true;
}
// System.Int32 System.String.IndexOf(System.String, System.Int32, System.Int32, System.StringComparison)
public static bool Equals(string aThis, string aThat, StringComparison aComparison) {
#warning TODO: implement
return EqualsHelper(aThis,
aThat);
}
public static bool EqualsHelper(string aStrA,
string aStrB) {
return aStrA.CompareTo(aStrB) == 0;

View file

@ -31,19 +31,19 @@ namespace Cosmos.Sys.Plugs
aStorage = VFSManager.GetDirectoryEntry(aPath);
}
public static bool get_Exists([FieldAccess(Name = "$$Storage$$")] ref FilesystemEntry aStorage)
public static bool get_Exists(DirectoryInfo aThis, [FieldAccess(Name = "$$Storage$$")] ref FilesystemEntry aStorage)
{
//TODO: actually test if it exists
return (aStorage != null);
}
public static string get_FullName([FieldAccess(Name="$$Storage$$")] ref FilesystemEntry aStorage)
public static string get_FullName(DirectoryInfo aThis, [FieldAccess(Name = "$$Storage$$")] ref FilesystemEntry aStorage)
{
//TODO: return FULL name
return aStorage.Name;
}
public static string get_Name([FieldAccess(Name = "$$Storage$$")] ref FilesystemEntry aStorage)
public static string get_Name(DirectoryInfo aThis, [FieldAccess(Name = "$$Storage$$")] ref FilesystemEntry aStorage)
{
return aStorage.Name;
}
@ -61,11 +61,11 @@ namespace Cosmos.Sys.Plugs
// return xFiles.ToArray();
//}
//public static string ToString([FieldAccess(Name = "$$Path$$")] ref String aPath)
//{
// return "ToString()";
//}
public static string ToString([FieldAccess(Name = "$$Path$$")] ref String aPath)
{
return "DirectoryInfo.ToString() not yet implemented";
}
}
}

View file

@ -34,5 +34,9 @@ namespace Cosmos.Sys.Plugs
{
return VFSManager.FileExists(aStorage.Name);
}
public static string ToString(FileInfo aThis) {
return "FileInfo.ToString() not yet implemented!";
}
}
}

View file

@ -65,8 +65,8 @@ namespace FrodeTest
//Test.LinqTest.RunTest();
//Test.ExceptionTest.RunTest();
//Test.FilesystemEntryTest.RunTest();
Test.VirtualFileSystemTest.RunTest();
//Test.DirectoryInfoTest.RunTest();
//Test.VirtualFileSystemTest.RunTest();
Test.DirectoryInfoTest.RunTest();
//Test.FileInfoTest.RunTest();
//Tests ready for Matthijs to fix ;)

View file

@ -15,14 +15,14 @@ namespace FrodeTest.Test
//Console.WriteLine("CurrentDirectory: " + Environment.CurrentDirectory);
DirectoryInfo dir = new DirectoryInfo("/0/lost+found/");
Console.WriteLine("FullName: " + dir.FullName);
//Console.WriteLine("FullName: " + dir.FullName);
Console.WriteLine("Name: " + dir.Name);
Console.WriteLine("ToString: " + dir.ToString());
//Console.WriteLine("ToString: " + dir.ToString());
Console.WriteLine("Files in the directory:");
foreach (FileInfo file in dir.GetFiles())
Console.WriteLine(file.Name);
//Console.WriteLine("Files in the directory:");
//foreach (FileInfo file in dir.GetFiles())
// Console.WriteLine(file.Name);
if (dir.Exists)

View file

@ -17,7 +17,7 @@ namespace Indy.IL2CPU.IL.X86.CustomImplementations.System {
return VTablesImpl.GetTypeName(xObjectType);
}
public static string get_Message(Exception aThis, [FieldAccess(Name = "System.String System.Exception._message")]string mMessage)
public static string get_Message(Exception aThis, [FieldAccess(Name = "System.String System.Exception._message")]ref string mMessage)
{
return mMessage;
}

View file

@ -146,7 +146,13 @@ namespace MatthijsTest {
var xBoot = new Cosmos.Sys.Boot();
xBoot.Execute();
}
try {
throw new Exception("Test error");
}
catch (Exception E) {
Console.Write("Error: ");
Console.WriteLine(E.Message);
}
Console.WriteLine("Done");
do
{