MCPcopy Create free account
hub / github.com/boostorg/build / parse_subscript

Function parse_subscript

src/engine/function.c:864–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862 */
863
864subscript_t parse_subscript( char const * s )
865{
866 subscript_t result;
867 result.sub1 = 0;
868 result.sub2 = 0;
869 do /* so we can use "break" */
870 {
871 /* Allow negative subscripts. */
872 if ( !isdigit( *s ) && ( *s != '-' ) )
873 {
874 result.sub2 = 0;
875 break;
876 }
877 result.sub1 = atoi( s );
878
879 /* Skip over the first symbol, which is either a digit or dash. */
880 ++s;
881 while ( isdigit( *s ) ) ++s;
882
883 if ( *s == '\0' )
884 {
885 result.sub2 = result.sub1;
886 break;
887 }
888
889 if ( *s != '-' )
890 {
891 result.sub2 = 0;
892 break;
893 }
894
895 ++s;
896
897 if ( *s == '\0' )
898 {
899 result.sub2 = -1;
900 break;
901 }
902
903 if ( !isdigit( *s ) && ( *s != '-' ) )
904 {
905 result.sub2 = 0;
906 break;
907 }
908
909 /* First, compute the index of the last element. */
910 result.sub2 = atoi( s );
911 while ( isdigit( *++s ) );
912
913 if ( *s != '\0' )
914 result.sub2 = 0;
915
916 } while ( 0 );
917 return result;
918}
919
920static LIST * apply_subscript( STACK * s )
921{

Callers 2

apply_subscriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected