User-Defined Opcode Database

TableDumpSimp

prints the content of a table in a simple way

Download UDO File

Description

prints the content of a table in a simple way. you may have to set the flag -+max_str_len=10000 for avoiding buffer overflow

Syntax

TableDumpSimp ifn, iprec, ippr

Initialization

ifn - function table number
iprec - float precision while printing (default = 3)
ippr - parameters per row (default = 10, maximum = 32)

Code

  opcode TableDumpSimp, 0, ijo
;prints the content of a table in a simple way
ifn, iprec, ippr   xin; function table, float precision while printing (default = 3), parameters per row (default = 10, maximum = 32)
iprec		=		(iprec == -1 ? 3 : iprec)
ippr		=		(ippr == 0 ? 10 : ippr)
iend		=		ftlen(ifn)
indx		=		0
Sformat	sprintf	"%%.%df\t", iprec
Sdump		=		""
loop:
ival		tab_i		indx, ifn
Snew		sprintf	Sformat, ival
Sdump		strcat		Sdump, Snew
indx		=		indx + 1
imod		=		indx % ippr
	if imod == 0 then
		puts		Sdump, 1
Sdump		=		""
	endif
	if indx < iend igoto loop
		puts		Sdump, 1
  endop

Examples

<CsoundSynthesizer>
<CsOptions>
-ndm0 -+max_str_len=10000
</CsOptions>
<CsInstruments>

gitab		ftgen	1, 0, -7, -2, 0, 1, 2, 3, 4, 5, 6
gisin		ftgen	2, 0, 128, 10, 1


  opcode TableDumpSimp, 0, ijo
;prints the content of a table in a simple way
ifn, iprec, ippr   xin; function table, float precision while printing (default = 3), parameters per row (default = 10, maximum = 32)
iprec		=		(iprec == -1 ? 3 : iprec)
ippr		=		(ippr == 0 ? 10 : ippr)
iend		=		ftlen(ifn)
indx		=		0
Sformat	sprintf	"%%.%df\t", iprec
Sdump		=		""
loop:
ival		tab_i		indx, ifn
Snew		sprintf	Sformat, ival
Sdump		strcat		Sdump, Snew
indx		=		indx + 1
imod		=		indx % ippr
	if imod == 0 then
		puts		Sdump, 1
Sdump		=		""
	endif
	if indx < iend igoto loop
		puts		Sdump, 1
  endop
	
	
instr 1
		TableDumpSimp	p4, p5, p6
endin

</CsInstruments>
<CsScore>
;i1	st	dur	ftab	prec	ppr
i1	0	0	1	-1
i1	.	.	1	0
i1 	.	.	2	3	10	
i1	.	.	2	6	32
</CsScore>
</CsoundSynthesizer>

Credits

joachim heintz 2010


Previous Home Next
PartikkelSimpB   StrNumP