Sciencexp : le site des Sciences Expérimentales

Mesures scientifiques et ordinateur : mesurer, figurer, comparer

Langages Pascal pour utiliser les pilotes Mensura.

FreePascal, Lazarus, Delphi, logiciel de statistiques PAST

FreePascal (logiciel libre, Windows et Linux)

Editeur FreePascal

program testdllfp;
//mettre les options de compilation à compatibilité Delphi ou TP
//et l'option Mode à normal

uses windows,sysutils,crt;

var l:thandle;         var i:integer;
var repchar : array[0..80] of char;
var stddetail:function : pchar ;stdcall;
var stdneap : function(n:longint):pchar;stdcall;
var stdneadp :function(n:longint):pchar;stdcall;
var stdeap : function(n:longint):longint;stdcall;
var stdeadp:function(n:longint):double;stdcall;
    stdcalibration:function(ch:pchar):pchar;stdcall;
begin
clrscr;
 @stddetail:=nil ; @stdeadp:=nil; @stdneadp:=nil; @stdcalibration:=nil;
  strpcopy(repchar,'bibdyn.dll');
  L:=loadlibrary(repchar);
  @stddetail:=getprocaddress(L,'stddetail');
  @stdneadp:=getprocaddress(L,'stdnead');
 @stdeadp:=getprocaddress(L,'stdead');
  @stdcalibration:=getprocaddress(L,'stdcalibration');
  writeln(stddetail());
  for i:=1 to 10 do begin
     write(stdneadp(i)); writeln(stdeadp(i));
     end;
 readln;
 end.


Environnement Lazarus

program appelle_bibdyn_lazarus;
//{$mode objfpc}{$H+}
{$mode DELPHI}   //mettre le compilateur en mode Delphi pour appeler les fonctions
uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
 ,windows,sysutils,crt
  ;

{$IFDEF WINDOWS}{$R appelle_bibdyn_lazarus.rc}{$ENDIF}

var l:thandle;         var i:integer;
var repchar : array[0..80] of char;
var stddetail:function : pchar ;stdcall;
var stdneap : function(n:longint):pchar;stdcall;
var stdneadp :function(n:longint):pchar;stdcall;
var stdeap : function(n:longint):longint;stdcall;
var stdeadp:function(n:longint):double;stdcall;
    stdcalibration:function(ch:pchar):pchar;stdcall;

begin
  clrscr;
@stddetail:=nil ; @stdeadp:=nil; @stdneadp:=nil; @stdcalibration:=nil;
  strpcopy(repchar,'bibdyn.dll');
  L:=loadlibrary(repchar);
  @stddetail:=getprocaddress(L,'stddetail');
  @stdneadp:=getprocaddress(L,'stdnead');
 @stdeadp:=getprocaddress(L,'stdead');
  @stdcalibration:=getprocaddress(L,'stdcalibration');
  writeln(stddetail());
  for i:=1 to 10 do begin
     write(stdneadp(i)); writeln(stdeadp(i));
     end;
 readln;
end.

Une autre manière de charger la bibliothèque dynamique peut être la suivante :
L:=loadlibrary(repchar);
  pointer(cdetail):=getprocaddress(L,'cdetail');
  pointer(cneadp):=getprocaddress(L,'cnead');
 pointer(ceadp):=getprocaddress(L,'cead');


Delphi (Borland-Embarcadero, Windows)

program appelle_bibdyn_Delphi;
{$APPTYPE CONSOLE}
uses windows,sysutils;

var l:thandle;         var i:integer;
var repchar : array[0..80] of char;
var stddetail:function : pchar ;stdcall;
var stdneap : function(n:longint):pchar;stdcall;
var stdneadp :function(n:longint):pchar;stdcall;
var stdeap : function(n:longint):longint;stdcall;
var stdeadp:function(n:longint):double;stdcall;
    stdcalibration:function(ch:pchar):pchar;stdcall;

begin
 @stddetail:=nil ; @stdeadp:=nil; @stdneadp:=nil; @stdcalibration:=nil;
  strpcopy(repchar,'bibdyn.dll');
  L:=loadlibrary(repchar);
  @stddetail:=getprocaddress(L,'stddetail');
  @stdneadp:=getprocaddress(L,'stdnead');
 @stdeadp:=getprocaddress(L,'stdead');
  @stdcalibration:=getprocaddress(L,'stdcalibration');
  writeln(stddetail());
  for i:=1 to 10 do begin
     write(stdneadp(i)); writeln(stdeadp(i));
     end;
 readln;
end.


Logiciel de statistiques PAST (Windows)

PAST est fondamentalement un logiciel de statistiques (http://folk.uio.no/ohammer/past/), qui contient un langage proche de Pascal pour faire des scripts.
Depuis la version 3.11, il est possible d'utiliser des bibliothèques dynamiques, et donc de faire en quelques lignes un programme d'acquisition de données, qui pourront ensuite être traitées par les fonctions de statistique et de modélisation de PAST, ou transmises à un autre logiciel d'analyse de données.
L'intérêt de ce langage de programmation est de pouvoir profiter des outils statistiques, graphiques et de modélisation du logiciel principal PAST : voir la page spéciale PAST






Dernière modification le 10/03/2018

Site motorisé par ZitePLUS 0.9.1