Ejemplo n.º 1
0
void RenderView::layout()
{
    if (printing())
        m_minPrefWidth = m_maxPrefWidth = width();

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, false);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent())
                child->setChildNeedsLayout(true, false);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
    state.m_clipped = false;
    m_layoutState = &state;

    if (needsLayout())
        RenderBlock::layout();

    // Reset overflow and then replace it with docWidth and docHeight.
    m_overflow.clear();
    addLayoutOverflow(IntRect(0, 0, docWidth(), docHeight()));


    ASSERT(layoutDelta() == IntSize());
    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
}
Ejemplo n.º 2
0
static inline void printing(int total_size, int node) {
    int permission = 0, llimit, ulimit, tab;

    if (node == 0) {
        permission = 1;
    } else if (mod2(node) == 0) {
        permission = (tree[div2(node - 1)] == 1) ? 1 : 0;
    } else {
        permission = (tree[div2(node)] == 1) ? 1 : 0;
    }

    if (permission) {
        llimit = ulimit = tab = 0;

        while (!(llimit <= node && node <= ulimit)) {
            tab++;
            putchar('\t');
            llimit = ulimit + 1;
            ulimit = 2 * ulimit + 2;
        }

        printf(" %d ", total_size / power_2(tab));

        if (1 < tree[node]) {
            printf("---> Allocated %d\n", tree[node]);
        } else if (tree[node] == 1) {
            printf("---> Divided\n");
        } else {
            printf("---> Free\n");
        }

        printing(total_size, 2 * node + 1);
        printing(total_size, 2 * node + 2);
    }
}
Ejemplo n.º 3
0
void printing(int totsize,int node)
 {
int permission=0,llimit,ulimit,tab;

if(node==0)
	permission=1;
else 

if(node%2==0)
	permission=tree[(node-1)/2]==1?1:0;
else
	permission=tree[node/2]==1?1:0;

if(permission)
	{
llimit=ulimit=tab=0;
	while(1)
	{
	if(node>=llimit && node<=ulimit)
		{
		#ifdef DEBUG 
		printf("DEBUG1 value of node: %d \n",node);
		#endif 
		break;
		}
		else
		{
		tab++;
		printf(" ");
		llimit=ulimit+1;
		ulimit=2*ulimit+2;
		}
	}//while 

// a node can have 3 status : divided (=1), free (=0) and allocated (>1) frequested size

printf("\n Current Buddy Block: %d",totsize/power(2,tab)); 
 
	if(tree[node]>1)
		printf("--->allocated :%d",tree[node]);
	else 
		if(tree[node]==1)
		printf("--->divided"); 
	else printf("-->Free");
		printing(totsize,2*node+1);
		printing(totsize,2*node+2);
	}//permission
}
Ejemplo n.º 4
0
int RenderView::viewWidth() const
{
    int width = 0;
    if (!printing() && m_frameView)
        width = m_frameView->visibleWidth();
    return width;
}
Ejemplo n.º 5
0
void RenderView::calcWidth()
{
    if (!printing() && m_frameView)
        setWidth(viewWidth());
    m_marginLeft = 0;
    m_marginRight = 0;
}
Ejemplo n.º 6
0
void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
{
    // If a container was specified, and was not 0 or the RenderView,
    // then we should have found it by now.
    ASSERT_ARG(repaintContainer, !repaintContainer || repaintContainer == this);

    if (printing())
        return;

    if (style()->isFlippedBlocksWritingMode()) {
        // We have to flip by hand since the view's logical height has not been determined.  We
        // can use the viewport width and height.
        if (style()->isHorizontalWritingMode())
            rect.setY(viewHeight() - rect.maxY());
        else
            rect.setX(viewWidth() - rect.maxX());
    }

    if (fixed && m_frameView)
        rect.move(m_frameView->scrollOffsetForFixedPosition());
        
    // Apply our transform if we have one (because of full page zooming).
    if (!repaintContainer && m_layer && m_layer->transform())
        rect = m_layer->transform()->mapRect(rect);
}
Ejemplo n.º 7
0
int RenderView::viewHeight() const
{
    int height = 0;
    if (!printing() && m_frameView)
        height = m_frameView->visibleHeight();
    return height;
}
Ejemplo n.º 8
0
void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate)
{
    if (printing() || ur.width() == 0 || ur.height() == 0)
        return;

    if (!m_frameView)
        return;

    // We always just invalidate the root view, since we could be an iframe that is clipped out
    // or even invisible.
    Element* elt = document()->ownerElement();
    if (!elt)
        m_frameView->repaintContentRectangle(ur, immediate);
    else if (RenderObject* obj = elt->renderer()) {
        IntRect vr = viewRect();
        IntRect r = intersection(ur, vr);
        
        // Subtract out the contentsX and contentsY offsets to get our coords within the viewing
        // rectangle.
        r.move(-vr.x(), -vr.y());
        
        // FIXME: Hardcoded offsets here are not good.
        r.move(obj->borderLeft() + obj->paddingLeft(),
               obj->borderTop() + obj->paddingTop());
        obj->repaintRectangle(r, immediate);
    }
}
Ejemplo n.º 9
0
bool RenderView::shouldUsePrintingLayout() const
{
    if (!printing() || !m_frameView)
        return false;
    Frame* frame = m_frameView->frame();
    return frame && frame->shouldUsePrintingLayout();
}
Ejemplo n.º 10
0
int main()
{
    static int i=1;
    printf("Hello world!\n");
    int ax;
    int x=4.0/2;
    i=14;
    printf("The value of i should not change : %d\n",*&i);
    printf("See conversion : %d\n",x);
    printf("But its not implemented here : %d\n",(4.0/2));
    printf("To your surprise : %f\n",(4.0/2));
    printf("But its not implemented here : %d\n",(4.0+2));
    int y =-4.2/2;
    printf("The negative integer gives : %d\n",y);
  do
    {
        printf("Look : %d\n",i+=i);
    }
    while(i<=2);
    //looping();
    //switching();
    printing();
    return 0;

}
Ejemplo n.º 11
0
IntRect RenderView::viewRect() const
{
    if (printing())
        return IntRect(0, 0, width(), height());
    if (m_frameView)
        return m_frameView->visibleContentRect();
    return IntRect();
}
Ejemplo n.º 12
0
IntRect RenderView::viewRect() const
{
    if (printing())
        return IntRect(0, 0, m_width, m_height);
    if (m_frameView)
        return enclosingIntRect(m_frameView->visibleContentRect());
    return IntRect();
}
Ejemplo n.º 13
0
LayoutRect RenderView::viewRect() const
{
    if (printing())
        return LayoutRect(LayoutPoint(), size());
    if (m_frameView)
        return m_frameView->visibleContentRect();
    return LayoutRect();
}
Ejemplo n.º 14
0
/*
 * Handle an I/O request.
 */
static void sbd_transfer(struct sbd_device *dev, sector_t sector,
		unsigned long nsect, char *buffer, int write) {
	unsigned long offset = sector * logical_block_size;
	unsigned long nbytes = nsect * logical_block_size;

	int k;
  printk("Before decryption "); //added
  printk("\n");
  printing(buffer,nbytes); //added
  printk("\n");
  key_size = strlen(key); //added
	if(key_size == 0){
		printk(KERN_INFO "no key set\n");
	}else{
		crypto_cipher_clear_flags(tfm, ~0);
		crypto_cipher_setkey(tfm, crypto_key, key_size);
	}

	if ((offset + nbytes) > dev->size) {
		printk (KERN_NOTICE "sbd: Beyond-end write (%ld %ld)\n", offset, nbytes);
		return;
	}
	if (write){
    printing(buffer, nbytes);
    printk("\n");
		if(key_size != 0){
			for (k = 0; k < nbytes; k+= crypto_cipher_blocksize(tfm)) {
				crypto_cipher_encrypt_one(tfm, dev->data+offset+k, buffer+k);
			}
		}else{
			memcpy(dev->data + offset, buffer, nbytes);
		}
	}else{
		if(key_size != 0){
			for (k = 0; k < nbytes; k+= crypto_cipher_blocksize(tfm)) {
				crypto_cipher_decrypt_one(tfm, buffer+k, dev->data+offset+k);
			}
		}else{
			memcpy(buffer, dev->data + offset, nbytes);
		}
	}
  printk("Decrypted ");
  printk("\n");
  printing(buffer,nbytes);
  printk("\n");
}
Ejemplo n.º 15
0
void RenderView::layout()
{
    if (!document()->paginated())
        setPageHeight(0);
    m_absoluteOverflow.clear();

    if (printing())
        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width();

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, false);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent())
                child->setChildNeedsLayout(true, false);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
    state.m_clipped = false;
    state.m_pageHeight = m_pageHeight;
    state.m_pageHeightChanged = m_pageHeightChanged;
    m_pageHeightChanged = false;
    m_layoutState = &state;

    if (needsLayout())
        RenderBlock::layout();

#if ENABLE(VIEWPORT_REFLOW)
    calcReflowWidth();
#endif

    // Reset overflow and then replace it with docWidth and docHeight.
    m_overflow.clear();
    int leftOverflow = docLeft();
    addLayoutOverflow(IntRect(leftOverflow, 0, docWidth(leftOverflow), docHeight()));

    ASSERT(layoutDelta() == IntSize());
    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
}
Ejemplo n.º 16
0
int RenderView::viewHeight() const
{
    int height = 0;
    if (!printing() && m_frameView) {
        height = m_frameView->layoutHeight();
        height = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(height)) : height;
    }
    return height;
}
Ejemplo n.º 17
0
int RenderView::viewWidth() const
{
    int width = 0;
    if (!printing() && m_frameView) {
        width = m_frameView->layoutWidth();
        width = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(width)) : width;
    }
    return width;
}
Ejemplo n.º 18
0
void RenderView::layout()
{
    layoutCounter.startCounting();
    if (printing())
        m_minPrefWidth = m_maxPrefWidth = m_width;

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || m_width != viewWidth() || m_height != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, false);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent())
                child->setChildNeedsLayout(true, false);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    IntRect viewRectangle = viewRect();
    // An empty rect is not valid viewRect.
    state.m_clipped = !viewRectangle.isEmpty();

    if (state.m_clipped) {
        state.m_clipRect = IntRect(IntPoint(0, 0), viewRectangle.size());
        state.m_offset = IntSize(viewRectangle.x(), viewRectangle.y());
    }
    m_layoutState = &state;

    if (needsLayout())
        RenderBlock::layout();

    // Ensure that docWidth() >= width() and docHeight() >= height().
    setOverflowWidth(m_width);
    setOverflowHeight(m_height);

    setOverflowWidth(docWidth());
    setOverflowHeight(docHeight());

    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
    layoutCounter.stopCounting();
}
Ejemplo n.º 19
0
bool RenderView::shouldRepaint(const IntRect& r) const
{
    if (printing() || r.width() == 0 || r.height() == 0)
        return false;

    if (!m_frameView)
        return false;
    
    return true;
}
Ejemplo n.º 20
0
void RenderView::layout()
{
    if (!document()->paginated())
        setPageLogicalHeight(0);

    if (printing())
        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth();

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, MarkOnlyThis);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight())
                    || child->style()->logicalHeight().isPercent()
                    || child->style()->logicalMinHeight().isPercent()
                    || child->style()->logicalMaxHeight().isPercent())
                child->setChildNeedsLayout(true, MarkOnlyThis);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
    state.m_clipped = false;
    state.m_pageLogicalHeight = m_pageLogicalHeight;
    state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged;
    state.m_isPaginated = state.m_pageLogicalHeight;
    m_pageLogicalHeightChanged = false;
    m_layoutState = &state;

    if (needsLayout()) {
        RenderBlock::layout();
        if (hasRenderNamedFlowThreads())
            layoutRenderNamedFlowThreads();
    }

    ASSERT(layoutDelta() == LayoutSize());
    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
}
Ejemplo n.º 21
0
int main(int argc, char *argv[])
{

	program *prog = (program *) malloc(sizeof(program));
	player *user = (player *) malloc(sizeof(player));
	whitespace_info *whitespace_prog = (whitespace_info *) malloc(sizeof(whitespace_info));
	printing_board *first_board = (printing_board *) malloc(sizeof(printing_board));
	password_info *pw_info = (password_info *) malloc(sizeof(password_info));

	SDL_Simplewin sw;
	other_arg_type argument_indicator;

	check_initialisation(prog, user, whitespace_prog, first_board, pw_info);
	password_check(pw_info);

	if(pw_info -> pw_indicator == accept){

		check_command_line_arguments(user, argc, &argument_indicator, argv, pw_info);
		initialisation(prog, user, first_board);

		if(argument_indicator == secret){

			whitespace_functions(argv[1], whitespace_prog);
			open_program_file("ws_to_reg_translation.txt", prog);

		}
		else if(argument_indicator == combine_files){

			combine_ws_reg_files(prog, whitespace_prog, argv[1], argv[2]);

		}
		else if(argument_indicator != password_change){

			open_program_file(argv[1], prog);

		}

		if(argument_indicator == regular || argument_indicator == secret){

			parse_text_and_interpret(prog, user, first_board);
			printing(user, first_board, &sw);

		}
		else if(argument_indicator != password_change){

			write_file_to_whitespace(prog);

		}

	}

	free_components(first_board, prog, user, whitespace_prog, pw_info);

	return(0);
}
Ejemplo n.º 22
0
void RenderView::computeAbsoluteRepaintRect(IntRect& rect, bool fixed)
{
    if (printing())
        return;

    if (fixed && m_frameView)
        rect.move(m_frameView->scrollX(), m_frameView->scrollY());
        
    // Apply our transform if we have one (because of full page zooming).
    if (m_layer && m_layer->transform())
        rect = m_layer->transform()->mapRect(rect);
}
Ejemplo n.º 23
0
void RenderView::paint(PaintInfo& paintInfo, int tx, int ty)
{
    // If we ever require layout but receive a paint anyway, something has gone horribly wrong.
    ASSERT(!needsLayout());

    // Cache the print rect because the dirty rect could get changed during painting.
    if (printing())
        setPrintRect(paintInfo.rect);
    else
        setPrintRect(IntRect());
    paintObject(paintInfo, tx, ty);
}
Ejemplo n.º 24
0
bool RenderView::shouldRepaint(const LayoutRect& r) const
{
    if (printing() || r.width() == 0 || r.height() == 0)
        return false;

    if (!m_frameView)
        return false;

    if (m_frameView->repaintsDisabled())
        return false;

    return true;
}
/*
* the main function
*/
int main () 
{
	struct minHeap myHeap;
	int arr[10] = {6, 8, 2 ,4 , 1, 3, 9, 10, 5, 7};
	int size = 10;
	
	initialize(&myHeap);
	buildHeap(&myHeap, arr, size);
	//inorder_print(&myHeap, 0);
	//printf("\n");
	printing(&myHeap);
	printf("size: %d\n", myHeap.size);
	printf("Max: %d\n", getMax(&myHeap, 0));
	insert(&myHeap, 11);
	printing(&myHeap);
	printf("size: %d\n", myHeap.size);
	printf("Max: %d\n", getMax(&myHeap, 0));
	deleteNode(&myHeap);
	printing(&myHeap);
	deleteMinHeap(&myHeap);
	return 0;
}
Ejemplo n.º 26
0
int main(void) {
    int total_size, choice, request_size;

    frame_echo("\tB U D D Y   S Y S T E M  R E Q U I R E M E N T S");

    printf("*  Enter the Size of the memory  :  ");

    scanf("%d", &total_size);

    while (1) {
        frame_echo("\tB U D D Y   S Y S T E M ");
        puts(" *  1)\tLocate the process into the Memory");
        puts(" *  2)\tRemove the process from Memory");
        puts(" *  3)\tTree structure for Memory allocation Map");
        puts(" *  4)\tExit");
        printf(" *  Enter your choice : ");

        scanf(" %d", &choice);

        switch (choice) {
            case 1:
                frame_echo("\tM E M O R Y   A L L O C A T I O N ");
                printf(" *  Enter the Process size  : ");

                scanf("%d", &request_size);

                segmentalloc(total_size, request_size);

                break;
            case 2:
                frame_echo("\tM E M O R Y   D E A L L O C A T I O N ");
                printf(" *  Enter the process size  :  ");

                scanf("%d", &request_size);

                makefree(request_size);

                break;
            case 3:
                frame_echo("\tM E M O R Y   A L L O C A T I O N   M A P ");

                printing(total_size, 0);

                putchar('\n');

                break;
            default:
                return 0;
        }
    }
}
void RenderView::paint(PaintInfo& paintInfo, int tx, int ty)
{
#if PLATFORM(WKC)
    CRASH_IF_STACK_OVERFLOW(WKC_STACK_MARGIN_DEFAULT);
#endif
    // If we ever require layout but receive a paint anyway, something has gone horribly wrong.
    ASSERT(!needsLayout());

    // Cache the print rect because the dirty rect could get changed during painting.
    if (printing())
        setPrintRect(paintInfo.rect);
    else
        setPrintRect(IntRect());
    paintObject(paintInfo, tx, ty);
}
Ejemplo n.º 28
0
void RenderView::calcWidth()
{
    if (!printing() && m_frameView)
        setWidth(viewWidth());
#ifdef ANDROID_LAYOUT
    const Settings * settings = document()->settings();
    ASSERT(settings);
    if (settings->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen)
        m_visibleWidth = m_frameView->screenWidth();
    if (settings->useWideViewport() && settings->viewportWidth() == -1 && width() < minPrefWidth())
        setWidth(m_minPrefWidth);
#endif
    m_marginLeft = 0;
    m_marginRight = 0;
}
Ejemplo n.º 29
0
int main() {
	pthread_t threadName[NUM_THREADS];

	int i,t = 0;
	struct Data data[] = {{{1500, 1500, malloc(sizeof(int) * 2250000) } , {1500, 1500, malloc(sizeof(int) * 2250000)}}};
	init((void *) &data);
	for(t=0; t<NUM_THREADS; t++){
			pthread_create(&threadName[t], NULL, multiply, (void*)t);
			
	}
	for (i = 0; i < NUM_THREADS; i++)
			pthread_join (threadName[i], NULL);
			
	printing();
	pthread_exit(NULL);
}
Ejemplo n.º 30
0
void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed)
{
    // If a container was specified, and was not 0 or the RenderView,
    // then we should have found it by now.
    ASSERT_UNUSED(repaintContainer, !repaintContainer || repaintContainer == this);

    if (printing())
        return;

    if (fixed && m_frameView)
        rect.move(scrollOffsetForFixed(m_frameView));
        
    // Apply our transform if we have one (because of full page zooming).
    if (m_layer && m_layer->transform())
        rect = m_layer->transform()->mapRect(rect);
}