2016-04-16 20 views
0

Plplot in Ada erfordert eine Datei, die ada.numerics.real_arrays verwendet, und verhindert die Verwendung an anderer Stelle. Zur gleichen Zeit werden Vektoroperationen dadurch verborgen, und folglich verwendet anscheinend jedes plplot-Beispiel für ada elementweise Operationen, die den Zweck spezialisierter linearer Algebra-Typen an erster Stelle vereiteln.Verwenden von Ada real_arrays-Operatoren bei der Verwendung von plplot

Mache ich nur Dinge falsch, oder ist das eine echte Einschränkung in plplot?

Als Beispiel:

with ada.text_io; use ada.text_io; -- 'use' allows using library functions without fuilly qualified names 
with ada.float_text_io; use ada.float_text_io; 
--with ada.numerics.real_arrays; use ada.numerics.real_arrays; 

with 
PLplot_Auxiliary, 
PLplot; 
use 
PLplot_Auxiliary, 
PLplot; 

procedure Simple is 
    procedure Put (X : Real_Vector) is -- vector version of above, 1D instead of 2D 
    type Fixed is delta 0.01 range -100.0..100.0; 
    begin 
    for I in X'Range (1) loop 
     Put (Fixed'Image (Fixed (X (I)))); 
     New_Line; 
    end loop; 
    end Put; 

    x, y : Real_Vector(-10 .. 10); 


begin 
    for i in x'range loop 
     x(i) := float(i); 
     y(i) := x(i)**2; 
     y := x+y; --This line cause compilation to fail because plplot_auxiliary does not provide "+" for Real_Vector 
    end loop; 

    put(x); 

    Initialize_PLplot; -- Call this only once. 
    Simple_Plot(x, y); -- Make the plot. 
    End_PLplot;  -- Call this only once. 
end Simple; 

Baut mit:

gnatmake -aI/usr/share/ada/adainclude/plplotadad -aL/usr/lib64/ada/adalib/plplotadad simple.adb \ 
-cargs `PKG_CONFIG_PATH="/usr/lib64/pkgconfig:%{_PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig" pkg-config --cflags plplotd-ada` -largs `PKG_CONFIG_PATH="/usr/lib64/pkgconfig:%{_PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig" pkg-config --libs plplotd-ada` 
gcc -c -I/usr/share/ada/adainclude/plplotadad -I/usr/include/plplot simple.adb 
gnatbind -aI/usr/share/ada/adainclude/plplotadad -aO/usr/lib64/ada/adalib/plplotadad -x simple.ali 
gnatlink simple.ali -lplplotadad -lplplotd 
+0

Ohne einen Link zur Bibliothek (PLplot), es ist schwer zu helfen. –

Antwort

1

in den Quelldateien von dem libplplot-ada1-dev Paket in Debian/Jessie bereitgestellt Sehen, es wie Paket sieht PLPlot_Auxilary kann vorgesehen sein, entweder in eine Ada 95 Version oder eine Ada 2005 Version. Die Ada 2005-Version verwendet die Ada-Numerik-Pakete, während die Ada-95-Version nicht.