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.
 
 
 
 
 
 

110 lines
3.1 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. #include <stdio.h>
  19. #include "bwbasic.h"
  20. #include "bwb_mes.h"
  21. #if PARACT /* this whole file ignored if FALSE */
  22. /***************************************************************
  23. FUNCTION: bwb_newtask()
  24. DESCRIPTION: This C function allocates and initializes
  25. memory for a new task.
  26. ***************************************************************/
  27. #if ANSI_C
  28. int
  29. bwb_newtask( int task_requested )
  30. #else
  31. int
  32. bwb_newtask( task_requested )
  33. int task_requested;
  34. #endif
  35. {
  36. static char start_buf[] = "\0";
  37. static char end_buf[] = "\0";
  38. register int c;
  39. /* find if requested task slot is available */
  40. if ( bwb_tasks[ task_requested ] != NULL )
  41. {
  42. #if PROG_ERRORS
  43. sprintf( bwb_ebuf, "in bwb_newtask(): Slot requested is already in use" );
  44. bwb_error( bwb_ebuf );
  45. #else
  46. bwb_error( err_overflow );
  47. return -1;
  48. #endif
  49. }
  50. /* get memory for task structure */
  51. if ( ( bwb_tasks[ task_requested ] = calloc( 1, sizeof( struct bwb_task ) ) )
  52. == NULL )
  53. {
  54. #if PROG_ERRORS
  55. bwb_error( "in bwb_newtask(): failed to find memory for task structure" );
  56. #else
  57. bwb_error( err_getmem );
  58. #endif
  59. }
  60. /* set some initial variables */
  61. bwb_tasks[ task_requested ]->bwb_start.number = 0;
  62. bwb_tasks[ task_requested ]->bwb_start.next = &bwb_tasks[ task_requested ]->bwb_end;
  63. bwb_tasks[ task_requested ]->bwb_end.number = MAXLINENO + 1;
  64. bwb_tasks[ task_requested ]->bwb_end.next = &bwb_tasks[ task_requested ]->bwb_end;
  65. bwb_tasks[ task_requested ]->bwb_start.buffer = start_buf;
  66. bwb_tasks[ task_requested ]->bwb_end.buffer = end_buf;
  67. bwb_tasks[ task_requested ]->data_line = &bwb_tasks[ task_requested ]->bwb_start;
  68. bwb_tasks[ task_requested ]->data_pos = 0;
  69. bwb_tasks[ task_requested ]->rescan = TRUE;
  70. bwb_tasks[ task_requested ]->exsc = -1;
  71. bwb_tasks[ task_requested ]->expsc = 0;
  72. bwb_tasks[ task_requested ]->xtxtsc = 0;
  73. /* Variable and function table initializations */
  74. var_init( task_requested ); /* initialize variable chain */
  75. fnc_init( task_requested ); /* initialize function chain */
  76. fslt_init( task_requested ); /* initialize funtion-sub chain */
  77. return task_requested;
  78. }
  79. #endif
  80.