Csound Csound-dev Csound-tekno Search About

printk not initialized, but strangely

Date2015-05-09 05:25
FromChuckk Hubbard
Subjectprintk not initialized, but strangely
AttachmentsNone  None  
Hi there.

This gives "printk not initialized" as is; if I remove the goto statement it works. But what's weird is that, if I put the incrementing of kcount after endif, it works fine. Which is weird because I'd expect the "if" condition with the goto in its results to be skipped on the first pass the way it is, and to execute if I put the incrementing at the end. But either way, the error is raised by the second printk, not the first. I'm just curious, is this normal? Is it wrong to use goto to jump past endif?


<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 16
nchnls = 2

instr 1
kdummy init 2
kcount init 0
ktrig metro 4

;if (ktrig == 1) then
; kcount += 1
;endif

kcount += ktrig

if ((kcount % 4) == 0) then
 printk 2, kdummy, 1
 goto skip

elseif ((kcount % 4) == 1) then
 printk 1, kdummy, 1

endif

skip:
endin
</CsInstruments>

<CsScore>
f0 6
i1 0 5
e
</CsScore>
</CsoundSynthesizer>

Date2015-05-09 05:27
FromChuckk Hubbard
SubjectRe: printk not initialized, but strangely
AttachmentsNone  None  
Am I right in understanding that "goto" executes at i-time, but the "if" only at k-time? Is this what's happening?

-Chuckk

On Sat, May 9, 2015 at 7:25 AM, Chuckk Hubbard <badmuthahubbard@gmail.com> wrote:
Hi there.

This gives "printk not initialized" as is; if I remove the goto statement it works. But what's weird is that, if I put the incrementing of kcount after endif, it works fine. Which is weird because I'd expect the "if" condition with the goto in its results to be skipped on the first pass the way it is, and to execute if I put the incrementing at the end. But either way, the error is raised by the second printk, not the first. I'm just curious, is this normal? Is it wrong to use goto to jump past endif?


<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 16
nchnls = 2

instr 1
kdummy init 2
kcount init 0
ktrig metro 4

;if (ktrig == 1) then
; kcount += 1
;endif

kcount += ktrig

if ((kcount % 4) == 0) then
 printk 2, kdummy, 1
 goto skip

elseif ((kcount % 4) == 1) then
 printk 1, kdummy, 1

endif

skip:
endin
</CsInstruments>

<CsScore>
f0 6
i1 0 5
e
</CsScore>
</CsoundSynthesizer>



--

Date2015-05-09 12:41
Fromjoachim heintz
SubjectRe: printk not initialized, but strangely
yes, i think so.  you can see this if you replace "goto" by "igoto": 
then you get the same error.  if you replace it by "kgoto", the error 
disappears.

i'd recommend to always use either igoto or kgoto, to specify whether 
you want to go anywhere at initialisation or during the performance.  if 
you use goto, the code is unclear, and csound will decide one of the two 
possibilities.

looking at your code, i don't understand why you are using a statement 
here at all.  if the first condition of your if-expression is true, the 
rest will not be regarded, so it works as you want it to work (if i 
understand your code right) without any go-to.

	joachim


Am 09.05.2015 um 06:27 schrieb Chuckk Hubbard:
> Am I right in understanding that "goto" executes at i-time, but the "if"
> only at k-time? Is this what's happening?
>
> -Chuckk
>
> On Sat, May 9, 2015 at 7:25 AM, Chuckk Hubbard
> > wrote:
>
>     Hi there.
>
>     This gives "printk not initialized" as is; if I remove the goto
>     statement it works. But what's weird is that, if I put the
>     incrementing of kcount after endif, it works fine. Which is weird
>     because I'd expect the "if" condition with the goto in its results
>     to be skipped on the first pass the way it is, and to execute if I
>     put the incrementing at the end. But either way, the error is raised
>     by the second printk, not the first. I'm just curious, is this
>     normal? Is it wrong to use goto to jump past endif?
>
>
>     
>     
>     sr = 44100
>     ksmps = 16
>     nchnls = 2
>
>     instr 1
>     kdummy init 2
>     kcount init 0
>     ktrig metro 4
>
>     ;if (ktrig == 1) then
>     ; kcount += 1
>     ;endif
>
>     kcount += ktrig
>
>     if ((kcount % 4) == 0) then
>       printk 2, kdummy, 1
>       goto skip
>
>     elseif ((kcount % 4) == 1) then
>       printk 1, kdummy, 1
>
>     endif
>
>     skip:
>     endin
>     
>
>     
>     f0 6
>     i1 0 5
>     e
>     
>     
>
>
>
>
> --
> http://www.badmuthahubbard.com
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>
>
>
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>          https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-05-11 20:58
FromChuckk Hubbard
SubjectRe: printk not initialized, but strangely
AttachmentsNone  None  
OK, I understand.
There were other things in between in the file I was working with, I took them out to show just the things that were confusing me.
Thanks for the info!

-Chuckk

On Sat, May 9, 2015 at 2:41 PM, joachim heintz <jh@joachimheintz.de> wrote:
yes, i think so.  you can see this if you replace "goto" by "igoto":
then you get the same error.  if you replace it by "kgoto", the error
disappears.

i'd recommend to always use either igoto or kgoto, to specify whether
you want to go anywhere at initialisation or during the performance.  if
you use goto, the code is unclear, and csound will decide one of the two
possibilities.

looking at your code, i don't understand why you are using a statement
here at all.  if the first condition of your if-expression is true, the
rest will not be regarded, so it works as you want it to work (if i
understand your code right) without any go-to.

        joachim


Am 09.05.2015 um 06:27 schrieb Chuckk Hubbard:
> Am I right in understanding that "goto" executes at i-time, but the "if"
> only at k-time? Is this what's happening?
>
> -Chuckk
>
> On Sat, May 9, 2015 at 7:25 AM, Chuckk Hubbard
> <badmuthahubbard@gmail.com <mailto:badmuthahubbard@gmail.com>> wrote:
>
>     Hi there.
>
>     This gives "printk not initialized" as is; if I remove the goto
>     statement it works. But what's weird is that, if I put the
>     incrementing of kcount after endif, it works fine. Which is weird
>     because I'd expect the "if" condition with the goto in its results
>     to be skipped on the first pass the way it is, and to execute if I
>     put the incrementing at the end. But either way, the error is raised
>     by the second printk, not the first. I'm just curious, is this
>     normal? Is it wrong to use goto to jump past endif?
>
>
>     <CsoundSynthesizer>
>     <CsInstruments>
>     sr = 44100
>     ksmps = 16
>     nchnls = 2
>
>     instr 1
>     kdummy init 2
>     kcount init 0
>     ktrig metro 4
>
>     ;if (ktrig == 1) then
>     ; kcount += 1
>     ;endif
>
>     kcount += ktrig
>
>     if ((kcount % 4) == 0) then
>       printk 2, kdummy, 1
>       goto skip
>
>     elseif ((kcount % 4) == 1) then
>       printk 1, kdummy, 1
>
>     endif
>
>     skip:
>     endin
>     </CsInstruments>
>
>     <CsScore>
>     f0 6
>     i1 0 5
>     e
>     </CsScore>
>     </CsoundSynthesizer>
>
>
>
>
> --
> http://www.badmuthahubbard.com
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>
>
>
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>          https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--