------------------------------------------------------------------------------ -- -- -- Nom du fichier : Spider.adb -- -- -- -- Auteur(s) : Livio Righetti -- -- -- -- Date de creation : 26-MARS-97 -- -- -- -- But : Mettre a disposition des fonctions graphiques -- -- minimales. -- -- -- -- Date de modif. : 18-SEPT-97 (G.corbaz) -- -- Raison : Utilisation du paquetage Adagraph -- -- -- -- Date de modif. : 7-AVRIL-99 (P.Girardet) -- -- Raison : Pour creer une librairie -- -- -- -- Date de modif. : 28 avril 2000 (SALAMIN Michel) -- -- Raison : Suppression de AdaGraph et utilisation d'une DLL -- -- faisant des appels directs aux API de Windows. -- -- -- -- Modules appeles : -- -- Mat. particulier : Graphmin.dll -- -- -- -- Compilateur : -- -- -- ------------------------------------------------------------------------------ package body Spider is procedure Traiter_Erreur(Valeur : in Natural) is begin case Valeur is when 1 => raise Fenetre_Non_Init; when 2 => raise Fenetre_Deja_Init; when 3 => raise Pixel_Invalid; when others => raise Erreur_Inconnue; end case; end Traiter_Erreur; function ADA_Get_Max_X return Natural; pragma import(DLL,ADA_Get_Max_X,"ADA_getMaxX"); function Get_Max_X return Natural is begin return ADA_Get_Max_X; end Get_Max_X; function ADA_Get_Max_Y return Natural; pragma import(DLL,ADA_Get_Max_Y,"ADA_getMaxY"); function Get_Max_Y return Natural is begin return ADA_Get_Max_Y; end Get_Max_Y; procedure ADA_Move_To(X : in Natural; Y : in Natural); pragma import(DLL,ADA_Move_To,"ADA_moveTo"); procedure Move_To(X : in Natural;Y : in Natural) is begin ADA_Move_To(X,Y); end Move_To; procedure ADA_Move(DX : in Integer; DY : in Integer); pragma import(DLL,ADA_Move,"ADA_move"); procedure Move(DX : in Integer;DY : in Integer) is begin ADA_Move(DX,DY); end Move; procedure ADA_Line_To(X1 : in Natural; Y1 : in Natural; X2 : in Natural; Y2 : in Natural; Err : out Natural); pragma import(DLL,ADA_Line_To,"ADA_lineTo"); procedure Line_To(X1 : in Natural; Y1 : in Natural; X2 : in Natural; Y2 : in Natural) is Err : Integer; begin ADA_Line_To(X1,Y1,X2,Y2,Err); if Err /= 0 then Traiter_Erreur(Err); end if; end Line_To; procedure ADA_Line(DX : in Integer; DY : in Integer; ERR : out Natural); pragma import(DLL,ADA_Line,"ADA_line"); procedure Line(DX : in Integer; DY : in Integer) is Err : Integer; begin ADA_Line(DX,DY,Err); if Err /= 0 then Traiter_Erreur(Err); end if; end Line; procedure ADA_Clear_Window(Err : out Natural); pragma import(DLL,ADA_Clear_Window,"ADA_clearWindow"); procedure Clear_Window is Err : Integer; begin ADA_Clear_Window(Err); if Err /= 0 then Traiter_Erreur(Err); end if; end Clear_Window; procedure ADA_Init_Window(Title : in String; Err : out Natural); pragma import(DLL,ADA_Init_Window,"ADA_initWindow"); procedure Init_Window(Title : in String) is ADA_Title : String := Title & Character'Val(0); Err : Integer; begin ADA_Init_Window(ADA_Title,Err); if Err /= 0 then Traiter_Erreur(Err); end if; end Init_Window; procedure ADA_Close_Window(Err : out Natural); pragma import(DLL,ADA_Close_Window,"ADA_closeWindow"); procedure Close_Window is Err : Integer; begin ADA_Close_Window(Err); if Err /= 0 then Traiter_Erreur(Err); end if; end Close_Window; end Spider;