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.
 
 
 
 
 
 

116 lines
3.5 KiB

  1. /***************************************************************
  2. bwb_par.c Parallel Action (Multitasking) Routines
  3. for Bywater BASIC Interpreter
  4. Currently UNDER CONSTRUCTION
  5. Copyright (c) 1993, Ted A. Campbell
  6. Bywater Software
  7. email: tcamp@delphi.com
  8. Copyright and Permissions Information:
  9. All U.S. and international rights are claimed by the author,
  10. Ted A. Campbell.
  11. This software is released under the terms of the GNU General
  12. Public License (GPL), which is distributed with this software
  13. in the file "COPYING". The GPL specifies the terms under
  14. which users may copy and use the software in this distribution.
  15. A separate license is available for commercial distribution,
  16. for information on which you should contact the author.
  17. ***************************************************************/
  18. /*---------------------------------------------------------------*/
  19. /* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */
  20. /* 11/1995 (eidetics@cerf.net). */
  21. /*---------------------------------------------------------------*/
  22. #include <stdio.h>
  23. #include "bwbasic.h"
  24. #include "bwb_mes.h"
  25. #if PARACT /* this whole file ignored if FALSE */
  26. /***************************************************************
  27. FUNCTION: bwb_newtask()
  28. DESCRIPTION: This C function allocates and initializes
  29. memory for a new task.
  30. ***************************************************************/
  31. #if ANSI_C
  32. int
  33. bwb_newtask( int task_requested )
  34. #else
  35. int
  36. bwb_newtask( task_requested )
  37. int task_requested;
  38. #endif
  39. {
  40. static char start_buf[] = "\0";
  41. static char end_buf[] = "\0";
  42. register int c;
  43. /* find if requested task slot is available */
  44. if ( bwb_tasks[ task_requested ] != NULL )
  45. {
  46. #if PROG_ERRORS
  47. sprintf( bwb_ebuf, "in bwb_newtask(): Slot requested is already in use" );
  48. bwb_error( bwb_ebuf );
  49. #else
  50. bwb_error( err_overflow );
  51. return -1;
  52. #endif
  53. }
  54. /* get memory for task structure */
  55. /* Revised to CALLOC pass-thru call by JBV */
  56. if ( ( bwb_tasks[ task_requested ] = CALLOC( 1, sizeof( struct bwb_task ), "bwb_newtask" ) )
  57. == NULL )
  58. {
  59. #if PROG_ERRORS
  60. bwb_error( "in bwb_newtask(): failed to find memory for task structure" );
  61. #else
  62. bwb_error( err_getmem );
  63. #endif
  64. }
  65. /* set some initial variables */
  66. bwb_tasks[ task_requested ]->bwb_start.number = 0;
  67. bwb_tasks[ task_requested ]->bwb_start.next = &bwb_tasks[ task_requested ]->bwb_end;
  68. bwb_tasks[ task_requested ]->bwb_end.number = MAXLINENO + 1;
  69. bwb_tasks[ task_requested ]->bwb_end.next = &bwb_tasks[ task_requested ]->bwb_end;
  70. bwb_tasks[ task_requested ]->bwb_start.buffer = start_buf;
  71. bwb_tasks[ task_requested ]->bwb_end.buffer = end_buf;
  72. bwb_tasks[ task_requested ]->data_line = &bwb_tasks[ task_requested ]->bwb_start;
  73. bwb_tasks[ task_requested ]->data_pos = 0;
  74. bwb_tasks[ task_requested ]->rescan = TRUE;
  75. bwb_tasks[ task_requested ]->exsc = -1;
  76. bwb_tasks[ task_requested ]->expsc = 0;
  77. bwb_tasks[ task_requested ]->xtxtsc = 0;
  78. /* Variable and function table initializations */
  79. var_init( task_requested ); /* initialize variable chain */
  80. fnc_init( task_requested ); /* initialize function chain */
  81. fslt_init( task_requested ); /* initialize funtion-sub chain */
  82. return task_requested;
  83. }
  84. #endif