Mercurial > hg > CbC > CbC_xv6
changeset 247:63a65e3a5340
tweak_regex...
author | anatofuz |
---|---|
date | Tue, 04 Feb 2020 11:57:39 +0900 |
parents | 7e4e7f864970 |
children | 96fd8e1db32f |
files | src/gearsTools/generate_stub.pl src/gearsTools/lib/Gears/Util.pm src/impl/vm_impl.h src/interface/TaskManager.h src/interface/vm.h |
diffstat | 5 files changed, 8 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gearsTools/generate_stub.pl Tue Feb 04 11:35:37 2020 +0900 +++ b/src/gearsTools/generate_stub.pl Tue Feb 04 11:57:39 2020 +0900 @@ -141,7 +141,7 @@ } if (/__code (\w+)/) { my $args = $'; - while ($args =~ /(struct|union|const)?\s*([\w\[\]_]+)\*?\s*(\w+),?/g) { + while ($args =~ /\s*(struct|union|const)?\s*([\w\[\]_]+)\*?\s*(\w+),?/g) { #$args eq (Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...)); my $const_type = $1; my $ttype = $2;
--- a/src/gearsTools/lib/Gears/Util.pm Tue Feb 04 11:35:37 2020 +0900 +++ b/src/gearsTools/lib/Gears/Util.pm Tue Feb 04 11:57:39 2020 +0900 @@ -3,7 +3,6 @@ use warnings; use Carp qw/croak/; use File::Find; -use List::Util qw/uniq/; sub parse { my ($class, $file_name) = @_; @@ -58,7 +57,7 @@ push(@tmp_args,"enum Code $1;\n"); my $args = $'; #$args eq (Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...)); - while ($args =~ /(struct|union|const)?\s*([\w*\[\]_]+)\s*(\w+),?/g) { + while ($args =~ /\s*(struct|union|const)?\s*([\w*\[\]_]+)\s*(\w+),?/g) { my $const_type = $1; my $type = $2; my $vname = $3; @@ -74,10 +73,15 @@ push(@tmp_args,$line); } - push(@{$ir->{content}}, uniq(@tmp_args)); + push(@{$ir->{content}}, _uniq(@tmp_args)); return $ir; } +sub _uniq { + my %seen; + return grep { !$seen{$_}++ } @_; +} + sub parse_with_rewrite { my ($class, $file) = @_; my $ir = _parse_base($file);
--- a/src/impl/vm_impl.h Tue Feb 04 11:35:37 2020 +0900 +++ b/src/impl/vm_impl.h Tue Feb 04 11:57:39 2020 +0900 @@ -1,33 +1,4 @@ typedef struct vm_impl<Impl, Isa> impl vm{ - union Data* vm_impl; - uint i; - pte_t* pte; - uint sz; - pde_t* pgdir; - char* addr; - struct inode* ip; - uint offset; - uint pa; - uint n; - uint oldsz; - uint newsz; - uint a; - int ret; - char* mem; - char* uva; - pde_t* d; - uint ap; - uint phy_low; - uint phy_hi; - uint va; - void* pp; - uint len; - char* buf; - char* pa0; - uint va0; - proc_struct* p; - char* init; - __code kpt_alloc_check_impl(Type* vm_impl, __code next(...)); __code loaduvm_ptesize_check(Type* vm_impl, __code next(int ret, ...)); __code loaduvm_loop(Type* vm_impl, uint i, pte_t* pte, uint sz, __code next(int ret, ...));
--- a/src/interface/TaskManager.h Tue Feb 04 11:35:37 2020 +0900 +++ b/src/interface/TaskManager.h Tue Feb 04 11:57:39 2020 +0900 @@ -1,7 +1,4 @@ typedef struct TaskManager<Impl>{ - union Data* taskManager; - struct Context* task; - struct Element* taskList; __code spawn(Impl* taskManager, struct Context* task, __code next(...)); __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...));
--- a/src/interface/vm.h Tue Feb 04 11:35:37 2020 +0900 +++ b/src/interface/vm.h Tue Feb 04 11:57:39 2020 +0900 @@ -1,22 +1,4 @@ typedef struct vm<Type,Impl> { - union Data* vm; - uint low; - uint hi; - struct proc* p; - pde_t* pgdir; - char* init; - uint sz; - char* addr; - struct inode* ip; - uint offset; - uint oldsz; - uint newsz; - char* uva; - uint va; - void* pp; - uint len; - uint phy_low; - uint phy_hi; __code init_vmm(Impl* vm, __code next(...)); __code kpt_freerange(Impl* vm, uint low, uint hi, __code next(...)); __code kpt_alloc(Impl* vm ,__code next(...));