Compiler output goes to my code edit file rather than the UEdit output window?

Compiler output goes to my code edit file rather than the UEdit output window?

3
NewbieNewbie
3

    Nov 25, 2008#1

    This is weird. When I run my compiler with the following options set, the compiler output (which I have got it to place onto the Windows clipboard) gets inserted by UEdit back to my current edited code file rather than to the UEdit output window. I want it to go to the UEdit output window.

    The UEDit Tool Configuration options I am using are as follows:

    Command line: "c:\program files\...\Myprecompiler.exe" "%f"
    Program type: DOS program (it's actually a Windows program but I get an obscure error message from UEdit otherwise - error opening file for write).
    Output: to list box; capture output; replace text with clipboard.

    I guess the problem is in some part due to the two-stage process I am using - UEdit runs a pre-compiler, the pre-compiler runs the compiler where I can get it to place the error diagnostics onto the Windows clipboard. I think there is a timing issue here because the pre-compiler finishes before the compiler so the clipboard return shown by UEdit is often empty. But that still doesn't explain why it always ends up in my code edit file rather than the UEdit output window.

    Does anyone have any suggestions on how to fix this problem. Thanks.

    1029
    Power UserPower User
    1029

      Nov 25, 2008#2

      From the UE help for this

      "Replace Selected Text With

      This [2] indicates that at the completion of the tool command, the captured output or contents of the clipboard will be used to replace the current selection (or inserted at the cursor position if no selection), or if no replace is selected, the output will be displayed as normal."

      As you can see it will either replace any text you have selected in your input (source) file, or place the captured output at the current cursor location.

      I always have the no replace option selected for this.

      Cheers...

      Frank

      3
      NewbieNewbie
      3

        Nov 25, 2008#3

        Hi Frank, many thanks. I see now, I actually have two problems. I was getting no diagnostic information back from the compiler when I selected the "no replace" option. This is because of the timing problem I referred to. I have just tested it out to make sure - the compiler diagnostics are actually on the clipboard it's just that when UEdit places them back onto the output window they are not yet there because the pre-compiler finishes before the compiler.

        There must be an easy work-around available. I can get the compiler to output to a file rather than the clipboard and I can have the pre-compiler wait until the file is present before finishing. Is there a way I can get UEdit to pick up the diagnostics from a file rather than the clipboard?

        1029
        Power UserPower User
        1029

          Nov 25, 2008#4

          Because you are actually trying to run 2 different tools one after another, with the start/execution of the second one dependent on the completion of the first one, your best option is probably to use a script to control this. You could check in the script for the existence of the file containing your compiler output and then complete your other step if it exists.

          Cheers...

          Frank

          6,602548
          Grand MasterGrand Master
          6,602548

            Nov 25, 2008#5

            I think waiting in the precompiler or in a script for presence of the output file will be no real help because the output file will appear in the file system immdiately after opening the file in your compiler before any data is written into this file. So you would have the problem that you either could not access the file because the compiler writes to it now or you just get a snapshot of the first few data written into the output file.

            You have to wait for the termination of the compiler before you can evaluate the output. I suggest to write a batch file which runs first your precompiler and then the compiler and last types the output file which could be captured by UltraEdit to the output window. For example the batch file could look like this:

            @echo off
            start "PreCompiler" /wait "c:\program files\...\Myprecompiler.exe" "%1"
            start "Compiler" /wait "c:\program files\...\Compiler.exe" "file created by the precompiler"
            type "name of the compiler output file"


            start is an internal command (embedded in cmd.exe of Windows NT4 and later) to run a Windows GUI application from a command shell and most often used with the /wait parameter to wait for the termination of the Windows GUI application before continueing the batch file.

            Also possible would be to run the precompiler in the batch file as shown above and then use Windows command Find together with command tasklist or tlist (depending on your version of Windows) in a loop to wait for the termination of the compiler. When the precompiler has terminated, the find command is executed on the list created by tasklist or tlist to search for the name of the compiler in the list of running tasks. If found the batch file should wait 1-3 seconds and then run the check for the compiler application in the task list again. When the compiler application name cannot be found anymore in the Windows tasklist, the batch file can continue with typing the compiler output file which is then captured by UltraEdit to the output window.

            By the way: Why does the compiler not write to stdout or stderr as compilers normally do?
            Best regards from an UC/UE/UES for Windows user from Austria

            3
            NewbieNewbie
            3

              Nov 27, 2008#6

              Hi Mofi. Thanks for the suggestion, looks promising, I'll think it through and see how far I get. I can control in the compiler exactly when the file is created and therefore made available to another application that's why I thought this would be a good way to go.

              The product is Alpha Five and as far as I am aware no one has previously successfully interfaced an external editor with it. It comes with it's own editor and this is built into the product itself. Interfacing an external editor with this product presents some challenges. It currently provides no such interface so I have had to develop one myself - the PreCompiler. It works really well and now I want a closer level of integration by adding a few embellishments, like being able to direct the compiler output to the UltraEdit output window. A5 has no ability to output to STDOUT or STDERR (at least not a documented one). So this is why I am exploring an effective and workable alternative. So I am still pondering the best way to do it. My precompiler must also handle situations where A5 is already running, so I don't think I will have the option to start the precompiler and then start A5.