ktigcc.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. ktigcc - TIGCC IDE for KDE
  3. Copyright (C) 2004 Kevin Kofler
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #include <stdlib.h>
  17. #include <unistd.h>
  18. #include <kapplication.h>
  19. #include <kcmdlineargs.h>
  20. #include "mainform.h"
  21. void qCleanupImages_ktigcc();
  22. void qInitImages_ktigcc();
  23. const char *tigcc_base;
  24. char *quill_drv;
  25. int main( int argc, char *argv[] )
  26. {
  27. KCmdLineArgs::init(argc,argv,"KTIGCC","TIGCC IDE for KDE","1.00");
  28. KApplication app;
  29. // Readd the images KDE kindly removes...
  30. qCleanupImages_ktigcc();
  31. qInitImages_ktigcc();
  32. if ((tigcc_base = getenv("TIGCC")) == NULL) {
  33. fprintf(stderr, "Fatal error: TIGCC is not defined in the environment. "
  34. "TIGCC must be defined before tigcc can run.\nFor (ba)sh, "
  35. "try: export TIGCC=/path/to/tigcc\nFor (t)csh, try: setenv "
  36. "TIGCC /path/to/tigcc\n");
  37. exit(-1);
  38. }
  39. quill_drv = (char *) malloc (strlen(tigcc_base) + 25);
  40. if (!quill_drv) {
  41. fprintf(stderr, "Fatal error: not enough free memory\n");
  42. exit(-1);
  43. }
  44. sprintf(quill_drv, "%s/bin/quill.drv", tigcc_base);
  45. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  46. sprintf(quill_drv, "%s/bin/Quill.drv", tigcc_base);
  47. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  48. sprintf(quill_drv, "%s/include/c/quill.drv", tigcc_base);
  49. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  50. sprintf(quill_drv, "%s/include/c/Quill.drv", tigcc_base);
  51. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  52. sprintf(quill_drv, "%s/include/quill/quill.drv", tigcc_base);
  53. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  54. sprintf(quill_drv, "%s/include/quill/Quill.drv", tigcc_base);
  55. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  56. sprintf(quill_drv, "%s/include/Quill/quill.drv", tigcc_base);
  57. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  58. sprintf(quill_drv, "%s/include/Quill/Quill.drv", tigcc_base);
  59. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  60. sprintf(quill_drv, "%s/lib/quill.drv", tigcc_base);
  61. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  62. sprintf(quill_drv, "%s/lib/Quill.drv", tigcc_base);
  63. if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  64. free(quill_drv);
  65. quill_drv=NULL;
  66. quill_drv_found:
  67. MainForm mainForm;
  68. app.setMainWidget( &mainForm );
  69. mainForm.show();
  70. return app.exec();
  71. }