JuliaLang/julia — pull request #8880 by waTeim (2014-11-03 02:04:10+00:00)
Title: Reorganization of files to allow distribution of Julia for embedding without uv.h

Here is a proposal that Fixes #8690 with minimal changes to the interface. It is partially done, but is enough for a source of discussion and/or a short term fix since no embedding can be done currently without uv.h.

## Modifications

1. ios.h is split into ios.h and ios_internal.h
2. Inclusion of uv.h is moved to ios_internal.h.
3. uv struct types are left declared as incomplete-opaque but only if uv.h is not included in julia.h
4. ios_t made incomplete-opaque in ios.h
5. julia_internal.h is modified to include ios_internal.h and julia.h in the right order.
6. Julia source files are modified to include julia_internal.h and/or ios_internal.h as necessary.
7. The definition of ios_t moved to ios_internal.h
8. The definition of jl_uv_file_t moved to julia_internal.h
9. The declaration of jl_spawn moved to julia_internal.h
10. The definition of ios_buffmode_t moved to ios_internal.h
11. The declaration of ios_buffmode move to ios_internal.h

## Most of the embedding interface as been left as is except for.

1. As mentioned above. All of the uv_ types are opaque
2. Also ios_t is opaque
3. uv_handle_type is exclusively internal.
4. ios_buffmode_t is exclusively internal.
5. jl_spawn is no longer available to embedding because it uses uv_handle_type as a parameter.
6. ios_buffmode is no longer available to embedding because it uses ios_buffmode_t

## Limitations

### Opaque uv_types
This is ok since all uv-using functions (except 2) take pointers so these type decls can be left incomplete for purposes of providing parameters, however, the embedder can no longer create the uv parameters directly, but must have a factory provided.

### missing uv_handle_type
uv_handle_type could also be made opaque, except for 1 problem, it's an enum, not a struct. Unfortunate, but there is only 1 casualty **jl_spawn**, which is problem, but not an insurmountable one, if the signature changed, or if there were a different function made available for embedding, then the functionality would be preserved.

### missing ios_buffmode
Similar to the above for similar reasons, **ios_buffmode** is not available.