mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-11-05 06:43:44 +02:00
61 lines
1.8 KiB
COBOL
61 lines
1.8 KiB
COBOL
#pypp 0
|
|
// Iris: micro-kernel for a capability-based operating system.
|
|
// source/test.ccp: Testing program.
|
|
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#include <iris.hh>
|
|
#include <devices.hh>
|
|
|
|
bool match (char const *a, char const *b):
|
|
for unsigned i = 0; i < 11; ++i:
|
|
if a[i] != b[i]:
|
|
return false
|
|
return true
|
|
|
|
Iris::Num start ():
|
|
Iris::Directory dir = Iris::my_parent.get_capability <Iris::Directory> ()
|
|
dir.lock_ro ()
|
|
Iris::Num files = dir.get_size ()
|
|
for Iris::Num i = 0; i.value () < files.value (); i = i.value () + 1:
|
|
Iris::String f = dir.get_name (i)
|
|
char start[16]
|
|
f.get_chars (0, start)
|
|
if match (start, "TEST TXT"):
|
|
Iris::free_cap (f)
|
|
f = dir.get_file_ro (i)
|
|
dir.unlock_ro ()
|
|
Iris::Page p = f.get_block (0)
|
|
char *mapping = (char *)0x15000
|
|
Iris::my_memory.map (p, (unsigned)mapping)
|
|
for unsigned j = 0; j < PAGE_SIZE; ++j:
|
|
kdebug_char (mapping[j])
|
|
kdebug_char ('\n')
|
|
return 0
|
|
unsigned i
|
|
for i = 0; i < 16; ++i:
|
|
if start[i] != 0:
|
|
break
|
|
if i < 16:
|
|
for i = 0; i < 16; ++i:
|
|
kdebug_num (start[i], 2)
|
|
kdebug (" ")
|
|
for i = 0; i < 16; ++i:
|
|
kdebug_char (start[i])
|
|
kdebug ("\n")
|
|
Iris::free_cap (f)
|
|
kdebug ("file test.txt not found\n")
|
|
return 1
|