Beispiel #1
0
/*ARGSUSED*/
static
/*
*		patch_abstract(DBPROCESSdb,MedArtrec,AbPListplist)
*/
int	patch_abstract( DBPROCESS *db, MedArt *rec, AbPList *plist )
{
    int	first = 1;
    int	rv;

    /* Load the patches */

    for( plist->n_patches = 0; plist->n_patches < MAX_ABSTRACT_PATCHES &&
	 (rv = load_patch( db, &plist->buffer[plist->used],
		sizeof(plist->buffer) - plist->used,
		&plist->patches[plist->n_patches].line_no,
		&plist->patches[plist->n_patches].length,
		first )) == True;
	 plist->n_patches++ )
    {
	/* A patch was loaded - record it */
	plist->used += plist->patches[plist->n_patches].length;
	first = 0;
    }

    /* Done */

    return( (rv == Error) ? Error : ((plist->n_patches > 0) ? True : False) );
}
Beispiel #2
0
/*ARGSUSED*/
static
/*
*		patch_string(DBPROCESSdb,charstr,intsize)
*/
int	patch_string( DBPROCESS *db, char *str, int size )
{
    DBBINARY	patches[PATCH_BUFFER_SIZE];
    DBINT	patch_length = 0, item = 0;
    DBCHAR	buffer[TEXT_BUFFER_SIZE];
    int		rv;
    char	*ptr;

    /* Get the title patches from the input string */

    if( ! DBROWS( db ) ) return( False );
    rv = load_patch( db, patches, sizeof(patches), &item, &patch_length, True );
    if( rv != True ) return( rv );

    /* We have the patches, apply them */

    if( ApplyIsoPatches( str, size, buffer, sizeof(buffer),
	patches, patch_length ) > 0 )
    {
	return( Error );
    }

  /* Done - put the stuff back */
   strcpy( str, buffer );
    return( True );
}
Beispiel #3
0
/*ARGSUSED*/
static
/*
*		patch_author(DBPROCESSdb,MedArtrec)
*/
int	patch_author( DBPROCESS *db, MedArt *rec )
{
    DBBINARY	patches[PATCH_BUFFER_SIZE];
    DBINT	patch_length = 0, item = 0;
    DBCHAR	buffer[TEXT_BUFFER_SIZE];
    int		rv = False;
    int	first;

    for( first = 1;; first = 0 ) {
	switch( load_patch( db, patches, sizeof(patches), &item,
				&patch_length, first ) )
	{
	    case True:	/* We found a patch */
		if( ApplyIsoPatches( rec->authors[item-1],
			sizeof(rec->authors[0]), buffer, sizeof(buffer),
			patches, patch_length ) == 0 )
		{
		    strcpy( rec->authors[item-1], buffer );
		    rv = True;
		}
		break;
	    case False:	/* No patch found */
		return( rv );
	    case Error:	/* Oops - */
		return( Error );
	}
    }
}
Beispiel #4
0
INT mcu_sys_init(RTMP_ADAPTER *pAd)
{
	NDIS_STATUS Status;

	/* Load MCU firmware*/
	MCU_CTRL_INIT(pAd);

	Status = load_patch(pAd);
	
	if (Status != NDIS_STATUS_SUCCESS)
	{
		DBGPRINT_ERR(("load patch failed, Status[=0x%08x]\n", Status));
		return FALSE;
	}
	
	Status = NICLoadFirmware(pAd);
	if (Status != NDIS_STATUS_SUCCESS)
	{
		DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status));
		return FALSE;
	}

	return TRUE;
}
Beispiel #5
0
HyperDocPage *
parse_patch(PasteNode *paste)
{
    TextNode *new_paste;
    TextNode *end_node;
    TextNode *begin_node;
    TextNode *arg_node;
    TextNode *old;
    TextNode *next_node;
    InputItem *paste_item = paste->paste_item;
    int where = paste->where;
    GroupItem *g = paste->group;
    ItemStack *is = paste->item_stack;
    PatchStore *patch;
    char *patch_name;
    int ret_value = 1;

    /* prepare to throw away the current paste node */
    end_node = paste->end_node;
    next_node = end_node->next;
    begin_node = paste->begin_node;
    arg_node = paste->arg_node;
    old = begin_node->next;

    /* now read the new stuff and add it in between all this stuff */

    switch (where) {
      case openaxiom_FromFile_input:
        patch_name = print_to_string(arg_node);
        patch = (PatchStore *) hash_find(gWindow->fPatchHashTable, patch_name);
        if (!patch) {
            fprintf(stderr, "(HyperDoc) Unknown patch name %s\n", patch_name);
            BeepAtTheUser();
            return 0;
        }
        if (!patch->loaded)
            load_patch(patch);
        input_type = openaxiom_FromString_input;
        input_string = patch->string;
        break;
      case openaxiom_FromSpadSocket_input:
        input_type = openaxiom_FromSpadSocket_input;
        ret_value = issue_serverpaste(arg_node);
        if (ret_value < 0) {
            paste->where = where;
            paste->end_node = end_node;
            paste->arg_node = arg_node;
            paste->group = g;
            paste->item_stack = is;
            paste->haspaste = 1;
            return 0;
        }
        break;
      case openaxiom_FromUnixFD_input:
        input_type = openaxiom_FromUnixFD_input;
        issue_unixpaste(arg_node);
        break;
      default:
        fprintf(stderr, "(HyperDoc) \\parsebutton error: Unknown where\n");
        exit(-1);
        break;
    }

    paste->where = 0;
    paste->end_node = paste->arg_node = paste->begin_node = 0;
    paste->group = 0;
    paste->item_stack = 0;
    paste->haspaste = 0;
    paste->paste_item = 0;


    /* set the jump buffer in case it is needed */
    if (setjmp(jmpbuf)) {
        /*** OOOPS, an error occurred ****/
        fprintf(stderr, "(HyperDoc) Had an error parsing a patch: Goodbye!\n");
        exit(-1);
    }


    end_node->next = 0;
    free_node(old, 1);

    init_parse_patch(gWindow->page);
    init_paste_item(paste_item);
    get_token();
    if (token.type != openaxiom_Patch_token) {
        fprintf(stderr, "(HyperDoc) Pastebutton %s was expecting a patch\n",
                paste->name);
        jump();
    }
    if (input_type == openaxiom_FromString_input) {
        get_token();
        if (token.type != openaxiom_Lbrace_token) {
            token_name(token.type);
            fprintf(stderr, "(HyperDoc) Unexpected %s \n", ebuffer);
            print_page_and_filename();
            jump();
        }

        get_token();
        if (token.type != openaxiom_Word_token) {
            token_name(token.type);
            fprintf(stderr, "(HyperDoc) Unexpected %s \n", ebuffer);
            print_page_and_filename();
            jump();
        }

        get_token();
        if (token.type != openaxiom_Rbrace_token) {
            token_name(token.type);
            fprintf(stderr, "(HyperDoc) Unexpected %s \n", ebuffer);
            print_page_and_filename();
            jump();
        }
    }
    new_paste = alloc_node();
    curr_node = new_paste;
    parse_HyperDoc();

    /* Once I am back, I need only reallign all the text structures */
    curr_node->type = openaxiom_Noop_token;
    curr_node->next = next_node;
    begin_node->next = new_paste;
    begin_node->type = openaxiom_Noop_token;
    free(begin_node->data.text);
    begin_node->data.text = 0;

    gWindow->fDisplayedWindow = gWindow->fScrollWindow;

    repaste_item();

    paste_page(begin_node);

    /* so now I should just be able to disappear */
    return gWindow->page;
}