| makepp documentation | Contained in the makepp distribution. |
Scanner::Esqlc - makepp scanner for Embedded SQL C files
Scans a C file for EXEC SQL INCLUDEs, $includes and #includes.
Tags are:
File scanned due to an EXEC SQL INCLUDE "filename" or $INCLUDE "filename" directive.
File scanned due to an EXEC SQL INCLUDE <filename<, EXEC SQL INCLUDE filename or $INCLUDE <filename< directive.
| makepp documentation | Contained in the makepp distribution. |
use strict; package Scanner::Esqlc; use Scanner::C; our @ISA = 'Scanner::C'; sub get_directive { if( s/^\s*(?:EXEC\s+SQL\s+|\$\s*)INCLUDE\s+//i ) { 'sql'; } elsif( s/^\s*EXEC\s+ORACLE\s+// ) { if( s/^(DEFINE|IFN?DEF)(\s+\w+)\s*;/$2/i || s/^(ELSE|ENDIF)\s*;//i ) { lc $1; } } else { &Scanner::C::get_directive; } } sub other_directive { my( $self, $cp, $finfo, $conditional, $tag, $scanworthy ) = @_; return 0 unless $tag eq 'sql'; $_ = $self->expand_macros($_) if $conditional; $$scanworthy = 1; if( s/^(<)(.+?)>\s*;?\s*$// or s/^(['"]?)(.+?)\1\s*;?\s*$// ) { $tag = ($1 eq '<') ? 'sys' : 'user'; my $file = $1 ? $2 : lc $2; # downcase unquoted file $self->include( $cp, $tag, $file, $finfo ) or undef; } } 1;