github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/program/definition_struct.go (about)

     1  package program
     2  
     3  func (p *Program) initializationStructs() {
     4  	// stdlib.h
     5  	p.Structs["div_t"] = &Struct{
     6  		Name: "div_t",
     7  		Type: StructType,
     8  		Fields: map[string]interface{}{
     9  			"quot": "int",
    10  			"rem":  "int",
    11  		},
    12  	}
    13  	p.Structs["c4go_div_t"] = &Struct{
    14  		Name: "github.com/Konstantin8105/c4go/noarch.DivT",
    15  		Type: StructType,
    16  		Fields: map[string]interface{}{
    17  			"quot": "Quot",
    18  			"rem":  "Rem",
    19  		},
    20  	}
    21  
    22  	// stdlib.h
    23  	p.Structs["ldiv_t"] = &Struct{
    24  		Name: "ldiv_t",
    25  		Type: StructType,
    26  		Fields: map[string]interface{}{
    27  			"quot": "long int",
    28  			"rem":  "long int",
    29  		},
    30  	}
    31  	p.Structs["c4go_ldiv_t"] = &Struct{
    32  		Name: "github.com/Konstantin8105/c4go/noarch.LdivT",
    33  		Type: StructType,
    34  		Fields: map[string]interface{}{
    35  			"quot": "Quot",
    36  			"rem":  "Rem",
    37  		},
    38  	}
    39  
    40  	// stdlib.h
    41  	p.Structs["lldiv_t"] = &Struct{
    42  		Name: "lldiv_t",
    43  		Type: StructType,
    44  		Fields: map[string]interface{}{
    45  			"quot": "long long",
    46  			"rem":  "long long",
    47  		},
    48  	}
    49  	p.Structs["c4go_lldiv_t"] = &Struct{
    50  		Name: "github.com/Konstantin8105/c4go/noarch.LldivT",
    51  		Type: StructType,
    52  		Fields: map[string]interface{}{
    53  			"quot": "Quot",
    54  			"rem":  "Rem",
    55  		},
    56  	}
    57  
    58  	// locale.h
    59  	p.Structs["struct lconv"] = &Struct{
    60  		Name: "struct lconv",
    61  		Type: StructType,
    62  		Fields: map[string]interface{}{
    63  			"currency_symbol": "char *",
    64  			"int_curr_symbol": "char *",
    65  		},
    66  	}
    67  	p.Structs["c4go_struct lconv"] = &Struct{
    68  		Name: "github.com/Konstantin8105/c4go/noarch.Lconv",
    69  		Type: StructType,
    70  		Fields: map[string]interface{}{
    71  			"currency_symbol": "Currency_symbol",
    72  			"int_curr_symbol": "IntCurrSymbol",
    73  		},
    74  	}
    75  
    76  	// time.h
    77  	p.Structs["struct tm"] = &Struct{
    78  		Name: "struct tm",
    79  		Type: StructType,
    80  		Fields: map[string]interface{}{
    81  			"tm_sec":   "int",
    82  			"tm_min":   "int",
    83  			"tm_hour":  "int",
    84  			"tm_mday":  "int",
    85  			"tm_mon":   "int",
    86  			"tm_year":  "int",
    87  			"tm_wday":  "int",
    88  			"tm_yday":  "int",
    89  			"tm_isdst": "int",
    90  		},
    91  	}
    92  	p.Structs["c4go_struct tm"] = &Struct{
    93  		Name: "github.com/Konstantin8105/c4go/noarch.Tm",
    94  		Type: StructType,
    95  		Fields: map[string]interface{}{
    96  			"tm_sec":   "TmSec",
    97  			"tm_min":   "TmMin",
    98  			"tm_hour":  "TmHour",
    99  			"tm_mday":  "TmMday",
   100  			"tm_mon":   "TmMon",
   101  			"tm_year":  "TmYear",
   102  			"tm_wday":  "TmWday",
   103  			"tm_yday":  "TmYday",
   104  			"tm_isdst": "TmIsdst",
   105  		},
   106  	}
   107  
   108  	// sys/time.h
   109  	p.Structs["struct itimerval"] = &Struct{
   110  		Name: "struct itimerval",
   111  		Type: StructType,
   112  		Fields: map[string]interface{}{
   113  			"it_interval": "struct timeval",
   114  			"it_value":    "struct timeval",
   115  		},
   116  	}
   117  	p.Structs["c4go_struct itimerval"] = &Struct{
   118  		Name: "github.com/Konstantin8105/c4go/noarch.Itimeval",
   119  		Type: StructType,
   120  		Fields: map[string]interface{}{
   121  			"it_interval": "ItInterval",
   122  			"it_value":    "ItValue",
   123  		},
   124  	}
   125  
   126  	// sys/time.h
   127  	p.Structs["struct timeval"] = &Struct{
   128  		Name: "struct timeval",
   129  		Type: StructType,
   130  		Fields: map[string]interface{}{
   131  			"tv_sec":  "long",
   132  			"tv_usec": "long",
   133  		},
   134  	}
   135  	p.Structs["c4go_struct timeval"] = &Struct{
   136  		Name: "github.com/Konstantin8105/c4go/noarch.Timeval",
   137  		Type: StructType,
   138  		Fields: map[string]interface{}{
   139  			"tv_sec":  "TvSec",
   140  			"tv_usec": "TvUsec",
   141  		},
   142  	}
   143  
   144  	// sys/time.h
   145  	p.Structs["struct timezone"] = &Struct{
   146  		Name: "struct timezone",
   147  		Type: StructType,
   148  		Fields: map[string]interface{}{
   149  			"tz_minuteswest": "long",
   150  			"tz_dsttime":     "long",
   151  		},
   152  	}
   153  	p.Structs["c4go_struct timezone"] = &Struct{
   154  		Name: "github.com/Konstantin8105/c4go/noarch.Timezone",
   155  		Type: StructType,
   156  		Fields: map[string]interface{}{
   157  			"tz_minuteswest": "TzMinuteswest",
   158  			"tz_dsttime":     "TzDsttime",
   159  		},
   160  	}
   161  
   162  	// termios.h
   163  	p.Structs["struct termios"] = &Struct{
   164  		Name: "struct termios",
   165  		Type: StructType,
   166  		Fields: map[string]interface{}{
   167  			"c_iflag": "unsigned int",
   168  			"c_oflag": "unsigned int",
   169  			"c_cflag": "unsigned int",
   170  			"c_lflag": "unsigned int",
   171  			"c_cc":    "unsigned char[32]",
   172  		},
   173  	}
   174  	p.Structs["c4go_struct termios"] = &Struct{
   175  		Name: "github.com/Konstantin8105/c4go/noarch.Termios",
   176  		Type: StructType,
   177  		Fields: map[string]interface{}{
   178  			"c_iflag": "Iflag",
   179  			"c_oflag": "Oflag",
   180  			"c_cflag": "Cflag",
   181  			"c_lflag": "Lflag",
   182  			"c_cc":    "Cc",
   183  		},
   184  	}
   185  
   186  	// sys/resource.h
   187  	p.Structs["struct rusage"] = &Struct{
   188  		Name: "struct rusage",
   189  		Type: StructType,
   190  		Fields: map[string]interface{}{
   191  			"ru_utime":    "struct timeval",
   192  			"ru_stime":    "struct timeval",
   193  			"ru_maxrss":   "long",
   194  			"ru_ixrss":    "long",
   195  			"ru_idrss":    "long",
   196  			"ru_isrss":    "long",
   197  			"ru_minflt":   "long",
   198  			"ru_majflt":   "long",
   199  			"ru_nswap":    "long",
   200  			"ru_inblock":  "long",
   201  			"ru_oublock":  "long",
   202  			"ru_msgsnd":   "long",
   203  			"ru_msgrcv":   "long",
   204  			"ru_nsignals": "long",
   205  			"ru_nvcsw":    "long",
   206  			"ru_nivcsw":   "long",
   207  		},
   208  	}
   209  	p.Structs["c4go_struct rusage"] = &Struct{
   210  		Name: "github.com/Konstantin8105/c4go/noarch.Rusage",
   211  		Type: StructType,
   212  		Fields: map[string]interface{}{
   213  			"ru_utime":    "Utime",
   214  			"ru_stime":    "Stime",
   215  			"ru_maxrss":   "Maxrss",
   216  			"ru_ixrss":    "Ixrss",
   217  			"ru_idrss":    "Idrss",
   218  			"ru_isrss":    "Isrss",
   219  			"ru_minflt":   "Minflt",
   220  			"ru_majflt":   "Majflt",
   221  			"ru_nswap":    "Nswap",
   222  			"ru_inblock":  "Inblock",
   223  			"ru_oublock":  "Oublock",
   224  			"ru_msgsnd":   "Msgsnd",
   225  			"ru_msgrcv":   "Msgrcv",
   226  			"ru_nsignals": "Nsignals",
   227  			"ru_nvcsw":    "Nvcsw",
   228  			"ru_nivcsw":   "Nivcsw",
   229  		},
   230  	}
   231  
   232  	// sys/ioctl.h
   233  	p.Structs["struct winsize"] = &Struct{
   234  		Name: "struct winsize",
   235  		Type: StructType,
   236  		Fields: map[string]interface{}{
   237  			"ws_row":    "unsigned short",
   238  			"ws_col":    "unsigned short",
   239  			"ws_xpixel": "unsigned short",
   240  			"ws_ypixel": "unsigned short",
   241  		},
   242  	}
   243  	p.Structs["c4go_struct winsize"] = &Struct{
   244  		Name: "github.com/Konstantin8105/c4go/noarch.Winsize",
   245  		Type: StructType,
   246  		Fields: map[string]interface{}{
   247  			"ws_row":    "Row",
   248  			"ws_col":    "Col",
   249  			"ws_xpixel": "Xpixel",
   250  			"ws_ypixel": "Ypixel",
   251  		},
   252  	}
   253  
   254  	// fcntl.h
   255  	p.Structs["struct flock"] = &Struct{
   256  		Name: "struct flock",
   257  		Type: StructType,
   258  		Fields: map[string]interface{}{
   259  			"l_type":   "short",
   260  			"l_whence": "short",
   261  			"l_start":  "off_t",
   262  			"l_len":    "off_t",
   263  			"l_pid":    "pid_t",
   264  		},
   265  	}
   266  	p.Structs["c4go_struct flock"] = &Struct{
   267  		Name: "github.com/Konstantin8105/c4go/noarch.Flock",
   268  		Type: StructType,
   269  		Fields: map[string]interface{}{
   270  			"l_type":   "Type",
   271  			"l_whence": "Whence",
   272  			"l_start":  "Start",
   273  			"l_len":    "Len",
   274  			"l_pid":    "Pid",
   275  		},
   276  	}
   277  
   278  	// sys/stat.h
   279  	p.Structs["struct stat"] = &Struct{
   280  		Name: "struct stat",
   281  		Type: StructType,
   282  		Fields: map[string]interface{}{
   283  			"st_dev":     "unsigned long long",
   284  			"st_ino":     "unsigned long long",
   285  			"st_mode":    "unsigned int",
   286  			"st_nlink":   "unsigned long long",
   287  			"st_uid":     "unsigned int",
   288  			"st_gid":     "unsigned int",
   289  			"st_rdev":    "unsigned long long",
   290  			"st_size":    "long long int",
   291  			"st_blksize": "long long int",
   292  			"st_blocks":  "long long int",
   293  			"st_atime":   "time_t",
   294  			"st_mtime":   "time_t",
   295  			"st_ctime":   "time_t",
   296  		},
   297  	}
   298  	p.Structs["c4go_struct stat"] = &Struct{
   299  		Name: "syscall.Stat_t",
   300  		Type: StructType,
   301  		Fields: map[string]interface{}{
   302  			"st_dev":     "Dev",
   303  			"st_ino":     "Ino",
   304  			"st_mode":    "Mode",
   305  			"st_nlink":   "Nlink",
   306  			"st_uid":     "Uid",
   307  			"st_gid":     "Gid",
   308  			"st_rdev":    "Rdev",
   309  			"st_size":    "Size",
   310  			"st_blksize": "Blksize",
   311  			"st_blocks":  "Blocks",
   312  			"st_atime":   "Atim",
   313  			"st_mtime":   "Mtim",
   314  			"st_ctime":   "Ctim",
   315  		},
   316  	}
   317  }