/usr/share/dx/samples/callmodule/Simple.c is in dxsamples 4.4.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #include "dx/dx.h"
#include <stdio.h>
#include <unistd.h>
#define MAX_PARAMS 21
exit_handler(int fd, Pointer arg)
{
getchar();
exit(0);
}
main()
{
int rcode;
ModuleInput minput[MAX_PARAMS];
ModuleOutput moutput[MAX_PARAMS];
float iso_value = 0.1;
Object isosurface_out, autocamera_out, import_cloud_out;
DXInitModules();
/* This program will exit when the enter key is hit */
DXRegisterInputHandler(exit_handler, STDIN_FILENO, 0) ;
/* Import - setup in/outputs and call module */
DXModSetStringInput(&minput[0], "name",
"cloudwater");
DXModSetObjectOutput(&moutput[0], "data", &import_cloud_out);
rcode = DXCallModule("Import", 1, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* Isosurface - setup in/outputs and call module */
/* no need to reference import_cloud_out before using it here */
/* because we will not use it again. After this module is */
/* called import_cloud_out will be deleted. */
DXModSetObjectInput(&minput[0], "data", import_cloud_out);
DXModSetFloatInput(&minput[1], "value", iso_value);
DXModSetObjectOutput(&moutput[0], "surface", &isosurface_out);
rcode = DXCallModule("Isosurface", 2, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* AutoCamera - setup in/outputs and call module */
/* We need to reference isosurface_out, because we will need */
/* it again as an input to Display */
/* If it were not referenced here, it would be deleted after the */
/* call to DXCallModule */
DXReference(isosurface_out);
DXModSetObjectInput(&minput[0], "object", isosurface_out);
DXModSetObjectOutput(&moutput[0], "camera", &autocamera_out);
rcode = DXCallModule("AutoCamera", 1, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* Display - setup in/outputs and call module */
DXModSetObjectInput(&minput[0], "object", isosurface_out);
DXModSetObjectInput(&minput[1], "camera", autocamera_out);
rcode = DXCallModule("Display", 2, minput, 0, moutput);
if (rcode == ERROR) goto error;
/* Delete the extra reference we put on isosurface_out that kept */
/* it from being deleted. */
DXDelete(isosurface_out);
fprintf(stderr, "Hit the enter key to exit: ");
/* enables the refresh of the display window, and the */
/* handling of the exit on carriage return */
while(1) {
DXCheckRIH(1);
}
error: exit (-1);
}
|