Gregory D Abram:
 |> Well, it works on SGI.  But it doesn't work on Linux or FreeBSD.
 |FWIW, this works on both my cygwin and linux builds.
...

Thanks for testing.  Your results prompted me to review the code which
revealed a bug.  Updated version attached.

The putenv's were wrong (when I was testing before, I just had DXLTRACE and
DXLSYNCHRONOUS in my environment).

Now it fails on SGI as well.  Still unsure whether this is valid script or not.

Randy

-- 
Randall Hopper (mailto:[EMAIL PROTECTED])
Lockheed Martin Operation Support
EPA Scientific Visualization Center
US EPA N127-01; RTP, NC 27711
/* cc -o tst tst.c -lDXL -I/usr/local/dx/include -L/usr/local/dx/lib_freebsd */

#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include "dxl.h"

void SyncAfterExecute(DXLConnection *conn)
{
  int status=1;

   while (status) {
      sleep(1);
      if (DXLIsMessagePending(conn))
         DXLHandlePendingMessages(conn);
      DXLGetExecutionStatus(conn, &status);
   }
}


main(int argc, char *argv[])
{
    DXLConnection *conn = NULL;
    char result[100];

    putenv("DXLTRACE=");
    putenv("DXLSYNCHRONOUS=");

    conn = DXLStartDX("dx -execonly", NULL);
    assert(conn);

    exDXLBeginMacroDefinition( conn, "macro foo( ) -> ( )" );
    /*DXLSetString(conn, "a","1");*/
    DXLSend(conn, "a = \"1\";");
    DXLSend(conn, "b = c;");
    exDXLEndMacroDefinition( conn );
    DXLSend(conn, "foo();");

    DXLExecuteOnce(conn);
    SyncAfterExecute(conn);

    printf("Hit return to quit:");
    fgets(result, sizeof(result), stdin);
    DXLExitDX(conn);
}


/*---------------------------------------------------------------------------
THE ERROR:

...
DXLink connected to server at version 4.2.0
Sending -> |1000001|$mac|0|

Sending -> macro foo( ) -> ( )
Sending -> {

Sending -> a = "1";
Sending -> |1000002|$for|8|a = "1";|

Sending -> $sync
Recving <- id 1000001 type 7  0:  ERROR:  UI[10,1]:  parse error:  |

----------------------------------------------------------------------------*/

Reply via email to