ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bwx_tty.c 4.6 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /***************************************************************
  2. bwx_tty.c TTY front-end
  3. for Bywater BASIC Interpreter
  4. Copyright (c) 1993, Ted A. Campbell
  5. Bywater Software
  6. email: tcamp@delphi.com
  7. Copyright and Permissions Information:
  8. All U.S. and international rights are claimed by the author,
  9. Ted A. Campbell.
  10. This software is released under the terms of the GNU General
  11. Public License (GPL), which is distributed with this software
  12. in the file "COPYING". The GPL specifies the terms under
  13. which users may copy and use the software in this distribution.
  14. A separate license is available for commercial distribution,
  15. for information on which you should contact the author.
  16. ***************************************************************/
  17. /*---------------------------------------------------------------*/
  18. /* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */
  19. /* 11/1995 (eidetics@cerf.net). */
  20. /* */
  21. /* Those additionally marked with "DD" were at the suggestion of */
  22. /* Dale DePriest (daled@cadence.com). */
  23. /* */
  24. /* Version 3.00 by Howard Wulf, AF5NE */
  25. /* */
  26. /* Version 3.10 by Howard Wulf, AF5NE */
  27. /* */
  28. /*---------------------------------------------------------------*/
  29. #include "bwbasic.h"
  30. /***************************************************************
  31. FUNCTION: bwb_edit()
  32. DESCRIPTION: This function implements the BASIC EDIT
  33. program by shelling out to a default editor
  34. specified by the variable BWB.EDITOR$.
  35. SYNTAX: EDIT
  36. ***************************************************************/
  37. LineType *
  38. bwb_EDIT(LineType * l)
  39. {
  40. VariableType *v;
  41. char tbuf[BasicStringLengthMax + 1];
  42. bwx_DEBUG(__FUNCTION__);
  43. if( is_empty_filename( My->progfile ) )
  44. {
  45. WARN_BAD_FILE_NAME;
  46. return bwb_zline(l);
  47. }
  48. if( (v = var_find(DEFVNAME_EDITOR,0,FALSE)) == NULL )
  49. {
  50. bwb_strcpy(tbuf, DEF_EDITOR );
  51. }
  52. else
  53. {
  54. VariantType variant;
  55. if( var_get( v, &variant ) == FALSE )
  56. {
  57. bwb_strcpy(tbuf, DEF_EDITOR );
  58. }
  59. else
  60. {
  61. if( variant.TypeChar == '$' )
  62. {
  63. bwb_strcpy(tbuf, variant.Buffer );
  64. RELEASE( (&variant) );
  65. }
  66. else
  67. {
  68. bwb_strcpy(tbuf, DEF_EDITOR );
  69. }
  70. }
  71. }
  72. bwb_strcat( tbuf, " " );
  73. bwb_strcat( tbuf, My->progfile );
  74. system(tbuf);
  75. /* open edited file for read */
  76. bwb_NEW(l); /* Relocated by JBV (bug found by DD) */
  77. if( bwb_fload( NULL /* My->progfile */ ) == FALSE )
  78. {
  79. WARN_BAD_FILE_NAME;
  80. return bwb_zline(l);
  81. }
  82. return bwb_zline(l);
  83. }
  84. /***************************************************************
  85. FUNCTION: bwb_renum()
  86. DESCRIPTION: This function implements the BASIC RENUM
  87. command by shelling out to a default
  88. renumbering program called "renum".
  89. Added by JBV 10/95
  90. SYNTAX: RENUM
  91. ***************************************************************/
  92. LineType *
  93. bwb_RENUM(LineType * l)
  94. {
  95. VariableType *v;
  96. char tbuf[BasicStringLengthMax + 1];
  97. bwx_DEBUG(__FUNCTION__);
  98. if( is_empty_filename( My->progfile ) )
  99. {
  100. WARN_BAD_FILE_NAME;
  101. return bwb_zline(l);
  102. }
  103. if( (v = var_find(DEFVNAME_RENUM,0,FALSE)) == NULL )
  104. {
  105. bwb_strcpy(tbuf, DEF_RENUM );
  106. }
  107. else
  108. {
  109. VariantType variant;
  110. if( var_get( v, &variant ) == FALSE )
  111. {
  112. bwb_strcpy(tbuf, DEF_EDITOR );
  113. }
  114. else
  115. {
  116. if( variant.TypeChar == '$' )
  117. {
  118. bwb_strcpy(tbuf, variant.Buffer );
  119. RELEASE( (&variant) );
  120. }
  121. else
  122. {
  123. bwb_strcpy(tbuf, DEF_EDITOR );
  124. }
  125. }
  126. }
  127. bwb_strcat( tbuf, " " );
  128. bwb_strcat( tbuf, My->progfile );
  129. system(tbuf);
  130. /* open edited file for read */
  131. bwb_NEW(l); /* Relocated by JBV (bug found by DD) */
  132. if( bwb_fload( NULL /* My->progfile */ ) == FALSE )
  133. {
  134. WARN_BAD_FILE_NAME;
  135. return bwb_zline(l);
  136. }
  137. return bwb_zline(l);
  138. }
  139. LineType *
  140. bwb_RENUMBER(LineType * l)
  141. {
  142. return bwb_RENUM(l);
  143. }
  144. /* EOF */