home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / util / manip / turbo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  2.0 KB  |  100 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include "vaxconio.h"
  4. #define true (!false)
  5. #define false 0
  6. getch()
  7. {
  8.     return tt_inkey();
  9. }
  10. long coreleft(void)
  11. {
  12.     return 4000000l;
  13. }
  14. strlwr(char *s)
  15. {
  16.     while (*s!=0) {*s = tolower(*s); s++;}
  17. }
  18. char *strupr(char *s)
  19. {
  20.     while (*s!=0) {*s = toupper(*s); s++;}
  21.     return s;
  22. }
  23. unlink(char *filename)
  24. {
  25.     delete(filename);
  26. }
  27.  
  28. #include <descrip.h>
  29. int find_context;
  30. static char wildstr[200];
  31. static $DESCRIPTOR(str1,"");
  32. static $DESCRIPTOR(str2,"");
  33. static char rfile[200];
  34. findfirst(char *wild, struct ffblk *ffblk, int zz)
  35. {
  36.     int st;
  37.     char *s;
  38.     strcpy(wildstr,wild);
  39.     strcat(wildstr,";");
  40.     str1.dsc$a_pointer = wildstr;  str1.dsc$w_length = strlen(wildstr);
  41.     str2.dsc$a_pointer = &rfile[0];  str2.dsc$w_length = 132;
  42.     st = LIB$FIND_FILE(&str1,&str2,&find_context);
  43.     if ((st & 1) != 1) {
  44.         st = LIB$FIND_FILE_END(&find_context);
  45.         if ((st & 1) != 1) LIB$SIGNAL(st);
  46.         return true;
  47.     }
  48.     ffblk->ff_name = &rfile[0]; rfile[str2.dsc$w_length] = 0;
  49.     s = strchr(ffblk->ff_name,' ');
  50.     *s = 0;
  51.     trim_file(ffblk->ff_name);
  52.     return false;
  53. }
  54. findnext(struct ffblk *ffblk)
  55. {
  56.     int st;
  57.     char *s;
  58.     st = LIB$FIND_FILE(&str1,&str2,&find_context);
  59.     if ((st & 1) != 1) {
  60.         st = LIB$FIND_FILE_END(&find_context);
  61.         if ((st & 1) != 1) LIB$SIGNAL(st);
  62.         return true;
  63.     }
  64.     ffblk->ff_name = &rfile[0]; rfile[str2.dsc$w_length] = 0;
  65.     s = strchr(ffblk->ff_name,' ');
  66.     if (s!=NULL) *s = 0;
  67.     trim_file(ffblk->ff_name);
  68.     return false;
  69. }
  70. trim_file(char *s)
  71. {
  72.     char *t;
  73.     t = strchr(s,']');
  74.     if (t!=NULL) memcpy(s,t+1,strlen(t));
  75.     t = strchr(s,';');
  76.     if (s!=NULL) *t = 0;
  77. }
  78. char *getsymbol(char *sym)
  79. {
  80.     static char mystr[200],*s;
  81.     int r;
  82.     short teklen=80;
  83.     $DESCRIPTOR(symname,sym);
  84.     $DESCRIPTOR(tekval,mystr);
  85.     symname.dsc$w_length = strlen(sym);
  86.     tekval.dsc$w_length = 80;
  87.     r = lib$get_symbol(&symname,&tekval,&teklen,&1);
  88.     mystr[teklen] = 0;
  89. loop1:    s = strchr(mystr,'^');
  90.     if (s!=NULL) {
  91.         *(s+1) = *(s+1) - 64;
  92.         memmove(s,s+1,strlen(s+1)+1);
  93.         goto loop1;
  94.     }
  95.     return mystr;
  96. }
  97.  
  98.  
  99.                                                           
  100.