; procedure is not complete pro thm_eeprom_write_entry,entrynum,wbuff,array,loc,etcloc=etcloc,size=size,nwrite=nwrite,sclab=sclab,rev=rev,tocnum=tocnum,note=note ; entrynum: entry num in the table of contents. this number is auto incremented ! ; wbuff: map of eeprom (in words!) ; array: array to be written (in words) ; loc: starting loc to be written in eeprom (in words) ; etcloc: position in ETC memory for data to be copied to. (in words) ; size: size (in words) ;if not keyword_set(entrynum) then entrynum=0 n = uint(n_elements(array)) name = (scope_varname(array,count=c,level=-1))[0] if not keyword_set(note) then note = ' ' if n_params() eq 2 then begin id = hexval(sclab)*256 + rev*16 + tocnum entry = uint([0,id,0,0]) endif else begin if n eq 0 then begin dprint,dlevel=4,'Warning! Array is not defined. No table writes will be done. Only mod of TOC entry' name = name + ' Not initialized!' checksum = thm_etc_checksum(wbuff[loc:loc+size-1]) entry= uint([size*2,etcloc,loc*2,checksum]) endif else begin if keyword_set(size) then if size ne n then message,'Error in size.' w = where(nwrite[loc:loc+n-1] gt 0,nc) if nc gt 0 then begin test = array_equal( array[w], (wbuff[loc:loc+n-1])[w] ) if not test then dprint,'Overwriting buffer with new values!' endif wbuff[loc:loc+n-1] = array ;if keyword_set(nwrite) then $ nwrite[loc:loc+n-1] += 1 chksum = thm_etc_checksum(array) entry = uint([n*2, etcloc,loc*2,chksum]) endelse endelse dprint,entrynum,entrynum,entry,strmid(note,0,12),name,format='(Z02,i4," ",4(Z04,"x ")," ",a-12," ",a)' wbuff[entrynum*4:entrynum*4+3] = entry nwrite[entrynum*4:entrynum*4+3] +=1 entrynum += 1 ;toc = keyword_set(toc) ? [[toc],[entry]] : entry end