Ejemplo n.º 1
0
void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) {
	// don't call this function when the queue is full, but just in case, wait for a move to complete and free up the space for the passed target
	while (queue_full())
		delay(WAITING_DELAY);

	uint8_t h = mb_head + 1;
	h &= (MOVEBUFFER_SIZE - 1);

	DDA* new_movebuffer = &(movebuffer[h]);
	
	if (t != NULL) {
		dda_create(new_movebuffer, t);
		new_movebuffer->endstop_check = endstop_check;
		new_movebuffer->endstop_stop_cond = endstop_stop_cond;
	}
	else {
		// it's a wait for temp
		new_movebuffer->waitfor_temp = 1;
		new_movebuffer->nullmove = 0;
	}

	// make certain all writes to global memory
	// are flushed before modifying mb_head.
	MEMORY_BARRIER();
	
	mb_head = h;
	
	uint8_t save_reg = SREG;
	cli();
	CLI_SEI_BUG_MEMORY_BARRIER();

	uint8_t isdead = (movebuffer[mb_tail].live == 0);
	
	MEMORY_BARRIER();
	SREG = save_reg;
	
	if (isdead) {
		timer1_compa_deferred_enable = 0;
		next_move();
		if (timer1_compa_deferred_enable) {
			uint8_t save_reg = SREG;
			cli();
			CLI_SEI_BUG_MEMORY_BARRIER();
			
			TIMSK1 |= MASK(OCIE1A);
			
			MEMORY_BARRIER();
			SREG = save_reg;
		}
	}	
}
Ejemplo n.º 2
0
static int __clhepfl_mutex_lock(clhepfl_mutex_t *impl, clhepfl_context_t *me) {
    clhepfl_node_t *p = me->current;
    p->spin           = LOCKED;

    MEMORY_BARRIER();
    // The thread enqueues
    clhepfl_node_t *pred = xchg_64((void *)&impl->tail, (void *)p);
    if (pred == NULL)
        return 0;

    // If the previous thread was locked, we wait on its context
    PREFETCHW(pred);
    while (pred->spin == LOCKED) {
        CPU_PAUSE();
        pause_rep(REP_VAL);
        PREFETCHW(pred);
    }

    impl->head = p;
    COMPILER_BARRIER();
    // We take the context of the previous thread
    me->current = pred;

    return 0;
}
Ejemplo n.º 3
0
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
  MEMORY_BARRIER ();
  *lock = 0;
  return 0;
}
Ejemplo n.º 4
0
/// check if the queue is completely full
uint8_t queue_full() {
	MEMORY_BARRIER();
	if (mb_tail > mb_head) {
		return ((mb_tail - mb_head - 1) == 0) ? 255 : 0;
	} else {
		return ((mb_tail + MOVEBUFFER_SIZE - mb_head - 1) == 0) ? 255 : 0;
	}
}
Ejemplo n.º 5
0
void read_ucode(void* start, unsigned long size)
{
    data_cache_hit_writeback_invalidate(start, size);

    disable_interrupts();
    __SP_DMA_wait();

    SP_regs->DRAM_addr = start;
    MEMORY_BARRIER();
    SP_regs->RSP_addr = (void*)SP_DMA_IMEM;
    MEMORY_BARRIER();
    SP_regs->rsp_write_length = size - 1;
    MEMORY_BARRIER();
    __SP_DMA_wait();
    data_cache_hit_invalidate(start, size);

    enable_interrupts();
    return;
}
Ejemplo n.º 6
0
uint8_t queue_empty(){
    uint8_t save_reg = SREG;
    cli();
    CLI_SEI_BUG_MEMORY_BARRIER();

    uint8_t result = ((mb_tail == mb_head) && (movebuffer[mb_tail].live = 0))?255:0;

    MEMORY_BARRIER();
    SREG = save_reg;
    return result;
}
    /**
     * Returns a SecureRandom object that implements the specified Random Number Generator (RNG) algorithm.
     */
    SecureRandom SecureRandom::getInstance(const NarrowString& algorithm)
    {
        ASSERT( !algorithm.empty() );

        const NarrowString alg(AlgorithmName::normalizeAlgorithm(algorithm));
        SecureRandomBase* impl = SecureRandomBase::createInstance(alg, nullptr, 0);
        MEMORY_BARRIER();

        ASSERT(impl != nullptr);
        return SecureRandom(impl);
    }
Ejemplo n.º 8
0
uint8_t queue_push(uint8_t *p_pointer, uint8_t *p_behind, uint8_t queue_size){
	NO_INTERRUPTS_BLOCK();
	MEMORY_BARRIER();
	
	uint8_t                ret;
	uint8_t                pointer           = *p_pointer;
	uint8_t                behind            = *p_behind;
	
	pointer += 1;
	pointer -= (pointer >= queue_size) ? queue_size : 0;
	
	if(pointer == behind){
		ret = 255; // error
	}else{
		*p_pointer = pointer;
		ret = 0;   // success
	}
	
	MEMORY_BARRIER();
	END_BLOCK();
	return ret;
}
Ejemplo n.º 9
0
uint8_t queue_pop(uint8_t *p_pointer, uint8_t *p_ahead, uint8_t queue_size){
	NO_INTERRUPTS_BLOCK();
	MEMORY_BARRIER();
	
	uint8_t                ret;
	uint8_t                pointer           = *p_pointer;
	uint8_t                ahead             = *p_ahead;
	
	if(pointer == ahead){
		ret = 255; // error
	}else{
		pointer += 1;
		pointer -= (pointer >= queue_size) ? queue_size : 0;
		
		*p_pointer = pointer;
		ret = 0;   // success
	}
	
	MEMORY_BARRIER();
	END_BLOCK();
	return ret;
}
Ejemplo n.º 10
0
//-------------------------------------------
//      Entry point for the application
//-------------------------------------------
void appMain(void)
{
    PRINTF("Starting...\n");

    initFullBN();

    accelOn();

    mdelay(START_DELAY);

    redLedOn();

    for (;;) {
        uint16_t now = ALARM_TIMER_VALUE();
        uint16_t endTime = now + MAIN_LOOP_LENGTH;

        Packet_t packet;
        packet.accX = accelReadX();
        packet.accY = accelReadY();
        packet.accZ = accelReadZ();

        // PRINTF("read %d %d %d\n", packet.accX, packet.accY, packet.accZ);

        uint16_t start = ALARM_TIMER_VALUE();
        MEMORY_BARRIER();

        addMeasurement(&packet);

        MEMORY_BARRIER();
        uint16_t end = ALARM_TIMER_VALUE();
        
        if (vectorPos == 0) {
            PRINTF("time to calc = %u ticks\n", end - start);
        }

        while (timeAfter16(endTime, ALARM_TIMER_VALUE()));
    }
}
Ejemplo n.º 11
0
uint8_t queue_have_item(uint8_t *p_pointer, uint8_t *p_ahead, uint8_t queue_size){
	NO_INTERRUPTS_BLOCK();
	MEMORY_BARRIER();
	
	uint8_t                ret;
	uint8_t                pointer           = *p_pointer;
	uint8_t                ahead             = *p_ahead;
	
	ret =  (pointer == ahead) ?
		255 :
		0;
	
	END_BLOCK();
	return ret;
}
Ejemplo n.º 12
0
/// dump queue for emergency stop.
/// \todo effect on startpoint is undefined!
void queue_flush() {
	// Since the timer interrupt is disabled before this function
	// is called it is not strictly necessary to write the variables
	// inside an interrupt disabled block...
	uint8_t save_reg = SREG;
	cli();
	CLI_SEI_BUG_MEMORY_BARRIER();
	
	// flush queue
	mb_tail = mb_head;
	movebuffer[mb_head].live = 0;

	// disable timer
	setTimer(0);
	
	MEMORY_BARRIER();
	SREG = save_reg;
}
Ejemplo n.º 13
0
uint8_t queue_have_space(uint8_t *p_pointer, uint8_t *p_behind, uint8_t queue_size){
	NO_INTERRUPTS_BLOCK();
	MEMORY_BARRIER();
	
	uint8_t                ret;
	uint8_t                pointer           = *p_pointer;
	uint8_t                behind            = *p_behind;
	
	pointer += 1;
	pointer -= (pointer >= queue_size) ? queue_size : 0;
	
	ret = (pointer == behind) ?
		255 : // error
		0;
	
	END_BLOCK()
	return ret;
}
Ejemplo n.º 14
0
/// add a move to the movebuffer
/// \note this function waits for space to be available if necessary, check queue_full() first if waiting is a problem
/// This is the only function that modifies mb_head and it always called from outside an interrupt.
void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) {
	// don't call this function when the queue is full, but just in case, wait for a move to complete and free up the space for the passed target
	while (queue_full())
		delay_us(100);

	uint8_t h = mb_head + 1;
	h &= (MOVEBUFFER_SIZE - 1);

	DDA* new_movebuffer = &(movebuffer[h]);
  DDA* prev_movebuffer = (queue_empty() != 0) ? NULL : &movebuffer[mb_head];

  if (t != NULL) {
    dda_create(new_movebuffer, t, prev_movebuffer);
		new_movebuffer->endstop_check = endstop_check;
		new_movebuffer->endstop_stop_cond = endstop_stop_cond;
	}
	else {
		// it's a wait for temp
		new_movebuffer->waitfor_temp = 1;
		new_movebuffer->nullmove = 0;
	}

	// make certain all writes to global memory
	// are flushed before modifying mb_head.
	MEMORY_BARRIER();

	mb_head = h;

  uint8_t isdead;

  ATOMIC_START
    isdead = (movebuffer[mb_tail].live == 0);
  ATOMIC_END

	if (isdead) {
		next_move();
		// Compensate for the cli() in setTimer().
		sei();
	}
}
Ejemplo n.º 15
0
/*!	do stuff every 1/4 second

	called from clock_10ms(), do not call directly
*/
void clock_250ms() {
	#ifndef	NO_AUTO_IDLE
	if (temp_all_zero())	{
		if (steptimeout > (30 * 4)) {
			power_off();
		}
		else {
			uint8_t save_reg = SREG;
			cli();
			CLI_SEI_BUG_MEMORY_BARRIER();
			steptimeout++;
			MEMORY_BARRIER();
			SREG = save_reg;
		}
	}
	#endif

	ifclock(clock_flag_1s) {
		if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
			// current position
			sersendf_P(PSTR("Pos: %ld,%ld,%ld,%ld,%lu\n"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);

			// target position
			sersendf_P(PSTR("Dst: %ld,%ld,%ld,%ld,%lu\n"), movebuffer[mb_tail].endpoint.X, movebuffer[mb_tail].endpoint.Y, movebuffer[mb_tail].endpoint.Z, movebuffer[mb_tail].endpoint.E, movebuffer[mb_tail].endpoint.F);

			// Queue
			print_queue();

			// newline
			serial_writechar('\n');
		}
		// temperature
		/*		if (temp_get_target())
		temp_print();*/
	}
	#ifdef	TEMP_INTERCOM
	start_send();
	#endif
}
Ejemplo n.º 16
0
thread_info *
rdf_thread_info(rdf_db *db, int tid)
{ query_admin *qa = &db->queries;
  per_thread *td = &qa->query.per_thread;
  thread_info *ti;
  size_t idx = MSB(tid);

  if ( !td->blocks[idx] )
  { simpleMutexLock(&qa->query.lock);
    if ( !td->blocks[idx] )
    { size_t bs = BLOCKLEN(idx);
      thread_info **newblock = rdf_malloc(db, bs*sizeof(thread_info*));

      memset(newblock, 0, bs*sizeof(thread_info*));

      td->blocks[idx] = newblock-bs;
    }
    simpleMutexUnlock(&qa->query.lock);
  }

  if ( !(ti=td->blocks[idx][tid]) )
  { simpleMutexLock(&qa->query.lock);
    if ( !(ti=td->blocks[idx][tid]) )
    { ti = rdf_malloc(db, sizeof(*ti));
      memset(ti, 0, sizeof(*ti));
      init_query_stack(db, &ti->queries);
      MEMORY_BARRIER();
      td->blocks[idx][tid] = ti;
      if ( tid > qa->query.thread_max )
	qa->query.thread_max = tid;
    }
    simpleMutexUnlock(&qa->query.lock);
  }

  return ti;
}
Ejemplo n.º 17
0
/// specify how long until the step timer should fire
void setTimer(uint32_t delay)
{
	// save interrupt flag
	uint8_t sreg = SREG;
	uint16_t step_start = 0;
	
	// disable interrupts
	cli();
	CLI_SEI_BUG_MEMORY_BARRIER();
	
	// re-enable clock interrupt in case we're recovering from emergency stop
	TIMSK1 |= MASK(OCIE1B);

	if (delay > 0) {

		// if the delay is too small use a minimum delay so that there is time
		// to set everything up before the timer expires.

		if (delay < 17 )
			delay = 17;
		
		// Assume all steps belong to one move. Within one move the delay is
		// from one step to the next one, which should be more or less the same
		// as from one step interrupt to the next one. The last step interrupt happend
		// at OCR1A, so start delay from there.
		step_start = OCR1A;
		if (next_step_time == 0) {
			// new move, take current time as start value
			step_start = TCNT1;
		}

		next_step_time = delay;
		if (next_step_time < 65536) {
			// set the comparator directly to the next real step
			OCR1A = (next_step_time + step_start) & 0xFFFF;
		}
		else if (next_step_time < 75536) {
			// Next comparator interrupt would have to trigger another
			// interrupt within a short time (possibly within 1 cycle).
			// Avoid the impossible by firing the interrupt earlier.
			OCR1A = (step_start - 10000) & 0xFFFF;
			next_step_time += 10000;
		}
		else {
			OCR1A = step_start;
		}

		// Defer the enabling of the timer1_CompA interrupts.
		
		timer1_compa_deferred_enable = 1;
	} else {
		// flag: move has ended
		next_step_time = 0;
		TIMSK1 &= ~MASK(OCIE1A);
		timer1_compa_deferred_enable = 0;
	}

	// restore interrupt flag
	MEMORY_BARRIER();
	SREG = sreg;
}
Ejemplo n.º 18
0
/// check if the queue is completely full
uint8_t queue_full() {
        MEMORY_BARRIER();
        return (((mb_tail - mb_head - 1) & (MOVEBUFFER_SIZE - 1)) == 0)?255:0;
}
Ejemplo n.º 19
0
void clock_250ms() {
        debug_led_step();

        if (steptimeout > (30 * 4)) {
                power_off();
        }
        else if (heaters_all_off())	{
                uint8_t save_reg = SREG;
                cli();
                CLI_SEI_BUG_MEMORY_BARRIER();
                steptimeout++;
                MEMORY_BARRIER();
                SREG = save_reg;
        }
        
#ifdef	TEMP_INTERCOM
        start_send();
#endif

        ifclock(clock_flag_1s) {
                if (DEBUG_POSITION && (debug_flags & DEBUG_CLOCK)) sersendf_P(PSTR("1s"));
                if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
                        // current position
                        sersendf_P(PSTR("Pos: %ld,%ld,%ld,%ld,%lu\n"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);

                        // target position
                        sersendf_P(PSTR("Dst: %ld,%ld,%ld,%ld,%lu\n"), movebuffer[mb_tail].endpoint.X, movebuffer[mb_tail].endpoint.Y, movebuffer[mb_tail].endpoint.Z, movebuffer[mb_tail].endpoint.E, movebuffer[mb_tail].endpoint.F);

                        // Queue
                        print_queue();

                        // newline
                        serial_writechar('\n');
                }

                check_temp_achieved();
                if (DEBUG_POSITION && (debug_flags & DEBUG_CLOCK)) sersendf_P(PSTR("t"));
                
                
                ++seconds_counter;
                
                if (++idle_seconds>60)
                	working_seconds=0;
               	else
	                ++working_seconds;
                #ifdef OK_WHEN_IDLE
		if (idle_seconds>OK_WHEN_IDLE && seconds_counter-last_ok_time>OK_WHEN_IDLE)
		{
			sersendf_P(PSTR("ok (idle)\n"));
			last_ok_time=seconds_counter;
		}
		#endif 
		
		
                if (DEBUG_POSITION && (debug_flags & DEBUG_CLOCK)) sersendf_P(PSTR("r\n"));
                
                #if defined ALWAYS_CHECK_Z_MIN && defined Z_MIN_PIN
		if (z_min_pushed_flag) {
			sersendf_P(PSTR("ALERT!! PUSHING UNDERGROUND!!\n"));
			z_min_pushed_flag=0;
		}
		#endif
        }
        
}
Ejemplo n.º 20
0
uint8_t queue_current(uint8_t *p_pointer){
	MEMORY_BARRIER();
	return *p_pointer;
}
  /**
  * Build a unmodifiable Map from entity Character to Name.
  * @return Unmodifiable map.
  */
  const HTMLEntityCodec::EntityMap& HTMLEntityCodec::getCharacterToEntityMap()
  {
    MutexLock lock(getClassMutex());

    static volatile bool init = false;
    static shared_ptr<EntityMap> map;

    MEMORY_BARRIER();
    if(!init)
    {
      shared_ptr<EntityMap> temp(new EntityMap);
      ASSERT(nullptr != temp.get());

      // Convenience
      EntityMap& tm = *temp.get();

      // 252 items, but no reserve() on std::map
      tm[WideCharToNarrowStr(34)] = "quot"; /* quotation mark */
      tm[WideCharToNarrowStr(38)] = "amp"; /* ampersand */
      tm[WideCharToNarrowStr(60)] = "lt"; /* less-than sign */
      tm[WideCharToNarrowStr(62)] = "gt"; /* greater-than sign */
      tm[WideCharToNarrowStr(160)] = "nbsp"; /* no-break space */
      tm[WideCharToNarrowStr(161)] = "iexcl"; /* inverted exclamation mark */
      tm[WideCharToNarrowStr(162)] = "cent"; /* cent sign */
      tm[WideCharToNarrowStr(163)] = "pound"; /* pound sign */
      tm[WideCharToNarrowStr(164)] = "curren"; /* currency sign */
      tm[WideCharToNarrowStr(165)] = "yen"; /* yen sign */
      tm[WideCharToNarrowStr(166)] = "brvbar"; /* broken bar */
      tm[WideCharToNarrowStr(167)] = "sect"; /* section sign */
      tm[WideCharToNarrowStr(168)] = "uml"; /* diaeresis */
      tm[WideCharToNarrowStr(169)] = "copy"; /* copyright sign */
      tm[WideCharToNarrowStr(170)] = "ordf"; /* feminine ordinal indicator */
      tm[WideCharToNarrowStr(171)] = "laquo"; /* left-pointing double angle quotation mark */
      tm[WideCharToNarrowStr(172)] = "not"; /* not sign */
      tm[WideCharToNarrowStr(173)] = "shy"; /* soft hyphen */
      tm[WideCharToNarrowStr(174)] = "reg"; /* registered sign */
      tm[WideCharToNarrowStr(175)] = "macr"; /* macron */
      tm[WideCharToNarrowStr(176)] = "deg"; /* degree sign */
      tm[WideCharToNarrowStr(177)] = "plusmn"; /* plus-minus sign */
      tm[WideCharToNarrowStr(178)] = "sup2"; /* superscript two */
      tm[WideCharToNarrowStr(179)] = "sup3"; /* superscript three */
      tm[WideCharToNarrowStr(180)] = "acute"; /* acute accent */
      tm[WideCharToNarrowStr(181)] = "micro"; /* micro sign */
      tm[WideCharToNarrowStr(182)] = "para"; /* pilcrow sign */
      tm[WideCharToNarrowStr(183)] = "middot"; /* middle dot */
      tm[WideCharToNarrowStr(184)] = "cedil"; /* cedilla */
      tm[WideCharToNarrowStr(185)] = "sup1"; /* superscript one */
      tm[WideCharToNarrowStr(186)] = "ordm"; /* masculine ordinal indicator */
      tm[WideCharToNarrowStr(187)] = "raquo"; /* right-pointing double angle quotation mark */
      tm[WideCharToNarrowStr(188)] = "frac14"; /* vulgar fraction one quarter */
      tm[WideCharToNarrowStr(189)] = "frac12"; /* vulgar fraction one half */
      tm[WideCharToNarrowStr(190)] = "frac34"; /* vulgar fraction three quarters */
      tm[WideCharToNarrowStr(191)] = "iquest"; /* inverted question mark */
      tm[WideCharToNarrowStr(192)] = "Agrave"; /* Latin capital letter a with grave */
      tm[WideCharToNarrowStr(193)] = "Aacute"; /* Latin capital letter a with acute */
      tm[WideCharToNarrowStr(194)] = "Acirc"; /* Latin capital letter a with circumflex */
      tm[WideCharToNarrowStr(195)] = "Atilde"; /* Latin capital letter a with tilde */
      tm[WideCharToNarrowStr(196)] = "Aum"; /* Latin capital letter a with diaeresis */
      tm[WideCharToNarrowStr(197)] = "Aring"; /* Latin capital letter a with ring above */
      tm[WideCharToNarrowStr(198)] = "AElig"; /* Latin capital letter ae */
      tm[WideCharToNarrowStr(199)] = "Ccedil"; /* Latin capital letter c with cedilla */
      tm[WideCharToNarrowStr(200)] = "Egrave"; /* Latin capital letter e with grave */
      tm[WideCharToNarrowStr(201)] = "Eacute"; /* Latin capital letter e with acute */
      tm[WideCharToNarrowStr(202)] = "Ecirc"; /* Latin capital letter e with circumflex */
      tm[WideCharToNarrowStr(203)] = "Euml"; /* Latin capital letter e with diaeresis */
      tm[WideCharToNarrowStr(204)] = "Igrave"; /* Latin capital letter i with grave */
      tm[WideCharToNarrowStr(205)] = "Iacute"; /* Latin capital letter i with acute */
      tm[WideCharToNarrowStr(206)] = "Icirc"; /* Latin capital letter i with circumflex */
      tm[WideCharToNarrowStr(207)] = "Iuml"; /* Latin capital letter i with diaeresis */
      tm[WideCharToNarrowStr(208)] = "ETH"; /* Latin capital letter eth */
      tm[WideCharToNarrowStr(209)] = "Ntilde"; /* Latin capital letter n with tilde */
      tm[WideCharToNarrowStr(210)] = "Ograve"; /* Latin capital letter o with grave */
      tm[WideCharToNarrowStr(211)] = "Oacute"; /* Latin capital letter o with acute */
      tm[WideCharToNarrowStr(212)] = "Ocirc"; /* Latin capital letter o with circumflex */
      tm[WideCharToNarrowStr(213)] = "Otilde"; /* Latin capital letter o with tilde */
      tm[WideCharToNarrowStr(214)] = "Ouml"; /* Latin capital letter o with diaeresis */
      tm[WideCharToNarrowStr(215)] = "times"; /* multiplication sign */
      tm[WideCharToNarrowStr(216)] = "Oslash"; /* Latin capital letter o with stroke */
      tm[WideCharToNarrowStr(217)] = "Ugrave"; /* Latin capital letter u with grave */
      tm[WideCharToNarrowStr(218)] = "Uacute"; /* Latin capital letter u with acute */
      tm[WideCharToNarrowStr(219)] = "Ucirc"; /* Latin capital letter u with circumflex */
      tm[WideCharToNarrowStr(220)] = "Uuml"; /* Latin capital letter u with diaeresis */
      tm[WideCharToNarrowStr(221)] = "Yacute"; /* Latin capital letter y with acute */
      tm[WideCharToNarrowStr(222)] = "THORN"; /* Latin capital letter thorn */
      tm[WideCharToNarrowStr(223)] = "szlig"; /* Latin small letter sharp sXCOMMAX German Eszett */
      tm[WideCharToNarrowStr(224)] = "agrave"; /* Latin small letter a with grave */
      tm[WideCharToNarrowStr(225)] = "aacute"; /* Latin small letter a with acute */
      tm[WideCharToNarrowStr(226)] = "acirc"; /* Latin small letter a with circumflex */
      tm[WideCharToNarrowStr(227)] = "atilde"; /* Latin small letter a with tilde */
      tm[WideCharToNarrowStr(228)] = "auml"; /* Latin small letter a with diaeresis */
      tm[WideCharToNarrowStr(229)] = "aring"; /* Latin small letter a with ring above */
      tm[WideCharToNarrowStr(230)] = "aelig"; /* Latin lowercase ligature ae */
      tm[WideCharToNarrowStr(231)] = "ccedil"; /* Latin small letter c with cedilla */
      tm[WideCharToNarrowStr(232)] = "egrave"; /* Latin small letter e with grave */
      tm[WideCharToNarrowStr(233)] = "eacute"; /* Latin small letter e with acute */
      tm[WideCharToNarrowStr(234)] = "ecirc"; /* Latin small letter e with circumflex */
      tm[WideCharToNarrowStr(235)] = "euml"; /* Latin small letter e with diaeresis */
      tm[WideCharToNarrowStr(236)] = "igrave"; /* Latin small letter i with grave */
      tm[WideCharToNarrowStr(237)] = "iacute"; /* Latin small letter i with acute */
      tm[WideCharToNarrowStr(238)] = "icirc"; /* Latin small letter i with circumflex */
      tm[WideCharToNarrowStr(239)] = "iuml"; /* Latin small letter i with diaeresis */
      tm[WideCharToNarrowStr(240)] = "eth"; /* Latin small letter eth */
      tm[WideCharToNarrowStr(241)] = "ntilde"; /* Latin small letter n with tilde */
      tm[WideCharToNarrowStr(242)] = "ograve"; /* Latin small letter o with grave */
      tm[WideCharToNarrowStr(243)] = "oacute"; /* Latin small letter o with acute */
      tm[WideCharToNarrowStr(244)] = "ocirc"; /* Latin small letter o with circumflex */
      tm[WideCharToNarrowStr(245)] = "otilde"; /* Latin small letter o with tilde */
      tm[WideCharToNarrowStr(246)] = "ouml"; /* Latin small letter o with diaeresis */
      tm[WideCharToNarrowStr(247)] = "divide"; /* division sign */
      tm[WideCharToNarrowStr(248)] = "oslash"; /* Latin small letter o with stroke */
      tm[WideCharToNarrowStr(249)] = "ugrave"; /* Latin small letter u with grave */
      tm[WideCharToNarrowStr(250)] = "uacute"; /* Latin small letter u with acute */
      tm[WideCharToNarrowStr(251)] = "ucirc"; /* Latin small letter u with circumflex */
      tm[WideCharToNarrowStr(252)] = "uuml"; /* Latin small letter u with diaeresis */
      tm[WideCharToNarrowStr(253)] = "yacute"; /* Latin small letter y with acute */
      tm[WideCharToNarrowStr(254)] = "thorn"; /* Latin small letter thorn */
      tm[WideCharToNarrowStr(255)] = "yuml"; /* Latin small letter y with diaeresis */
      tm[WideCharToNarrowStr(338)] = "OElig"; /* Latin capital ligature oe */
      tm[WideCharToNarrowStr(339)] = "oelig"; /* Latin small ligature oe */
      tm[WideCharToNarrowStr(352)] = "Scaron"; /* Latin capital letter s with caron */
      tm[WideCharToNarrowStr(353)] = "scaron"; /* Latin small letter s with caron */
      tm[WideCharToNarrowStr(376)] = "Yuml"; /* Latin capital letter y with diaeresis */
      tm[WideCharToNarrowStr(402)] = "fnof"; /* Latin small letter f with hook */
      tm[WideCharToNarrowStr(710)] = "circ"; /* modifier letter circumflex accent */
      tm[WideCharToNarrowStr(732)] = "tilde"; /* small tilde */
      tm[WideCharToNarrowStr(913)] = "Alpha"; /* Greek capital letter alpha */
      tm[WideCharToNarrowStr(914)] = "Beta"; /* Greek capital letter beta */
      tm[WideCharToNarrowStr(915)] = "Gamma"; /* Greek capital letter gamma */
      tm[WideCharToNarrowStr(916)] = "Delta"; /* Greek capital letter delta */
      tm[WideCharToNarrowStr(917)] = "Epsilon"; /* Greek capital letter epsilon */
      tm[WideCharToNarrowStr(918)] = "Zeta"; /* Greek capital letter zeta */
      tm[WideCharToNarrowStr(919)] = "Eta"; /* Greek capital letter eta */
      tm[WideCharToNarrowStr(920)] = "Theta"; /* Greek capital letter theta */
      tm[WideCharToNarrowStr(921)] = "Iota"; /* Greek capital letter iota */
      tm[WideCharToNarrowStr(922)] = "Kappa"; /* Greek capital letter kappa */
      tm[WideCharToNarrowStr(923)] = "Lambda"; /* Greek capital letter lambda */
      tm[WideCharToNarrowStr(924)] = "Mu"; /* Greek capital letter mu */
      tm[WideCharToNarrowStr(925)] = "Nu"; /* Greek capital letter nu */
      tm[WideCharToNarrowStr(926)] = "Xi"; /* Greek capital letter xi */
      tm[WideCharToNarrowStr(927)] = "Omicron"; /* Greek capital letter omicron */
      tm[WideCharToNarrowStr(928)] = "Pi"; /* Greek capital letter pi */
      tm[WideCharToNarrowStr(929)] = "Rho"; /* Greek capital letter rho */
      tm[WideCharToNarrowStr(931)] = "Sigma"; /* Greek capital letter sigma */
      tm[WideCharToNarrowStr(932)] = "Tau"; /* Greek capital letter tau */
      tm[WideCharToNarrowStr(933)] = "Upsilon"; /* Greek capital letter upsilon */
      tm[WideCharToNarrowStr(934)] = "Phi"; /* Greek capital letter phi */
      tm[WideCharToNarrowStr(935)] = "Chi"; /* Greek capital letter chi */
      tm[WideCharToNarrowStr(936)] = "Psi"; /* Greek capital letter psi */
      tm[WideCharToNarrowStr(937)] = "Omega"; /* Greek capital letter omega */
      tm[WideCharToNarrowStr(945)] = "alpha"; /* Greek small letter alpha */
      tm[WideCharToNarrowStr(946)] = "beta"; /* Greek small letter beta */
      tm[WideCharToNarrowStr(947)] = "gamma"; /* Greek small letter gamma */
      tm[WideCharToNarrowStr(948)] = "delta"; /* Greek small letter delta */
      tm[WideCharToNarrowStr(949)] = "epsilon"; /* Greek small letter epsilon */
      tm[WideCharToNarrowStr(950)] = "zeta"; /* Greek small letter zeta */
      tm[WideCharToNarrowStr(951)] = "eta"; /* Greek small letter eta */
      tm[WideCharToNarrowStr(952)] = "theta"; /* Greek small letter theta */
      tm[WideCharToNarrowStr(953)] = "iota"; /* Greek small letter iota */
      tm[WideCharToNarrowStr(954)] = "kappa"; /* Greek small letter kappa */
      tm[WideCharToNarrowStr(955)] = "lambda"; /* Greek small letter lambda */
      tm[WideCharToNarrowStr(956)] = "mu"; /* Greek small letter mu */
      tm[WideCharToNarrowStr(957)] = "nu"; /* Greek small letter nu */
      tm[WideCharToNarrowStr(958)] = "xi"; /* Greek small letter xi */
      tm[WideCharToNarrowStr(959)] = "omicron"; /* Greek small letter omicron */
      tm[WideCharToNarrowStr(960)] = "pi"; /* Greek small letter pi */
      tm[WideCharToNarrowStr(961)] = "rho"; /* Greek small letter rho */
      tm[WideCharToNarrowStr(962)] = "sigmaf"; /* Greek small letter final sigma */
      tm[WideCharToNarrowStr(963)] = "sigma"; /* Greek small letter sigma */
      tm[WideCharToNarrowStr(964)] = "tau"; /* Greek small letter tau */
      tm[WideCharToNarrowStr(965)] = "upsilon"; /* Greek small letter upsilon */
      tm[WideCharToNarrowStr(966)] = "phi"; /* Greek small letter phi */
      tm[WideCharToNarrowStr(967)] = "chi"; /* Greek small letter chi */
      tm[WideCharToNarrowStr(968)] = "psi"; /* Greek small letter psi */
      tm[WideCharToNarrowStr(969)] = "omega"; /* Greek small letter omega */
      tm[WideCharToNarrowStr(977)] = "thetasym"; /* Greek theta symbol */
      tm[WideCharToNarrowStr(978)] = "upsih"; /* Greek upsilon with hook symbol */
      tm[WideCharToNarrowStr(982)] = "piv"; /* Greek pi symbol */
      tm[WideCharToNarrowStr(8194)] = "ensp"; /* en space */
      tm[WideCharToNarrowStr(8195)] = "emsp"; /* em space */
      tm[WideCharToNarrowStr(8201)] = "thinsp"; /* thin space */
      tm[WideCharToNarrowStr(8204)] = "zwnj"; /* zero width non-joiner */
      tm[WideCharToNarrowStr(8205)] = "zwj"; /* zero width joiner */
      tm[WideCharToNarrowStr(8206)] = "lrm"; /* left-to-right mark */
      tm[WideCharToNarrowStr(8207)] = "rlm"; /* right-to-left mark */
      tm[WideCharToNarrowStr(8211)] = "ndash"; /* en dash */
      tm[WideCharToNarrowStr(8212)] = "mdash"; /* em dash */
      tm[WideCharToNarrowStr(8216)] = "lsquo"; /* left single quotation mark */
      tm[WideCharToNarrowStr(8217)] = "rsquo"; /* right single quotation mark */
      tm[WideCharToNarrowStr(8218)] = "sbquo"; /* single low-9 quotation mark */
      tm[WideCharToNarrowStr(8220)] = "ldquo"; /* left double quotation mark */
      tm[WideCharToNarrowStr(8221)] = "rdquo"; /* right double quotation mark */
      tm[WideCharToNarrowStr(8222)] = "bdquo"; /* double low-9 quotation mark */
      tm[WideCharToNarrowStr(8224)] = "dagger"; /* dagger */
      tm[WideCharToNarrowStr(8225)] = "Dagger"; /* double dagger */
      tm[WideCharToNarrowStr(8226)] = "bull"; /* bullet */
      tm[WideCharToNarrowStr(8230)] = "hellip"; /* horizontal ellipsis */
      tm[WideCharToNarrowStr(8240)] = "permil"; /* per mille sign */
      tm[WideCharToNarrowStr(8242)] = "prime"; /* prime */
      tm[WideCharToNarrowStr(8243)] = "Prime"; /* double prime */
      tm[WideCharToNarrowStr(8249)] = "lsaquo"; /* single left-pointing angle quotation mark */
      tm[WideCharToNarrowStr(8250)] = "rsaquo"; /* single right-pointing angle quotation mark */
      tm[WideCharToNarrowStr(8254)] = "oline"; /* overline */
      tm[WideCharToNarrowStr(8260)] = "frasl"; /* fraction slash */
      tm[WideCharToNarrowStr(8364)] = "euro"; /* euro sign */
      tm[WideCharToNarrowStr(8465)] = "image"; /* black-letter capital i */
      tm[WideCharToNarrowStr(8472)] = "weierp"; /* script capital pXCOMMAX Weierstrass p */
      tm[WideCharToNarrowStr(8476)] = "real"; /* black-letter capital r */
      tm[WideCharToNarrowStr(8482)] = "trade"; /* trademark sign */
      tm[WideCharToNarrowStr(8501)] = "alefsym"; /* alef symbol */
      tm[WideCharToNarrowStr(8592)] = "larr"; /* leftwards arrow */
      tm[WideCharToNarrowStr(8593)] = "uarr"; /* upwards arrow */
      tm[WideCharToNarrowStr(8594)] = "rarr"; /* rightwards arrow */
      tm[WideCharToNarrowStr(8595)] = "darr"; /* downwards arrow */
      tm[WideCharToNarrowStr(8596)] = "harr"; /* left right arrow */
      tm[WideCharToNarrowStr(8629)] = "crarr"; /* downwards arrow with corner leftwards */
      tm[WideCharToNarrowStr(8656)] = "lArr"; /* leftwards double arrow */
      tm[WideCharToNarrowStr(8657)] = "uArr"; /* upwards double arrow */
      tm[WideCharToNarrowStr(8658)] = "rArr"; /* rightwards double arrow */
      tm[WideCharToNarrowStr(8659)] = "dArr"; /* downwards double arrow */
      tm[WideCharToNarrowStr(8660)] = "hArr"; /* left right double arrow */
      tm[WideCharToNarrowStr(8704)] = "forall"; /* for all */
      tm[WideCharToNarrowStr(8706)] = "part"; /* partial differential */
      tm[WideCharToNarrowStr(8707)] = "exist"; /* there exists */
      tm[WideCharToNarrowStr(8709)] = "empty"; /* empty set */
      tm[WideCharToNarrowStr(8711)] = "nabla"; /* nabla */
      tm[WideCharToNarrowStr(8712)] = "isin"; /* element of */
      tm[WideCharToNarrowStr(8713)] = "notin"; /* not an element of */
      tm[WideCharToNarrowStr(8715)] = "ni"; /* contains as member */
      tm[WideCharToNarrowStr(8719)] = "prod"; /* n-ary product */
      tm[WideCharToNarrowStr(8721)] = "sum"; /* n-ary summation */
      tm[WideCharToNarrowStr(8722)] = "minus"; /* minus sign */
      tm[WideCharToNarrowStr(8727)] = "lowast"; /* asterisk operator */
      tm[WideCharToNarrowStr(8730)] = "radic"; /* square root */
      tm[WideCharToNarrowStr(8733)] = "prop"; /* proportional to */
      tm[WideCharToNarrowStr(8734)] = "infin"; /* infinity */
      tm[WideCharToNarrowStr(8736)] = "ang"; /* angle */
      tm[WideCharToNarrowStr(8743)] = "and"; /* logical and */
      tm[WideCharToNarrowStr(8744)] = "or"; /* logical or */
      tm[WideCharToNarrowStr(8745)] = "cap"; /* intersection */
      tm[WideCharToNarrowStr(8746)] = "cup"; /* union */
      tm[WideCharToNarrowStr(8747)] = "int"; /* integral */
      tm[WideCharToNarrowStr(8756)] = "there4"; /* therefore */
      tm[WideCharToNarrowStr(8764)] = "sim"; /* tilde operator */
      tm[WideCharToNarrowStr(8773)] = "cong"; /* congruent to */
      tm[WideCharToNarrowStr(8776)] = "asymp"; /* almost equal to */
      tm[WideCharToNarrowStr(8800)] = "ne"; /* not equal to */
      tm[WideCharToNarrowStr(8801)] = "equiv"; /* identical toXCOMMAX equivalent to */
      tm[WideCharToNarrowStr(8804)] = "le"; /* less-than or equal to */
      tm[WideCharToNarrowStr(8805)] = "ge"; /* greater-than or equal to */
      tm[WideCharToNarrowStr(8834)] = "sub"; /* subset of */
      tm[WideCharToNarrowStr(8835)] = "sup"; /* superset of */
      tm[WideCharToNarrowStr(8836)] = "nsub"; /* not a subset of */
      tm[WideCharToNarrowStr(8838)] = "sube"; /* subset of or equal to */
      tm[WideCharToNarrowStr(8839)] = "supe"; /* superset of or equal to */
      tm[WideCharToNarrowStr(8853)] = "oplus"; /* circled plus */
      tm[WideCharToNarrowStr(8855)] = "otimes"; /* circled times */
      tm[WideCharToNarrowStr(8869)] = "perp"; /* up tack */
      tm[WideCharToNarrowStr(8901)] = "sdot"; /* dot operator */
      tm[WideCharToNarrowStr(8968)] = "lceil"; /* left ceiling */
      tm[WideCharToNarrowStr(8969)] = "rceil"; /* right ceiling */
      tm[WideCharToNarrowStr(8970)] = "lfloor"; /* left floor */
      tm[WideCharToNarrowStr(8971)] = "rfloor"; /* right floor */
      tm[WideCharToNarrowStr(9001)] = "lang"; /* left-pointing angle bracket */
      tm[WideCharToNarrowStr(9002)] = "rang"; /* right-pointing angle bracket */
      tm[WideCharToNarrowStr(9674)] = "loz"; /* lozenge */
      tm[WideCharToNarrowStr(9824)] = "spades"; /* black spade suit */
      tm[WideCharToNarrowStr(9827)] = "clubs"; /* black club suit */
      tm[WideCharToNarrowStr(9829)] = "hearts"; /* black heart suit */
      tm[WideCharToNarrowStr(9830)] = "diams"; /* black diamond suit */

      map.swap(temp);
      init = true;

      MEMORY_BARRIER();

    } // !init

    return *map.get();
  }