home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / ada / 2505 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  4.0 KB

  1. Path: sparky!uunet!wupost!usc!nic.csu.net!vmsclst1.sc.csupomona.edu!mgeorgy
  2. Newsgroups: comp.lang.ada
  3. Subject: ADA help Urgently Requested..Please!!!!
  4. Message-ID: <1992Sep1.211014.1@vmsclst1.sc.csupomona.edu>
  5. From: mgeorgy@vmsclst1.sc.csupomona.edu
  6. Date: 1 Sep 92 21:10:14 PDT
  7. Organization: Computer Science Computational Systems
  8. Nntp-Posting-Host: csvax4
  9. Nntp-Posting-User: mgeorgy
  10. Lines: 124
  11.  
  12. Hello, the program that follows began as a simple imaging program that I was
  13. writing for myself.  But now it has become a big problem.  Everything ok except
  14. the file opening and creating.  When I run the program and select option 1 or
  15. 2, open or create a file, I get a DEVICE ERROR.  I can tell you what is
  16. happening but I just don't know why.  What is happening is that when it get to
  17. the GET_LINE statment it uses IN_FILE_NAME's decleration of ' '.  Now I should
  18. tell anyone willing to help me that the statments work alone but not as part of
  19. another program (ie, IF statment, or sub-PROCEDURES).  I have raked my brain
  20. and tried everything.  
  21.  
  22. SOMEONE PLEASE HELP ME!!!!!!
  23.  
  24. THANX FOR ANY HELP,
  25. Matt Georgy
  26. California Polytechnic State University, Pomona  -- Computer Science
  27.  
  28. +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29. +  Cal Poly, Pomona, Making Yesterdays Mistakes Today +
  30. +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  31.  
  32.  
  33. P.S. Please reply by posting to the news group our mail system is screwed up
  34. right now.
  35.  
  36. THANX AGAIN.
  37.  
  38. -------------------------------------------------------------------------------
  39. with TEXT_IO, INTEGER_TEXT_IO, SEQUENTIAL_IO;
  40. use TEXT_IO, INTEGER_TEXT_IO;
  41.  
  42. procedure IMAGE is
  43.    
  44. type BYTE is range 0..255;
  45. for BYTE'size use 8;
  46.  
  47. package BYTE_IO is new SEQUENTIAL_IO(BYTE);
  48. use BYTE_IO;
  49.  
  50.    type BYTE_STRING is ARRAY (1..512) of BYTE;
  51.  
  52.    INF                  :  BYTE_IO.FILE_TYPE;
  53.    IN_FILE_NAME         :  STRING (1..80) := (others => ' ');
  54.    INPUT_LINE_LENGTH    :  INTEGER := 0;
  55.    IN_FILE_OPEN         :  BOOLEAN := FALSE;
  56.    
  57.    OUTF                 :  BYTE_IO.FILE_TYPE;
  58.    OUT_FILE_NAME        :  STRING (1..80) := (others => ' ');
  59.    OUTPUT_LINE_LENGTH   :  INTEGER := 0;
  60.    OUT_FILE_OPEN        :  BOOLEAN := FALSE;
  61.    
  62.    READ_BYTE            :  BYTE;
  63.    READ_STRING          :  BYTE_STRING;
  64.    COUNTER              :  INTEGER := 0;   
  65.    SELECTION            :  INTEGER := 1;
  66.    
  67.    procedure IMAGING_MENU is
  68.    
  69.    begin
  70.    
  71.       NULL;
  72.       
  73.    end IMAGING_MENU;
  74.    
  75. begin
  76.  
  77.    while SELECTION /= 0 loop    
  78.         PUT("STATUS:     INPUT FILE: ");
  79.       if IN_FILE_NAME(1) = ' ' then
  80.          PUT("<NONE>");
  81.       else
  82.          PUT(IN_FILE_NAME);
  83.          IN_FILE_OPEN := TRUE;
  84.       end if;
  85.          PUT("        ");
  86.       PUT("   OUTPUT FILE: ");
  87.       if OUT_FILE_NAME(1) = ' ' then
  88.          PUT("<NONE>");
  89.       else
  90.          PUT(OUT_FILE_NAME);
  91.          OUT_FILE_OPEN := TRUE;
  92.          end if;
  93.       NEW_LINE(2);
  94.       PUT("          Welcome to POLY-Vision");
  95.       NEW_LINE(3);
  96.       PUT_LINE("                 MAIN MENU");
  97.       NEW_LINE;
  98.       PUT_LINE("          (1) Get Input Filename");
  99.       NEW_LINE;
  100.       PUT_LINE("          (2) Get Output Filename");
  101.       NEW_LINE;
  102.          PUT_LINE("          (3) Begin Image Processing");
  103.       NEW_LINE;
  104.       PUT_LINE("          (0) Exit POLY-Vision");
  105.       NEW_LINE(2);
  106.       PUT_LINE("                   CHOICE: ");
  107.       GET(SELECTION);
  108.       if SELECTION = 1 then
  109.          PUT_LINE("INPUT FILE NAME: ");
  110.          GET_LINE(IN_FILE_NAME, INPUT_LINE_LENGTH);
  111.          open(INF, IN_FILE, IN_FILE_NAME(1..INPUT_LINE_LENGTH));
  112.       elsif SELECTION = 2 then
  113.          PUT("OUTPUT FILE NAME: ( ");
  114.          PUT(IN_FILE_NAME(1..INPUT_LINE_LENGTH - 3));
  115.          PUT_LINE("NEW )");
  116.          GET_LINE(OUT_FILE_NAME, OUTPUT_LINE_LENGTH);
  117.          if OUT_FILE_NAME(1) = ' ' then
  118.             create(OUTF, OUT_FILE, IN_FILE_NAME(1..INPUT_LINE_LENGTH - 3) & "NEW");
  119.          else
  120.             create(OUTF, OUT_FILE, OUT_FILE_NAME(1..OUTPUT_LINE_LENGTH));
  121.          end if; 
  122.       elsif SELECTION = 3 then
  123.          IMAGING_MENU;
  124.       else
  125.          if IN_FILE_OPEN then
  126.             close(INF);
  127.             end if;
  128.          if OUT_FILE_OPEN then
  129.             close(OUTF);
  130.          end if;
  131.          EXIT;
  132.       end if;
  133.    end loop;
  134.  
  135. end IMAGE;
  136.