Spider 4 beta 2

Found an issue in SpiderBasic ? Please report it here !
Stefan
Posts: 268
Joined: Mon Feb 05, 2018 9:44 pm

Spider 4 beta 2

Post by Stefan »

It would be good to know what was changed in Beta 2. My program doesn't run in Beta 2, whereas it did in Beta 1. However, I don't get an error message because the debugger doesn't even launch. Unfortunately, I can't post the code here because it's too large.
At first glance, the program works without the debugger...



This is the cosole log:
debug.js?t=1786716137:59 /austausch/loungeproggen/spider/lounge_client2910.sb:1 error: Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules (http://127.0.0.1:19080/spiderbasic.js?t=1786716137, line: 71602)


function spider_InitFunctions() {
spider_InitMap()
This is line 71602 : await spider_InitFileSystem()
spider_InitImageDecoder()
spider_InitImage()
spider_Init2DDrawing()
spider_InitDesktop()
spider_InitList()
spider_InitGadget()
spider_Event_Init()
spider_InitWindow()
spider_InitFont()
spider_InitSystem()
spider_InitMenu()
spider_InitArray()
}
Fred
Site Admin
Posts: 1895
Joined: Mon Feb 24, 2014 10:51 am

Re: Spider 4 beta 2

Post by Fred »

It looks like the postprocessor doesn't tag the init function as async. Is it on Windows ? Did you install in a new dir ? If you can reduce the code while preserving the bug, it would be great. As it's a postprocessor stuff, you can just remove included file etc. until it starts to compile again
Stefan
Posts: 268
Joined: Mon Feb 05, 2018 9:44 pm

Re: Spider 4 beta 2

Post by Stefan »

I tried it on Windows 10 and Linux Mint. New folders for SpiderBasic were created.
I removed all XIncludeFile files. Now it seems to be working.
Fred
Site Admin
Posts: 1895
Joined: Mon Feb 24, 2014 10:51 am

Re: Spider 4 beta 2

Post by Fred »

Could you try to find the one which id triggering the error and send it to me so I can fix it ?
Stefan
Posts: 268
Joined: Mon Feb 05, 2018 9:44 pm

Re: Spider 4 beta 2

Post by Stefan »

Do you mean the XInclude file?

Code: Select all


DeclareModule ListIconGadgetEx
  
  EnableExplicit
  
  Declare SetRowHeight(ListIconGadget, RowHeight)
  Declare BindCellClick(ListIconGadget, Callback)
  
  Declare SetEvenRowColor(ListIconGadget, RowColor.s, SelectedRowColor.s, TextColor.s, SelectedTextColor.s)
  Declare SetOddRowColor (ListIconGadget, RowColor.s, SelectedRowColor.s, TextColor.s, SelectedTextColor.s)
  
  Declare SetColumnHeaderColor(ListIconGadget, Column, BackColor.s, FrontColor.s)
  
  Declare SetColumnHeaderAlignment(ListIconGadget, Column, Alignment.s)
  Declare SetColumnAlignment(ListIconGadget, Column, Alignment.s)
  
  Declare RenderCell(ListIconGadget, Column, Callback)
  
EndDeclareModule

Module ListIconGadgetEx
  
  EnableExplicit
  
  Macro GetGadgetID(ListIconGadget)
    If IsGadget(ListIconGadget) = 0 : ProcedureReturn : EndIf
    If GadgetType(ListIconGadget) <> #PB_GadgetType_ListIcon : ProcedureReturn : EndIf
    Protected GadgetID = GadgetID(ListIconGadget)
  EndMacro
  
  Macro GetGrid
    GetGadgetID(ListIconGadget)
    ! var grid = v_gadgetid.gadget;
  EndMacro
  
  Procedure SetRowHeight(ListIconGadget, RowHeight)
    
    GetGrid
    
    ! spider.DojoAspect.after( grid, 'renderRow', function( row, args ) {
    !		var div = $(row).find("td.dgrid-cell").find("div").find("div");
    ! 	div.css('height', v_rowheight + 'px');
    ! 	div.css('line-height', v_rowheight + 'px');
    ! 	return row;
    ! });	
    
  EndProcedure
  
  Procedure BindCellClick(ListIconGadget, Callback)
    
    GetGrid
    
    ! grid.on('.dgrid-header .dgrid-cell:click', function (e) {
    ! 	v_callback(v_gadget, grid.cell(e).column.index, -1);
    ! });
    
    ! grid.on('.dgrid-row .dgrid-cell:click', function (e) {
    ! 	v_callback(v_gadget, grid.cell(e).column.index, grid.cell(e).row.id);
    ! });
    
  EndProcedure
  
  Procedure SetEvenRowColor(ListIconGadget, RowColor.s, SelectedRowColor.s, TextColor.s, SelectedTextColor.s)
    
    GetGrid
    
    ! $('#EvenRowColorStyle_' + grid.id).remove();
    
    ! var style = "<style type='text/css' id='EvenRowColorStyle_" + grid.id + "'>" + 
    !             " #" + grid.id + " .dgrid-row-even.dgrid-selected {background:" + v_selectedrowcolor + ";color:" + v_selectedtextcolor + ";}" + 
    !             " #" + grid.id + " .dgrid-row-even {background:" + v_rowcolor + ";color:" + v_textcolor + ";}" + 
    !             "</style>"
    
    ! $(style).appendTo("head");
    
  EndProcedure
  
  Procedure SetOddRowColor(ListIconGadget, RowColor.s, SelectedRowColor.s, TextColor.s, SelectedTextColor.s)
    
    GetGrid
    
    ! $('#OddRowColorStyle_' + grid.id).remove();
    
    ! var style = "<style type='text/css' id='OddRowColorStyle_" + grid.id + "'>" + 
    !             " #" + grid.id + " .dgrid-row-odd.dgrid-selected {background:" + v_selectedrowcolor + ";color:" + v_selectedtextcolor + ";}" + 
    !             " #" + grid.id + " .dgrid-row-odd {background:" + v_rowcolor + ";color:" + v_textcolor + ";}" + 
    !             "</style>"
    
    ! $(style).appendTo("head");
    
  EndProcedure
  
  Procedure SetColumnHeaderColor(ListIconGadget, Column, BackColor.s, FrontColor.s)
    GetGrid
    ! var id = "ligchc_" + grid.id + "_" + v_column;
    ! $("#" + id).remove();
    ! $("<style id='" + id + "'>" + "#" + grid.id + " .dgrid-column-" + v_column + "[role='columnheader'] { color: " + v_frontcolor + "; background-color: " + v_backcolor + "; }</style>").appendTo("head");
  EndProcedure  
  
  Procedure SetColumnHeaderAlignment(ListIconGadget, Column, Alignment.s)
    GetGrid
    ! var id = "ligcha_" + grid.id + "_" + v_column;
    ! $("#" + id).remove();
    ! $("<style id='" + id + "'>" + "#" + grid.id + " .dgrid-column-" + v_column + "[role='columnheader'] { text-align: " + v_alignment + ";}</style>").appendTo("head");
  EndProcedure
  
  Procedure SetColumnAlignment(ListIconGadget, Column, Alignment.s)
    GetGrid
    ! var id = "ligca_" + grid.id + "_" + v_column;
    ! $("#" + id).remove();
    ! $("<style id='" + id + "'>" + "#" + grid.id + " .dgrid-column-" + v_column + "[role='gridcell'] { text-align: " + v_alignment + ";}</style>").appendTo("head");
  EndProcedure
  
  Procedure RenderCell(ListIconGadget, Column, Callback)
    
    Protected Lig
    Protected Col
    Protected Row
    Protected Text.s
    
    GetGrid
    
    ! grid.ListIconGadget = v_listicongadget;
    
    ! grid.columns[v_column].renderCell = function(a, b, c, d) {
    
    !   v_col = parseInt(c.columnId);
    !   v_row = parseInt(a.id);
    
    !   v_lig = grid.ListIconGadget;
    
    Text = GetGadgetItemText(LIG, Row, Col)
    
    !   var td = c;
    
    !   v_callback(v_row, v_col, v_text, td, v_listicongadget);
    
    ! };
    
    
    ! grid.set("columns", dijit.byId(grid).columns);
    ! grid.startup();
    
  EndProcedure   
  
EndModule

Fred
Site Admin
Posts: 1895
Joined: Mon Feb 24, 2014 10:51 am

Re: Spider 4 beta 2

Post by Fred »

I just tried but it doesn't trigger the error, could you try to reduce your code the most you can with the error still happening and send it to me in PM ?
Stefan
Posts: 268
Joined: Mon Feb 05, 2018 9:44 pm

Re: Spider 4 beta 2

Post by Stefan »

I'm afraid I don't quite understand what you mean. Are you suggesting I add the include file back in and then edit my source code until it works with the include file?
My source code has over 60,000 lines!
Where am I supposed to even begin?

But since the code works with beta1 but not with beta2, you should be able to find out what's different in beta2 compared to beta1.
Stefan
Posts: 268
Joined: Mon Feb 05, 2018 9:44 pm

Re: Spider 4 beta 2

Post by Stefan »

Perhaps the following will help you:

I created an include file with 4 procedures.

These don't actually have to contain anything.

My program does NOT work if I have 4 procedures in the include file.

My program works if I have 3 or fewer procedures in the include file.


Code: Select all



Declare tt1()
Declare tt2()
Declare tt3()
Declare tt4()



Procedure tt1()
  
EndProcedure


 Procedure tt2()
   
 EndProcedure
 
 
 Procedure tt3()
   
 EndProcedure
 
 
 Procedure tt4()
   
 EndProcedure
 






Post Reply