<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/tl/onlinemanual/vsc_source_analyze_codes" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Source Analyze Codes</Title>
		<Keyword ContextSensitive="No"><Level1>VSC</Level1>
			<Level2>source analyze codes</Level2>
		</Keyword>
	</Header>
	<GeneralSection><Paragraph class="Default">Source analyze codes are used to perform user-defined checks on scripts such as UI scripts, DLLs and DALs.</Paragraph>
		<Paragraph class="Default">Each source analyze code is linked to an expression text and to a warning message. The expression text contains a search pattern, which is used to find errors.</Paragraph>
		<Paragraph class="Default">If an error is found, <Link href="/baanerp/tl/glossary/glossary#000100" role="glossary" Update="No">VSC</Link> generates a <Link href="/baanerp/tl/glossary/glossary#000102" role="glossary">warning</Link>. The warning contains, among other things, the name of the script and the line number where the error is found, and the text of the warning message that is linked to the source analyze code.</Paragraph>
		<Paragraph class="Default">Some source analyze codes are linked to a DLL. This DLL is used to perform more complex search actions.</Paragraph>
		<List><ListIntro>Each source analyze code:</ListIntro>
			<ListItem>has a message ID and a <Link href="/baanerp/tl/glossary/glossary#000101" role="glossary">rule</Link> ID.</ListItem>
			<ListItem>belongs to a category, for example: Tools Consistency, Application Design, or Performance.</ListItem>
			<ListItem>has a priority: High, Normal, Suspicious, or Low.</ListItem>
		</List>
		<Paragraph class="Default">You can maintain source analyze codes in the <GUIRef href="/baanerp/tl/vsc/tlvsc3511m000" role="session">Source Analyze Codes (tlvsc3511m000)</GUIRef> session. For more information, refer to the session help.</Paragraph>
		<Paragraph class="Default">To make sure that the checks defined in a source analyze code's expression are executed, you must link the source analyze code to one or more <Link href="/baanerp/tl/glossary/glossary#000104" role="glossary" Update="No">verification filters</Link>. For more information, refer to <Link href="/baanerp/tl/onlinemanual/vsc_to_configure_vsc" role="manual">To configure VSC</Link>.</Paragraph>
		<GeneralSection><SectionTitle>Expressions</SectionTitle>
			<Paragraph class="Default">The search pattern in an expression text consists of start expressions, end expressions and search expressions.</Paragraph>
			<List><ListIntro>Points of attention:</ListIntro>
				<ListItem>Expressions are regular.</ListItem>
				<ListItem>An expression can consist of several expressions. The start expression can only be a single expression.</ListItem>
				<ListItem>If you use more expressions in an end expression, the separate expressions must be separated by a pipe sign (|).</ListItem>
				<ListItem>If you use more expressions in a search expression, the separate expressions must be separated by a pipe sign (|) or an ampersand sign (&amp;). You cannot use both signs in one search expression.</ListItem>
				<ListItem>If you enter two expressions that are separated by a pipe sign (|), ERP LN must find either one of the expressions, not both.</ListItem>
				<ListItem>If you enter two expressions that are separated by an ampersand sign (&amp;), ERP LN must find both expressions.</ListItem>
			</List>
		</GeneralSection>
		<GeneralSection><SectionTitle>Search mechanism</SectionTitle>
			<ProcedureList><ListIntro>To execute the checks that are defined for a source analyze code, VSC does the following:</ListIntro>
				<ListItem>VSC starts searching for a piece of source code that matches the start expression.</ListItem>
				<ListItem>If VSC finds a matching piece of code, VSC searches for a piece of source code that complies with the end expression. The positions where VSC finds the start and end expressions respectively, will be the start and end position for the actual search.</ListItem>
				<ListItem>The search expression searches between the start position and the end position. The result is true or false (found or not found).</ListItem>
				<ListItem>If the error is found, a VSC warning is generated with the category and the priority that are assigned to the source analyze code.</ListItem>
			</ProcedureList>
		</GeneralSection>
		<GeneralSection><SectionTitle>Examples</SectionTitle>
			<ExampleSection><SectionTitle>
                                    Example- Source Analyze Code without DLL</SectionTitle>
				<Paragraph class="Default">VSC executes the following source analyze code.</Paragraph>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="166" align="left" rowspan="1" colspan="1">Source Analyze Code</TH>
							<TD width="326" align="left" rowspan="1" colspan="1">app_start</TD>
						</TR>
						<TR><TH width="166" align="left" rowspan="1" colspan="1">Warning Message</TH>
							<TD width="326" align="left" rowspan="1" colspan="1">Function 'app_start' is not supported by WebTop</TD>
						</TR>
						<TR><TH width="166" align="left" rowspan="1" colspan="1">Expression Text</TH>
							<TD width="326" align="left" rowspan="1" colspan="1">
								<CodeBlock space-and-orientation="indented-estimated">maxlen		:sourcelinelen
pattern	:[ =&lt;&gt;,(){]app_start[ ]*[(]</CodeBlock>
							</TD>
						</TR>
					</TBODY>
				</TABLE>
				<Paragraph class="Default">The expression searches for lines that contain the "app_start" function. For each search result, VSC generates a warning. The warning contains, among other things, the name of the script and the line number where the error is found, and the text of the warning message ("Function 'app_start' is not supported by WebTop").</Paragraph>
			</ExampleSection>
			<ExampleSection><SectionTitle>
                                    Example- Source Analyze Code with DLL</SectionTitle>
				<Paragraph class="Default">VSC executes the following source analyze code.</Paragraph>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="163" align="left" rowspan="1" colspan="1">Source Analyze Code</TH>
							<TD width="310" align="left" rowspan="1" colspan="1">message_args</TD>
						</TR>
						<TR><TH width="163" align="left" rowspan="1" colspan="1">Warning Message</TH>
							<TD width="310" align="left" rowspan="1" colspan="1">Text in function message()</TD>
						</TR>
						<TR><TH width="163" align="left" rowspan="1" colspan="1">DLL</TH>
							<TD width="310" align="left" rowspan="1" colspan="1">otlvscdll4009</TD>
						</TR>
						<TR><TH width="163" align="left" rowspan="1" colspan="1">Expression Text</TH>
							<TD width="310" align="left" rowspan="1" colspan="1">
								<CodeBlock space-and-orientation="indented-estimated">maxlen			:512
start			:[ ,:(]message[ ]*[(]
end			:~[)]
pattern_log		:end_start-start_end</CodeBlock>
							</TD>
						</TR>
					</TBODY>
				</TABLE>
				<Paragraph class="Default">The expression searches for lines that contain the "message" function. Subsequently, the "otlvscdll4009" DLL checks the message arguments. VSC generates a warning if a message call contains plain text, instead of a message code. The warning contains, among other things, the name of the script and the line number where the error is found, and the text of the warning message ("Text in function message()").</Paragraph>
			</ExampleSection>
		</GeneralSection>
	</GeneralSection>
</ManualTopic>
