Parameters I should set when executing stored proceisure - postgresql

I am maintainance engineer at a huge enterprise .
I got some trouble researching about an inquiry from users from Thailand.
(I am in Japan )
Please help me fix this.
Occuring
invalid parameters specified
(Plz ignore red rectangle)
When happening
execute stored proceisure
SECURITY INVOKER
AS $procedure$
BEGIN
-- エラー情報クリア
p_numOutErrCd := 0;
p_varOutPos := ' ';
p_varOutPos := 'データ取得カーソル OPEN';
OPEN p_CUR FOR
select SHOYOU.*,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, null, SHOYOU.NOKI01, SHOYOU.NOKI02) AS TYUMON01,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI01, SHOYOU.NOKI02, SHOYOU.NOKI03) AS TYUMON02,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI02, SHOYOU.NOKI03, SHOYOU.NOKI04) AS TYUMON03,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI03, SHOYOU.NOKI04, SHOYOU.NOKI05) AS TYUMON04,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI04, SHOYOU.NOKI05, SHOYOU.NOKI06) AS TYUMON05,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI05, SHOYOU.NOKI06, SHOYOU.NOKI07) AS TYUMON06,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI06, SHOYOU.NOKI07, SHOYOU.NOKI08) AS TYUMON07,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI07, SHOYOU.NOKI08, SHOYOU.NOKI09) AS TYUMON08,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI08, SHOYOU.NOKI09, SHOYOU.NOKI10) AS TYUMON09,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI09, SHOYOU.NOKI10, SHOYOU.NOKI11) AS TYUMON10,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI10, SHOYOU.NOKI11, SHOYOU.NOKI12) AS TYUMON11,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI11, SHOYOU.NOKI12, SHOYOU.NOKI13) AS TYUMON12,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI12, SHOYOU.NOKI13, SHOYOU.NOKI14) AS TYUMON13,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI13, SHOYOU.NOKI14, SHOYOU.NOKI15) AS TYUMON14,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI14, SHOYOU.NOKI15, SHOYOU.NOKI16) AS TYUMON15,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI15, SHOYOU.NOKI16, SHOYOU.NOKI17) AS TYUMON16,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI16, SHOYOU.NOKI17, SHOYOU.NOKI18) AS TYUMON17,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI17, SHOYOU.NOKI18, SHOYOU.NOKI19) AS TYUMON18,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI18, SHOYOU.NOKI19, SHOYOU.NOKI20) AS TYUMON19,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI19, SHOYOU.NOKI20, SHOYOU.NOKI21) AS TYUMON20,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI20, SHOYOU.NOKI21, SHOYOU.NOKI22) AS TYUMON21,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI21, SHOYOU.NOKI22, SHOYOU.NOKI23) AS TYUMON22,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI22, SHOYOU.NOKI23, SHOYOU.NOKI24) AS TYUMON23,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI23, SHOYOU.NOKI24, SHOYOU.NOKI25) AS TYUMON24,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI24, SHOYOU.NOKI25, SHOYOU.NOKI26) AS TYUMON25,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI25, SHOYOU.NOKI26, SHOYOU.NOKI27) AS TYUMON26,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI26, SHOYOU.NOKI27, SHOYOU.NOKI28) AS TYUMON27,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI27, SHOYOU.NOKI28, SHOYOU.NOKI29) AS TYUMON28,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI28, SHOYOU.NOKI29, SHOYOU.NOKI30) AS TYUMON29,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI29, SHOYOU.NOKI30, SHOYOU.NOKI31) AS TYUMON30,
fn_GetTMNSY(SHOYOU.HTSCD, SHOYOU.ZGHB, SHOYOU.ZTSCD, SHOYOU.HTSHCD, SHOYOU.HTBMNCD, SHOYOU.NOKI30, SHOYOU.NOKI31, null) AS TYUMON31
/*
,0 as TYUMON32,0 as TYUMON33,0 as TYUMON34,0 as TYUMON35,0 as TYUMON36,0 as TYUMON37,0 as TYUMON38,0 as TYUMON39,0 as TYUMON40
*/
from (
select KONKAI.*,
-- chg 2019.09.04 start
-- to_number(nvl(trim(KONKAI.SYRKKSY01), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY02), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY03), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY04), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY05), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY06), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY07), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY08), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY09), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY10), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY11), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY12), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY13), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY14), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY15), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY16), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY17), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY18), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY19), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY20), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY21), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY22), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY23), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY24), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY25), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY26), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY27), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY28), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY29), 0)) + to_number(nvl(trim(KONKAI.SYRKKSY30), 0))
-- + to_number(nvl(trim(KONKAI.SYRKKSY31), 0)) AS SYRKKSYSUM, -- 所要計画合計
to_number(nvl(trim(KONKAI.SYRKKSY01)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY02)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY03)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY04)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY05)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY06)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY07)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY08)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY09)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY10)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY11)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY12)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY13)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY14)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY15)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY16)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY17)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY18)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY19)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY20)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY21)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY22)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY23)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY24)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY25)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY26)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY27)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY28)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY29)::numeric, 0)) + to_number(nvl(trim(KONKAI.SYRKKSY30)::numeric, 0))
+ to_number(nvl(trim(KONKAI.SYRKKSY31)::numeric, 0)) AS SYRKKSYSUM, -- 所要計画合計
-- chg 2019.09.04 end
M_EIAJ_HTS_WEB.BUMONNM, -- 発注事業本部名称
ZENKAI.KEYNO AS ZEN_KEYNO, -- 前回計画番号
ZENKAI.KEYDATE AS ZEN_KEYDATE, -- 前回計画日
ZENKAI.NOKI01 AS ZEN_NOKI01, ZENKAI.SYRKKSY01 AS ZEN_SYRKKSY01,
ZENKAI.NOKI02 AS ZEN_NOKI02, ZENKAI.SYRKKSY02 AS ZEN_SYRKKSY02,
ZENKAI.NOKI03 AS ZEN_NOKI03, ZENKAI.SYRKKSY03 AS ZEN_SYRKKSY03,
ZENKAI.NOKI04 AS ZEN_NOKI04, ZENKAI.SYRKKSY04 AS ZEN_SYRKKSY04,
ZENKAI.NOKI05 AS ZEN_NOKI05, ZENKAI.SYRKKSY05 AS ZEN_SYRKKSY05,
ZENKAI.NOKI06 AS ZEN_NOKI06, ZENKAI.SYRKKSY06 AS ZEN_SYRKKSY06,
ZENKAI.NOKI07 AS ZEN_NOKI07, ZENKAI.SYRKKSY07 AS ZEN_SYRKKSY07,
ZENKAI.NOKI08 AS ZEN_NOKI08, ZENKAI.SYRKKSY08 AS ZEN_SYRKKSY08,
ZENKAI.NOKI09 AS ZEN_NOKI09, ZENKAI.SYRKKSY09 AS ZEN_SYRKKSY09,
ZENKAI.NOKI10 AS ZEN_NOKI10, ZENKAI.SYRKKSY10 AS ZEN_SYRKKSY10,
ZENKAI.NOKI11 AS ZEN_NOKI11, ZENKAI.SYRKKSY11 AS ZEN_SYRKKSY11,
ZENKAI.NOKI12 AS ZEN_NOKI12, ZENKAI.SYRKKSY12 AS ZEN_SYRKKSY12,
ZENKAI.NOKI13 AS ZEN_NOKI13, ZENKAI.SYRKKSY13 AS ZEN_SYRKKSY13,
ZENKAI.NOKI14 AS ZEN_NOKI14, ZENKAI.SYRKKSY14 AS ZEN_SYRKKSY14,
ZENKAI.NOKI15 AS ZEN_NOKI15, ZENKAI.SYRKKSY15 AS ZEN_SYRKKSY15,
ZENKAI.NOKI16 AS ZEN_NOKI16, ZENKAI.SYRKKSY16 AS ZEN_SYRKKSY16,
ZENKAI.NOKI17 AS ZEN_NOKI17, ZENKAI.SYRKKSY17 AS ZEN_SYRKKSY17,
ZENKAI.NOKI18 AS ZEN_NOKI18, ZENKAI.SYRKKSY18 AS ZEN_SYRKKSY18,
ZENKAI.NOKI19 AS ZEN_NOKI19, ZENKAI.SYRKKSY19 AS ZEN_SYRKKSY19,
ZENKAI.NOKI20 AS ZEN_NOKI20, ZENKAI.SYRKKSY20 AS ZEN_SYRKKSY20,
ZENKAI.NOKI21 AS ZEN_NOKI21, ZENKAI.SYRKKSY21 AS ZEN_SYRKKSY21,
ZENKAI.NOKI22 AS ZEN_NOKI22, ZENKAI.SYRKKSY22 AS ZEN_SYRKKSY22,
ZENKAI.NOKI23 AS ZEN_NOKI23, ZENKAI.SYRKKSY23 AS ZEN_SYRKKSY23,
ZENKAI.NOKI24 AS ZEN_NOKI24, ZENKAI.SYRKKSY24 AS ZEN_SYRKKSY24,
ZENKAI.NOKI25 AS ZEN_NOKI25, ZENKAI.SYRKKSY25 AS ZEN_SYRKKSY25,
ZENKAI.NOKI26 AS ZEN_NOKI26, ZENKAI.SYRKKSY26 AS ZEN_SYRKKSY26,
ZENKAI.NOKI27 AS ZEN_NOKI27, ZENKAI.SYRKKSY27 AS ZEN_SYRKKSY27,
ZENKAI.NOKI28 AS ZEN_NOKI28, ZENKAI.SYRKKSY28 AS ZEN_SYRKKSY28,
ZENKAI.NOKI29 AS ZEN_NOKI29, ZENKAI.SYRKKSY29 AS ZEN_SYRKKSY29,
ZENKAI.NOKI30 AS ZEN_NOKI30, ZENKAI.SYRKKSY30 AS ZEN_SYRKKSY30,
ZENKAI.NOKI31 AS ZEN_NOKI31, ZENKAI.SYRKKSY31 AS ZEN_SYRKKSY31,
nvl(RANK() OVER (ORDER BY ZENKAI.DATASNO2 DESC), 1) AS ZENKAINO, -- 前回所要計画.データ作成日時_降順番号
TRK_KYOKYUKAITO.TMBTSU01, TRK_KYOKYUKAITO.TMBTSU02, TRK_KYOKYUKAITO.TMBTSU03,
TRK_KYOKYUKAITO.TMBTSU04, TRK_KYOKYUKAITO.TMBTSU05, TRK_KYOKYUKAITO.TMBTSU06,
TRK_KYOKYUKAITO.TMBTSU07, TRK_KYOKYUKAITO.TMBTSU08, TRK_KYOKYUKAITO.TMBTSU09,
TRK_KYOKYUKAITO.TMBTSU10, TRK_KYOKYUKAITO.TMBTSU11, TRK_KYOKYUKAITO.TMBTSU12,
TRK_KYOKYUKAITO.TMBTSU13, TRK_KYOKYUKAITO.TMBTSU14, TRK_KYOKYUKAITO.TMBTSU15,
TRK_KYOKYUKAITO.TMBTSU16, TRK_KYOKYUKAITO.TMBTSU17, TRK_KYOKYUKAITO.TMBTSU18,
TRK_KYOKYUKAITO.TMBTSU19, TRK_KYOKYUKAITO.TMBTSU20, TRK_KYOKYUKAITO.TMBTSU21,
TRK_KYOKYUKAITO.TMBTSU22, TRK_KYOKYUKAITO.TMBTSU23, TRK_KYOKYUKAITO.TMBTSU24,
TRK_KYOKYUKAITO.TMBTSU25, TRK_KYOKYUKAITO.TMBTSU26, TRK_KYOKYUKAITO.TMBTSU27,
TRK_KYOKYUKAITO.TMBTSU28, TRK_KYOKYUKAITO.TMBTSU29, TRK_KYOKYUKAITO.TMBTSU30,
TRK_KYOKYUKAITO.TMBTSU31,
TRK_KYOKYUKAITO.KEYDATE AS KYOKYUKAITODATE, -- 供給回答日
nvl(RANK() OVER (ORDER BY TRK_KYOKYUKAITO.DATASNO2 DESC), 1) AS KYOKYUNO -- 供給回答.データ作成日時_降順番号
/*
,'20190304' as NOKI32, 4500 as SYRKKSY32,'20190225' as ZEN_NOKI32, 2000 as ZEN_SYRKKSY32,0 as TMBTSU32
,'20190311' as NOKI33, 1000 as SYRKKSY33,'20190304' as ZEN_NOKI33, 1500 as ZEN_SYRKKSY33,0 as TMBTSU33
,'20190318' as NOKI34, 1100 as SYRKKSY34,'20190311' as ZEN_NOKI34, 1400 as ZEN_SYRKKSY34,0 as TMBTSU34
,'20190325' as NOKI35, 1200 as SYRKKSY35,'20190318' as ZEN_NOKI35, 1300 as ZEN_SYRKKSY35,0 as TMBTSU35
,'20190401' as NOKI36, 1300 as SYRKKSY36,'20190325' as ZEN_NOKI36, 1200 as ZEN_SYRKKSY36,0 as TMBTSU36
,'20190408' as NOKI37, 1400 as SYRKKSY37,'20190401' as ZEN_NOKI37, 1100 as ZEN_SYRKKSY37,0 as TMBTSU37
,'20190415' as NOKI38, 1500 as SYRKKSY38,'20190408' as ZEN_NOKI38, 1000 as ZEN_SYRKKSY38,0 as TMBTSU38
,'20190422' as NOKI39, 1600 as SYRKKSY39,'20190415' as ZEN_NOKI39, 900 as ZEN_SYRKKSY39,0 as TMBTSU39
,'20190429' as NOKI40, 1700 as SYRKKSY40,'20190422' as ZEN_NOKI40, 800 as ZEN_SYRKKSY40,0 as TMBTSU40
*/
from TRK_SHOYOU KONKAI -- 所要計画
inner join TRK_HEAD on
TRK_HEAD.SRDATE = KONKAI.SRDATE AND
TRK_HEAD.HSHSSYCD = KONKAI.HSHSSYCD AND
TRK_HEAD.ZSZSCTCD = KONKAI.ZSZSCTCD AND
TRK_HEAD.ZSZSSYCD = KONKAI.ZSZSSYCD AND
TRK_HEAD.THSCD = KONKAI.THSCD AND
TRK_HEAD.ZHSKBN = KONKAI.ZHSKBN AND
TRK_HEAD.ZHKBCD = KONKAI.ZHKBCD AND
TRK_HEAD.HEADNO = KONKAI.HEADNO
inner join M_EIAJ_HTS_WEB on
M_EIAJ_HTS_WEB.HTSCD = KONKAI.HTSCD AND
M_EIAJ_HTS_WEB.GENGOKBN = p_LANGUAGE
left outer join TRK_SHOYOU ZENKAI on -- 前回所要計画
ZENKAI.KEYNO != KONKAI.KEYNO AND
ZENKAI.HTSCD = KONKAI.HTSCD AND
ZENKAI.ZTSCD = KONKAI.ZTSCD AND
ZENKAI.HTBMNCD = KONKAI.HTBMNCD AND
ZENKAI.HTSHCD = KONKAI.HTSHCD AND
ZENKAI.DATASNO2 < KONKAI.DATASNO2
left outer join TRK_KYOKYUKAITO on -- 供給回答
TRK_KYOKYUKAITO.HTSCD = KONKAI.HTSCD AND
TRK_KYOKYUKAITO.KEYNO = KONKAI.KEYNO AND
TRK_KYOKYUKAITO.KKKDATE = KONKAI.KEYDATE
where KONKAI.SRDATE = p_SRDATE AND
KONKAI.HSHSSYCD = p_HSHSSYCD AND
KONKAI.ZSZSCTCD = p_ZSZSCTCD AND
KONKAI.ZSZSSYCD = p_ZSZSSYCD AND
KONKAI.THSCD = p_THSCD AND
KONKAI.ZHSKBN = p_ZHSKBN AND
KONKAI.ZHKBCD = p_ZHKBCD AND
KONKAI.HEADNO = p_HEADNO AND
KONKAI.DETAILNO = p_DETAILNO
) SHOYOU
where SHOYOU.ZENKAINO = 1 AND SHOYOU.KYOKYUNO = 1;
p_varOutPos := 'データ取得カーソル OPEN 終了';
EXCEPTION
WHEN OTHERS THEN
p_numOutErrCd := SQLCODE;
p_varOutPos := p_varOutPos || CHR(13) || CHR(10) || SQLERRM;
END pr_GetDETAIL$procedure$
LANGUAGE edbspl
I have tried…
execute only select query to check those 9 params(from p_srdate to p_language) are set correctly.
Confirmed valid.(If these params are set null or other invalid values , that leads empty result (and then leads"invalid parameters specified"error??) I assumed)
Question
What should I set in p_cur?
Honestly I don’t know exactly when this error is returned from the program.
It seems that before executing stored proceisure ,some kind of "params check process" is running…
What is this?
I read some articles about stored proceisure , I couldn’t understand why I need to set OUT data before executing query.
DBMS:A5Mk2
DB:Postgres

Related

GTk printing 0ne p[age documents

I have a problem printing one page documents in GTK 3.0.
Documents with more than one page are correctly printed but one page documents are not printed.
Because using the debugger in GNAT Studio 23.0w (20220512) is sometimes a problem I have printed some inbetween results during running to the GTK textview. I found that the program not even reaches Draw_Page from Connect_and_Run.
My question is what should I do to also correctly print one page documents.
The insert_at_buffer function (procedure) is used to print to the Text view and result of these statements are seen below
For your information On_Print the code is using:
Set_N_Pages (Print_Op, nr_Pages);
Set_Use_Full_Page(Print_Op, true);
Set_Unit (Print_Op, points);
--DEBUG-------------------------------------------------------------------
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Set_Unit (Print_Op, points)"), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages =") & Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line =") & integer'image(first_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line =") & integer'image(last_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines =") & integer'image(delta_lines), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number =") & long_float'image(Number), 0, true));
--------------------------------------------------------------------------
Print_Op.Set_Print_Settings(Print_Set);
-------------------------------------------------------------------
-- procedure On_Draw_Page
-- (Self : not null access Gtk_Print_Operation_Record;
-- Call : Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void;
-- After : Boolean := False);
--------------------------------------------------------------------
--DEBUG-------------------------------------------------------------------
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Print_Op.Set_Print_Settings(Print_Set)"), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages =") & Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line =") & integer'image(first_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line =") & integer'image(last_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines =") & integer'image(delta_lines), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number =") & long_float'image(Number), 0, true));
--------------------------------------------------------------------------
On_Draw_Page(Print_Op, Draw);
--DEBUG-------------------------------------------------------------------
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("On_Draw_Page(Print_Op, Draw)"), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages =") & Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line =") & integer'image(first_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line =") & integer'image(last_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines =") & integer'image(delta_lines), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number =") & long_float'image(Number), 0, true));
--------------------------------------------------------------------------
Result := Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window);
-- --DEBUG-------------------------------------------------------------------
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window)"), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages =") & Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line =") & integer'image(first_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line =") & integer'image(last_line), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines =") & integer'image(delta_lines), 0, true));
Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number =") & long_float'image(Number), 0, true));
--------------------------------------------------------------------------
In Draw_Page also someinformation lines are presented:
nr := first_line;
Cr := Get_Cairo_Context (Context);
Set_Source_Rgb (Cr, 0.0, 0.0, 0.0);
Select_font_face(Cr, "Consolas", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
Set_Font_Size(Cr, GDouble(10));
if nr = 1 then
pagenr := 1;
else
pagenr := pagenr + 1;
end if;
if pagenr rem 2 = 1 then
width := 70;
else
width := 40;
end if;
if last_page_line > last_line then
last_page_line := last_line;
end if;
len := 3;
nr1 := 10;
while last_line > nr1 - 1 loop
nr1 := nr1 * 10;
len := len + 1;
end loop;
--DEBUG-------------------------------------------------------------------
Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("Draw_Page "), 0, true));
Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("pagenr = ") & integer'image(pagenr), 0, true));
Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("first_line = " & integer'image(first_line) & " Buffer = " & Windows'image(Window_Type)), 0, true));
Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("last_line = ") & integer'image(last_line), 0, true));
Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("last_page_line = ") & integer'image(last_page_line), 0, true));
--------------------------------------------------------------------------
>With a one page document I got:
>Set_Unit (Print_Op, points)
>nr_Pages = 1 Filetype GL
>first_line = 1
>last_line = 15
>delta_lines = 56
>Number = 1.00000000000000E+00
>Print_Op.Set_Print_Settings(Print_Set)
>nr_Pages = 1 Filetype GL
>first_line = 1
>last_line = 15
>delta_lines = 56
>Number = 1.00000000000000E+00
>On_Draw_Page(Print_Op, Draw)
>nr_Pages = 1 Filetype GL
>first_line = 1
>last_line = 15
>delta_lines = 56
>Number = 1.00000000000000E+00
>Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window)
>nr_Pages = 1 Filetype GL
>first_line = 1
>last_line = 15
>delta_lines = 56
>Number = 1.00000000000000E+00
>With a Multipage document I got:
>Set_Unit (Print_Op, points)
>nr_Pages = 2 Filetype BI
>first_line = 1
>last_line = 68
>delta_lines = 56
>Number = 2.00000000000000E+00
>Print_Op.Set_Print_Settings(Print_Set)
>nr_Pages = 2 Filetype BI
>first_line = 1
>last_line = 68
>delta_lines = 56
>Number = 2.00000000000000E+00
>On_Draw_Page(Print_Op, Draw)
>nr_Pages = 2 Filetype BI
>first_line = 1
>last_line = 68
>delta_lines = 56
>Number = 2.00000000000000E+00
>Draw_Page
>pagenr = 1
>first_line = 1 Buffer = BI
>last_line = 68
>last_page_line = 57
>Draw_Page
>pagenr = 2
>first_line = 58 Buffer = BI
>last_line = 68
>last_page_line = 68
>Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window)
>nr_Pages = 2 Filetype BI
>first_line = 69
>last_line = 68
>delta_lines = 56
>Number = 2.00000000000000E+00
I Solved the problem.It was a problem caused by the arrangement of variuos statements creating Print_Op and Print_Set. I just tried variuos arrangements and all of a sudden the program worked

Why is TIC-80 giving me the attempt to index a nil value error?

So I am building a game for a game jam over at itch.io, and I'm using this really neat Fantasy Console called TIC-80, found at tic80.com. My issue is that while I understand what the error message is and what it means, I don't understand as to why it's giving me this error.
Error Message (In the TIC-80 console):
>[string "-- title: The Clone
Wars..."]:144: attempt to index a nil
value (field '?')
stack traceback:
[string "-- title: The Clone
Wars..."]:144: in function 'TIC'
The Code in question:
-- title: The Clone Wars
-- author: DinoNuggies
-- desc: Help the jedi destroy the clones!
-- script: lua
--Functions
function sign(n) return n>0 and 1 or n<0 and -1 or 0 end
function lerp(a,b,t) return (1-t)*a + t*b end
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
--End of Functions
--Variables
player = {
spr = 256,
sprMod = 0,
x = 1,
y = 1,
vx = 0,
vy = 0,
dirX = 0,
dirY = 0,
flip = 0,
shoot = false,
}
gun = {
t = 0,
spr = 258,
sprMod = 0,
x = 0,
y = 0,
modX = 0,
modY = 0,
flip = 0,
rot = 0,
}
tile = {
r0 = 0,
r1 = 0,
l0 = 0,
l1 = 0,
u0 = 0,
u1 = 0,
d0 = 0,
d1 = 0,
m = 0,
}
m = {
x = 0,
y = 0,
left = false,
right = false,
middle = false,
}
cam = {
activate = true,
x = 120,
y = 64,
}
--Bullet Class & Functions
bulletMod = 0
bullet = {}
function bullet:new()
local this = {
spr = 260,
x = player.x,
y = player.y,
vx = 0,
vy = 0,
mx = m.x - (player.x + cam.x),
my = m.y - (player.y + cam.y),
t = 0,
}
return this
end
function bullet:remove()
local this = {
spr = nil,
x = nil,
y = nil,
vx = nil,
vy = nil,
mx = nil,
my = nil,
t = nil,
}
return this
end
--End of Variables
function TIC()
cls()
--Camera
if cam.activate then
cam.x = math.min(120, lerp(cam.x, 120-player.x, 0.05))
cam.y = math.min(64, lerp(cam.y, 64-player.y, 0.05))
ccx = cam.x / 8 + (cam.x % 8 == 0 and 1 or 0)
ccy = cam.y / 8 + (cam.y % 8 == 0 and 1 or 0)
end
map(15 - ccx, 8 - ccy, 31, 18, (cam.x % 8) - 8, (cam.y % 8) - 8, 0)
--End of Camera
--Gun Physics
m.x, m.y, m.left, m.middle, m.right = mouse()
gun.x = player.x + cam.x
gun.y = player.y + cam.y
bullets = tablelength(bullet) - 2
flick = (time() // 16) % 16 == 0
if m.left then m.leftp = flick else m.leftp = false end
--Gun Display
if m.x > player.x + cam.x + 4 then
gun.flip = 0
gun.modX = 4
else
gun.flip = 1
gun.modX = -4
end
--Gun Firing
if m.leftp == true then
bullet[bullets] = bullet:new()
if m.x > player.x + cam.x + 4 then
bullet[bullets].vx = 8
else
bullet[bullets].vx = -8
end
end
--End of Gun Physics
--Bullet Physics
if bullets > 0 then
for i=0,bullets-1 do
bullet[i].x = bullet[i].x + bullet[i].vx --LINE 144, THE ONE IN QUESTION
bullet[i].y = bullet[i].y + bullet[i].vy
spr(bullet[i].spr, bullet[i].x + cam.x, bullet[i].y + cam.y, 0, 1)
bullet[i].t = bullet[i].t + 1
if bullet[i].t > 16 then
bullet[i] = bullet:remove()
bullet[i] = nil
end
end
end
bullets = tablelength(bullet) - 2
--End of Bullet Physics
--Drawing
--Sprites
spr(player.spr + player.sprMod, player.x + cam.x, player.y + cam.y, 0, 1, player.flip)
spr(gun.spr + gun.sprMod, gun.x + gun.modX, gun.y + gun.modY, 0, 1, gun.flip, gun.rot)
--Debug
print("Debug:", 1, 1, 11)
print("X: " .. (player.x // 8) + 15 .. " Y: " .. (player.y // 8) + 9, 1, 8, 11)
print("BLTs: " .. bullets .. " ", 1, 16, 11)
--End of Drawing
--Player Movement
player.x = player.x + player.vx
player.y = player.y + player.vy
if key(1) and player.x > -120 then
player.vx = -1
player.sprMod = 1
player.dirX = 0
elseif key(4) then
player.vx = 1
player.sprMod = 0
player.dirX = 1
else
player.vx = 0
end
if key(23) and player.y > -64 then
player.vy = -1
player.dirY = 0
elseif key(19) then
player.vy = 1
player.dirY = 1
else
player.vy = 0
end
if btnp(0) then player.y = player.y - 1
elseif btnp(1) then player.y = player.y + 1
elseif btnp(2) then player.x = player.x - 1
elseif btnp(3) then player.x = player.x + 1
end
--End of Movement
--Player Collision
tile.r0 = mget(((player.x + 7) // 8) + 15, ((player.y - 9) // 8) + 9)
tile.r1 = mget(((player.x + 7) // 8) + 15, ((player.y - 2) // 8) + 9)
tile.l0 = mget(((player.x - 2) // 8) + 15, ((player.y - 9) // 8) + 9)
tile.l1 = mget(((player.x - 2) // 8) + 15, ((player.y - 2) // 8) + 9)
tile.u0 = mget(((player.x - 1) // 8) + 15, ((player.y - 10) // 8) + 9)
tile.u1 = mget(((player.x + 6) // 8) + 15, ((player.y - 10) // 8) + 9)
tile.d0 = mget(((player.x - 1) // 8) + 15, ((player.y - 1) // 8) + 9)
tile.d1 = mget(((player.x + 6) // 8) + 15, ((player.y - 1) // 8) + 9)
if player.dirX == 1 then
if fget(tile.r0, 0) or fget(tile.r1, 0) then
player.vx = 0
end
elseif player.dirX == 0 then
if fget(tile.l0, 0) or fget(tile.l1, 0) then
player.vx = 0
end
end
if player.dirY == 0 then
if fget(tile.u0, 0) or fget(tile.u1, 0) then
player.vy = 0
end
elseif player.dirY == 1 then
if fget(tile.d0, 0) or fget(tile.d1, 0) then
player.vy = 0
end
end
--End of Player Collision
--Misc
if keyp(3) then
if cam.activate then
cam.activate = false
else
cam.activate = true
end
end
--End of Misc
end
--DON'T WORRY ABOUT ANYTHING PAST THIS POINT, IT'S ONLY SPRITE AND TILE DEFINITIONS FOR TIC-80 VISUALS
-- <TILES>
-- 000:6666666666666666666666666666666666666666666666666666666666666666
-- 001:6666666666566566666666656666666665665666666665666566666666666666
-- 002:6668666666898566666866656666666665665866686689868986686668666666
-- 003:6656556666555556555556555555556555555555665555556556555666655566
-- 016:dddddddeddddddefddeeeeffddeeeeffddeeeeffddeeeeffdeffffffefffffff
-- 017:6226622661266126222222221121112161266126612661265126512665266525
-- 018:6228622661298126222222221121112161266126612681268126512668266525
-- 019:6226522661255126222222221121112151255125612551255126512665255525
-- </TILES>
-- <SPRITES>
-- 000:00cccc000cccccd00cbbbbb0ccbbcbbdcccfefcd0dddddd000ceec0000c00c00
-- 001:00cccc000cccccd00bbbbbd0cbbcbbcdccfefccd0dddddd000ceec0000c00c00
-- 002:000000000000000000000000000eeeed000efff0000ef0000000000000000000
-- 003:0000ed00000eef0000eef0000eef000000eef000000ee0000000000000000000
-- 004:0000000000000000000000000aaaaaa00aaaaaa0000000000000000000000000
-- </SPRITES>
-- <MAP>
-- 000:010101010101010101010101010101010101010101010101010101010101010000000000000000000000101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 001:010000000000000000000000000000101000101000001000000010101001010000000000100000000000101010000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 002:010001000100010000000000000010000000100010001000100010001001010000000010100000000000101010000000000000001010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 003:010001000100000000000000000000101000100010001000100010100001010000000010000000000000101000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 004:010001010100010000000000000000001000100010001000100010000001010000000010000000000000101010000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 005:010001000100010000000000000010100000001010000010100010000001010000000010000000000000101010000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 006:010000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 007:010000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 008:010000000000000000000000000101301010000000000000000000000000000000000000101010000000101000000000000000000010101000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 009:010000000000000000000000000101101010100000000000000000000000000000001010101000000000101000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 010:010000000000000000000000000101101010000000000001111101000000001111111121211111110000101000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 011:010000000000000000000000000101000000000000001000000001000000000000001020101000000000101000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 012:010000000000000000000000000101000000000000011111111101010001010000101010000000000010101000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 013:010000000000000000000000000101000000000010101000000001011101010000101000000000000010100000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 014:010000000000000000000000000101000000000010101010000000000000010000000000000000000010100000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 015:010000000000000000000000000101000000000000000000000000000000010000000000000000001010000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 016:010101010101010101010101010101000000000000000000000000000000010000000000000000001010000000000000001010000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 017:010101010101010101010101010101000000000000000000000000000000000000000000000000101010000000000010102000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- 018:000000000000000000000000000101000000000000000000000010100000000000000000000000101000000000001010000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 019:000000000000000000001010000101000000000000000000000000100000000000000000000010101000001111211110000000001010000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 020:000000001000000000001000000101000000000000000000000000101000000000000000001010101000000010101011111100000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 021:000000000000000000001010100101101010000000000000000000000000000000000000101000000000001010200000000011110000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 022:000000000000000000000000000101001010100000000000000000000000000000000010101000000010101010100000000000001111000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 023:000000000000000000000000000101000000000000000000000000000000000000001010100000000010101010000000000000000000110000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 024:000000000000000000000000000101000000000000000000000000000000000000001010100000001020201000000000000000100000001100102001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 025:000000000000000000000000000101000000000000000000000000000000000000101010000000001020100000000000000000100000000011212101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 026:000000101000000000000000000101000000000000000000000000000000001010100010000000001010100000000010000000100010100010101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 027:000000101010000000000000100101000000000000000010101010101010101010000010000000001010000000000000101010000000001010000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 028:000000100010000000000000100101000000000000000000000000001010101000101010000000001010000010101010000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 029:000000001010000000000000000101000000000000000000000000000010100000000000000000001010000000000000000000100010000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 030:000000001010000000000000000101100000000000000000000000000000000000000000000000001000000000001000000000100000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 031:000000001010000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 032:000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 033:000000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 135:010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-- </MAP>
-- <WAVES>
-- 000:00000000ffffffff00000000ffffffff
-- 001:0123456789abcdeffedcba9876543210
-- 002:0123456789abcdef0123456789abcdef
-- </WAVES>
-- <SFX>
-- 000:020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200304000000000
-- 001:020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200307000000000
-- 002:02000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020030b000000000
-- </SFX>
-- <FLAGS>
-- 000:00000000000000000000000000000000101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- </FLAGS>
-- <PALETTE>
-- 000:1a1c2c5d2810814428ca9581ffcd7575ae442495482571793c55c22c9dfae20000000000f4f4f494b0c2566c86333c57
-- </PALETTE>
What triggers the error, is after the player fires the second bullet. After firing one, the bullet is created, displayed, and despawned on queue, but after the second bullet starts existing, it stops and gives me the error. I've switched things around quite a bit, and it seems like every time I reference to one of the bullet objects values when more then one exists, it sends me the error, which is what I don't understand, as i thought I had already solved that problem with the for loops.
So if you noticed anything right off the bat that doesn't look quite right, let me know, and if you don't know anything about TIC-80 or what the API does, I'm sure the TIC-80 website can explain it way better then me.
If you want to run the game, to see the issue in action and mess around with the code, download TIC-80 from the website and run this file:
https://drive.google.com/file/d/18ti0NboNNN9Yog6l_n73usF_eX_86EN4/view?usp=sharing
Let's take a look at your bullet handling
First call to TIC:
bullets is 0. We add one bullet into bullet[0]
Second call:
bullets is 1. We add one bullet into bullet[1].
Now, as bullets > 0 we enter the bullet physics if statement.
We do some calculations to that bullet and increment bullet[0].t
The following calls we do the same. We add a bullet and process all but the new bullet as we did above.
When a bullet's t field becomes > 16 we remove it from bullet.
So first we remove the oldest bullet bullet[0]. But in the following call we again start our loop at i = 0. so bullet[i] is nil and hence indexing it in bullet[i].x causes the observed error.
Side note:
This makes no sense.
function bullet:remove()
local this = {
spr = nil,
x = nil,
y = nil,
vx = nil,
vy = nil,
mx = nil,
my = nil,
t = nil,
}
return this
end
A table with all nil values is just an empty table. So simply return an empty table.
On top of that you don't need that function as it does nothing useful.
bullet[i] = bullet:remove()
bullet[i] = nil
The first line is non necessary. You don't have to assign an emtpy table and then nil. Just assign nil.
If you'd just keep the bullets in the array part of the table you wouldn't need your own tablelength function and then subtract 2 btw.
Then you could also use table.remove to remove bullets without creating unexpected gaps in your bullet list.

Understanding AudioStreamBasicDescription

I'm trying to understand the AudioStreamBasicDescription results. Practically non of what I can get makes sense for me. For example:
AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 41, mBytesPerPacket: 4, mFramesPerPacket: 1, mBytesPerFrame: 4, mChannelsPerFrame: 2, mBitsPerChannel: 32, mReserved: 0)
What I would expect:
"Bytes per packet" and "bytes per frame" should be 8 not 4:
4 (size of 32 bit Float) x 2 (two channels per frame) x 1 (1 frame per packet) = 8 bytes
Why is it 4?
import CoreAudio
import AudioUnit
var inputUnitDescription = AudioComponentDescription(componentType: kAudioUnitType_Output,
componentSubType: kAudioUnitSubType_HALOutput,
componentManufacturer: kAudioUnitManufacturer_Apple,
componentFlags: 0,
componentFlagsMask: 0)
let defaultInput = AudioComponentFindNext(nil, &inputUnitDescription)
var inputUnit: AudioUnit?
AudioComponentInstanceNew(defaultInput!, &inputUnit)
var asbd = AudioStreamBasicDescription()
var propertySize = UInt32(MemoryLayout<AudioStreamBasicDescription>.size)
AudioUnitGetProperty(inputUnit!,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
1,
&asbd,
&propertySize)
dump(asbd)
Your ABSD has mFormatFlags == 41 .
if (mFormatFlags & 32) != 0 , that means the format includes the kAudioFormatFlagIsNonInterleaved bit.
A non-interleaved format only returns one channel of data per frame, not 2.
Instead you get multiple buffers, each buffer with only one channel per frame, or 4 bytes (for Float32 format), not 8.

Change variable value inside loop in MATLAB

How can I change the value of 'StartRow' and 'EndRow' inside the loop?
for k = 1:11
filename = 'file.txt';
...
startRow = 1422; %1564, 1706, 1848, 1990, 2132, 2274, 2416, 2558, 2700, 2842
endRow = 1562; %1704, 1846, 1988, 2130, 2272, 2414, 2556, 2698, 2840, 2982
...
f=figure;
plot(...);
saveas(f,sprintf('fig%d.png',k));
end
You can store all values of startRow and endRow in a list right before the for loop and then iterate through the list to change the value of these variables inside the loop.
startRowList = [1422, 1564, 1706, 1848, 1990, 2132, 2274, 2416, 2558, 2700, 2842];
endRowList = [1562, 1704, 1846, 1988, 2130, 2272, 2414, 2556, 2698, 2840, 2982];
for k = 1:11
filename = 'file.txt';
...
startRow = startRowList(k);
endRow = endRowList(k);
...
f=figure;
plot(...);
saveas(f,sprintf('fig%d.png',k));
end
Keep startRow and endRow outside the loop and call them inside the loop using loop index.
startRow = [1422 1564, 1706, 1848, 1990, 2132, 2274, 2416, 2558, 2700, 2842] ;
endRow = [1562 1704, 1846, 1988, 2130, 2272, 2414, 2556, 2698, 2840, 2982];
n = length(startRow) ;
for k = 1:n
filename = 'file.txt';
thestart = startRow(k) ;
theend = endRow(k) ;
...
...
f=figure;
plot(...);
saveas(f,sprintf('fig%d.png',k));
end
starts = [1422, 1564, 1706, 1848, 1990, 2132, 2274, 2416, 2558, 2700, 2842];
ends = [1562, 1704, 1846, 1988, 2130, 2272, 2414, 2556, 2698, 2840, 2982];
for k = 1:11
...
startRow = starts(k);
endRow = ends(k);
...
end

Getting error from: dlen = uint32(0) ;

I don't know why but I am getting this error:
Error in mr_lsbpex (line 3)
dlen = uint32(0) ;
Output argument "a" (and maybe others) not assigned during call to "E:\path\mr_lsbpex.m>mr_lsbpex"
I have tested "dlen = uint32(0) ;" in matlab enviorment (outside of this function) and everything was OK. Here is my code:
function a = mr_lsbpex ( r, p )
% extract from an array
dlen = uint32(0) ;
s = size (r) ;
rnd = rand (s(1),s(2)) ;
rd = 32 ;
rl = s(2) ;
for i=1:s(2)
if rnd(1,i)<rd/rl
d = bitget (round(r(1,i)/p),1);
dlen = bitset (dlen,rd,d);
rd = rd -1 ;
end
rl = rl -1 ;
end
if (dlen > 10000000 )
clear a ;
return ;
end
a = uint8(zeros(dlen,1)) ;
rd = double(dlen * 8) ;
rl = double(s(1)*s(2)-s(2)) ;
for i=2:s(1)
for j=1:s(2)
if rnd(i,j)<rd/rl
d = bitget (round(r(i,j)/p) ,1) ;
a = z_set_bit (a,rd,d) ;
rd = rd - 1 ;
end
rl = rl - 1 ;
end
end
Remember: a needs to be returned ALLWAYS!
The error is not in that specific line, but in the "whole" function itself.
Your problem is that Matlab thinks that a its not going to be created. And actually in some case it may not be created.
The following line in the beginning of your function should do the trick
a=0; % well, or a=NaN; or whatever you want to return
Additionally, don't clear a in if (dlen > 10000000 ).