next up previous
Next: 参考文献 Up: 無題 Previous: Appendix A: Ninf

Appendix B: Ninf IDL Sample

sample.idl:

Module sample;
Library "-lm";

Globals { int x,y,z; }

Define sin(IN double d, OUT double result[])
" This is test ..."
{    
    double sin();
    *result = sin(d);
}

Define mmul(long mode_in int n, mode_in double A[n][n], 
    mode_in double B[n][n],
    mode_out double C[n][n])
Required "sample.o"
Calls "C" mmul(n,A,B,C);

Define mmul2(long mode_in int n, mode_in double A[n*n+1-1], 
        mode_in double B[n*n+2-3+1],
        mode_out double C[n*n])
Required "sample.o"
Calls "C" mmul(n,A,B,C);


Define FFT(IN int n,IN int m, OUT float x[n][m], float INOUT y[m][n])
Required "sample.o"
Calls "Fortran" FFT(n,x,y);

sample.mak:

# This file 'sample.mak' was created by ninf_gen. Don't edit

# CompileOptions:

# stub sources
NINF_STUB_SRC = _stub_sin.c  _stub_mmul.c  _stub_FFT.c 

# stub programs
NINF_STUB_PROGRAM = _stub_sin _stub_mmul _stub_FFT

all: $(NINF_STUB_PROGRAM)

_stub_sin:
    $(CC) $(LDFLAGS) -o _stub_sin _stub_sin.c ninf_stub_lib.a  -lm

_stub_mmul:
    $(CC) $(LDFLAGS) -o _stub_mmul _stub_mmul.c ninf_stub_lib.a sample.o -lm

_stub_mmul2:
    $(CC) $(LDFLAGS) -o _stub_mmul2 _stub_mmul2.c ninf_stub_lib.a sample.o -lm

_stub_FFT:
    $(CC) $(LDFLAGS) -o _stub_FFT _stub_FFT.c ninf_stub_lib.a sample.o -lm


clean:
    rm $(NINF_STUB_PROGRAM)

# END OF Makefile

_stub_mmul2.c:

/* _stub_mmul2.c : generated by ./ninf_gen, don't edit. */
#include "ninf_stub.h"

NINF_STUB_INFO ninf_stub_info = {
0,0,0,  "sample","mmul2",4,
{
        { 5, 1, 0,},
        { 13, 1, 1,{
                { 3, 2, 
                        {
                          {2,2,4,1,4,1,4,5,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,3,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                },
                }},
        { 13, 1, 1,{
                { 3, 1, 
                        {
                          {2,2,4,1,4,1,4,1,4,5,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,3,2,1,3,2,1,1,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                },
                }},
        { 13, 2, 1,{
                { 3, 3, 
                        {
                          {2,2,4,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                  0, 0, 
                        {
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                          {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
                        },
                },
                }},
}
};

/* Globals */
 int x,y,z; 

/* Stub Main program */
main(argc,argv){
        long n;
        double *A;
        double *B;
        double *C;

        Ninf_stub_INIT(argc,argv);
        while(Ninf_stub_REQ()){
                Ninf_stub_SET_ARG(&n,0);
                Ninf_stub_SET_ARG(&A,1);
                Ninf_stub_SET_ARG(&B,2);
                Ninf_stub_SET_ARG(&C,3);
                mmul(n,A,B,C);
                Ninf_stub_END();
        }
        Ninf_stub_EXIT();
}
 /* END OF Stub Main */



Hidemoto Nakada
Wed Dec 20 05:42:46 JST 1995