예제 #1
0
파일: decl.cpp 프로젝트: darwin/inferno
// o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o
void
Decl::print(std::ostream& out, bool showBase, int level) const
{
    assert(this != NULL);

    if (showBase)
    {
        printStorage(out,storage);

        // Hack to fix K&R non-declarations
        if (form == NULL)
        {
            out << "int ";
        }
    }

    if (form)
    {
        form->printType(out,name,showBase,level);
    }
    else if (name)
    {
        out << *name;
    }

    if (attrib)
    {
        attrib->print(out);
    }

    if (initializer)
    {
        out << " = ";

        initializer->print(out);
    }

    /*
    if (!form->isBaseType())
    {
        out << "  [FORM: ";
        form->printForm(out);
        out << " ]";
    }
    */
}
예제 #2
0
파일: decl.cpp 프로젝트: darwin/inferno
bool Decl::printStructureStreamInternals( std::ostream& out ) const
{
    assert(this != NULL);

    if (true)
    {
        printStorage(out,storage);

        // Hack to fix K&R non-declarations
        if (form == NULL)
        {
            out << "int ";
        }
    }

    if (form)
    {
        if(!form->printStructureStreamHelperType(out,name->name))
          return false;
    }
    else if (name)
    {
        out << *name;
    }

    if (attrib)
    {
        attrib->print(out);
    }

    if (initializer)
    {
        out << " = ";

        initializer->print(out);
    }

    return true;
}
예제 #3
0
/* This task is responsible for gesture recognition. */
void gesture_recognition_task(void *pdata)
{
	INT8U err;

	double end_time = 0.0;
	double start_time = OSTimeGet();
	double frame_rate = 0.0;
	double time_passed = 0.0;

	int frame_count = 0;
	int x = 0;
	int y = 0;
	int direction_code = 0;
    int mode = SEARCH_MODE;

	struct SearchNode *storage_base = getBase();
	printStorage(storage_base->next);

	struct DirectionNode *incoming_node, *last_incoming_node, *base;
    last_incoming_node = getDummyBase();

	while (1) {
		int centroid = (int) OSQPend(position_queue, 0, &err);
		if (err == OS_NO_ERR) {
			end_time = OSTimeGet();
			frame_count += 1;
			time_passed = (end_time - start_time) / OS_TICKS_PER_SEC;

			x = centroid & 1023;
			y = centroid >> 16;
			frame_rate = frame_count / time_passed;
;
			incoming_node = createDirectionNode(x, y, NO_GESTURE);

			/* We ignore position information that falls within the same grid */
			if (compareTwoDirectionNodes(incoming_node, last_incoming_node) == NODES_DIFFERENT) {

                if (mode == SEARCH_MODE) {
			        base = firstDirectionNode(incoming_node, last_incoming_node);
                } else {
				    base = nextDirectionNode(incoming_node, base, last_incoming_node, &direction_code);
                }

				if (base) {
					// Leaf node
					if (base->gesture_code != NO_GESTURE) {
                        mode = SEARCH_MODE;
                        handleGestureCommands(base->gesture_code);

					} else {
                        mode = FOLLOW_MODE;
					}
				} else {
                    mode = SEARCH_MODE;
				}

		        free(last_incoming_node);
		        last_incoming_node = incoming_node;

			} else {
			}
		} else {