示例#1
0
boolean winregread (Handle h, tyvaluerecord *v) {

	/*
	7.0.2b1 Radio PBS: read a registry value.
	*/

	HKEY hbasekey = HKEY_CURRENT_USER;
	Handle hvalue;
	unsigned long length;
	DWORD regtype;

	if (!winregpullhkeyfromtext (h, &hbasekey))
		return (false);

	if (!winreggetvaluelength (hbasekey, h, &length))
		return (false);

	if (!newhandle (length, &hvalue))
		return (false);
	
	if (!winreggetvalue (hbasekey, h, hvalue, &regtype, &length))
		return (false);

	winregcoercetofrontiertype (hvalue, regtype, v);

	return (true);
	} /*winregread*/
示例#2
0
boolean newgrowinghandle (long size, Handle *h) {

    /*
    allocate a handle of the specified size, but with room to grow.

    note that the first getnewhandle should never fail, since the memory
    manager just told us that an even large block could be produced. but
    it's easy enough to handle that case too, so we do.
    */

    register long ctgrab = getidealchunksize ();

    if (ctgrab > size) {

        *h = getnewhandle (ctgrab, false);

        if (*h != nil) {

            SetHandleSize (*h, size); /*can't fail, getting smaller*/

            return (true);
        }
    }

    return (newhandle (size, h));
} /*newhandlewithroomtogrow*/
示例#3
0
文件: lcd.c 项目: CNMAT/CNMAT-Externs
void *rLCD(void *patcher, short x, short y, short w, short s)
{
	ResType		theType;
	Lcd			*p;
	FontInfo	info;

	p = (Lcd *)newobject(lcd_class);

	if (s < 1) s = 1;
	box_new((Box *)p, patcher, F_DRAWFIRSTIN | F_GROWBOTH, x, y, x+w,y+s);

	p->lcd_box.b_firstin = (void *)p;  /* it's not really an inlet */
	p->lcd_row = 0;
	p->lcd_col = 0;
	p->lcd_region = 0L;  /* DDZ moved to prevent dispose of bad region handle
							(LCD_font calls LCD_resize) */
	LCD_font(p,0L,0L);	/* DDZ changed to add 0,0 as arguments (needed) 12/14/92 */
	
	p->lcd_shiftClick = false;
	p->file_outlet=outlet_new(p,0L);
	p->lcd_outlet = outlet_new(p,0L);

	p->lcd_palette = myPalette;
	p->lcd_pIndex = numPaletteColors-1;
	p->lcd_penMode = patCopy;
	
	p->screen = 0L;
	
	p->reson_sampleRate = 20000.0;
	p->reson_spectScale = -100.0;
	p->reson_trimRatio = 1.0;
	
	p->local=1; // sde want to draw mouseclicks by default

	p->lcd_debug = false;
	p->lcd_oldRect = p->lcd_box.b_rect;
	/* DDZ, the statement above needs to be done in case the 
		window is not visible, because otherwise, oldRect
		can be set to some huge size and erase the entire
		patcher window
	*/
	// sde
	picthandle = (PicHandle)newhandle(4L);// create a dummy so we have something to dispose
	pictgood=0;
	
	{
		GrafPort *gp;
		
		gp = patcher_setport(p->lcd_box.b_patcher);	
		if (gp) {
			LCD_resize(p);
			SetPort(gp);
		}
	}
	
	box_ready((Box *)p);

	return (p);
}
示例#4
0
int RM_Manager::OpenFile(const char *fileName, RM_FileHandle &fileHandle) {
	int fileid;
	if (bpm->fileManager->openFile(fileName, fileid)) {				//打开文件,分配fileid
		RM_FileHandle newhandle(fileid, bpm, fileName);					//生成相应的文件处理器
		fileHandle = newhandle;											//赋值给传进来的文件处理器
	} else {
		//cout << "[RM_Manager]OpenFile error: " << fileName << endl;	//打开错误,不存在该文件(实际文件系统并没有该功能)
		return 1;
	}
	return 0;
}
示例#5
0
static boolean initstack (short basesize, short elemsize, hdlstack *hstack) {

	/*
	generic handle-based stack initialization
	*/

	register ptrstack ps;

	if (!newhandle ((long) basesize, (Handle *) hstack))
		return (false);

	ps = **hstack;

	ps->topstack = 0;
	
	ps->basesize = basesize;
	
	ps->elemsize = elemsize;
	
	return (true);
	} /*initstack*/
示例#6
0
文件: handle.c 项目: scanlime/picogui
/* Allocates a new handle for obj */
g_error mkhandle(handle *h,unsigned char type,int owner,const void *obj) {
  struct handlenode *n;
  g_error e;
  int context = -1;
  struct conbuf *owner_conbuf;

  /* Find the owner's current context */
  if ((owner!=-1) && (owner_conbuf = find_conbuf(owner)))
    context = owner_conbuf->context;

  if (!h) return mkerror(PG_ERRT_INTERNAL,25);
  if (obj==NULL) {
    *h = 0;
    return success;
  }
#ifdef DEBUG_KEYS
  num_handles++;
#endif
  e = g_malloc((void **) &n,sizeof(struct handlenode));
  errorcheck;
  /* HAHAHA! Must initialize memory so 'group' doesn't have a random
   * value!  I think this was the source of MUCH trouble and TORMENT!!
   */
  memset(n,0,sizeof(struct handlenode));
  n->id = newhandle();
  n->type = type;
  n->context = context;
  n->obj = obj;
  n->owner = owner;
  htree_insert(n);
  *h = n->id;
   
#ifdef DEBUG_MEMORY
  printf("mkhandle(%d,0x%08X): node=%p\n",owner,*h,n);
#endif
   
  return success;
}
示例#7
0
boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon) {
#if defined (MACVERSION)
	//bigstring bsadricon = "\psystem.verbs.builtins.Frontier.tools.data.nodeTypes.link.icon.mac";
	

	IconRef iconRef;
	IconFamilyHandle iconHand;
	SInt32 theSize;
	OSStatus theErr;
	Handle hicon;
	bigstring bsadriconpart;
	
	theErr = noErr;
	theSize = sizeof(OSType) + sizeof(OSType);
	
	newhandle(theSize, (Handle*) &iconHand);

	//iconHand = (IconFamilyHandle) getnewhandle(theSize, false);
	
	if (iconHand == NULL) theErr = memFullErr;
	
	if (theErr == noErr) {
		(*iconHand)->resourceType = EndianU32_NtoB(kIconFamilyType);
		(*iconHand)->resourceSize = EndianU32_NtoB(theSize);
	}
	
	if (theErr == noErr) {
		setemptystring(bsadriconpart);
		copystring(bsadricon, bsadriconpart);
		pushstring(BIGSTRING("\x05" ".ics4"), bsadriconpart);
		theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics4"), &hicon);
		
		if (theErr == noErr) {
			theErr = SetIconFamilyData(iconHand, kSmall4BitData, hicon);
			disposehandle(hicon);
		}
	}
	
	if (theErr == noErr) {
		setemptystring(bsadriconpart);
		copystring(bsadricon, bsadriconpart);
		pushstring(BIGSTRING("\x05" ".ics8"), bsadriconpart);
		theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics8"), &hicon);
		
		if (theErr == noErr) {
			theErr = SetIconFamilyData(iconHand, kSmall8BitData, hicon);
			disposehandle(hicon);
		}
	}
	
	if (theErr == noErr) {
		setemptystring(bsadriconpart);
		copystring(bsadricon, bsadriconpart);
		pushstring(BIGSTRING("\x09" ".icspound"), bsadriconpart);
		theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x08" "icspound"), &hicon);
		
		if (theErr == noErr) {
			theErr = SetIconFamilyData(iconHand, kSmall1BitMask, hicon);
			disposehandle(hicon);
		}
	}
	
	if (theErr == noErr) {
		theErr = GetIconRefFromIconFamilyPtr(*iconHand, GetHandleSize((Handle) iconHand), &iconRef);
	}
	
	if (theErr == noErr) {
		theErr = PlotIconRef(r, align, transform, kIconServicesNormalUsageFlag, iconRef);
	}
	
	setemptystring(bsadriconpart);
	ReleaseIconRef(iconRef);
	disposehandle((Handle) iconHand);
	
	return theErr == noErr;
#else if defined (WIN95VERSION)
	return FALSE;
#endif
}
示例#8
0
boolean newemptyhandle (Handle *h) {

    return (newhandle ((long) 0, h));
} /*newemptyhandle*/