home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- *
- * G E T _ C C O D E . C
- * ---------------------
- *
- * Description:
- * Compiles a C-code statement.
- *
- * Included functions:
- * get_ccode - Does the job
- *
- * Revision:
- * Ver Date By Reason
- * --- ---- -- ------
- * 1.00 90730 Lars Berntzon Created
- *
- ******************************************************************************/
-
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
-
- #include "token.h"
- #include "comp.h"
-
- struct ccode *get_ccode()
- {
- struct ccode *cp = NULL;
- struct stmt *stmt;
-
- if ((stmt = get_stmt()) == NULL) {
- error("expected C-code statements");
- return NULL;
- }
-
- cp = memalloc(sizeof *cp);
- cp->stmt = stmt;
-
- return cp;
- }
-
- struct ccode *unget_ccode(struct ccode *cp)
- {
- struct ccode *next;
-
- if (cp == NULL) return NULL;
-
- next = NEXT_CCODE(cp);
- if (cp->stmt) unget_stmt(cp->stmt);
- if (cp->link.name) free(cp->link.name);
- free(cp);
-
- return next;
- }
-
-