Skip to content

Commit

Permalink
Rework internal frontend (#10629)
Browse files Browse the repository at this point in the history
* reorganize compiler/server frontend

* try some piping

see #9359

* clean up some more

* try to get subprocess piping right

* actually we need the shell...

* hold back on pipe changes because this isn't working right

* move some more stuff around

* a little more

* try to dodge for now

* try something

* some more cleanup

* $currentyear

skip ci
  • Loading branch information
Simn committed Mar 20, 2022
1 parent 43dd4f1 commit 1cedac8
Show file tree
Hide file tree
Showing 10 changed files with 1,702 additions and 1,592 deletions.
437 changes: 437 additions & 0 deletions src/compiler/args.ml

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions src/compiler/compilationContext.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
open Globals

type server_mode =
| SMNone
| SMListen of string
| SMConnect of string

type arg_context = {
mutable classes : Globals.path list;
mutable xml_out : string option;
mutable json_out : string option;
mutable swf_header : (int * int * float * int) option;
mutable cmds : string list;
mutable config_macros : string list;
mutable cp_libs : string list;
added_libs : (string,unit) Hashtbl.t;
mutable no_output : bool;
mutable did_something : bool;
mutable force_typing : bool;
mutable pre_compilation : (unit -> unit) list;
mutable interp : bool;
mutable jvm_flag : bool;
mutable swf_version : bool;
mutable native_libs : (string * bool) list;
mutable raise_usage : unit -> unit;
mutable server_mode : server_mode;
}

type communication = {
write_out : string -> unit;
write_err : string -> unit;
flush : compilation_context -> unit;
is_server : bool;
}

and compilation_context = {
com : Common.context;
mutable on_exit : (unit -> unit) list;
mutable messages : Common.compiler_message list;
mutable has_next : bool;
mutable has_error : bool;
comm : communication;
}

type server_accept = unit -> (bool * (bool -> string option) * (string -> unit) * (unit -> unit))

type server_api = {
setup_new_context : Common.context -> unit;
init_wait_socket : string -> int -> server_accept;
init_wait_connect : string -> int -> server_accept;
init_wait_stdio : unit -> server_accept;
wait_loop : bool -> server_accept -> unit;
do_connect : string -> int -> string list -> unit;
}

0 comments on commit 1cedac8

Please sign in to comment.