Compile rc files encounter "expected exponent value" error - delphi

I have a rc entry:
{CC6C210B-2EAC-4F6C-89E7-0D2FEFFCE278} 8000 "MyFile.txt"
When I compile the rc file with cgrc.exe or brcc32.exe, I encounter this error:
[BRCC32 Error] system.core.rc(1): expected exponent value, not 'a'
This is due to the resource name "CC6C210B-2EAC" was interpreted as exponent value (-2EA). The A character after -2E is not valid exponent value.
If I change the rc entry to something like
{CC6C210B-2E2C-4F6C-89E7-0D2FEFFCE278} 8000 "MyFile.txt"
The resource compile without any error.
Unfortunately, I can't simply change the resource name as it has been widely used. Is there any ways to make rc do not interpret resource name as exponent value?

I'm not so sure it was a good idea to use a GUID as resource name. If you really want to do that, you might want to "encode" it as a "normal" identifier, e.g.
_CC6C210B_2EAC_4F6C_89E7_0D2FEFFCE278 8000 "MyFile.txt"
You just write a set of simple routines to "encode" and "decode" such a value between a normal GUID string and the "encoded" form.
function DecodeToGUID(const renamedGUID: string): string;
begin
Result := '{' + Copy(ReplaceString(renamedGUID, '_', '-', [rfReplaceAll]), 2, MaxInt)) + '}';
end;
I'll leave the implementation of the other routine to your imagination. ;-)
Update
If you put the ID in quotes, it should compile, with rc.exe. Without the quotes, the resource compiler will treat it as a preprocessor directive and get terribly confused:
"{CC6C210B-2EAC-4F6C-89E7-0D2FEFFCE278}" 8000 "MyFile.txt"
I tested this with Microsoft's rc.exe. Embarcadero's brcc32.exe will still give an error:
Error resrc.rc 1 1: Expecting resource name or resource type name
So if you want to use that, or the built in resource compiler of the IDE, you'll have to use something like the renamed GUIDs as described above.

I recommend that you use the Microsoft resource compiler rc. According to the documentation for rc, the first token of a resource definition should be a name or a 16 bit integer. Why brcc32 wants to interpret this as a real value is quite beyond me.
If this doesn't work try enclosing the GUID in quotes, " rather than '.

Related

F# FSI "Unexpected compiler generated literal in interaction" with "#I __SOURCE_DIRECTORY__"

If I create a new F# file 'Test.fsx' in VSCode with the line
#I __SOURCE_DIRECTORY__
attempting to run the code in FSI generates the error
Test.fsx(2,4): error FS0010: Unexpected compiler generated literal in interaction. Expected incomplete structured construct at or before this point, ';', ';;' or other token.
Any idea what might be going wrong?
It is a known issue in VS2019, which has been fixed in VS2022.
https://github.com/dotnet/fsharp/issues/13467
You may replace the code with
#I "."

Delphi - Compiler Directives multi lines effects selected IDE error line

I'm wondering why if the compiler directives was typed on multi lines will effects the selected IDE error line.
For example:
{$SETPEFlAGS IMAGE_FILE_DEBUG_STRIPPED or
IMAGE_FILE_LINE_NUMS_STRIPPED or
IMAGE_FILE_LOCAL_SYMS_STRIPPED or
IMAGE_FILE_RELOCS_STRIPPED}
.....
procedure Foo();
begin
WriteLn('1');
WWriteLn('2');
WriteLn('3');
WriteLn('4');
WriteLn('5');
end;
IDE Error
[dcc32 Error] Crypter.dpr(29): E2003 Undeclared identifier: 'WWriteLn'
Inside the source code the selected line is WriteLn('5'); not WWriteLn('2');
But if the compiler directives was typed on this way (one line) :
{$SETPEFlAGS IMAGE_FILE_DEBUG_STRIPPED or IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_LOCAL_SYMS_STRIPPED or IMAGE_FILE_RELOCS_STRIPPED}
Will fix the issue!.
If things are as you say, then this is a defect in the IDE. Report the issue as a bug to Quality Portal.
It's easy to work around the issue. Simply don't use multi-line directives. In this case you can extract the flag into a separate constant and refer to it in the directive.
const
PEFlags = IMAGE_FILE_DEBUG_STRIPPED or
IMAGE_FILE_LINE_NUMS_STRIPPED or
IMAGE_FILE_LOCAL_SYMS_STRIPPED or
IMAGE_FILE_RELOCS_STRIPPED;
{$SETPEFlAGS PEFlags}
The reason I hesitate in the first paragraph is that what you describe would also occur if the linefeeds were incorrect. If your linefeeds are not CR+LF then the IDE gets confused about line numbers. So, it's worth checking that your linefeeds are CR+LF. You could simply re-type the code and the linefeeds will be correct. Typically you get mixed up linefeeds when you paste from another source.

what does "The run procedure option is not allowed with member type RPGLE" mean?

What does "The run procedure option is not allowed with member type RPGLE" mean?
what does "The run procedure option is not allowed with member type RPGLE" mean?
Apparently that is the error message identifier PDM0365 with first-level text "The Run Procedure option is not allowed with member type &1." from the Message File (MSGF) QUOMSGF in library QPDA. In the second level text [visible after F1=Help is pressed with the cursor positioned on that message id, or in Display Message Description (DSPMSGD) for that message Id and message file] what is the cause and the recovery for the error condition is further explained; i.e. the assistance requested on this site, probably could have been resolved by asking that the system should provide the Help:
Cause . . . . . : You cannot run a procedure with this type.
Recovery . . . : The following member types can be run as procedures: REXX,
OCL36, BASP, BASP38.
With the replacement text for the replacement-variable &1 being RPGLE, the indication is that the option-16="Run Procedure" was issued against a member listed in the Work With Members Using PDM (WRKMBRPDM) feature, and the TYPE for the member was RPGLE instead of one of the listed as supported member types noted in the Recovery text.
Additionally, if under the heading Opt [the USEnglish abbreviation for Option] the F1=Help were pressed [instead of] where the option 16 was typed, the following Help Text would be presented that explains what are the options that can be specified and what each of the system-supplied numeric options will effect:
Help Options - Help
16=Run procedure
Type 16 to run a source member with a member type of REXX,
OCL36, BASP, or BASP38. If you try to run a member with a type
that cannot be run, you receive an error message. To run an
OCL36 procedure, the file name must be QS36PRC. You can have
the member run in batch mode or interactively depending on what
you specified in the Run in batch prompt on the Change Defaults
display.
Therefore if a Run option is not an eligible task to perform against the member of type=RPGLE, perhaps review the other options for what they might provide. Here are two, one conspicuous by specific mention of support for the type-RPGLE in the Option help-text and another much more subtle by only an allusion to types that reflect an ILE source type [with [...] denoting snipped content from that help]:
[...]
14=Compile
Type 14 to compile one or more members. The system creates an
object based on the member being compiled. The member is
compiled interactively or in batch mode, depending on what you
have specified on the Change Defaults display.
The following member types can be compiled: [...]
PLI38, PNLGRP, PRTF, PRTF38, QRY38, RMC, RPG, RPGLE, RPG36,
RPG38, RPT, RPT36, RPT38, SPADCT, SQLC, SQLCPP, SQLCBL,
[...]
When the programming development manager compiles a program
[...]
15=Create module
Type 15 to create a module object for an ILE source type.
[...]
For the latter, to create a Module (*MOD) object versus to create a Bound Program (*PGM) from the RPGLE type which is a contraction of RPG and ILE, denoting that type as an ILE source type.
So instead of using Option-16, use either of Option-14 or Option-15 to compile the ILE RPG source into an executable [*PGM] or a linkable [*MOD] object.
Option 16 (Run procedure) only applies to REXX procedures (and maybe some others). You can't use it to run an RPG/COBOL/C program. It MIGHT work to run a CL program, but I don't think so.
To run a program, either CALL it from the command line or create your own PDM option.
The SEU error may or may not be an error - SEU hasn't been kept up-to-date with all the new features of the RPGLE language. Remember that SEU is simply a source editor/validator.
If you were able to compile the RPG program (using PDM option 14 for CRTBNDRPG or option 15 for CRTRPGMOD followed by running the CRTPGM command) then the SEU 'problem' isn't a problem at all.

F# integer file directive

I've been using fslex and fsyacc, and the F# source files (.fs they generate from the lexer (.fsl) and parser (.fsp) rules refer to the original .fsl (and sometimes to the same .fs source file) all over the place with statement such as this (numbers are line numbers):
lex.fs
1 # 1 "/[PROJECT-PATH-HERE]/lex.fsp
...
16 # 16 "/PROJECT-PATH-HERE]/lex.fs
17 // This is the type of tokens accepted by the parser
18 type token =
19 | EOF
...
Also, the .fs files generated by pars.fsp do the same kind of thing, but additionaly reference to the F# signature file (.fsi) generated alongside it. What does any of this do/mean?
The annotations you see in the generated code are F# Compiler Directives (specifically, the 'line' directive).
The 'line' directive makes it so that when the F# compiler needs to emit a warning/error message for some part of the generated code, it has a way to determine which part of the original file corresponds to that part of the generated code. In other words, the F# compiler can generate a warning/error message referencing the original code which is the basis of the generated code causing the error.

Add File Summary tab data in runtime in NTFS in WinXP SP3

I have given up tryng to figure out the reason of this issue, but here is the story and hope you could give a tip...
As I develop unique app ( http://code.google.com/p/sedev ) and therefore I need to polish it.
I have to add File Summary ( very useful info in my opinion ) to any created files by the app, so I decided to go with NTFS compatible structure
edit: code snippet in which problem occurs:
if (FileExists(BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
- 1) + '.vkp') = True) then // add NTFS descriptive information to output file
try
SetFileSummaryInfo
(PWideChar(BaseLocation + LeftStr(GetSSWData, Length
(GetSSWData) - 1) + '.vkp')); // in my testcase files full path is: C:\Documents and Settings\Kludge\Desktop\sedevrpg\SEDEV_RPG_O_710.vkp
ShowMessagePos('Patch Created successfuly!' + #13#13 +
'Please verify created data to www.se-developers.net.',
ParamStr2X, ParamStr3Y);
MessageBeep(0);
except // exception handler does not even fire on exception ...
on Exception do
begin
if (WarningChBx.Checked = True) then
ShowMessagePos
('Unable to add Description to Output file (' +
BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
- 1) + '.vkp )', ParamStr2X, ParamStr3Y);
MessageBeep(0);
end;
end
final edit by author: Problem was in SetFileSummaryInfo(PWideChar('')) because after PWideChar conversion you got CHARACTER, not Array of Characters ( aka Strings ) therefore it is not valid path anymore!
Here is main tutorial: http://www.delphipages.com/articles/setting_file_summary_information-9228.html
edit: a better formatted tutorial is here.
BUT, the thing is that I just cannot get that damned FileName param to accept any string ... I have EOleSysError exception: "%1 cannot be found" no matter what.
Faulting operand is:
OleCheck(StgOpenStorageEx(PWideChar(FileName),
STGM_SHARE_EXCLUSIVE or STGM_READWRITE,
STGFMT_ANY,
0, nil, nil, #IID_IPropertySetStorage, stg));
What I do not understand is why it actually wants %1 MSDOS file name input.
I am not launching app from CMD therefore I highly doubt it needs additional param for File path ...
I have tried all possible String and PString conversions, also tried various param passing methods ... It just does not work ...
Any help appreciated!
I can only reproduce your case by specifying an invalid filename. Make sure that you include the full path in your filename.

Resources