<commit_before>%%%  Programming Systems Lab, Universitaet des Saarlandes,
%%%  Postfach 15 11 50, D-66041 Saarbruecken, Phone (+49) 681 302-5609
%%%  Author: <NAME> <<EMAIL>>

proc {NewCompilerInterfaceEmacs Open OS ?CompilerInterfaceEmacs}
   MSG_ERROR = [17]
   EMU_OUT_START = [5]
   EMU_OUT_END = [6]
in
   class CompilerInterfaceEmacs
      prop locking final
      feat MyCompiler
      attr CompilerPanel: unit
      meth init()
         self.MyCompiler = {New CompilerClass init(self)}
         case {System.get standalone} then skip
         else
            {self.MyCompiler setSwitch(on(echoqueries unit))}
         end
      end

      meth !SetSwitches(_)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
      end
      meth !SetMaxNumberOfErrors(_)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
      end
      meth !ShowInfo(VS Coord <= unit)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
         case {System.get standalone} then
            {System.printInfo VS}
         else
            {System.printInfo EMU_OUT_END#VS#EMU_OUT_START}
         end
      end
      meth !DisplaySource(Title Ext VS) Name File in
         Name = {OS.tmpnam}#Ext
         File = {New Open.file init(name: Name flags: [write create truncate])}
         {File write(vs: VS)}
         {File close()}
         {Print {String.toAtom {VirtualString.toString 'oz-show-temp '#Name}}}
      end
      meth !ToTop()=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
         case {System.get standalone} then skip
         else
            {System.printInfo EMU_OUT_END#MSG_ERROR#EMU_OUT_START}
         end
      end
      meth !DisplayEnv(_)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
      end
      meth !AskAbort(?B)=M
         case CompilerInterfaceEmacs, DelegateToPanel(M $) then skip
         else B = true
         end
      end

      meth openPanel()
         lock D in
            case @CompilerPanel == unit orelse {IsDet @CompilerPanel.isClosed}
            then
               CompilerPanel <- {New Compiler.interface.tk
                                 init(self.MyCompiler)}
               D = {NewDictionary}
               {ForAll {Record.toListInd {self.MyCompiler getEnv($)}}
                proc {$ V#Value}
                   {Dictionary.put D V Value}
                end}
               {@CompilerPanel DisplayEnv(D)}
               {@CompilerPanel SetSwitches({self.MyCompiler getSwitches($)})}
            else
               CompilerPanel <- unit
            end
         end
      end
      meth putEnv(Env)=M
         case CompilerInterfaceEmacs, DelegateToPanel(M $) then skip
         else
            lock
               {self.MyCompiler putEnv(Env)}
            end
         end
      end
      meth mergeEnv(Env)=M
         case CompilerInterfaceEmacs, DelegateToPanel(M $) then skip
         else
            lock
               {self.MyCompiler mergeEnv(Env)}
            end<commit_msg>Use more of the instantiate stuff<commit_after>%%%  Programming Systems Lab, Universitaet des Saarlandes,
%%%  Postfach 15 11 50, D-66041 Saarbruecken, Phone (+49) 681 302-5609
%%%  Author: <NAME> <<EMAIL>>

proc {NewCompilerInterfaceEmacs Open OS ?CompilerInterfaceEmacs}
   MSG_ERROR = [17]
   EMU_OUT_START = [5]
   EMU_OUT_END = [6]
in
   class CompilerInterfaceEmacs
      prop locking final
      feat MyCompiler
      attr CompilerPanel: unit
      meth init()
         self.MyCompiler = {New CompilerClass init(self)}
         case {System.get standalone} then skip
         else
            {self.MyCompiler setSwitch(on(echoqueries unit))}
         end
      end

      meth !SetSwitches(_)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
      end
      meth !SetMaxNumberOfErrors(_)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
      end
      meth !ShowInfo(VS Coord <= unit)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
         case {System.get standalone} then
            {System.printInfo VS}
         else
            {System.printInfo EMU_OUT_END#VS#EMU_OUT_START}
         end
      end
      meth !DisplaySource(Title Ext VS) Name File in
         Name = {OS.tmpnam}#Ext
         File = {New Open.file init(name: Name flags: [write create truncate])}
         {File write(vs: VS)}
         {File close()}
         {Print {String.toAtom {VirtualString.toString 'oz-show-temp '#Name}}}
      end
      meth !ToTop()=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
         case {System.get standalone} then skip
         else
            {System.printInfo EMU_OUT_END#MSG_ERROR#EMU_OUT_START}
         end
      end
      meth !DisplayEnv(_)=M
         CompilerInterfaceEmacs, DelegateToPanel(M _)
      end
      meth !AskAbort(?B)=M
         case CompilerInterfaceEmacs, DelegateToPanel(M $) then skip
         else B = true
         end
      end

      meth openPanel()
         lock D in
            case @CompilerPanel == unit orelse {IsDet @CompilerPanel.isClosed}
            then
               Compiler.interface.tkRequest = unit
               CompilerPanel <- {New Compiler.interface.tk
                                 init(self.MyCompiler)}
               D = {NewDictionary}
               {ForAll {Record.toListInd {self.MyCompiler getEnv($)}}
                proc {$ V#Value}
                   {Dictionary.put D V Value}
                end}
               {@CompilerPanel DisplayEnv(D)}
               {@CompilerPanel SetSwitches({self.MyCompiler getSwitches($)})}
            else
               CompilerPanel <- unit
            end
         end
      end
      meth putEnv(Env)=M
         case CompilerInterfaceEmacs, DelegateToPanel(M $) then skip
         else
            lock
               {self.MyCompiler putEnv(Env)}
            end
         end
      end
      meth mergeEnv(Env)=M
         case CompilerInterfaceEmacs, DelegateToPanel(M $) then skip
         else
            lock
               {self.MyCompiler mergeEnv(Env)}
            end
{'fraction_non_alphanumeric': 0.08256880733944955, 'fraction_numerical': 0.009007506255212678, 'mean_word_length': 1.8417061611374408, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4487586', 'n_tokens_mistral': 1785, 'n_tokens_neox': 1688, 'n_words': 430}