about summary refs log tree commit diff stats
path: root/wiki/lib/plugins/extension/lang/cy
stat options
Period:
Authors:

Commits per author per week (path 'wiki/lib/plugins/extension/lang/cy')

AuthorW15 2025W16 2025W17 2025W18 2025Total
Total00000
ms using 'assume-filesystem'' href='/akkartik/mu/commit/088file.mu?h=hlt&id=bc98ddb2b699682dffb5590f9c5e5b2bf36cb278'>bc98ddb2 ^
da925d06 ^




ebea4c3f ^

























da925d06 ^

ebea4c3f ^
da925d06 ^







da925d06 ^
ff16e04f ^
a621ef95 ^

ebea4c3f ^















a621ef95 ^
















ff16e04f ^
da925d06 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



                                                                            





                                  




                                                                                                                

























                                                                                    

 
                                                                                                







                                       
                    
                          

 















                                                                                                                     
















                                                                                                                             
                          
 
# Wrappers around file-system primitives that take a 'filesystem' object and
# are thus easier to test.

container filesystem [
  data:address:array:file-mapping
]

container file-mapping [
  name:address:array:character
  contents:address:array:character
]

def start-reading fs:address:filesystem, filename:address:array:character -> contents:address:source:character [
  local-scope
  load-ingredients
  {
    break-if fs
    # real file-system
    file:number <- $open-file-for-reading filename
    assert file, [file not found]
    contents:address:source:character, sink:address:sink:character <- new-channel 30
    start-running transmit-from-file file, sink
    return
  }
  # fake file system
  i:number <- copy 0
  data:address:array:file-mapping <- get *fs, data:offset
  len:number <- length *data
  {
    done?:boolean <- greater-or-equal i, len
    break-if done?
    tmp:file-mapping <- index *data, i
    curr-filename:address:array:character <- get tmp, name:offset
    found?:boolean <- equal filename, curr-filename
    loop-unless found?
    contents:address:source:character, sink:address:sink:character <- new-channel 30
    curr-contents:address:array:character <- get tmp, contents:offset
    start-running transmit-from-text curr-contents, sink
    return
  }
  return 0/not-found
]

def transmit-from-file file:number, sink:address:sink:character -> sink:address:sink:character [
  local-scope
  load-ingredients
  {
    c:character <- $read-from-file file
    break-unless c
    sink <- write sink, c
    loop
  }
  sink <- close sink
  file <- $close-file file
]

def transmit-from-text contents:address:array:character, sink:address:sink:character -> sink:address:sink:character [
  local-scope
  load-ingredients
  i:number <- copy 0
  len:number <- length *contents
  {
    done?:boolean <- greater-or-equal i, len
    break-if done?
    c:character <- index *contents, i
    sink <- write sink, c
    i <- add i, 1
    loop
  }
  sink <- close sink
]

def start-writing fs:address:filesystem, filename:address:array:character -> sink:address:sink:character, routine-id:number [
  local-scope
  load-ingredients
  file:number <- $open-file-for-writing filename
  source:address:source:character, sink:address:sink:character <- new-channel 30
  routine-id <- start-running transmit-to-file file, source
]

def transmit-to-file file:number, source:address:source:character -> file:number, source:address:source:character [
  local-scope
  load-ingredients
  {
    c:character, done?:boolean, source <- read source
    break-if done?
    $write-to-file file, c
    loop
  }
  file <- $close-file file
]