| | 2766 | | trc_read_descriptor( ID, eid, name, entry_exit, index ) |
| | 2767 | | TRC_ID ID; |
| | 2768 | | int eid; |
| | 2769 | | char *name; |
| | 2770 | | int entry_exit; |
| | 2771 | | int index; |
| | 2772 | | { |
| | 2773 | | TRC_DATADESC DD; |
| | 2774 | | |
| | 2775 | | TRC_TEVDESC TD; |
| | 2776 | | TRC_TEVDESC tdptr; |
| | | | ... |
| | 2782 | | char last; |
| | 2783 | | char c; |
| | 2784 | | |
| | 2785 | | long tmp; |
| | 2786 | | |
| | 2787 | | int done; |
| | 2788 | | int i; |
| | 2789 | | |
| | 2790 | | |
| | 2791 | | |
| | 2792 | | if ( !trc_find_event_str( ID, "{" ) ) |
| | 2793 | | return( (TRC_TEVDESC) NULL );
|
| | 2794 | | |
| | 2795 | | |
| | 2796 | | |
| | 2797 | | |
| | 2798 | | |
| | 2799 | | TD = trc_create_tevdesc(); |
| | 2800 | | |
| | 2801 | | TD->refcount = 1; |
| | 2802 | | |
| | 2803 | | TD->name = trc_copy_str( name ); |
| | 2804 | | |
| | 2805 | | TD->eid = eid; |
| | 2806 | | |
| | 2807 | | TD->entry_exit = entry_exit; |
| | 2808 | | |
| | 2809 | | TD->index = index; |
| | 2810 | | |
| | 2811 | | |
| | 2812 | | |
| | 2813 | | done = 0; |
| | 2814 | | |
| | 2815 | | do |
| | 2816 | | { |
| | 2817 | | |
| | 2818 | | |
| | 2819 | | while ( (c = getc( ID->trace_in )) != (char) EOF
|
| | 2820 | | && c != '/' && c != '}' ); |
| | 2821 | | |
| | 2822 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2823 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2824 | | |
| | 2825 | | |
| | 2826 | | |
| | 2827 | | if ( c == '/' ) |
| | 2828 | | { |
| | 2829 | | if ( TD->ddesc == NULL )
|
| | 2830 | | DD = TD->ddesc = trc_create_datadesc(); |
| | 2831 | | |
| | 2832 | | else |
| | 2833 | | DD = DD->next = trc_create_datadesc(); |
| | 2834 | | |
| | 2835 | | |
| | 2836 | | |
| | 2837 | | c = getc( ID->trace_in ); |
| | 2838 | | |
| | 2839 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2840 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2841 | | |
| | 2842 | | if ( c != '/' ) |
| | 2843 | | { |
| | 2844 | | printf( "Error Parsing Event Descriptor\n" ); |
| | 2845 | | |
| | 2846 | | return( (TRC_TEVDESC) NULL );
|
| | 2847 | | } |
| | 2848 | | |
| | 2849 | | |
| | 2850 | | |
| | 2851 | | if ( !trc_find_event_str( ID, "\"" ) ) |
| | 2852 | | return( (TRC_TEVDESC) NULL );
|
| | 2853 | | |
| | 2854 | | i = 0; |
| | 2855 | | |
| | 2856 | | while ( (c = getc( ID->trace_in )) != (char) EOF
|
| | 2857 | | && c != '"' && i < 8 ) |
| | 2858 | | { |
| | 2859 | | did[i++] = c; |
| | 2860 | | } |
| | 2861 | | |
| | 2862 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2863 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2864 | | |
| | 2865 | | if ( c != '"' ) |
| | 2866 | | { |
| | 2867 | | printf( "Error Parsing Event Descriptor\n" ); |
| | 2868 | | |
| | 2869 | | return( (TRC_TEVDESC) NULL );
|
| | 2870 | | } |
| | 2871 | | |
| | 2872 | | did[i] = '\0'; |
| | 2873 | | |
| | 2874 | | |
| | 2875 | | |
| | 2876 | | if ( !trc_find_event_str( ID, "\"" ) ) |
| | 2877 | | return( (TRC_TEVDESC) NULL );
|
| | 2878 | | |
| $input_269164 > 1023 | 2879 | | i = 0; |
| | 2880 | | |
| | 2881 | | while ( (c = getc( ID->trace_in )) != (char) EOF
|
| | 2882 | | && c != '"' && i < 1024 ) |
| | 2883 | | { |
| | 2884 | | diddesc[i++] = c; |
| | 2885 | | } |
| | 2886 | | |
| | 2887 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2888 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2889 | | |
| | 2890 | | if ( c != '"' ) |
| | 2891 | | { |
| | 2892 | | printf( "Error Parsing Event Descriptor\n" ); |
| | 2893 | | |
| | 2894 | | return( (TRC_TEVDESC) NULL );
|
| | 2895 | | } |
| | 2896 | | |
| i > 1023 | 2897 | | diddesc[i] = '\0'; |
| | 2898 | | |
| | 2899 | | |
| | 2900 | | |
| | 2901 | | DD->did = (TRC_DID) trc_lookup_trie( TRC_DID_TRIE, |
| | 2902 | | (void *) did ); |
| | 2903 | | |
| | 2904 | | if ( DD->did == NULL )
|
| | 2905 | | { |
| | 2906 | | DD->did = trc_create_did(); |
| | 2907 | | |
| | 2908 | | DD->did->name = trc_copy_str( did ); |
| | 2909 | | |
| | 2910 | | DD->did->desc = trc_copy_str( diddesc ); |
| | 2911 | | } |
| | 2912 | | |
| | 2913 | | |
| | 2914 | | |
| | 2915 | | while ( (c = getc( ID->trace_in )) != (char) EOF
|
| | 2916 | | && ( c == ' ' || c == '\t' || c == '\n' ) ); |
| | 2917 | | |
| | 2918 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2919 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2920 | | |
| | 2921 | | dtstr[0] = c; |
| | 2922 | | |
| | 2923 | | i = 1; |
| | 2924 | | |
| | 2925 | | while ( (c = getc( ID->trace_in )) != (char) EOF
|
| | 2926 | | && c != ' ' && c != '\t' && c != '\n' && c != '"' ) |
| | 2927 | | { |
| | 2928 | | dtstr[i++] = c; |
| | 2929 | | } |
| | 2930 | | |
| | 2931 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2932 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2933 | | |
| | 2934 | | dtstr[i] = '\0'; |
| | 2935 | | |
| | 2936 | | DD->dt = trc_get_dt_str( dtstr ); |
| | 2937 | | |
| | 2938 | | if ( DD->dt < 0 ) |
| | 2939 | | { |
| | 2940 | | printf( "Error: Unknown Data Type \"%s\".\n", dtstr ); |
| | 2941 | | |
| | 2942 | | return( (TRC_TEVDESC) NULL );
|
| | 2943 | | } |
| | 2944 | | |
| | 2945 | | |
| | 2946 | | |
| | 2947 | | if ( c != '"' ) |
| | 2948 | | { |
| | 2949 | | if ( !trc_find_event_str( ID, "\"" ) ) |
| | 2950 | | return( (TRC_TEVDESC) NULL );
|
| | 2951 | | } |
| | 2952 | | |
| | 2953 | | if ( !trc_find_event_str( ID, "\"" ) ) |
| | 2954 | | return( (TRC_TEVDESC) NULL );
|
| | 2955 | | |
| | 2956 | | |
| | 2957 | | |
| | 2958 | | c = getc( ID->trace_in ); |
| | 2959 | | |
| | 2960 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2961 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2962 | | |
| | 2963 | | if ( c == '[' ) |
| | 2964 | | { |
| | 2965 | | if ( DD->dt == TEV_DATA_BYTE
|
| | 2966 | | || DD->dt == TEV_DATA_STRING )
|
| | 2967 | | { |
| | 2968 | | |
| | 2969 | | |
| | 2970 | | c = getc( ID->trace_in ); |
| | 2971 | | |
| | 2972 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2973 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2974 | | |
| | 2975 | | if ( c != ']' ) |
| | 2976 | | { |
| | 2977 | | printf( "Error Parsing Event Descriptor\n" ); |
| | 2978 | | |
| | 2979 | | return( (TRC_TEVDESC) NULL );
|
| | 2980 | | } |
| | 2981 | | |
| | 2982 | | |
| | 2983 | | |
| | 2984 | | c = getc( ID->trace_in ); |
| | 2985 | | |
| | 2986 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2987 | | return( (TRC_TEVDESC) NULL ) ); |
| | 2988 | | |
| | 2989 | | |
| | 2990 | | if ( c == '[' ) |
| | 2991 | | { |
| | 2992 | | if ( DD->dt == TEV_DATA_BYTE )
|
| | 2993 | | DD->dt = TEV_DATA_STRING;
|
| | 2994 | | |
| | 2995 | | DD->array = TEV_DATA_ARRAY;
|
| | 2996 | | } |
| | 2997 | | |
| | 2998 | | |
| | 2999 | | else |
| | 3000 | | { |
| | 3001 | | if ( DD->dt == TEV_DATA_STRING )
|
| | 3002 | | DD->dt = TEV_DATA_BYTE;
|
| | 3003 | | |
| | 3004 | | DD->array = TEV_DATA_ARRAY;
|
| | 3005 | | } |
| | 3006 | | } |
| | 3007 | | |
| | 3008 | | else |
| | 3009 | | DD->array = TEV_DATA_ARRAY;
|
| | 3010 | | } |
| | 3011 | | |
| | 3012 | | else |
| | 3013 | | DD->array = TEV_DATA_SCALAR;
|
| | 3014 | | } |
| | 3015 | | |
| | 3016 | | |
| | 3017 | | |
| | 3018 | | else |
| | 3019 | | { |
| | 3020 | | if ( !trc_find_event_end( ID ) ) |
| | 3021 | | return( (TRC_TEVDESC) NULL );
|
| | 3022 | | |
| | 3023 | | done++; |
| | 3024 | | } |
| | 3025 | | } |
| | 3026 | | while ( !done ); |