home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu 2008 / 2008-06-02_hobbes.nmsu.edu.zip / new / scummc-0.2.0-os2.zip / ScummC / src / scc_code.h < prev    next >
Encoding:
Text File  |  2006-11-09  |  2.3 KB  |  80 lines

  1. /* ScummC
  2.  * Copyright (C) 2004-2006  Alban Bedel
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License
  6.  * as published by the Free Software Foundation; either version 2
  7.  * of the License, or (at your option) any later version.
  8.  
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  17.  *
  18.  */
  19.  
  20. /**
  21.  * @file scc_code.h
  22.  * @ingroup scc
  23.  * @brief SCUMM code generator
  24.  */
  25.  
  26. /// @name Loop Stack
  27. /// A little stack for the loops, this is needed
  28. /// by the parser to check the branch instruction validity.
  29. //@{
  30.  
  31. /// @brief       Add a loop entry to the stack.
  32. /// @param type  Type of the corresponding instruction
  33. /// @param sym   Name of the loop or NULL
  34. void scc_loop_push(int type, char* sym);
  35.  
  36. /// @brief  Pop the current loop
  37. /// @return The poped loop
  38. scc_loop_t* scc_loop_pop(void);
  39.  
  40. /// @brief       Get the loop referenced by a branching instruction.
  41. /// @param type  Type of the branching instruction
  42. /// @param sym   Name of the loop or NULL
  43. /// @return      The matching loop or NULL
  44. scc_loop_t* scc_loop_get(int type,char* sym);
  45.  
  46. //@}
  47.  
  48. /// @name Code blocks
  49. //@(
  50.  
  51. /// Create a new code block
  52. scc_code_t* scc_code_new(int len);
  53.  
  54. /// Destroy a code block
  55. void scc_code_free(scc_code_t* c);
  56.  
  57. /// Destroy a code block list
  58. void scc_code_free_all(scc_code_t* c);
  59.  
  60. //@}
  61.  
  62. /// @name Scripts
  63. //@{
  64.  
  65. /// @brief            Generate a script from a parse tree.
  66. /// @param ns         Namespace to use
  67. /// @param inst       The parse tree
  68. /// @param return_op  The op code to use for return
  69. /// @param close_scr  If true add a return at the end of the script.
  70. scc_script_t* scc_script_new(scc_ns_t* ns, scc_instruct_t* inst,
  71.                              uint8_t return_op,char close_scr);
  72.  
  73. /// Destroy a script
  74. void scc_script_free(scc_script_t* scr);
  75.  
  76. /// Destroy a list of script
  77. void scc_script_list_free(scc_script_t* scr);
  78.  
  79. //@}
  80.