view paper/src/mkdir.cbc @ 45:d40d5c4e392f

fix introduction
author matac42 <matac@cr.ie.u-ryukyu.ac.jp>
date Tue, 01 Feb 2022 14:11:38 +0900
parents 124583e0b372
children
line wrap: on
line source

__code mkdir(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
    struct FTree* newDirectory = createFileSystemTree(context, gearsDirectory->currentDirectory);
    Node* inode = new Node();
    inode->key = gearsDirectory->INodeNumber;
    inode->value = newDirectory;
    struct FTree* cDirectory = new FTree();
    cDirectory = gearsDirectory->iNodeTree;
    goto cDirectory->put(inode, mkdir2);
}

__code mkdir2(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
    Node* dir = new Node();
    dir->key = name->value;
    Integer* iNum = new Integer();
    iNum->value = gearsDirectory->INodeNumber;
    dir->value = iNum;
    gearsDirectory->INodeNumber = gearsDirectory->INodeNumber + 1;
    struct FTree* cDirectory = new FTree();
    cDirectory = gearsDirectory->currentDirectory;
    goto cDirectory->put(dir, next(...));
}