-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: further shrink test for #22.
Once this one passes, should also try pass_ext2-mount.cogent
- Loading branch information
Zilin Chen
authored and
Zilin Chen
committed
Mar 6, 2018
1 parent
3b57a04
commit 091ad40
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
type Result a b = <Success a | Error b> | ||
|
||
type Option a | ||
type WordArray a | ||
|
||
type FsState = { | ||
superblock_num : U32, | ||
flags : U32, | ||
prealloc_offsets : Option (WordArray U32) | ||
} | ||
|
||
malloc_FsState: () -> Result (FsState take (..)) () | ||
|
||
wordarray_create : all (a :< DS). () -> Result (WordArray a) () | ||
|
||
free_FsState : FsState take (..) -> () | ||
|
||
fs_mount: () -> Result FsState U32 | ||
fs_mount _ = | ||
malloc_FsState () | ||
| Success state_t -> | ||
let state_t = state_t { superblock_num = 1 } | ||
in wordarray_create () | ||
| Success prealloc_offsets => | ||
let state = state_t { | ||
flags = 2, | ||
prealloc_offsets = Some prealloc_offsets | ||
} | ||
in Success state | ||
| Error _ -> | ||
let _ = free_FsState state_t | ||
in Error 1 | ||
| Error _ -> Error 2 | ||
|
||
|