Example #1
0
SemVal *p_catStmnts(SemVal *lval, SemVal *rval)
{
    p_patchupFalse(lval, 1);

    msg("lval length: %u, rval length: %u", lval->codelen, rval->codelen);

    if (gp_nestLevel == 0)
    {
        util_out(gp_bin, lval->code, lval->codelen);
        p_discard(lval);
        return rval;
    }

    return p_catCode(lval, rval);
}
Example #2
0
void p_makeFrame()
{
    if (symtab_nLocals())
    {
        SemVal e = *p_stackFrame(0);         /* initialize empty frame */

        p_pushDead();
        gp_dead[gp_dead_sp] = 0;
        p_generateCode(&e, op_frame);        /* generate frame instruction */
        p_popDead();

        util_out(gp_bin, e.code, e.codelen); /* write to gp_bin */

        msg("write code frame of %u bytes", e.codelen);

        free(e.code);
    }
}
Example #3
0
static int
imap4d_mainloop (int fd, FILE *infile, FILE *outfile)
{
  imap4d_tokbuf_t tokp;
  char *text;
  int debug_mode = isatty (fd);

  imap4d_child_signal_setup (imap4d_child_signal);
  util_setio (infile, outfile);

  if (imap4d_preauth_setup (fd) == 0)
    {
      if (debug_mode)
	{
	  mu_diag_output (MU_DIAG_INFO, _("started in debugging mode"));
	  text = "IMAP4rev1 Debugging mode";
	}
      else
	text = "IMAP4rev1";
    }
  else
    {
      util_flush_output ();
      return 0;
    }

  /* Greetings.  */
  util_out ((state == STATE_AUTH) ? RESP_PREAUTH : RESP_OK, "%s", text);
  util_flush_output ();

  tokp = imap4d_tokbuf_init ();
  while (1)
    {
      imap4d_readline (tokp);
      /* check for updates */
      imap4d_sync ();
      util_do_command (tokp);
      imap4d_sync ();
      util_flush_output ();
    }

  return 0;
}
Example #4
0
void p_endFunction(SemVal *funStmnt)
{
    msg("START");

    gp_nestLevel = 0;       /* function completed: writing code to gp_bin 
                                now OK */

    p_makeFrame();           /* make the frame, defining the local variables */
                            /* and define the function's first address      */

    p_lastStmnt(funStmnt);   /* add the function's statements, patching 
                               funStmnnt's false list */

    if (!gp_dead[gp_dead_sp])
        util_out(gp_bin, &opret, sizeof(int8_t)); /* add a 'ret' instruction */
    else
        gp_dead[gp_dead_sp] = 0;  /* leaving a function: code generation ok,  */
                                /* e.g. to define global variables          */

    symtab_cleanup();        /* pop all but the global symtab, update the local
                                variable offsets */

    msg("END");
}