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.
 
 
 
 
 
 

193 lines
4.6 KiB

  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 */