Esempio n. 1
0
// ### fasl-sharp-dollar stream sub-char numarg => value
Value SYS_fasl_sharp_dollar(Value streamarg, Value subchar, Value numarg)
{
  Symbol * symbol = check_symbol(stream_read_symbol(streamarg, FASL_READTABLE));
  Thread * thread = current_thread();
  Value package = thread->symbol_value(S_fasl_anonymous_package);
  if (package == NIL)
    {
      package = make_value(new Package());
      thread->set_symbol_value(S_fasl_anonymous_package, package);
    }
  Value sym = check_package(package)->intern(symbol->name(), false);
  the_symbol(sym)->set_package(NIL);
  return sym;
}
Esempio n. 2
0
int msg_send(fmsg_pack *p, int fdto)
{
    if (check_package(p) == -1)
        return -1;
    //lock fdto
    if (lockf(fdto, 1, 0) == -1)
        sys_quit("lock failed");

    if (write(fdto, p, sizeof(fmsg_pack)) < 0)
        sys_quit("error occured while attempted to write :");
    //unlock fdto
    if (lockf(fdto, 0, 0) == -1)
        sys_quit("unlock failed");

    return 0;
}
Esempio n. 3
0
int msg_receive(fmsg_pack *q, int fdself)
{

    if (q == NULL)
        err_common("bad address");

    //lock fdself
    if (lockf(fdself, 1, 0) == -1)
        sys_quit("lock failed");

    if (read(fdself, q, sizeof(fmsg_pack)) < 0)
        sys_quit("error occured while attempted to read :");

    //unlock fdself
    if (lockf(fdself, 0, 0) == -1)
        sys_quit("unlock failed");

    if (check_package(q))
        return -1;

    return 0;
}
Esempio n. 4
0
static void zero_call_counts()
{
  Value packages = CL_list_all_packages();
  while (packages != NIL)
    {
      Package * package = check_package(car(packages));
      Value internal_symbols = package->internal_symbols();
      while (internal_symbols != NIL)
        {
          Symbol * symbol = the_symbol(car(internal_symbols));
          zero_call_count(symbol);
          internal_symbols = xcdr(internal_symbols);
        }
      Value external_symbols = package->external_symbols();
      while (external_symbols != NIL)
        {
          Symbol * symbol = the_symbol(car(external_symbols));
          zero_call_count(symbol);
          external_symbols = xcdr(external_symbols);
        }
      packages = xcdr(packages);
    }
}