05-24-2012 10:41 AM
Using LabWindows/CVI 8.1
When I get this certain project out of source safe, and launch LabWindows/CVI, all the indents or tabs or spaces are all messed up in all files.
Example:
// AMD ****************************************************************
if ( strstr( current_command, "AMD_SET1" ) != NULL )
{
processAMD_SET1();
max_retries[reent_indx] = DEF_MAX_RETRY;
retry_cnt = DEF_MAX_RETRY;
SetCtrlVal(utilPanel, MMA_UTILS_RETRY_NUMERIC, retry_cnt);
}
else if ( strstr( current_command, "AMD_SET2" ) != NULL )
{
processAMD_SET2();
}
When a colleague of mine get it outand launches it on his computer, his looks fine:
// AMD ****************************************************************
if ( strstr( current_command, "AMD_SET1" ) != NULL )
{
processAMD_SET1();
max_retries[reent_indx] = DEF_MAX_RETRY;
retry_cnt = DEF_MAX_RETRY;
SetCtrlVal(utilPanel, MMA_UTILS_RETRY_NUMERIC, retry_cnt);
}
else if ( strstr( current_command, "AMD_SET2" ) != NULL )
{
processAMD_SET2();
}
I have tried going into Options -> Editor Preferences and changes the Auto indent and tabs but nothing seem to correct the problem
Any help would be greatly appreciated as this is driving me nuts.
Thanks!
John W.
05-24-2012 11:18 AM - edited 05-24-2012 11:19 AM
If this is not an issue with the tabs, then I don't know what else it could be. Have you tried enabling "Convert leading spaced to tabs when loading files" in the Editor Preferences. You could also try this in conjunction with a really large Tab length to help you differentiate between tabs and spaces for troubleshooting purposes. Maybe if you post an example file (doesn't have to be real code) that demonstrates the issue, I could try it on my system and may be able to find the right settings.
Also, as a workaround, you could try using a third-party tool to auto format your code. Check out this toturial: LabWindows/CVI Tip: Integrate Free Code Formatter into CVI Tools Menu
05-24-2012 12:05 PM
Thanks for the reply,
Convert leading spaced to tabs when loading files didn't work.
Attached is a snippet of one of the files I am having problems with.
Thanks!
JW
05-24-2012 01:36 PM
Looking at the file in Notepad++ (see screenshot), it looks like the file is formatted in an odd way. The tabs don't seem to conform to any particular style. Is it possible that the source control is affecting the files. You could try checking out the file from source control on both your systems and looking at it in a third-party editor like Notepad++ where you can see the white space characters. Then you can compare the two to see if there are any differences between the actual characters in the files. The reason I say this, is because if you and your colleague have the same Editor Preferences, then the file should be the same on both systems unless the files are not the same.