From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7cbbcde0157485b2,start X-Google-Attributes: gid103376,public From: Roga Danar Subject: Problem w/ Win NT Apex or just me? Date: 1998/10/16 Message-ID: <36278110.66641D91@stelnj.com>#1/1 X-Deja-AN: 401834120 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-Trace: news1.exit109.com 908554852 27800 208.225.73.22 (16 Oct 1998 16:20:52 GMT) Organization: AlphaSoft, Inc. Mime-Version: 1.0 Reply-To: nospam@nospam.com NNTP-Posting-Date: 16 Oct 1998 16:20:52 GMT Newsgroups: comp.lang.ada Date: 1998-10-16T16:20:52+00:00 List-Id: Hi, I have been attempting to write an Apex Ada95 program that will print from WIN NT w/ using the WIN API, just as a test. The following code fails on each block, but I expected that. But I am confused why the pragma interface to a C program is not working either. The program finishes but no printing happens. I am not sure what if anything I am doing incorrectly. I am sure it will be pointed out if I am. If someone could help me out it would be great. The 'C' code and Ada code follows: ******************** C program *************************** #include #include main (void) { puts ("Starting to print"); system ("print disk_file.txt"); } ************* Ada standalone procedure *************************** -- -- File Name: printer.2.ada -- with Ada.Text_Io; use Ada.Text_Io; -- with Win_Show; procedure Printer is -- pragma Link_With ("pr.o"); Lpt1 : constant String := "LPT1"; Prn : constant String := "PRN"; Net_Printer : constant String := "\\COMPAQ_5\LAB"; Disk_File : constant String := "c:\Disk_File"; File_Buf, File_Buf2, File_Buf3, Disk_Buf : File_Type; -- -- procedure Print; pragma Interface (C, Print); pragma Interface_Name (Print, "_main"); begin begin begin Open (File => Disk_Buf, Mode => Out_File, Name => Disk_File); Put_Line("Opening Disk File"); exception when others => Create (File => Disk_Buf, Mode => Out_File, Name => Disk_File); Put_Line ("creating file"); end; Put_Line (Disk_Buf, "Testing Disk File"); Close(Disk_Buf); exception when Mode_Error => Put_Line ("Mode Error"); when others => Put_Line ("Disk File test failed"); end; ---------------------------------------------------- --- begin -- LPT Test if not Is_Open (File_Buf) then Open (File => File_Buf, Mode => Out_File, Name => Lpt1); end if; Put_Line (File_Buf, " Testing LPT1 "); New_Page (File_Buf); Close (File_Buf); exception when Name_Error => Put_Line ("LPT1 Name Error"); when Use_Error => Put_Line ("LPT1 Use Error"); when others => Put_Line (" LPT1 failed "); end; --------------------------------------------------------- --- begin -- PRN Test Open (File => File_Buf2, Mode => Out_File, Name => Prn); Put_Line (File_Buf2, " Testing PRN "); New_Page (File_Buf2); Close (File_Buf2); exception when Name_Error => Put_Line ("PRN Name Error"); when Use_Error => Put_Line ("PRN Use Error"); when others => Put_Line (" PRN failed "); end; ---------------------------------------------------------- --- begin -- Net Printer Open (File => File_Buf3, Mode => Out_File, Name => Net_Printer); Put_Line (File_Buf3, " Testing Net Printer "); New_Page (File_Buf3); Close (File_Buf); exception when Mode_Error => Put_Line ("Mode Error"); when others => Put_Line (" Net Printer test failed "); end; --------------------------------------------------------- -- C printing Print; exception when Use_Error => Put_Line (" USE Error "); when others => Put_Line (" Something BAD went wrong !!"); end Printer;