Commit Graph

16 Commits

Author SHA1 Message Date
Kartik Agaram 23d3a02226 4266 - space for alloc-id in heap allocations
This has taken me almost 6 weeks :(
2018-06-24 09:18:20 -07:00
Kartik Agaram ce9b2b0515 4258 - undo 4257 2018-06-15 22:16:09 -07:00
Kartik Agaram 0edd9b9fc6 4257 - abortive attempt at safe fat pointers
I've been working on this slowly over several weeks, but it's too hard
to support 0 as the null value for addresses. I constantly have to add
exceptions for scalar value corresponding to an address type (now
occupying 2 locations). The final straw is the test for 'reload':

  x:num <- reload text

'reload' returns an address. But there's no way to know that for
arbitrary instructions.

New plan: let's put this off for a bit and first create support for
literals. Then use 'null' instead of '0' for addresses everywhere. Then
it'll be easy to just change what 'null' means.
2018-06-15 22:12:03 -07:00
Kartik K. Agaram 2b25071710 3877 2017-05-26 17:36:16 -07:00
Kartik K. Agaram f2043a7324 3433 2016-10-01 23:14:17 -07:00
Kartik K. Agaram 78c5020531 3374 2016-09-16 23:57:55 -07:00
Kartik K. Agaram 10bbca643f 3238
Clean up primitive for reading from file. Never return EOF character.
Stop using null character to indicate EOF as well. Instead, always use a
second product to indicate EOF, and require calls to use it.
2016-08-21 08:13:44 -07:00
Kartik K. Agaram ff16e04f57 3237
More checks for unsafe filesystem primitives. Most important, make sure
the product of any $close-file instruction is never ignored, and that
it's the same variable as the ingredient. (No way to indicate that in Mu
code yet, but then Mu code should always be safe and not require such
checks.)
2016-08-21 08:12:13 -07:00
Kartik K. Agaram e440e3e06e 3236 2016-08-21 08:06:29 -07:00
Kartik K. Agaram a621ef95f4 3225 - testable interface for writing files
For example usage of file operations, see filesystem.mu.

Is it ugly that we don't actually write to disk unless we wait for the
writing routine to exit? Maybe there's a nice way to wrap it. At any
rate, all buffering is explicit, which seems a win compared to *nix.
2016-08-18 21:09:27 -07:00
Kartik K. Agaram c057f5c190 3195 2016-08-16 12:39:47 -07:00
Kartik K. Agaram fda86efe51 3185 2016-08-14 05:06:39 -07:00
Kartik K. Agaram f4eee01a6b 3184
Fix CI. How does it work on my Mac without explicitly including errno?
2016-08-14 05:05:05 -07:00
Kartik K. Agaram 734eef7c0e 3183 - cleanup
- New plan
Primitives:
  $open-file-for-reading
  $open-file-for-writing
  $read-from-file
  $write-to-file
  $close-file

The '$' prefix indicates that none of these are intended to be used
directly since they rely on type-system-busting numbers. Also that they
are just temporary hacks depending on primitives provided by the host
system. A putative 'Mu machine' would have very different primitives.

Testable interfaces:
- start-reading: starts a routine to read from a file and returns the
  source where the contents will become available.
- start-writing: starts a routine to write to a file and returns the
  sink where the contents can be provided.

Both operate on the real file-system if the first 'filesystem'
ingredient is 0.

Once you start them up you can read/write/close the channel as usual.
2016-08-13 23:10:25 -07:00
Kartik K. Agaram dff1abb2e1 3182 - primitives for manipulating the file system
I don't know why this took so long to gel. I just needed to copy my
approach to screen management:

1. primitives layer (C++): simple, non-testable, non-safe operations.
2. wrappers layer (Mu): wrap operations with dependency-injected
versions that can take a fake file system.
3. scenario layer (C++): implement assume-filesystem that constructs a
fake file system.
4. scenario test layer (Mu): test out assume-filesystem in a test.

This commit implements step 1.
2016-08-13 22:57:13 -07:00
Kartik K. Agaram a7c3f156d7 2788 2016-03-16 17:06:01 -07:00