Exemplo n.º 1
0
Arquivo: cfold.c Projeto: kstephens/ll
#define IR ll_ARG_1

ll_define_primitive(object, _ir_constantQ, _2(self, ir), _0())
{
  ll_call_tail(ll_o(constantQ), _1(ll_SELF));
}
ll_define_primitive_end


/* Returns true if symbol's binding is readonly. */
ll_define_primitive(symbol, _ir_readonlyQ, _1(self), _1(no_side_effect, "#t"))
{
  ll_v x;

  x = ll_call(ll_o(_binding), _1(ll_SELF));
  if ( ll_unbox_boolean(x) ) {
    x = ll_call(ll_o(readonlyQ), _1(x));
  } else {
    x = ll_call(ll_o(property), _2(ll_SELF, ll_s(readonly)));
  }

  ll_return(x);
}
ll_define_primitive_end


ll_define_primitive(symbol, _ir_constantQ, _2(self, ir), _0())
{
  ll_v x;
Exemplo n.º 2
0
void ResetStates( )
{
    ll_call( STATE_OFF, FUNCTION_CHARGING_LED );
    ll_call( STATE_OFF, FUNCTION_FLASHLIGHT );
    ll_call( STATE_ON, FUNCTION_DISPLAY );
}
Exemplo n.º 3
0
Arquivo: props.c Projeto: kstephens/ll
ll_define_primitive(properties_mixin, initialize, __1(self, args), _0())
{
  ll_call(ll_o(set_propertiesE), _2(ll_SELF, ll_nil));
}
Exemplo n.º 4
0
Arquivo: llt.c Projeto: kstephens/ll
int main(int argc, char **argv, char **envp)
{
  int interactive = 1;
  int print_result = 0;
  ll_v result;

  ll_init(&argc, &argv, &envp);

  result = ll_undef;

  {
    int argi;
    for ( argi = 1; argi < argc; ++ argi ) {
      const char *arg = argv[argi];
      if ( arg[0] == '-' ) {
	if ( ! strcmp("-h", arg) || ! strcmp("--help", arg) ) {
	  if ( interactive == 1 ) {
	    interactive = 0;
	  }
	  printf(
		 "%s [ -h | -d | -p | -i | -e expr ]\n"
		 "\n"
		 "  -h \n"
		 "    This help message. \n"
		 "  -d \n"
		 "    Invoke debugger on error. \n"
		 "  -p \n"
		 "    Print result of -e eval. \n"
		 "  -i \n"
		 "    Force interactive REPL. \n"
		 "  -e expr \n"
		 "    Evaluate expression (disables interactive unless -i). \n"
		 , argv[0]);
	} else
	if ( ! strcmp("-d", arg) ) {
	  ll_bind_fluid(ll_s(error_handler), ll_o(error_start_debugger));
	} else
	if ( ! strcmp("-p", arg) ) {
	  print_result = 1;
	} else
	if ( ! strcmp("-i", arg) ) {
	  interactive = 2;
	} else
	if ( ! strcmp("-e", arg) ) {
	  if ( interactive == 1 ) {
	    interactive = 0;
	  }

	  result = ll_eval_string(argv[++ argi], (size_t) -1);

	  if ( print_result ) {
	    if ( ll_NE(result, ll_unspec) ) {
	      ll_format(ll_undef, "~S\n", 1, result);
	    }
	  }	  
	} else {
	  fprintf(stderr, "ll: invalid argument: \"%s\"\n", arg);
	  exit(1);
	}
      }
    }
  }

  if ( interactive ) {
    ll_call(ll_o(llCtop_level), _0());
  }

  return 0;
}
Exemplo n.º 5
0
Arquivo: props.c Projeto: kstephens/ll
#define __rcs_id_ll_props_c__
static const char __rcs_id_ll_props_c[] = "$Id: props.c,v 1.7 2007/12/19 04:04:20 stephens Exp $";
#endif
#endif /* __rcs_id__ */

#include "ll.h"

ll_define_primitive(properties_mixin, initialize, __1(self, args), _0())
{
  ll_call(ll_o(set_propertiesE), _2(ll_SELF, ll_nil));
}
ll_define_primitive_end

ll_define_primitive(properties_mixin, properties, _1(self), _1(no_side_effect,"#t"))
{
  ll_v ploc = ll_call(ll_o(locative_properties), _1(ll_SELF));
  ll_return(*ll_unbox_locative(ploc));
}
ll_define_primitive_end

ll_define_primitive(properties_mixin, set_propertiesE, _2(self, props), _1(no_side_effect,"#t"))
{
  ll_v ploc = ll_call(ll_o(locative_properties), _1(ll_SELF));
  *ll_unbox_locative(ploc) = ll_ARG_1;
  ll_write_barrier(ll_UNBOX_locative(ploc));
}
ll_define_primitive_end

ll_define_primitive(properties_mixin, property, _2(self, prop), _1(no_side_effect,"#t"))
{
  ll_v ploc = ll_call(ll_o(locative_properties), _1(ll_SELF));