home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / smalltk / src / tty.c < prev    next >
C/C++ Source or Header  |  1991-10-12  |  2KB  |  77 lines

  1. /*
  2.     Little Smalltalk, version 3
  3.     Written by Tim Budd, January 1989
  4.  
  5.     tty interface routines
  6.     this is used by those systems that have a bare tty interface
  7.     systems using another interface, such as the stdwin interface
  8.     will replace this file with another.
  9. */
  10.  
  11. # include <stdio.h>
  12. # include "env.h"
  13. # include "memory.h"
  14.  
  15. extern boolean parseok;
  16.  
  17. /* report a fatal system error */
  18. noreturn sysError(s1, s2)
  19. char *s1, *s2;
  20. {
  21.     ignore fprintf(stderr,"%s\n%s\n", s1, s2);
  22.     ignore abort();
  23. }
  24.  
  25. /* report a nonfatal system error */
  26. noreturn sysWarn(s1, s2)
  27. char *s1, *s2;
  28. {
  29.     ignore fprintf(stderr,"%s\n%s\n", s1, s2);
  30. }
  31.  
  32. compilWarn(selector, str1, str2)
  33. char *selector, *str1, *str2;
  34. {
  35.     ignore fprintf(stderr,"compiler warning: Method %s : %s %s\n", 
  36.         selector, str1, str2);
  37. }
  38.  
  39. compilError(selector, str1, str2)
  40. char *selector, *str1, *str2;
  41. {
  42.     ignore fprintf(stderr,"compiler error: Method %s : %s %s\n", 
  43.         selector, str1, str2);
  44.     parseok = false;
  45. }
  46.  
  47. noreturn dspMethod(cp, mp)
  48. char *cp, *mp;
  49. {
  50.     /*ignore fprintf(stderr,"%s %s\n", cp, mp);*/
  51. }
  52.  
  53. givepause()
  54. {    char buffer[80];
  55.  
  56.     ignore fprintf(stderr,"push return to continue\n");
  57.     ignore gets(buffer);
  58. }
  59.  
  60. object sysPrimitive(number, arguments)
  61. int number;
  62. object *arguments;
  63. {    object returnedObject;
  64.  
  65.         /* someday there will be more here */
  66.     switch(number - 150) {
  67.         case 0:        /* do a system() call */
  68.             returnedObject = newInteger(system(
  69.                 charPtr(arguments[0])));
  70.             break;
  71.  
  72.         default:
  73.             sysError("unknown primitive","sysPrimitive");
  74.         }
  75.     return(returnedObject);
  76. }
  77.