The board is set for giving limited capabilities to posters will less than 50 posts (this is because of spammers editing previous posts to add links to crappy sites), you are near to reach that number of posts, from then on you will have no more time limits on editing previous posts.
Thanks a lot, now this is clear to me.
The %* is ALL parameters excluded the %0 one.
In batch you have the shift command to manipulate parameter numbers/order, but the grub4dos implementation does not accept shift -1 if I recall correctly (not that it is usually needed).
Good to know about %*.
What I do not like so much about using shift in the main routine is losing arguments (with regard to in this 'function'-project). And if there are many arguments, it is a waste of variables, needed to hold the values of the arguments.
In one of my projects I was because of this *thing* condemned to endless debugging with varsleft.g4b (I believe it's from steve6375 - no author 'inside'. It's a very handy debugging-tool).
I experimented with call :%1 %* - seems to give no problems, I only have to test if shift inside a sub-routine does the same, without losing anything in the main routine.
I have been thinking about the dll-'idea' I should 'not attribute' to you.
To give this sort of call's a more unified structure, should their not be error-handling too? Although I have only vague notions of, for instance, the windows API, I know many different error-codes are needed.
To exemplify I made a function I really need: counting number of labels. My latest count (105 labels) took me a very long time, and I was not even sure about the final number. So I made the function 'cntlabel'. Still not very high-level, just meant to give an idea about a possible general structure.
!BAT #FUNCTION.G4B by deomsh; thanks to Wonko the Sane #DLL for Grub4Dos #Arguments: function, mandatory arguments, optional arguments; errormsg: 0=No function given, 1=Function not supported #Implemented: cntlabel (20210717) debug off setlocal && set * if "%~1"=="" && set /a errormsg=0 > nul if not exist errormsg && call :dbfunc %~1 if not exist errormsg && call :%~1 %* endlocal && set result=%result% && set errormsg=%errormsg% echo %1: result=%result% errormsg=%errormsg% goto :eof :cntlabel #Function: count number of labels; Argument: FILE; Optional: dos or mac; errormsg: 2=FILE not given, 3=FILE does not exist setlocal && set * if "%~2"=="" && endlocal && set /a errormsg=2 > nul && goto :eof if not exist %~2 && endlocal && set /a errormsg=3 > nul && goto :eof if /i "%~3"=="dos" && set EOL=\x0D\x0A ! set EOL=\x0A if /i "%~3"=="mac" && set EOL=\x0D echo EOL=%EOL% cat --locate=%EOL%\x3A %~2 > nul &; set /a result=%@retval% > nul endlocal && set result=%result% goto :eof :dbfunc #database of available functions setlocal && set * if not /i %~1==cntlabel && endlocal && set /a errormsg=1 > nul && goto :eof endlocal goto :eof
This is the 'print-screen' of the output (the optional argument gives also more possible uses of cntlabel):
grub> (hd0,0)/function.g4b : result: errormsg=0 grub> (hd0,00/function.g4b cntlabe cntlabe: result= errormsg=1 grub> (hd0,0)/function.g4b cntlabel (hd0,0)/fattext.g4d cntlabel: result= errormsg=3 grub> (hd0,0)/function.g4b cntlabel (hd0,0)/fattext.g4b EOL=\x0A cntlabel: result=102 errormsg= grub> (hd0,0)/function.g4b cntlabel (hd0,0)/fattext.g4b dos EOL=\x0D0A cntlabel: result=102 errormsg= grub> (hd0,0)/function.g4b cntlabel (hd0,0)/fattext.g4b mac EOL=\X0D cntlabel: result= errormsg= grub> (hd0,0)/function.g4b cntlabel (hd0,0)/fattext.g4b ms-dos EOL=\0Ax cntlabel: result=102 errormsg= grub>
BTW I tried to make textual error messages too, but today I was plagued again by Error 16 Inconsistent filesystem structure. Has something to do with editing files in Windows in combination with Imdisk to have access to VBox in combination with 'saving' grub4dos-sessions in VBox. After 'refreshing everything' Error 16 disappeared.
What do you think about error-handling?