예제 #1
0
파일: eval.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(object, eval_stage_3, __1(obj, env), _0())
{
  ll_v ir;

  ir = ll_SELF;

  /* Do constant folding. */
  if ( ! ll_unbox_boolean(ll_call(ll_o(property), _2(ir, ll_s(no_const_folding)))) ) {
    /* 
       ll_format(ll_undef, "const folding ~S\n", 1, ll_THIS->_body);
    */

    ll_call(ll_o(_ir_const_fold), _2(ir, ir));
    
    /*
      ll_format(ll_undef, "const folded ~S\n", 1, ll_THIS->_body);
    */
  } else {
    /* ll_format(ll_undef, "NO const folding ~S\n", 1, ll_THIS->_body); */
  }

  ll_return(ir);
}
예제 #2
0
파일: eval.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(object, eval_no_const_fold, __1(obj, env), _0())
{
  ll_v obj;
  ll_v env;
  ll_v expr;
  ll_v ir;
  ll_v op;

  obj = ll_SELF;
  env = ll_ARGV[1];

  expr = ll_call(ll_o(eval_stage_1), _2(obj, env));

  ir = ll_call(ll_o(eval_stage_2), _2(expr, env));
  
  /* Disable constant folding */
  ll_call(ll_o(set_propertyE), _3(ir, ll_s(no_const_folding), ll_t));

  ir = ll_call(ll_o(eval_stage_3), _2(ir, env));

  op = ll_call(ll_o(_ir_operation), _1(ir));
  
  ll_call_tail(op, _0());
}
예제 #3
0
파일: bcompile2.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(pair, _ir_compile2_debug_expr, _2(self, ir), _0())
{
  ll_assert_ref(IR);
  ll_call(ll_o(_ir_emit_constant), _2(IR, ll_SELF));
  ll_call(ll_o(_ir_emit), _2(IR, ll_s(_bcCdebug_expr)));
  ll_call_tail(ll_o(_ir_emit), _2(IR, ll_s(pop)));
}
예제 #4
0
파일: bcompile2.c 프로젝트: kstephens/ll
ll_define_primitive_end


/*
** Compile into code to generate a value for an exports vector.
*/
ll_define_primitive(pair, _ir_compile2_export, _2(self, ir), _0())
{
  ll_v x = ll_SELF;
  ll_v var = ll_car(x);
  ll_v type = var_type(x);
  ll_v index = var_index(x);

  ll_assert_ref(IR);

  /* slot ref */
  if ( ll_EQ(type, ll_s(slot)) ) {
    /* Create a const containing the global var name */
    index = ll_call(ll_o(_ir_const_index), _2(IR, var));
  } else
  if ( ll_EQ(type, ll_s(glo)) ) {
    ll_abort("<pair>:%ir-compile2-export");
  }

  /* undef export is a local from a car-pos sub lambda */
  if ( ll_EQ(type, ll_undef) ) {
    ll_call_tail(ll_o(_ir_compile2), _3(ll_undef, IR, ll_f));
  } else {
    ll_v emit_type = type;

    /* env_loc is an environment slot containing a locative */
    if ( ll_EQ(type, ll_s(env_loc)) ) {
      emit_type = ll_s(env);
    }

    if ( ll_unbox_boolean(index) ) {
      ll_call(ll_o(_ir_emit_with_int), _3(IR, emit_type, index));
    } else {
      ll_call(ll_o(_ir_emit), _2(IR, emit_type));
    }

    /*
    ** arg and local values are stored directly into the exports vector.
    ** so put the value, not a locative to the arg or local in the exports vector.
    */
    if ( ll_EQ(type, ll_s(arg)) 
	 || ll_EQ(type, ll_s(local)) 
	 || ll_EQ(type, ll_s(env_loc))
      ) {
      ll_call_tail(ll_o(_ir_emit), _2(IR, ll_s(contents)));
    }
  }
}
예제 #5
0
	vec3 obox::center() const
	{
		vec3 _1(x1y2z1 + (x2y1z2 - x1y2z1) / 2.0f);
		vec3 _2(x2y2z1 + (x1y1z2 - x2y2z1) / 2.0f);
		vec3 _3(x2y1z1 + (x1y2z2 - x2y1z1) / 2.0f);
		return vec3((_1 + _2 + _3) / 3.0f);
	}
예제 #6
0
파일: type.c 프로젝트: kstephens/ll
ll_define_primitive(type,_init_type_offset_alist, _2(type, src), _0())
{
  DBX(ll_SELF);

  ll_v src = ll_ARG_1;

  /* Not already scanned src into our type-offset-alist? */
  if ( ll_EQ(ll_assq(src, ll_THIS->_type_offset_alist), ll_f) ) {
    /* Do src's supers first */
    ll_v src_supers = ll_call(ll_o(type_supers), _1(src));
    ll_LIST_LOOP(src_supers, super);
    {
      ll_call(ll_o(_init_type_offset_alist), _2(ll_SELF, super));
    }
    ll_LIST_LOOP_END;

    /* Add */ 
    DBX(ll_SELF);
    ll_THIS->_type_offset_alist = ll_cons(ll_immutable_cons(src, ll_THIS->_size), ll_THIS->_type_offset_alist);
    ll_write_barrier_SELF();

    /* Increment our size based on the src slot-size */
    DBX(ll_SELF);
    ll_THIS->_size = ll__ADD(ll_THIS->_size, ll_call(ll_o(type_slots_size), _1(src)));
    ll_write_barrier_SELF();
  }

  DBX(ll_SELF);
}
예제 #7
0
파일: bcompile2.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(_ir, _ir_compile2_debug_expr, _2(self, ir), _0())
{
  ll_v expr;

  ll_assert_ref(IR);

  expr = ll_cons(ll_s(closure),
		 ll_cons(ll_THIS->_formals,
			 ll_THIS->_body));

  ll_call(ll_o(_ir_emit_constant), _2(IR, expr));
  ll_call(ll_o(_ir_emit), _2(IR, ll_s(_bcCdebug_expr)));
  ll_call_tail(ll_o(_ir_emit), _2(IR, ll_s(pop)));
}
예제 #8
0
void*
object_cache_alloc(object_cache* cache, uint32 flags)
{
	if (!(cache->flags & CACHE_NO_DEPOT)) {
		void* object = object_depot_obtain(&cache->depot);
		if (object) {
			T(Alloc(cache, flags, object));
			return object;
		}
	}

	MutexLocker _(cache->lock);
	slab* source = NULL;

	while (true) {
		source = cache->partial.Head();
		if (source != NULL)
			break;

		source = cache->empty.RemoveHead();
		if (source != NULL) {
			cache->empty_count--;
			cache->partial.Add(source);
			break;
		}

		if (object_cache_reserve_internal(cache, 1, flags) != B_OK) {
			T(Alloc(cache, flags, NULL));
			return NULL;
		}

		cache->pressure++;
	}

	ParanoiaChecker _2(source);

	object_link* link = _pop(source->free);
	source->count--;
	cache->used_count++;

	if (cache->total_objects - cache->used_count < cache->min_object_reserve)
		increase_object_reserve(cache);

	REMOVE_PARANOIA_CHECK(PARANOIA_SUSPICIOUS, source, &link->next,
		sizeof(void*));

	TRACE_CACHE(cache, "allocate %p (%p) from %p, %lu remaining.",
		link_to_object(link, cache->object_size), link, source, source->count);

	if (source->count == 0) {
		cache->partial.Remove(source);
		cache->full.Add(source);
	}

	void* object = link_to_object(link, cache->object_size);
	T(Alloc(cache, flags, object));
	return object;
}
예제 #9
0
파일: bcompile2.c 프로젝트: kstephens/ll
ll_define_primitive_end


/**********************************************************************/


#define CAR_POSQ ll_THIS_ISA(_ir, IR)->_car_posQ
#define TAIL_POSQ ll_ARG_2


ll_define_primitive(constant, _ir_compile2, _3(self, ir, tail_posQ), _0())
{
  ll_assert_ref(IR);
  ll_call(ll_o(_ir_emit_constant), _2(IR, SELF));
  if ( ll_unbox_boolean(TAIL_POSQ) ) {
    ll_call_tail(ll_o(_ir_emit), _2(IR, ll_s(rtn)));
  }
}
예제 #10
0
파일: bcompile2.c 프로젝트: kstephens/ll
/*
** Compiles a symbol into an instruction that generates a get,
** locative, or set operation.
** to the variable.
*/
ll_define_primitive(symbol, _ir_compile2_gen, _4(self, ir, tail_posQ, mode), _0())
{
  ll_v x = ll_call(ll_o(_ir_var_scope), _2(IR, SELF));
  ll_v mode = ll_ARG_3;
  ll_v var = SELF;
  ll_v type = var_type(x);
  ll_v index = var_index(x);
  ll_v co = var_closed_overQ(x);
  ll_v isn = ll_nil;

  _ll_gdb_stop_at();

  if ( ll_DEBUG(compile_emit) ) {
    ll_format(ll_undef, "  ~O: compile2-gen: ~S ~S\n", 3, IR, mode, x);
  }

  ll_assert_ref(IR);

  /* If it's closed over and environment has been exported.
   *
   * The environment has not been exported until 
   * the rest args creation
   * and other preambles have been emited.
   */
  if ( ll_unbox_boolean(co) 
       && ! in_preamble 
       /* && ll_unbox_boolean(ll_THIS_ISA(_ir, IR)->_env_exportedQ) */
       ) {
    /* Get the locative to the exports[slots] value */
    ll_call(ll_o(_ir_emit_with_int), _3(IR, ll_s(export), co));

    /*
    ** If the closed-over variable is an argument or a local
    ** the value is stored directly in the exported environment
    ** vector.
    **
    ** Otherwise the environment slot contains a locative
    ** to the actual value, probably an object slot.
    */
    if ( ! (ll_EQ(type, ll_s(arg)) || ll_EQ(type, ll_s(local))) ) {
      ll_call(ll_o(_ir_emit), _2(IR, ll_s(contents)));
    }
  }
예제 #11
0
파일: eval.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(list, eval_list, __1(list, env), _0())
{
  int eval_each = 1; // getenv("ll_LOAD_EVAL_EACH") ? 1 : 0;
  ll_v exprs = ll_SELF;

  if ( eval_each ) {
    ll_v result = ll_undef;

    ll_LIST_LOOP(exprs, expr);
    {
      result = ll_call(ll_o(eval), _1(expr));
    }
    ll_LIST_LOOP_END;

    ll_return(result);
  } else {
    exprs = ll_call(ll_o(map), _2(ll_o(Seval_hookS), exprs));

    exprs = ll_call(ll_o(map), _2(ll_o(macro_expand), exprs));

    {
      ll_v ir;
      ll_v op;
      
      ir = ll_call(ll_o(make), _2(ll_type(_ir),
				  exprs               /* body */
				  ));
      
      op = ll_call(ll_o(_ir_operation), _1(ir));
      
      ll_call_tail(op, _0());
    }
  }
}
예제 #12
0
파일: eval.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(object, eval_stage_2, __1(obj, env), _0())
{
  ll_v expr;
  ll_v ir;

  expr = ll_SELF;

  /*
    ll_format(ll_undef, "\neval: after macro-expand: ~S\n\n", 1, expr);
  */

  ir = ll_call(ll_o(make), _2(ll_type(_ir),
			       ll_cons(expr, ll_nil)  /* body */
			       ));

  ll_return(ir);
}
예제 #13
0
  void visitDecl(InterfaceDeclNode* node) {
    ScopedFormatAttrActivate _(virtualAttr);
    ScopedFormatAttrBlock    _2(apiAttr);

    indent() << "class " << apiExport << " " << node->name << "Interface";
    if (node->inherits.size() > 0) {
      out() << ": ";
      for (unsigned int i = 0; i < node->inherits.size(); ++i) {
        out() << "virtual public " << node->inherits.at(i) << "Interface";
        if (i + 1 != node->inherits.size())
          out() << ", ";
      }
    }
    out() << " {" << std::endl;
    indent() << "public:" << std::endl;
    //add a virtual destructor
    indent() << "  virtual ~" << node->name << "Interface() {}" << std::endl;
    scoped(node->values);
    indent() << "};" << std::endl << std::endl;
    indent() << "typedef qi::Object<" << node->name << "Interface> " << node->name << ";" << std::endl;
  }
예제 #14
0
  void visitDecl(InterfaceDeclNode* node) {
    int current = id;
    id++;
    currentParent = formatNs(_pr->package) + "::" + node->name + "Interface";
    indent() << "static int initType" << current << "() {" << std::endl;
    {
      ScopedIndent _(_indent);
      ScopedFormatAttrActivate _2(methodAttr);
      indent() << "qi::ObjectTypeBuilder< " << currentParent << " > builder;" << std::endl;
      for (unsigned int i = 0; i < node->inherits.size(); ++i) {
        indent() << "builder.inherits< " << node->inherits.at(i) << "Interface >();" << std::endl;
      }
      for (unsigned int i = 0; i < node->values.size(); ++i) {
        accept(node->values.at(i));
      }
      indent() << "builder.registerType();" << std::endl;

      currentParent = "";
      indent() << "return 42;" << std::endl;
    }
    indent() << "}" << std::endl;
    indent() << "static int myinittype" << current << " = initType" << current << "();" << std::endl;
    indent() << std::endl;
  }
예제 #15
0
파일: props.c 프로젝트: kstephens/ll
ll_define_primitive(properties_mixin, initialize, __1(self, args), _0())
{
  ll_call(ll_o(set_propertiesE), _2(ll_SELF, ll_nil));
}
예제 #16
0
void
do_scheduling_analysis(bigtime_t startTime, bigtime_t endTime,
	size_t bufferSize)
{
	printf("\n");

	// allocate a chunk of memory for the scheduling analysis
	void* buffer = malloc(bufferSize);
	if (buffer == NULL) {
		fprintf(stderr, "Error: Failed to allocate memory for the scheduling "
			"analysis.\n");
		exit(1);
	}
	MemoryDeleter _(buffer);

	// do the scheduling analysis
	scheduling_analysis analysis;
	status_t error = _kern_analyze_scheduling(startTime, endTime, buffer,
		bufferSize, &analysis);
	if (error != B_OK) {
		fprintf(stderr, "Error: Scheduling analysis failed: %s\n",
			strerror(error));
		exit(1);
	}

	// allocate arrays for grouping and sorting the wait objects
	scheduling_analysis_thread_wait_object** waitObjects
		= new(std::nothrow) scheduling_analysis_thread_wait_object*[
			analysis.thread_wait_object_count];
	ArrayDeleter<scheduling_analysis_thread_wait_object*> _2(waitObjects);

	wait_object_group* waitObjectGroups = new(std::nothrow) wait_object_group[
		analysis.thread_wait_object_count];
	ArrayDeleter<wait_object_group> _3(waitObjectGroups);

	if (waitObjects == NULL || waitObjectGroups == NULL) {
		fprintf(stderr, "Error: Out of memory\n");
		exit(1);
	}

	printf("scheduling analysis: %lu threads, %llu wait objects, "
		"%llu thread wait objects\n", analysis.thread_count,
		analysis.wait_object_count, analysis.thread_wait_object_count);

	// sort the thread by run time
	std::sort(analysis.threads, analysis.threads + analysis.thread_count,
		ThreadRunTimeComparator());

	for (uint32 i = 0; i < analysis.thread_count; i++) {
		scheduling_analysis_thread* thread = analysis.threads[i];

		// compute total wait time and prepare the objects for sorting
		int32 waitObjectCount = 0;
		bigtime_t waitTime = 0;
		scheduling_analysis_thread_wait_object* threadWaitObject
			= thread->wait_objects;
		while (threadWaitObject != NULL) {
			waitObjects[waitObjectCount++] = threadWaitObject;
			waitTime += threadWaitObject->wait_time;
			threadWaitObject = threadWaitObject->next_in_list;
		}

		// sort the wait objects by type + name
		std::sort(waitObjects, waitObjects + waitObjectCount,
			WaitObjectGroupingComparator());

		// create the groups
		wait_object_group* group = NULL;
		int32 groupCount = 0;
		for (int32 i = 0; i < waitObjectCount; i++) {
			scheduling_analysis_thread_wait_object* threadWaitObject
				= waitObjects[i];
			scheduling_analysis_wait_object* waitObject
				= threadWaitObject->wait_object;

			if (groupCount == 0 || strcmp(waitObject->name, "?") == 0
				|| waitObject->type != group->objects[0]->wait_object->type
				|| strcmp(waitObject->name,
						group->objects[0]->wait_object->name) != 0) {
				// create a new group
				group = &waitObjectGroups[groupCount++];
				group->objects = waitObjects + i;
				group->count = 0;
				group->wait_time = 0;
				group->waits = 0;
			}

			group->count++;
			group->wait_time += threadWaitObject->wait_time;
			group->waits += threadWaitObject->waits;
		}

		// sort the groups by wait time
		std::sort(waitObjectGroups, waitObjectGroups + groupCount,
			WaitObjectGroupTimeComparator());

		printf("\nthread %ld \"%s\":\n", thread->id, thread->name);
		printf("  run time:    %lld us (%lld runs)\n", thread->total_run_time,
			thread->runs);
		printf("  wait time:   %lld us\n", waitTime);
		printf("  latencies:   %lld us (%lld)\n", thread->total_latency,
			thread->latencies);
		printf("  preemptions: %lld us (%lld)\n", thread->total_rerun_time,
			thread->reruns);
		printf("  unspecified: %lld us\n", thread->unspecified_wait_time);

		printf("  waited on:\n");
		for (int32 i = 0; i < groupCount; i++) {
			wait_object_group& group = waitObjectGroups[i];
			char buffer[1024];

			if (group.count == 1) {
				// only one element -- just print it
				scheduling_analysis_thread_wait_object* threadWaitObject
					= group.objects[0];
				scheduling_analysis_wait_object* waitObject
					= threadWaitObject->wait_object;
				wait_object_to_string(waitObject, buffer);
				printf("    %s: %lld us (%lld)\n", buffer,
					threadWaitObject->wait_time, threadWaitObject->waits);
			} else {
				// sort the wait objects by wait time
				std::sort(group.objects, group.objects + group.count,
					WaitObjectTimeComparator());

				// print the group line
				wait_object_to_string(group.objects[0]->wait_object, buffer,
					true);
				printf("    group %s: %lld us (%lld)\n", buffer,
					group.wait_time, group.waits);

				// print the wait objects
				for (int32 k = 0; k < group.count; k++) {
					scheduling_analysis_thread_wait_object* threadWaitObject
						= group.objects[k];
					scheduling_analysis_wait_object* waitObject
						= threadWaitObject->wait_object;
					wait_object_to_string(waitObject, buffer);
					printf("      %s: %lld us (%lld)\n", buffer,
						threadWaitObject->wait_time, threadWaitObject->waits);
				}
			}
		}
	}
}
예제 #17
0
파일: singleton.c 프로젝트: kstephens/ll
#include "ll.h"

/*************************************************************************/

ll_define_primitive(singleton_type, make, __1(type, args), _0())
{
  ll_call_super(ll_o(make), ll_f, _1(ll_SELF));
}
ll_define_primitive_end


/*************************************************************************/


ll_define_primitive(singleton_type, instance, 
		    _1(self), 
		    _2(no_side_effect, "#f",
		       doc, "Returns the singleton instance."))
{
  if ( ll_EQ(ll_THIS->_instance, ll_undef) ) {
    ll_THIS->_instance = ll_call_super(ll_o(make), ll_f, _1(ll_SELF));
  }
  ll_return(ll_THIS->_instance);
}
ll_define_primitive_end


/*************************************************************************/


예제 #18
0
unsigned char key_layout_us[128][4] = {
  { '\0', '\0', '\0', '\0' }, // 00
  { _4(KEY_ESCAPE) }, // 01 - Escape
  { '1', '!', '\0', '\0' }, // 02 - Numeric 1
  { '2', '@', '\0', '\0' }, // 03
  { '3', '#', '\0', '\0' }, // 04
  { '4', '$', '\0', '\0' }, // 05
  { '5', '%', '\0', '\0' }, // 06
  { '6', '^', '\0', '\0' }, // 07
  { '7', '&', '\0', '\0' }, // 08
  { '8', '*', '\0', '\0' }, // 09
  { '9', '(', '\0', '\0' }, // 0a
  { '0', ')', '\0', '\0' }, // 0b
  { '-', '_', '\0', '\0' }, // 0c
  { '=', '+', '\0', '\0' }, // d0
  { _2(KEY_BACKSPACE), '\0', '\0' }, // 0e - Backspace
  { _2(KEY_TAB), '\0', '\0' }, // 0f - Tabs
  { 'q', 'Q', '\0', '\0' }, // 10 - Alpha line 1
  { 'w', 'W', '\0', '\0' }, // 11
  { 'e', 'E', '\0', '\0' }, // 12
  { 'r', 'R', '\0', '\0' }, // 13
  { 't', 'T', '\0', '\0' }, // 14
  { 'y', 'Y', '\0', '\0' }, // 15
  { 'u', 'U', '\0', '\0' }, // 16
  { 'i', 'I', '\0', '\0' }, // 17
  { 'o', 'O', '\0', '\0' }, // 18
  { 'p', 'P', '\0', '\0' }, // 19
  { '[', '{', '\0', '\0' }, // 1a
  { ']', '}', '\0', '\0' }, // 1b
  { _2(KEY_ENTER), '\0', '\0' }, // 1c - Enter
  { _2(KEY_CTRL), '\0', '\0' }, // 1d - Left Ctrl
예제 #19
0
	.extended = (EFUSE_DEFAULT)
};

LOCKBITS = (LB_MODE_1); 

EEMEM	var_t		E;									// Variables in eeprom
		var_t		R									// Variables in ram
					=									// Variables in flash rom
{		.RC_OSCCAL			= 0xFF						// CPU osc tune value
,		.FreqXtal			= DEVICE_XTAL				// crystal frequency[MHz] (8.24bits)
,		.Freq				= 0x03866666				// Running frequency[MHz] (11.21bits)
#if INCLUDE_SMOOTH
,		.SmoothTunePPM		= 3500						// SmoothTunePPM
#endif
#if INCLUDE_FREQ_SM
,		.FreqSub			= 0.0 * _2(21)				// Freq subtract value is 0.0MHz (11.21bits)
,		.FreqMul			= 1.0 * _2(21)				// Freq multiply value os 1.0    (11.21bits)
#endif
#if INCLUDE_ABPF | INCLUDE_IBPF
,		.FilterCrossOver[0]	= {  4.0 * 4.0 * _2(5) }	// Default filter cross over
,		.FilterCrossOver[1]	= {  8.0 * 4.0 * _2(5) }	// frequnecy for softrock V9
,		.FilterCrossOver[2]	= { 16.0 * 4.0 * _2(5) }	// BPF. Four value array.
,		.FilterCrossOver[3]	= { true }					// ABPF is default enabled
#endif													// Filter control on/off [3]
#if INCLUDE_IBPF
,		.Band2Filter		= {	0,            1,            2,            3            }
,		.BandSub			= {	0.0 * _2(21), 0.0 * _2(21), 0.0 * _2(21), 0.0 * _2(21) }
,		.BandMul			= {	1.0 * _2(21), 1.0 * _2(21), 1.0 * _2(21), 1.0 * _2(21) }
#endif
#if INCLUDE_SN
,		.SerialNumber		= '0'						// Default USB SerialNumber ID.
예제 #20
0
파일: eq.c 프로젝트: kstephens/ll
#include "ll.h"
#include "call_int.h"

#define X ll_SELF
#define Y ll_ARG_1

/************************************************************************/

ll_define_primitive(object, eqQ, _2(x, y), _1(no_side_effect,"#t"))
{
  ll_return(ll_make_boolean(ll_EQ(X, Y)));
}
ll_define_primitive_end

/************************************************************************/

ll_define_primitive(object, eqvQ, _2(x, y), _1(no_side_effect,"#t"))
{
  ll_return(ll_make_boolean(ll_EQ(X, Y)));
}
ll_define_primitive_end

ll_define_primitive(fixnum, eqvQ, _2(x, y), _1(no_side_effect,"#t"))
{
  ll_v t2;

  if ( ll_EQ(ll_ARG_0, ll_ARG_1) ) {
    ll_return(ll_t);
  }
  t2 = ll_TYPE(ll_ARG_1);
예제 #21
0
				,	PCF_LPF2_I2C_ADDR		// I2C address for the second MegaFilterMobo PCF8574
				,	PCF_EXT_I2C_ADDR		// I2C address for an external PCF8574 used for FAN, attenuators etc
				,	HI_TMP_TRIGGER			// If PA temperature goes above this point, then
											// disable transmission
				,	P_MIN_TRIGGER			// Min P out measurement for SWR trigger
				,	SWR_PROTECT_TIMER		// Timer loop value (in 10ms increments)
				,	SWR_TRIGGER				// Max SWR threshold (10 x SWR)
				,	PWR_CALIBRATE			// Power meter calibration value
				,	BIAS_SELECT				// Which bias, 0 = Cal, 1 = LO, 2 = HI
				,	BIAS_LO					// PA Bias in 10 * mA, typically  20mA or Class B
				,	BIAS_HI					// PA Bias in 10 * mA, typically 350mA or Class A
				,	CAL_LO					// PA Bias setting, Class LO
				,	CAL_HI					// PA Bias setting, Class HI
				,	DEVICE_XTAL				// FreqXtal
				,	3500					// SmoothTunePPM
				, {	( 7.050000 * _2(23) )	// Freq at startup, Default
				,	( 1.820000 * _2(23) )	// Freq at startup, Memory 1
				,	( 3.520000 * _2(23) )	// Freq at startup, Memory 2
				,	( 7.020000 * _2(23) )	// Freq at startup, Memory 3
				,	(10.120000 * _2(23) )	// Freq at startup, Memory 4
				,	(14.020000 * _2(23) )	// Freq at startup, Memory 5
				,	(18.090000 * _2(23) )	// Freq at startup, Memory 6
				,	(21.020000 * _2(23) )	// Freq at startup, Memory 7
				,	(24.910000 * _2(23) )	// Freq at startup, Memory 8
				,	(28.020000 * _2(23) ) }	// Freq at startup, Memory 9
				, 	3						// Which memory was last in use
				, {	(  2.0 * 4.0 * _2(5) )	// Default filter cross over
				,	(  6.0 * 4.0 * _2(5) )	// frequencies for Mobo V4.3
				,	(  8.0 * 4.0 * _2(5) )	// BPF. eight value array.
				,	( 12.0 * 4.0 * _2(5) )
				,	( 16.0 * 4.0 * _2(5) )
예제 #22
0
// Update
status_t
ShareAttrDir::Update(const AttrDirInfo& dirInfo,
	DoublyLinkedList<ShareAttrDirIterator>* iterators)
{
	if (!dirInfo.isValid)
		return B_BAD_VALUE;

	if (fRevision >= dirInfo.revision)
		return B_OK;

	// allocate an array for the old attributes
	int32 oldCount = fAttributes.Size();
	Attribute** oldAttributes = new(std::nothrow) Attribute*[oldCount];
	if (!oldAttributes)
		return B_NO_MEMORY;
	ArrayDeleter<Attribute*> _(oldAttributes);

	// get the new attributes
	Attribute** newAttributes = NULL;
	int32 newCount = 0;
	status_t error = _GetAttributes(dirInfo, newAttributes, newCount);
	if (error != B_OK)
		return error;
	ArrayDeleter<Attribute*> _2(newAttributes);

	// sort the iterators
	int32 iteratorCount = (iterators ? iterators->Count() : 0);
	if (iteratorCount > 0) {
		// allocate an array
		ShareAttrDirIterator** _iterators
			= new(std::nothrow) ShareAttrDirIterator*[iteratorCount];
		if (!_iterators)
			return B_NO_MEMORY;
		ArrayDeleter<ShareAttrDirIterator*> _3(_iterators);

		// move the iterators
		for (int32 i = 0; i < iteratorCount; i++) {
			ShareAttrDirIterator* iterator = iterators->First();
			_iterators[i] = iterator;
			iterators->Remove(iterator);
		}

		// sort them
		qsort(_iterators, iteratorCount, sizeof(ShareAttrDirIterator*),
			compare_iterators);

		// move them back into the list
		for (int32 i = 0; i < iteratorCount; i++)
			iterators->Insert(_iterators[i]);
	}

	// remove the old attributes
	for (int32 i = 0; i < oldCount; i++) {
		Attribute* attribute = fAttributes.GetFirst();
		oldAttributes[i] = attribute;
		fAttributes.Remove(attribute);
	}

	// add the new attributes
	int32 oldIndex = 0;
	int32 newIndex = 0;
	ShareAttrDirIterator* iterator = (iterators ? iterators->First() : NULL);
	while (oldIndex < oldCount || newIndex < newCount) {
		Attribute* oldAttr = (oldCount > 0 ? oldAttributes[oldIndex] : NULL);
		Attribute* newAttr = (newCount > 0 ? newAttributes[newIndex] : NULL);
		int cmp = compare_attributes(oldAttr, newAttr);
		if (cmp < 0) {
			// oldAttr is obsolete: move all iterators pointing to it to the
			// next new attribute
			while (iterator && iterator->GetCurrentAttribute() == oldAttr) {
				iterator->SetCurrentAttribute(newAttr);
				iterator = iterators->GetNext(iterator);
			}
			oldIndex++;
		} else if (cmp > 0) {
			// newAttr is new
			fAttributes.Insert(newAttr);
			newIndex++;
		} else {
			// oldAttr == newAttr
			fAttributes.Insert(newAttr);
			oldIndex++;
			newIndex++;

			// move the attributes pointing to this attribute
			while (iterator && iterator->GetCurrentAttribute() == oldAttr) {
				iterator->SetCurrentAttribute(newAttr);
				iterator = iterators->GetNext(iterator);
			}
		}
	}

	// delete the old attributes
	for (int32 i = 0; i < oldCount; i++)
		Attribute::DeleteAttribute(oldAttributes[i]);

	fRevision = dirInfo.revision;
	fUpToDate = true;

	return B_OK;
}
예제 #23
0
파일: type.c 프로젝트: kstephens/ll
ll_define_primitive_end


ll_define_primitive(type,initialize, __3(self,supertypes,slot_names,doc), _0())
{
  DBX(ll_SELF);

  ll_call_super(ll_o(initialize), ll_f, _1(ll_SELF));

  /* copy supers */
  {
    ll_v supers = ll_nil, *xp = &supers;

    ll_LIST_LOOP(ll_ARG_1, super);
    {
      *xp = ll_immutable_cons(super, ll_nil);
      /* WRITE BARRIER */
      xp = &ll_CDR(*xp);
    }
    ll_LIST_LOOP_END;

    ll_THIS->_supers = ll_ARG_1;
    ll_write_barrier_SELF();
  }

  /* copy and compute slot offsets, and slots size */
  DBX(ll_SELF);
  {
    ll_v slots = ll_nil, *xp = &slots;
    size_t offset = 0;

    ll_LIST_LOOP(ll_ARG_2, slot_def);
    {
      ll_v slot_name, slot_offset;
      ll_v slot_item;

      slot_name = slot_def;
      slot_offset = ll_make_fixnum(offset);
      offset += sizeof(ll_v);

      slot_item = ll_immutable_cons(slot_name, ll_immutable_cons(slot_offset, ll_nil));

      *xp = ll_immutable_cons(slot_item, ll_nil);
      /* WRITE BARRIER */
      xp = &ll_CDR(*xp);
    }
    ll_LIST_LOOP_END;

    ll_THIS->_slots = slots;
    ll_THIS->_slots_size = ll_make_fixnum(offset);
    ll_write_barrier_SELF();
  }

  /* We'll fill this in later */
  ll_THIS->_size = ll_make_fixnum(0);
  ll_write_barrier_SELF();

#if ll_USE_OP_METH_ALIST
  /* A new type as no methods */
  ll_THIS->_op_meth_alist = ll_nil;
#endif

  /* We'll fill this in later */
  ll_THIS->_type_offset_alist = ll_nil;

  /* It's not top wired and it's not immutable */
  ll_THIS->_top_wiredQ = ll_f;
  ll_THIS->_immutableQ = ll_f;

  /* Create anon coerce and type-check ops */
  DBX(ll_SELF);
  ll_THIS->_tester = ll_f;
  ll_write_barrier_SELF();
  ll_THIS->_coercer = _ll_make_operation();
  ll_write_barrier_SELF();
  ll_THIS->_typechecker = _ll_make_operation();
  ll_THIS->_properties = ll_nil;
  ll_write_barrier_SELF();

  /* Remember any documentation. */
  if ( ll_ARGC >= 4 ) {
    ll_call(ll_o(set_llCdocE), _2(ll_SELF, ll_ARG_3));
  }

  /* Fill in the size and type offset alist */
  DBX(ll_SELF);
  ll_call(ll_o(_init_type_offset_alist), _2(ll_SELF, ll_SELF));

  /* Add methods for coerce and type-check ops */
  DBX(ll_SELF);
  _ll_add_method(ll_SELF, ll_THIS->_coercer, _ll_p_identity);
  _ll_add_method(ll_SELF, ll_THIS->_typechecker, _ll_p_identity);

  DBX(ll_SELF);
  ll_return(ll_SELF);
}
예제 #24
0
파일: type.c 프로젝트: kstephens/ll
    _ll_bc_debug = 1;
  }

  /* (make <type> ...) -> (initialize <instance> ...) */
  ll_SELF = instance;
  __ll_call_tailv(ll_o(initialize),ll_ARGC);
}
ll_define_primitive_end


/*************************************************************************/


ll_define_primitive(type, locative_properties, 
		    _1(self), 
		    _2(no_side_effect, "#t",
		       doc, "Returns a locative to the type's properties list."))
{
  ll_return(ll_make_locative(&ll_THIS->_properties));
}
ll_define_primitive_end


ll_define_primitive(type,type_size,
		    _1(type), 
		    _2(no_side_effect,"#t",
		       doc, "Returns the size, in bytes, of an instance."))
{
  ll_return(ll_THIS->_size);
}
ll_define_primitive_end