100+ results for 'printf'

Not the results you expected?

test_archive_string.c (https://bitbucket.org/iorivur/freebsd-bhyve-with-suspend-resume.git) C · 344 lines

278

279 static void

280 test_archive_string_sprintf(void)

281 {

282 struct archive_string s;

299 assertExactString(0, 0, NULL, s);

300

301 archive_string_sprintf(&s, "%s", "");

302 assertExactString(0, 2 * EXTENT, "", s);

303

304 archive_string_empty(&s);

305 archive_string_sprintf(&s, "%s", s32);

306 assertExactString(32, 2 * EXTENT, s32, s);

307

global1_vtu.c (https://github.com/srikard/linux.git) C · 690 lines

671 return chip->vtu_prob_irq;

672

673 snprintf(chip->vtu_prob_irq_name, sizeof(chip->vtu_prob_irq_name),

674 "mv88e6xxx-%s-g1-vtu-prob", dev_name(chip->dev));

675

fc8050_spi.c (https://bitbucket.org/thenameisnigel/android_kernel_lge_ls840.git) C · 385 lines

110 if(!ret)

111 {

112 PRINTF(0, "fc8050_spi_bulkread fail : %d\n", ret);

113 return BBM_NOK;

114 }

134 if(!ret)

135 {

136 PRINTF(0, "fc8050_spi_bulkwrite fail : %d\n", ret);

137 return BBM_NOK;

138 }

155 if(!ret)

156 {

157 PRINTF(0, "fc8050_spi_dataread fail : %d\n", ret);

158 return BBM_NOK;

159 }

tidaldisk.c (https://github.com/Milkyway-at-home/nemo.git) C · 158 lines

103 if(n>5) add= par[5] > 0.;

104 if(n>6) warning("tidaldisk: npar=%d only 5 parameters accepted",n);

105 dprintf(1," inipotential: tidaldisk\n");

106 dprintf(1," parameters: h, Sig, Vz, Z0, add= %f %f %f %f %d\n",h,Sig,Vz,Z0,add);

friso_lexicon.c (https://bitbucket.org/linju_tony/test.git) C · 373 lines

68 string word, string syn ) {

69 if ( lex >= 0 || lex < __FRISO_LEXICON_LENGTH__ ) {

70 //printf("lex=%d, word=%s, syn=%s\n", lex, word, syn);

71 hash_put_mapping( dic[lex], word, new_lex_entry( word, syn, 0, ( char ) strlen(word), ( char ) lex ) );

72 }

302 if ( lex_t == -1 ) continue;

303

304 //printf("key=%s, type=%d\n", __key__, lex_t );

305 while ( ( __line__ = file_get_line( __chars__, __stream ) ) != NULL ) {

306 //comments filter.

ipx_proc.c (https://gitlab.com/envieidoc/tomato) C · 407 lines

74

75 i = v;

76 seq_printf(seq, "%08lX ", (unsigned long int)ntohl(i->if_netnum));

77 seq_printf(seq, "%02X%02X%02X%02X%02X%02X ",

78 i->if_node[0], i->if_node[1], i->if_node[2],

79 i->if_node[3], i->if_node[4], i->if_node[5]);

80 seq_printf(seq, "%-9s", i == ipx_primary_net ? "Yes" : "No");

81 seq_printf(seq, "%-11s", ipx_device_name(i));

82 seq_printf(seq, "%-9s", ipx_frame_name(i->if_dlink_type));

83 #ifdef IPX_REFCNT_DEBUG

84 seq_printf(seq, "%6d", atomic_read(&i->refcnt));

152 }

153 rt = v;

154 seq_printf(seq, "%08lX ", (unsigned long int)ntohl(rt->ir_net));

155 if (rt->ir_routed)

156 seq_printf(seq, "%08lX %02X%02X%02X%02X%02X%02X\n",

sunxi-mmc-debug.c (https://gitlab.com/pine64-android/linux-3.10) C · 392 lines

60 int ret;

61

62 ret = snprintf(buf, PAGE_SIZE, "Usage: \"echo 1 > insert\" to scan card\n");

63 return ret;

64 }

167

168

169 p += sprintf(p, "Dump sdmmc regs:\n");

170 for (i=0; i<0x180; i+=4) {

171 if (!(i&0xf))

172 p += sprintf(p, "\n0x%08llx : ", (u64)(host->reg_base + i));

173 p += sprintf(p, "%08x ", readl(host->reg_base + i));

174 }

175 p += sprintf(p, "\n");

176

177

t_k5buf.c (https://github.com/rhuitl/uClinux.git) C · 287 lines

36 {

37 if (condition) {

38 fprintf(stderr, "%s failed\n", name);

39 exit(1);

40 }

cpufreq-monitor-sysfs.c (https://github.com/mate-desktop/mate-applets.git) C · 345 lines

94 NULL);

95

96 path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH,

97 cpu, monitor_sysfs_files[CPUINFO_MAX]);

98

159 gboolean retval;

160

161 path = g_strdup_printf ("/sys/devices/system/cpu/cpu%u/", cpu);

162 retval = g_file_test (path, G_FILE_TEST_IS_DIR);

163 g_free (path);

179 NULL);

180

181 path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH,

182 cpu, monitor_sysfs_files[GOVERNOR]);

183 governor = cpufreq_sysfs_read (path, &error);

sql-desc.c (https://github.com/robins/postgres.git) C · 377 lines

245 #line 55 "desc.pgc"

246

247 printf("output = %s\n", val2output);

248

249 /* declare c1 cursor for $1 */

271 #line 61 "desc.pgc"

272

273 printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",

274 val1output, ind1, val2output, ind2);

275

321 #line 73 "desc.pgc"

322

323 printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);

324

325 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close c2", ECPGt_EOIT, ECPGt_EORT);

config.c (https://github.com/groovybits/groovymame.git) C · 328 lines

250 /* log that we are processing this entry */

251 if (DEBUG_CONFIG)

252 mame_printf_debug("Entry: %s -- processing\n", name);

253

254 /* loop over all registrants and call their load function */

bt_everything.c (https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk) C · 498 lines

446 for (n = 0; n < 200; n++) {

447 UChar ch = block[n];

448 /* printf("%d ", (int)block[n]); */

449 res = rol1(res) ^ (UInt)ch;

450 }

451

452 printf("MEM-L: final res 0x%llx, carrydep 0x%llx\n", res, carrydep);

453

454 /*------------------------ REG-L -----------------------*/

480 }

481

482 printf("REG-L: final res 0x%llx, carrydep 0x%llx\n", reg, carrydep);

483

484 block += 100;

kgsl_pwrscale.c (https://bitbucket.org/gideonx/bms-jb-3.4.y.git) C · 376 lines

89

90 if (device->pwrscale.policy) {

91 ret = snprintf(buf, PAGE_SIZE, "%s",

92 device->pwrscale.policy->name);

93 if (device->pwrscale.enabled == 0)

94 ret += snprintf(buf + ret, PAGE_SIZE - ret,

95 " (disabled)");

96 ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n");

97 } else

98 ret = snprintf(buf, PAGE_SIZE, "none\n");

99

100 return ret;

utils.c (https://gitlab.com/flypig/knot3d) C · 334 lines

194

195 void PrintMatrix (Matrix3 * m1) {

196 printf ("[ %f, \t%f, \t%f \t]\n", m1->fA1, m1->fB1, m1->fC1);

197 printf ("[ %f, \t%f, \t%f \t]\n", m1->fA2, m1->fB2, m1->fC2);

198 printf ("[ %f, \t%f, \t%f \t]\n", m1->fA3, m1->fB3, m1->fC3);

199 }

200

201 void PrintVector (Vector3 * v1) {

202 printf ("[ %f, \t%f, \t%f \t]\n", v1->fX, v1->fY, v1->fZ);

203 }

204

tst_grps2.c (https://bitbucket.org/iridl/netcdf.git) C · 204 lines

29 main(int argc, char **argv)

30 {

31 printf("\n*** Testing netcdf-4 group functions.\n");

32 printf("*** testing use of unlimited dim in parent group...");

155

156 SUMMARIZE_ERR;

157 printf("*** testing groups and unlimited dimensions...");

158 {

159 int ncid;

output.c (https://bitbucket.org/Taapat/stlinux.bsp-duckbox.git) C · 353 lines

38 static short debug_level = 0;

39

40 #define output_printf(level, x...) do { \

41 if (debug_level >= level) printf(x); } while (0)

42 #else

43 #define output_printf(level, x...)

44 #endif

45

46 #ifndef OUTPUT_SILENT

47 #define output_err(x...) do { printf(x); } while (0)

48 #else

49 #define output_err(x...)

75 int i, j;

76

77 output_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);

78 output_printf(10, "Capabilities:\n");

biossums.c (https://github.com/l4ka/afterburner.git) C · 504 lines

101 arg = 2;

102 } else if (argc != 2) {

103 printf("Error. Need a file-name as an argument.\n");

104 exit(EXIT_FAILURE);

105 }

107

108 if ((stream = fopen(argv[arg], "rb")) == NULL) {

109 printf("Error opening %s for reading.\n", argv[arg]);

110 exit(EXIT_FAILURE);

111 }

112 bios_len = fread(bios_data, 1, LEN_BIOS_DATA, stream);

113 if ((bios_len < LEN_BIOS_DATA) && (pad == 0)) {

114 printf("Error reading 64KBytes from %s.\n", argv[arg]);

115 fclose(stream);

116 exit(EXIT_FAILURE);

data_hash.C (https://bitbucket.org/bathtub/rose.git) C · 372 lines

28 {

29 if (APP_DEBUG > 0)

30 printf ("Initialize the doubleArray_Data_hash table! \n");

31

32 Number_Of_Buckets = NUMBER_OF_BUCKETS;

48

49 if (APP_DEBUG > 0)

50 printf ("Leaving Hash_Table constructor! \n");

51 }

52

68 if ( (Index == Depth_Of_Table-1) && ( (Temp_Bucket != NULL ) && ( Temp_Bucket->Memory_Size != Key ) ) )

69 {

70 printf ("ERROR:Get_Temporary_Vector - Not yet implemented, 2nd level of hash table! \n");

71 APP_ABORT();

72 }

util.c (https://bitbucket.org/lge/gmsh.git) C · 525 lines

24

25 va_start(argp, f_str);

26 vsprintf(out1, f_str, argp);

27 va_end(argp);

28

29 sprintf(out2, "Error! %s", out1);

30

31 fprintf(stdout, out2);

lhash-table.c (https://bitbucket.org/manvscode/libcollections.git) C · 321 lines

309 size_t count;

310

311 printf( "[" );

312 for( count = 0; count < lc_array_size(&p_table->table); count++ )

313 {

316 if( bucket_is_occupied( p_table, count ) ) bucket = 'O';

317 if( bucket_is_deleted( p_table, count ) ) bucket = 'd';

318 printf( "%c", bucket );

319 }

320 printf( "]" );

col.c (https://bitbucket.org/hchbaw/terminology.git) C · 475 lines

400 else

401 {

402 snprintf(buf, sizeof(buf) - 1, "c%i", c);

403 if (!edje_object_color_class_get(bg, buf,

404 &r,

428 for (c = 0; c < 256; c++)

429 {

430 snprintf(buf, sizeof(buf) - 1, "C%i", c);

431

432 if (!edje_object_color_class_get(bg, buf,

b3v1check.c (https://github.com/henjo/gnucap-models.git) C · 364 lines

30 if ((fplog = fopen("b3v3_1check.log", "w")) != NULL)

31 { pParam = here->pParam;

32 fprintf(fplog, "BSIM3V3.1 Parameter Check\n");

33 fprintf(fplog, "Model = %s\n", model->BSIM3v1modName);

34 fprintf(fplog, "W = %g, L = %g\n", here->BSIM3v1w, here->BSIM3v1l);

35

36

37 if (pParam->BSIM3v1nlx < -pParam->BSIM3v1leff)

38 { fprintf(fplog, "Fatal: Nlx = %g is less than -Leff.\n",

39 pParam->BSIM3v1nlx);

40 printf("Fatal: Nlx = %g is less than -Leff.\n",

44

45 if (model->BSIM3v1tox <= 0.0)

46 { fprintf(fplog, "Fatal: Tox = %g is not positive.\n",

47 model->BSIM3v1tox);

48 printf("Fatal: Tox = %g is not positive.\n", model->BSIM3v1tox);

test_c_QcMatValues.c (https://gitlab.com/miro.ilias/qcmatrix) C · 245 lines

53 ierr = QcMatCreate(&A);

54 if (ierr==QSUCCESS) {

55 printf("test_c_QcMatValues>> QcMatCreate(A) passed ...\n");

56 }

57 else {

58 printf("test_c_QcMatValues>> failed to call QcMatCreate(A)\n");

59 exit(ierr);

60 }

61 ierr = QcMatBlockCreate(&A, dim_block);

62 if (ierr==QSUCCESS) {

63 printf("test_c_QcMatValues>> QcMatBlockCreate(A) passed ...\n");

64 }

65 else {

hipe_gc.c (https://github.com/cparedes/omnibus.git) C · 555 lines

73 return n_htop;

74 }

75 fprintf(stderr, "%s: passed end of stack\r\n", __FUNCTION__);

76 break;

77 }

180 return;

181 }

182 fprintf(stderr, "%s: passed end of stack\r\n", __FUNCTION__);

183 break;

184 }

257 if (nsp == nsp_end)

258 return n_htop;

259 fprintf(stderr, "%s: passed end of stack\r\n", __FUNCTION__);

260 break;

261 }

test-daemon.c (https://gitlab.com/tchaik/gnome-builder) C · 500 lines

394

395 root = g_path_get_dirname (path);

396 uri = g_strdup_printf ("file://%s", root);

397

398 params = JSONRPC_MESSAGE_NEW (

pinmux.c (https://github.com/atgreen/u-boot-moxie.git) C · 513 lines

463 case PERIPH_ID_SDMMC3:

464 case PERIPH_ID_SDMMC4:

465 printf("SDMMC device %d not implemented\n", peripheral);

466 return -1;

467 default:

omtTestError.c (https://github.com/mmklee/Sources.git) C · 436 lines

43 omMemCell cell = NULL;

44

45 printf("omtTestErrors: Start\n");

46 om_Opts.MinCheck = 2;

47 for (error = omError_MemoryCorrupted; error < omError_MaxError; error++)

49 om_InternalErrorStatus = omError_NoError;

50 om_ErrorStatus = omError_NoError;

51 printf("!!!expect %s\n", omError2Serror(error));

52 memset(&spec, 0, sizeof(struct LongSpec));

53 cell = NULL;

68 bin->last_page = last_page;

69 }

70 else printf("cell not found\n");

71 break;

72 }

mk500boot.c (https://gitlab.com/GrieverV/rockbox) C · 322 lines

30 static void usage(void)

31 {

32 printf( "Usage: mk500boot <options> <input file> [output file]\n"

33 "options:\n"

34 "\t-decrypt Decrypt the input file and save the output file\n"

43

44 void display_header(struct olympus_header *header) {

45 printf("Magic Name: \t%s\n", header->magic_name);

46 printf("Unknown: \t0x%08hX\n", header->unknown);

47 printf("Header Length: \t0x%04X\n", header->header_length);

48 printf("Flags: \t\t0x%04X\n", header->flags);

49 printf("Unknonwn Zeros: 0x%08X\n", header->unknown_zeros);

50 printf("Image Length: \t0x%08X\n", header->image_length);

codecs.c (https://gitlab.com/thanhnhat041/padavan-ng) C · 245 lines

18 unsigned int i;

19

20 printf("%s\n",

21 sodium_bin2hex(buf3, 33U, (const unsigned char *) "0123456789ABCDEF",

22 16U));

23 printf("bin2hex(..., guard_page, 0):%s\n",

24 sodium_bin2hex(buf3, sizeof buf3, guard_page, 0U));

25 printf("bin2hex(..., \"\", 0):%s\n",

29 sodium_hex2bin(buf4, sizeof buf4, hex, strlen(hex), ": ", &bin_len,

30 &hex_end);

31 printf("%lu:%02x%02x%02x%02x\n", (unsigned long) bin_len,

32 buf4[0], buf4[1], buf4[2], buf4[3]);

33 printf("dt1: %ld\n", (long) (hex_end - hex));

mixer_vp_layer.c (https://github.com/mturquette/linux.git) C · 242 lines

217 char name[32];

218

219 sprintf(name, "video%d", idx);

220

221 layer = mxr_base_layer_create(mdev, idx, name, &ops);

test_complex_source.c (https://bitbucket.org/bosp/benchmarks-parsec.git) C · 579 lines

473 }

474

475 #if USES_LONGDOUBLE && ! HAVE_PRINTF_LONGDOUBLE

476 /* skip this test */

477 #else

495 };

496

497 FUNCTION (gsl_vector, fprintf) (f, v, OUT_FORMAT);

498

499 fclose (f);

517 FUNCTION (gsl_vector, free) (w);

518

519 gsl_test (status, NAME (gsl_vector) "_fprintf and fscanf");

520 }

521 #endif

utilities.c (https://github.com/guocongwudi/9315ass2.git) C · 473 lines

382 {

383 #if 0

384 fprintf(stderr, "faulty slice operation:\n");

385 debug(z, -1, 0);

386 #endif

455 int i;

456 int limit = SIZE(z->p);

457 /*if (number >= 0) printf("%3d (line %4d): '", number, line_count);*/

458 if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit);

459 for (i = 0; i <= limit; i++) {

460 if (z->lb == i) printf("{");

461 if (z->bra == i) printf("[");

462 if (z->c == i) printf("|");

463 if (z->ket == i) printf("]");

GUISeekBar.c (https://gitlab.com/brian0218/RKNanoD_Wireless_Audio_SDK_V1.5) C · 378 lines

165 if (pstClass->pScoll== NULL || pstClass->pBlock== NULL)

166 {

167 printf("GUI_SeekBarSetStyle error: Create icon fault %d %d\n", Scoll, Block);

168 return RK_ERROR;

169 }

317 if (pstSeekBarClass== NULL)

318 {

319 printf("Create SeekBar: malloc fault\n");

320 return NULL;

321 }

356 if ( pstSeekBarClass== NULL )

357 {

358 printf("delete SeekBar fault\n");

359 return RK_ERROR;

360 }

w1_ds250x.c (https://github.com/srikard/linux.git) C · 290 lines

199

200 if (sl->master->bus_master->dev_id)

201 snprintf(data->nvmem_name, sizeof(data->nvmem_name),

202 "%s-%02x-%012llx",

203 sl->master->bus_master->dev_id, sl->reg_num.family,

204 (unsigned long long)sl->reg_num.id);

205 else

206 snprintf(data->nvmem_name, sizeof(data->nvmem_name),

207 "%02x-%012llx",

208 sl->reg_num.family,

leds.c (https://github.com/srikard/linux.git) C · 242 lines

202 INIT_DELAYED_WORK(&priv->led_off, led_turn_off);

203

204 snprintf(name, sizeof(name),

205 "rtl8187-%s::radio", wiphy_name(dev->wiphy));

206 err = rtl8187_register_led(dev, &priv->led_radio, name,

209 return;

210

211 snprintf(name, sizeof(name),

212 "rtl8187-%s::tx", wiphy_name(dev->wiphy));

213 err = rtl8187_register_led(dev, &priv->led_tx, name,

216 goto err_tx;

217

218 snprintf(name, sizeof(name),

219 "rtl8187-%s::rx", wiphy_name(dev->wiphy));

220 err = rtl8187_register_led(dev, &priv->led_rx, name,

war.c (https://github.com/jwhite66/geled.git) C · 593 lines

574 if (fifo_init(FIFO_PATH, &fifo_callback, &f, p) != 0)

575 {

576 fprintf(stderr, "Error opening command fifo\n");

577 exit(1);

578 }

cli-rl.c (https://github.com/lkundrak/glusterfs.git) C · 414 lines

46 }

47

48 printf ("\r%*s\r", (int)strlen (state->prompt), "");

49

50 ret = vprintf (fmt, ap);

51

52 printf ("\n");

53 fflush(stdout);

54

74 }

75

76 fprintf (stderr, "\r%*s\r", (int)strlen (state->prompt), "");

77

78 ret = vfprintf (stderr, fmt, ap);

prof.c (https://github.com/adamgreen/gcc4mbed.git) C · 407 lines

68

69 #define prof_measure(func, ...) ({ \

70 printf("%s: ...", #func); \

71 fflush(stdout); \

72 \

87 } \

88 res -= prof_baseline_cycle; \

89 printf("\r%s: %"PRIu64" %s", #func, res, prof_units); \

90 \

91 if (!isatty(0)) { \

95 \

96 if (perc > 10) { \

97 printf(" (\e[32m%+"PRId64"%%\e[0m)", perc); \

98 } else if (perc < -10) { \

99 printf(" (\e[31m%+"PRId64"%%\e[0m)", perc); \

oric_tap.c (https://github.com/groovybits/groovymame.git) C · 519 lines

2

3 #define ORIC_WAV_DEBUG 0

4 #define LOG(x) do { if (ORIC_WAV_DEBUG) printf x; } while (0)

5

6 /* this code based heavily on tap2wav by Fabrice Frances */

test.c (https://github.com/tekkamanninja/linux.git) C · 287 lines

150 int i;

151

152 // printf("%s(0x%08lx, 0x%08lx, %d)\n", __FUNCTION__, start, nr, chunk);

153

154 while ((nfound = radix_tree_gang_lookup(root, (void **)items, into,

155 chunk))) {

156 // printf("At 0x%08lx, nfound=%d\n", into, nfound);

157 for (i = 0; i < nfound; i++) {

158 assert(items[i]->index == this_index);

159 this_index++;

160 }

161 // printf("Found 0x%08lx->0x%08lx\n",

162 // items[0]->index, items[nfound-1]->index);

163 into = this_index;

sysctl-test.c (https://github.com/tekkamanninja/linux.git) C · 394 lines

329 */

330 KUNIT_ASSERT_LT(test,

331 (size_t)snprintf(buffer, max_len, "-%lu",

332 abs_of_less_than_min),

333 max_len);

362

363 KUNIT_ASSERT_GT(test, greater_than_max, (unsigned long)INT_MAX);

364 KUNIT_ASSERT_LT(test, (size_t)snprintf(buffer, max_len, "%lu",

365 greater_than_max),

366 max_len);

tascam-pcm.c (https://github.com/mturquette/linux.git) C · 312 lines

304

305 pcm->private_data = tscm;

306 snprintf(pcm->name, sizeof(pcm->name),

307 "%s PCM", tscm->card->shortname);

308 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_playback_ops);

vars.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 272 lines ✨ Summary

This C code is part of a wad file parser, used to process data from a game’s executable file format. It converts local variables in the wad file into usable data types such as long integers and double precision floating point numbers. The code handles various data types, including integers, floats, doubles, and characters, and provides functions for formatting and converting these values into human-readable strings.

158 case WAD_TYPE_FLOAT:

159 wad_memcpy(&fval,l->ptr,sizeof(float));

160 sprintf(buffer,"%g",fval);

161 break;

162 case WAD_TYPE_DOUBLE:

163 wad_memcpy(&dval,l->ptr,sizeof(double));

164 sprintf(buffer,"%g",dval);

165 break;

166 case WAD_TYPE_UNKNOWN:

batchflow.cc (https://freespeech.svn.sourceforge.net/svnroot/freespeech) C++ · 33 lines ✨ Summary

This C++ code creates a new instance of UIDocument from a file specified by the first command-line argument, loads its contents, and runs a set of parameters on it. It then attempts to export the document’s information to a network, but this part is currently commented out. The program catches any exceptions that occur during execution and prints their error messages before exiting with a non-zero status code.

19 {

20 char arg_name[100];

21 sprintf (arg_name, "ARG%d", arg-1);

22 param.add(arg_name, ObjectRef (new String (argv[arg])));

23 }

FileSystemPOSIX.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 258 lines

246 continue;

247 char filePath[1024];

248 if (static_cast<int>(sizeof(filePath) - 1) < snprintf(filePath, sizeof(filePath), "%s/%s", cpath.data(), name))

249 continue; // buffer overflow

250 entries.append(filePath);

exportnet3.m (https://freespeech.svn.sourceforge.net/svnroot/freespeech) MATLAB · 20 lines ✨ Summary

This MATLAB code exports a neural network’s architecture to a file, specifically a FFNet (Fully-Connected Feedforward) topology. It writes the network’s layer dimensions and weights to the file in a human-readable format, allowing for easy import into other software or analysis. The output includes information about each layer, including input and output dimensions, weights, and biases.

7 file = fopen(filename,"w");

8

9 fprintf (file, "<FFNet\n");

10 fprintf (file, "<topo <Vector %d %d %d %d > >\n",T1,T2,T3, T4);

11 fprintf (file, "<layers <Vector \n");

12

13 exportlayer(file, W1,B1,layer1);

15 exportlayer(file, W3,B3,layer3);

16

17 fprintf (file, "> >\n");

18 fprintf (file, ">\n");

ExpandableDictionary.java (http://scandinavian-keyboard.googlecode.com/svn/trunk/) Java · 458 lines ✨ Summary

This Java code outputs a hexadecimal representation of Unicode character codes, mapping each code to its corresponding Unicode character. The data is generated from a file called UnicodeData.txt and is used to create a lookup table for easy access to Unicode characters by their code points.

453

454 // generated with:

455 // cat UnicodeData.txt | perl -e 'while (<>) { @foo = split(/;/); $foo[5] =~ s/<.*> //; $base[hex($foo[0])] = hex($foo[5]);} for ($i = 0; $i < 0x500; $i += 8) { for ($j = $i; $j < $i + 8; $j++) { printf("0x%04x, ", $base[$j] ? $base[$j] : $j)}; print "\n"; }'

456

457 }

mptag_test.cpp (git://github.com/hpcc-systems/HPCC-Platform.git) C++ · 139 lines ✨ Summary

This C++ code tests various scenarios for a memory pool tag (MPTAG) system, including allocating and deallocating tags, freeing marked tags, and querying formatters for non-existent tags. It exercises different aspects of the MPTAG system, such as memory management, exception handling, and formatter association. The test cases cover various edge cases to ensure the system’s correctness and robustness.

33 for( i=0;i<(size);i++) {

34 a[i]=allocMPtag("hello",123);

35 printf("alloc: %d \n" ,a[i]);

36 }

37 printf("alloc: %d \n" , allocMPtag("hello",123));

38 for( i=0;i<size;i++) { //free marked 10

39 printf("free: %d \n",a[i]);

40 freeMPtag(a[i]);

41 }

47 {

48 mptag_t a[10]; int i; //IMessageTraceFormatter f;

49 printf("**********************ENTER 100 \n");

50 for( i=1;i<101;i++) { //enter 100

51 printf("alloc: %d \n" ,allocMPtag("hello",123));

exportlayer.m (https://freespeech.svn.sourceforge.net/svnroot/freespeech) MATLAB · 14 lines ✨ Summary

This MATLAB code exports a layer of a neural network to a file, specifying its characteristics such as number of neurons and inputs, function type, and weights. The output is written in a format that resembles a neural network configuration file, with each line representing a specific piece of information about the layer. It appears to be part of a larger system for defining and exporting neural networks.

4 w=ww(:);

5 [N,I] = size(W);

6 fprintf (file, "<FFLayer\n");

7 fprintf (file, "<nbNeurons %d>\n",N);

8 fprintf (file, "<nbInputs %d>\n",I);

9 fprintf (file, "<funcType %s >\n",type);

10 fprintf (file, "<weights ");

11 fprintf (file, "%f ",w);

12 fprintf (file, ">\n");

13 fprintf (file, ">\n");

query.php (http://forceworkbench.googlecode.com/svn/trunk/workbench/) PHP · 996 lines ✨ Summary

This PHP code is part of a Salesforce Workbench application, handling query-related functionality. It generates query results, exports data to CSV, and allows users to execute queries asynchronously. The code also handles errors, warnings, and export options, providing a user-friendly interface for interacting with Salesforce data.

901 if ($_SESSION['totalQuerySize'] !== 1) print 's';

902 print " in ";

903 printf ("%01.3f", $queryTimeElapsed);

904 print " seconds:</p>\n";

905

dosinst.c (https://bitbucket.org/ultra_iter/vim-qt.git) C · 2596 lines

21

22 /* Macro to do an error check I was typing over and over */

23 #define CHECK_REG_ERROR(code) if (code != ERROR_SUCCESS) { printf("%ld error number: %ld\n", (long)__LINE__, (long)code); return 1; }

24

25 int has_vim = 0; /* installable vim.exe exists */

152 {

153 if (idx)

154 printf("%2d ", idx);

155 printf(table[idx]);

156 printf("\n");

157 }

158 printf("Choice: ");

186 && installdir[runtimeidx - 1] != '\\'))

187 {

188 printf("ERROR: Install program not in directory \"%s\"\n",

189 VIM_VERSION_NODOT);

190 printf("This program can only work when it is located in its original directory\n");

awk.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 116 lines

60 <KEYWORD1>nextfile</KEYWORD1>

61 <KEYWORD1>print</KEYWORD1>

62 <KEYWORD1>printf</KEYWORD1>

63 <KEYWORD1>return</KEYWORD1>

64 <KEYWORD1>while</KEYWORD1>

78 <KEYWORD2>sin</KEYWORD2>

79 <KEYWORD2>split</KEYWORD2>

80 <KEYWORD2>sprintf</KEYWORD2>

81 <KEYWORD2>sqrt</KEYWORD2>

82 <KEYWORD2>srand</KEYWORD2>

perl.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 595 lines

190 <KEYWORD3>reverse</KEYWORD3>

191 <KEYWORD3>rindex</KEYWORD3>

192 <KEYWORD3>sprintf</KEYWORD3>

193 <KEYWORD3>substr</KEYWORD3>

194 <KEYWORD3>uc</KEYWORD3>

250 <KEYWORD3>getc</KEYWORD3>

251 <KEYWORD3>print</KEYWORD3>

252 <KEYWORD3>printf</KEYWORD3>

253 <KEYWORD3>read</KEYWORD3>

254 <KEYWORD3>readdir</KEYWORD3>

g_NCR5380.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 957 lines ✨ Summary

This C code defines a Linux kernel module for a SCSI driver, specifically for NCR (NCR Corporation) storage devices. It provides functions for detecting and initializing the device, handling commands, and managing resources. The code is part of the Linux kernel’s SCSI subsystem and is designed to work with various NCR storage controllers, including the 5380 and 53C400 models.

746 #include "NCR5380.c"

747

748 #define PRINTP(x) len += sprintf(buffer+len, x)

749 #define ANDP ,

750

767

768 /**

769 * sprintf_Scsi_Cmnd - print a scsi command

770 * @buffer: buffr to print into

771 * @len: buffer length

lbfgsUpdate.m (git://github.com/Sohl-Dickstein/Minimum-Probability-Flow-Learning.git) Objective C · 21 lines ✨ Summary

This MATLAB function updates the limited-memory Broyden-Fletcher-Goldfarb-Shanno (LBFGS) algorithm’s memory with new corrections. It checks if a correction is significant enough to update the memory, and if so, it either performs a full update or adds the new correction to the existing memory. The function also updates the scale of the initial Hessian approximation based on the significance of the correction.

17 else

18 if debug

19 fprintf('Skipping Update\n');

20 end

21 end

apdbg.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 458 lines ✨ Summary

This C code is a part of a Linux kernel module that interacts with a wireless network interface card (NIC). It sends commands to the NIC using ioctl system calls, which allows for low-level control over the device. The code parses command-line arguments and converts them into binary data, then sends it to the NIC using ioctl.

99 {

100 if (ioctl(sock, ZDAPIOCTL, req) < 0) {

101 fprintf(stderr, "%s: ioctl(SIOCGIFMAP): %s\n",

102 prgname, strerror(errno));

103 return -1;

116

117 //zdreq = (struct zdap_ioctl *)req->ifr_data;

118 //printf( "reg = %4x, value = %4x\n", zdreq->addr, zdreq->value);

119

120 return 0;

131

132 /*zdreq = (struct zdap_ioctl *)req->ifr_data;

133 printf( "dump mem from %x, length = %x\n", zdreq->addr, zdreq->value);

134

135 for (i=0; i<zdreq->value; i++) {

doh.h (https://swig.svn.sourceforge.net/svnroot/swig) C++ Header · 447 lines ✨ Summary

This is a C++ header file that provides a set of data structures and functions for working with objects, strings, files, and other data types. It defines classes and functions for managing memory, performing operations on data, and handling errors. The code appears to be part of a larger library or framework, providing a way to interact with various types of data in a consistent and efficient manner.

84 #define DohDelmeta DOH_NAMESPACE(Delmeta)

85 #define DohEncoding DOH_NAMESPACE(Encoding)

86 #define DohPrintf DOH_NAMESPACE(Printf)

87 #define DohvPrintf DOH_NAMESPACE(vPrintf)

256

257 extern void DohEncoding(char *name, DOH *(*fn) (DOH *s));

258 extern int DohPrintf(DOHFile * obj, const char *format, ...);

259 extern int DohvPrintf(DOHFile * obj, const char *format, va_list ap);

369 #define Seek DohSeek

370 #define Tell DohTell

371 #define Printf DohPrintf

372 #define Printv DohPrintv

373 #define Getc DohGetc

384

385 #define Close DohClose

386 #define vPrintf DohvPrintf

387 #define GetInt DohGetInt

388 #define GetDouble DohGetDouble

db_queues.rb (git://github.com/37signals/37s_cookbooks.git) Ruby · 103 lines ✨ Summary

This Ruby script checks the size of a database queue by executing a MySQL query and comparing its result to user-defined thresholds for warning and critical values. It outputs Nagios-compatible performance data, indicating whether the query result is within acceptable limits or not, and exits with an appropriate status code (OK, WARNING, CRITICAL, or UNKNOWN).

85

86 if value >= c[:crit]

87 puts sprintf(message, value, c[:crit], value)

88 exit(EXIT_CRITICAL)

89 end

90

91 if value >= c[:warn]

92 puts sprintf(message, value, c[:warn], value)

93 exit(EXIT_WARNING)

94 end

100 # if warning nor critical trigger, say OK and return performance data

101

102 puts sprintf("Query '#{c[:query]}' result %d OK|#{perfdata}", value, value)

103

sample_advanced.cpp (http://hadesmem.googlecode.com/svn/trunk/) C++ · 0 lines ✨ Summary

The code demonstrates advanced usage of the Boost Format library, showcasing its capabilities for formatting strings with various options and manipulators. It shows how to store parsed format-strings in objects, bind arguments, modify formatting options, handle exceptions, and use manipulators to control output. The example outputs a series of formatted strings with different settings and manipulations.

126 // misc:

127

128 // unsupported printf directives %n and asterisk-fields are purely ignored.

129 // do *NOT* provide an argument for them, it is an error.

130 cout << format("|%5d| %n") % 7 << endl;

memory.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 220 lines ✨ Summary

This C code implements a memory management system for objects, including allocation and deallocation of memory blocks. It creates a pool of memory and manages a list of free objects to reduce fragmentation. The DohObjMalloc function allocates memory for new objects, while DohObjFree frees the allocated memory. The DohMemoryDebug function displays statistics on memory usage and object types.

172 int numhash = 0;

173

174 printf("Memory statistics:\n\n");

175 printf("Pools:\n");

189 }

190 }

191 printf(" Pool %8p: size = %10d. used = %10d. free = %10d\n", (void *)p, p->len, nused, nfree);

192 totsize += p->len;

193 totused+= nused;

195 p = p->next;

196 }

197 printf("\n Total: size = %10d, used = %10d, free = %10d\n", totsize, totused, totfree);

198

199 printf("\nObject types\n");

200 printf(" Strings : %d\n", numstring);

201 printf(" Lists : %d\n", numlist);

objvariant.ml (git://github.com/multani/ocaml-mirror.git) OCaml · 43 lines ✨ Summary

The code defines a set of data types and functions for working with expressions, including variables, integers, and addition operations. It creates an expression e1 that represents the sum of two values: the variable “x” and the integer 2. The output is likely to be a string representation of this expression in a specific format.

31 method e1 = e1

32 method e2 = e2

33 method print ppf = Format.fprintf ppf "(%t, %t)" e1#print e2#print

34 end

35

38 type expr1 = expr1 expr

39

40 let print = Format.printf "%t@."

41

42 let e1 : expr1 = `Add (new cadd (`Var (new cvar "x")) (`Int (new cint 2)))

ltmain.sh (https://freespeech.svn.sourceforge.net/svnroot/freespeech) Shell · 3976 lines ✨ Summary

This shell script is used to build and configure a library for use with the GNU Compiler Collection (GCC). It checks if the library is being built as a shared object, static library, or executable, and performs different actions accordingly. It also handles various flags and options passed to the compiler, such as version information, release information, and runtime path settings.

689 # */

690 #

691 # #include <stdio.h> /* for printf() */

692 # #include <unistd.h> /* for open(), lseek(), read() */

693 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */

788 # name_rvas = pe_as32 (expdata+32);

789 #

790 # printf ("EXPORTS\n");

791 # for (i = 0; i<nexp; i++)

792 # {

793 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);

794 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);

795 # }

796 #

example.i (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 70 lines

49 int i;

50 if (the_func.L==0){

51 printf("the_func is zero\n");

52 return;

53 }

55 if (!lua_isfunction(the_func.L,-1))

56 {

57 printf("the_func is not a function\n");

58 return;

59 }

readpng.h (http://angel-engine.googlecode.com/svn/trunk/) C++ Header · 89 lines ✨ Summary

This is a C header file that defines a simple PNG display program. It includes copyright information, licensing terms, and macro definitions for debugging and mathematical operations. The file also declares function prototypes for reading and manipulating PNG images, including initialization, background color retrieval, image data extraction, and cleanup.

65

66 #ifdef DEBUG

67 # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}

68 #else

69 # define Trace(x) ;

qplatformdefs.h (https://bitbucket.org/ultra_iter/qt-vtl.git) C Header · 97 lines

88

89 // Only Solaris 7 and better support 64-bit

90 #define QT_SNPRINTF ::snprintf

91 #define QT_VSNPRINTF ::vsnprintf

example.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 38 lines ✨ Summary

The code defines two functions, enum_test with different parameter orders. The first function takes a speed enum and prints its value. The second function takes a color enum and a speed enum, printing both values. When run, the output will be a series of color-speed pairs, such as “color = RED, speed = IMPULSE speed” or “color = Unknown color!, speed = Unknown speed!”.

6 void Foo::enum_test(speed s) {

7 if (s == IMPULSE) {

8 printf("IMPULSE speed\n");

9 } else if (s == WARP) {

10 printf("WARP speed\n");

11 } else if (s == LUDICROUS) {

12 printf("LUDICROUS speed\n");

13 } else {

14 printf("Unknown speed\n");

18 void enum_test(color c, Foo::speed s) {

19 if (c == RED) {

20 printf("color = RED, ");

21 } else if (c == BLUE) {

22 printf("color = BLUE, ");

example.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 51 lines ✨ Summary

The code generates a depth map of a volume, represented as a series of lines with varying densities. The density is determined by the volume’s depth at each point, with darker characters indicating greater depth. The output is a graphical representation of the volume’s depth distribution, with ‘x’ characters used to represent covered areas and ‘#’ characters used to represent uncovered areas.

14 if( s->cover( j,i ) ) putchar( 'x' ); else putchar( ' ' );

15 }

16 printf( "\n" );

17 }

18 }

typepass.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 1224 lines ✨ Summary

This C++ code is part of a SWIG (Simplified Interface to C and other languages) compiler, which generates interface code for C++ programs to interact with C libraries. It processes types in a C++ program, normalizing them according to the SWIG typemap rules, and installing using directives to import C types into the C++ scope.

54

55 qty = SwigType_typedef_qualified(ty);

56 /* Printf(stdout,"%s --> %s\n", ty, qty); */

57 Clear(ty);

58 Append(ty, qty);

83 String *vb = Swig_scopename_last(value);

84 Clear(value);

85 Printf(value, "%s::%s", SwigType_namestr(q), vb);

86 Delete(q);

87 }

885 Node *c = Getattr(n, "sym:overloaded");

886 Node *checkoverloaded = c;

887 Printf(stdout, "-------------------- overloaded start %s sym:overloaded():%p -------------------------------\n", Getattr(n, "name"), c);

888 while (c) {

889 if (Getattr(c, "error")) {

kvm-s390.h (http://omnia2droid.googlecode.com/svn/trunk/) C++ Header · 97 lines ✨ Summary

This C header file defines the interface for KVM (Kernel-based Virtual Machine) on s390 architecture. It provides functions and macros for handling interrupts, memory management, and debugging, as well as interfaces for injecting virtual machine events and handling specific interrupt types. The code is part of the Linux kernel’s KVM implementation.

31 #define VM_EVENT(d_kvm, d_loglevel, d_string, d_args...)\

32 do { \

33 debug_sprintf_event(d_kvm->arch.dbf, d_loglevel, d_string "\n", \

34 d_args); \

35 } while (0)

37 #define VCPU_EVENT(d_vcpu, d_loglevel, d_string, d_args...)\

38 do { \

39 debug_sprintf_event(d_vcpu->kvm->arch.dbf, d_loglevel, \

40 "%02d[%016lx-%016lx]: " d_string "\n", d_vcpu->vcpu_id, \

41 d_vcpu->arch.sie_block->gpsw.mask, d_vcpu->arch.sie_block->gpsw.addr,\

lpfc_sli.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 11728 lines ✨ Summary

This C code is part of a Linux driver for a network interface card (NIC). It reads configuration data from the NIC and checks if certain ports are enabled or disabled. Specifically, it verifies the presence of a “PORT_STE” sub-TLV in the configuration region 23, which indicates whether the port is enabled or not. If the port is disabled, it sets a flag to indicate this.

833 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);

834 if (rc != MBX_SUCCESS) {

835 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,

836 "0446 Adapter failed to init (%d), "

837 "mbxCmd x%x CFG_RING, mbxStatus x%x, "

929

930 if (unlikely(pring->local_getidx >= max_cmd_idx)) {

931 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,

932 "0315 Ring %d issue: portCmdGet %d "

933 "is bigger than cmd ring %d\n",

touchright.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 195 lines ✨ Summary

This C code implements a Linux kernel module for a serial touchscreen driver, specifically designed for the Touchright protocol. It registers a serio driver with the kernel, allowing it to interact with devices that support this protocol. The module provides interrupt handling and device registration functionality for touchscreens connected via serial interfaces.

117 tr->serio = serio;

118 tr->dev = input_dev;

119 snprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys);

120

121 input_dev->name = "Touchright Serial TouchScreen";

names.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 109 lines ✨ Summary

This C code is responsible for populating device names for Zorro devices based on manufacturer and product information stored in a configuration file. It iterates through a list of manufacturers, checking if the device’s ID matches any products associated with that manufacturer. If a match is found, it updates the device name accordingly.

70

71 /* Couldn't find either the manufacturer nor the product */

72 sprintf(name, "Zorro device %08x", dev->id);

73 return;

74

86

87 /* Ok, found the manufacturer, but unknown product */

88 sprintf(name, "Zorro device %08x (%s)", dev->id, manuf_p->name);

89 return;

90

91 /* Full match */

92 match_prod: {

93 char *n = name + sprintf(name, "%s %s", manuf_p->name, prod_p->name);

94 int nr = prod_p->seen + 1;

95 prod_p->seen = nr;

tst.functionentry.d (https://bitbucket.org/freebsd/freebsd-head/) D · 49 lines ✨ Summary

This D code is a test for the FBT (Filesystem Buffering Test) provider function entry and exit points. It prints messages when entering and exiting the ioctl function, simulating a file system operation. The output can be used to verify that the ioctl function is being called correctly by the FBT testing framework.

39 fbt::ioctl:entry

40 {

41 printf("Entering the ioctl function\n");

42 }

43

44 fbt::ioctl:return

45 {

46 printf("Returning from ioctl function\n");

47 exit(0);

48 }

traps.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 768 lines ✨ Summary

This C code defines a set of exception handlers for a Linux kernel, which are triggered when specific conditions occur during execution. The handlers catch and handle exceptions such as stack overflows, division by zero, and data corruption, among others. They print error messages, trigger system calls, and perform other necessary actions to prevent the program from crashing or causing further damage.

250

251 regs = task_pt_regs(task);

252 seq_printf(m, "task: %p, ksp: %p\n",

253 task, (void *)task->thread.ksp);

254 seq_printf(m, "User PSW : %p %p\n",

255 (void *) regs->psw.mask, (void *)regs->psw.addr);

256

257 seq_printf(m, "User GPRS: " FOURLONG,

258 regs->gprs[0], regs->gprs[1],

259 regs->gprs[2], regs->gprs[3]);

260 seq_printf(m, " " FOURLONG,

261 regs->gprs[4], regs->gprs[5],

262 regs->gprs[6], regs->gprs[7]);

tape.h (http://omnia2droid.googlecode.com/svn/trunk/) C++ Header · 404 lines ✨ Summary

This is a C header file that defines an interface for interacting with tape devices, such as magnetic tapes used in data storage and backup systems. It provides functions for initializing and cleaning up tape devices, opening and releasing them, sending commands to the device, and handling device sense information. The code also includes global variables for debugging and verbose output.

33 #define DBF_LH(level, str, ...) \

34 do { \

35 debug_sprintf_event(TAPE_DBF_AREA, level, str, ## __VA_ARGS__); \

36 } while (0)

37 #else

44 #define DBF_EVENT(d_level, d_str...) \

45 do { \

46 debug_sprintf_event(TAPE_DBF_AREA, d_level, d_str); \

47 } while (0)

48

49 #define DBF_EXCEPTION(d_level, d_str...) \

50 do { \

51 debug_sprintf_exception(TAPE_DBF_AREA, d_level, d_str); \

52 } while (0)

53

D3D_MAIN.CPP (https://jetpp.svn.sourceforge.net/svnroot/jetpp) Unknown · 3001 lines

312 FILE *f;

313

314 wvsprintf(Buffer, Str, (char*)(&Str+1));

315

316 f = fopen(D3DMAIN_LOG_FILENAME, "a+t");

319 return;

320

321 fprintf(f, "%s", Buffer);

322

323 fclose(f);

NorthwindTests.fs (git://github.com/mausch/FsSql.git) F# · 88 lines ✨ Summary

This code creates a SQLite database and defines four types: Employee, Order, Product, and OrderDetail. It then uses reflection to create tables for each type, with columns corresponding to the properties of each type. The createSchema function takes an array of types as input and creates a schema for each one using the createTable function.

32 let keywords = HashSet<_>(["order"], StringComparer.InvariantCultureIgnoreCase)

33 if keywords.Contains s

34 then sprintf "\"%s\"" s // sqlite-specific quote

35 else s

36 let createTable (escape: string -> string) (sqlType: Type -> string) (t: Type) =

37 let fields = FSharpType.GetRecordFields t |> Seq.filter (fun p -> p.Name <> "id")

38 let table = escape t.Name

39 let drop = sprintf "drop table if exists %s" table

40 let fields =

41 let fieldType (t: Type) =

48 sqlType t

49 let nullable = if nullable then "" else "not"

50 sprintf "%s %s null" sqlType nullable

51 fields |> Seq.map (fun f -> sprintf "%s %s" (escape f.Name) (fieldType f.PropertyType))

52 let fields = String.Join(",", Seq.toArray fields)

53 let create = sprintf "create table %s (id int primary key, %s)" table fields

54 printfn "%s" create

rubyrun.swg (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 445 lines

157 VALUE klass;

158 char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);

159 sprintf(klass_name, "TYPE%s", type->name);

160 if (NIL_P(_cSWIG_Pointer)) {

161 _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);

213 } else {

214 klass_name = (char *) malloc(4 + strlen(type->name) + 1);

215 sprintf(klass_name, "TYPE%s", type->name);

216 klass = rb_const_get(_mSWIG, rb_intern(klass_name));

217 free((void *) klass_name);

if_nfe.c (https://bitbucket.org/freebsd/freebsd-head/) C · 3374 lines ✨ Summary

This is a function that sets the Wake-on-LAN (WOL) settings for a network interface. It takes no arguments and returns nothing. The function first checks if the device has the Power Management Interface (PCI PM) capability, which is required for WOL. If it does, it then checks if the IFCAP_WOL flag is set in the interface’s capabilities, indicating that WOL is enabled. If so, it sets the NFE_WOL_CTL register to enable WOL and configures the MAC to have a 100Mbps, full-duplex link. It then enables RX and requests PME (Power Management Event) from the device’s power management controller if WOL is enabled. If the IFCAP_WOL flag is not set, it clears the NFE_WOL_CTL register to disable WOL.

132 #ifdef NFE_DEBUG

133 static int nfedebug = 0;

134 #define DPRINTF(sc, ...) do { \

135 if (nfedebug) \

136 device_printf((sc)->nfe_dev, __VA_ARGS__); \

137 } while (0)

138 #define DPRINTFN(sc, n, ...) do { \

139 if (nfedebug >= (n)) \

140 device_printf((sc)->nfe_dev, __VA_ARGS__); \

141 } while (0)

142 #else

143 #define DPRINTF(sc, ...)

144 #define DPRINTFN(sc, n, ...)

297 &rid, RF_ACTIVE);

298 if (sc->nfe_msix_res == NULL) {

299 device_printf(sc->nfe_dev,

300 "couldn't allocate MSIX table resource\n");

301 return;

testclosure.c (git://github.com/stevedekorte/io.git) C · 71 lines ✨ Summary

This C code tests a closure function that takes a struct as an argument and prints its fields to the console. It creates a struct, prepares a CIF (C Interface File) for the closure, allocates memory for the closure, and then calls the closure with the struct as an argument, verifying that the output matches the expected values.

17 void cls_struct_combined_fn(struct cls_struct_combined arg)

18 {

19 printf("%g %g %g %g\n",

20 arg.a, arg.b,

21 arg.c, arg.d);

cpu.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 407 lines ✨ Summary

This C code outputs information about the CPU’s architecture, frequency, and performance characteristics to a system log. It displays details such as chip type, CPU core revision, clock speed, cache sizes, and feature set. The output is formatted in a human-readable format, providing a snapshot of the CPU’s capabilities at boot time.

33

34 pccr = sysreg_read(PCCR);

35 return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f);

36 }

37 static ssize_t store_pc0event(struct sys_device *dev,

55

56 pcnt0 = sysreg_read(PCNT0);

57 return sprintf(buf, "%lu\n", pcnt0);

58 }

59 static ssize_t store_pc0count(struct sys_device *dev,

78

79 pccr = sysreg_read(PCCR);

80 return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f);

81 }

82 static ssize_t store_pc1event(struct sys_device *dev,

return_fl1.c (git://github.com/stevedekorte/io.git) C · 37 lines ✨ Summary

This C code tests the functionality of a foreign function interface (FFI) for calling a C function from another language. It initializes an FFI context, defines a C function return_fl that takes two float arguments and returns their sum, and then calls this function using the FFI. The result is compared to the expected value, ensuring the FFI call was successful.

31

32 ffi_call(&cif, FFI_FN(return_fl), &rfl, values);

33 printf ("%f vs %f\n", rfl, return_fl(fl1, fl2));

34 CHECK(rfl == fl1 + fl2);

35 exit(0);

example.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 87 lines ✨ Summary

The provided C code defines a set of global variables and functions to manipulate them, including integers, shorts, longs, floats, doubles, and pointers to these types. It also includes a Point structure with x and y coordinates, which can be printed using the pt_print function. The code demonstrates how to create instances of these data types and print their values.

35

36 void print_vars() {

37 printf("ivar = %d\n", ivar);

38 printf("svar = %d\n", svar);

39 printf("lvar = %ld\n", lvar);

40 printf("uivar = %u\n", uivar);

41 printf("usvar = %u\n", usvar);

42 printf("ulvar = %lu\n", ulvar);

43 printf("scvar = %d\n", scvar);

44 printf("ucvar = %u\n", ucvar);

45 printf("fvar = %g\n", fvar);

46 printf("dvar = %g\n", dvar);

debug.scrbl (git://github.com/gmarceau/PLT.git) Racket · 99 lines ✨ Summary

This Racket code defines a module for debugging, providing macros and functions to print out information about the evaluation of expressions. It includes debug, dprintf, and various forms that add logging to different types of expressions in Racket, such as begin, define, and let. These macros write messages to the current error port with indentation reflecting nested debugging forms.

35 }

36

37 @defproc[(dprintf [fmt string?] [arg any/c] ...) void?]{

38

39 Constructs a message in the same manner as @racket[format] and writes it to

42

43 @examples[#:eval the-eval

44 (dprintf "level: ~a" 0)

45 (debug (dprintf "level: ~a" 1))

46 (debug (debug (dprintf "level: ~a" 2)))

47 ]

48

MKBVH.H (https://jetpp.svn.sourceforge.net/svnroot/jetpp) C++ Header · 46 lines ✨ Summary

This is a C++ header file that defines an interface for working with Binary Voronoi Hierarchies (BVHs). It provides functions for creating and destroying BVH options, parsing option strings, outputting usage information, and making the BVH. The code is part of the Jet3D library and is licensed under the Jet3D Public License.

33 void MkBVH_OptionsDestroy (MkBVH_Options** ppOptions);

34 ReturnCode MkBVH_ParseOptionString(MkBVH_Options* options, const char* string,

35 MK_Boolean InScript,MkUtil_Printf PrintfCallback);

36 void MkBVH_OutputUsage (MkUtil_Printf PrintfCallback);

37 ReturnCode MkBVH_DoMake (MkBVH_Options* options,MkUtil_Printf PrintfCallback);

38

39

output_example.c (http://amv-codec-tools.googlecode.com/svn/trunk/) C · 549 lines ✨ Summary

This C code is an example of a media file output program using libavformat, libavcodec, and libavutil libraries. It takes a filename as input, detects the output format from the extension, and outputs a media file with interleaved audio and video streams. The program can write raw images or use default codecs for audio and video streams.

64 st = av_new_stream(oc, 1);

65 if (!st) {

66 fprintf(stderr, "Could not alloc stream\n");

67 exit(1);

68 }

89 codec = avcodec_find_encoder(c->codec_id);

90 if (!codec) {

91 fprintf(stderr, "codec not found\n");

92 exit(1);

93 }

95 /* open it */

96 if (avcodec_open(c, codec) < 0) {

97 fprintf(stderr, "could not open codec\n");

98 exit(1);

99 }

allegrocl.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 3117 lines ✨ Summary

This C++ code appears to be part of a tool for converting SWIG-generated C++ code into Common Lisp. It generates a string representation of the C++ code, including type conversions and function definitions, in a format that can be used by a Lisp interpreter. The output is likely used to create a Lisp wrapper around a C++ library or application.

108

109 if (SwigType_ispointer(stripped) || SwigType_isreference(stripped)) {

110 // Printf(stderr,"It is a pointer/reference. Is it a class?\n");

111 SwigType_pop(stripped);

112 if (SwigType_isclass(stripped)) {

120

121 #ifdef ALLEGROCL_TYPE_DEBUG

122 Printf(stderr, "Looking up defined type '%s'.\n Found: '%s'\n", k, Getattr(defined_foreign_types, k));

123 #endif

124

168 void add_linked_type(Node *n) {

169 #ifdef ALLEGROCL_CLASS_DEBUG

170 Printf(stderr, "Adding linked node of type: %s(%s) %s(%x)\n\n", nodeType(n), Getattr(n, "storage"), Getattr(n, "name"), n);

171 #endif

172 if (!first_linked_type) {

pre-post.py (https://bitbucket.org/scons/scons/) Python · 214 lines ✨ Summary

This Python script tests the AddPreAction and AddPostAction functions in SCons, a build tool. It creates several test cases to verify that pre- and post-build actions are executed correctly for different scenarios, including programs, builders, and custom commands. The script runs each test case and checks the output to ensure it matches the expected results.

82 int main(void)

83 {

84 printf("foo.c\n");

85 return 0;

86 }

92 int main(void)

93 {

94 printf("bar.c\n");

95 return 0;

96 }

lang.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 476 lines ✨ Summary

This C++ code is a part of a compiler or interpreter for a programming language, specifically designed to generate C++ code from a high-level language syntax tree. It defines functions that handle various aspects of C++ code generation, such as class declarations, function definitions, variable assignments, and pragmas. The code uses a syntax tree data structure to navigate the abstract syntax tree (AST) and generate corresponding C++ code.

22

23 void Language::create_command(String *, String *) {

24 Printf(stderr,"SWIG Warning. No command creation procedure defined.\n");

25 Printf(stderr,"C++ inheritance may not work correctly.\n");

32 void

33 Language::nativefunction(DOH *node) {

34 Printf(stderr,"%s:%d. Adding native function %s not supported (ignored).\n", Getfile(node), Getline(node), Getattr(node,"scriptname"));

35 }

36

137 if (AddMethods && ccode) {

138 /* Dump the C wrappers */

139 Printf(f_wrappers,"%s",w);

140 } else if (!AddMethods) {

141 /* Just create a string that does what we want */

165

166 if ((Cmp(name,ClassName))) {

167 Printf(stderr,"%s:%d. Function %s must have a return type.\n",

168 Getfile(node), Getline(node), name);

169 return;

elf.cpp (git://github.com/zpao/v8monkey.git) C++ · 164 lines ✨ Summary

This C++ code reads the symbol table from an ELF (Executable and Linkable Format) file, which is a binary format used by many operating systems to store executable files. It extracts symbols (functions, variables, etc.) from the file and stores them in a data structure called Symbol. The extracted symbols are then stored in memory for later use.

50 int fd = ::open(fileName, O_RDONLY);

51 if (fd < 0) {

52 fprintf(stderr, "%s: unable to open \"%s\"\n", applicationName,

53 fileName);

54 exit(-1);

58 Elf *elf = elf_begin(fd, ELF_C_READ, 0);

59 if (!elf) {

60 fprintf(stderr, "%s: \"%s\": has no symbol table\n", applicationName,

61 fileName);

62 exit(-1);

72 Elf32_Ehdr *ehdr = elf32_getehdr(elf);

73 if (!ehdr) {

74 fprintf(stderr, "%s: elf library lossage\n", applicationName);

75 exit(-1);

76 }

python.swg (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 382 lines

71 swig_globalvar *var;

72 flags = flags;

73 fprintf(fp,"Global variables { ");

74 for (var = v->vars; var; var=var->next) {

75 fprintf(fp,"%s", var->name);

76 if (var->next) fprintf(fp,", ");

77 }

78 fprintf(fp," }\n");

113 0, /* Itemsize */

114 0, /* Deallocator */

115 (printfunc) swig_varlink_print, /* Print */

116 (getattrfunc) swig_varlink_getattr, /* get attr */

117 (setattrfunc) swig_varlink_setattr, /* Set attr */

262 if (ty) {

263 char *temp = (char *) malloc(64+strlen(ty->name));

264 sprintf(temp,"Type error. Expected %s", ty->name);

265 PyErr_SetString(PyExc_TypeError, temp);

266 free((char *) temp);

base.h (https://swig.svn.sourceforge.net/svnroot/swig) C++ Header · 19 lines

6 virtual ~Base() { };

7 virtual void A() {

8 printf("I'm Base::A\n");

9 }

10 void B() {

11 printf("I'm Base::B\n");

12 }

13 virtual Base *toBase() {

string.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 912 lines ✨ Summary

This C code defines a string data type and its associated functions for manipulating strings, such as creating new strings, comparing strings, searching for substrings, and reading/writing files. It also provides object-oriented features like inheritance and polymorphism through the use of DohObjInfo and DohStringType structures. The code is part of a larger programming framework or library.

881 va_start(ap,fmt);

882 r = NewString("");

883 DohvPrintf(r,Char(fmt),ap);

884 va_end(ap);

885 return (DOHString *) r;

debug.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 99 lines ✨ Summary

The provided C code is a collection of test cases for various functions, including crash tests and assertions. It checks if different command-line arguments trigger specific crashes or errors, such as aborting, causing stack overflows, or performing invalid mathematical operations. The output will likely display error messages or crashes depending on the input arguments.

29 if (n > 0) bus_crash(n-1);

30 *a = 3;

31 printf("well, well, well.\n");

32 return 1;

33 }

54 ret = (*f)(n);

55 if (ret <= 0) {

56 printf("An error occurred!\n");

57 }

58 return 0;

76 Foo foo = { 3.14, 28.18, 1.0 };

77

78 printf("starting.\n");

79

80 if (strcmp(argv[1],"abort") == 0) {

mzrt.c (git://github.com/gmarceau/PLT.git) C · 783 lines ✨ Summary

This C code provides a set of synchronization primitives for concurrent programming, including mutexes, condition variables, and semaphores. It implements various locking and unlocking functions, as well as wait and post operations for these synchronization objects. The code is designed to be compatible with both Unix-like systems (using POSIX APIs) and Windows systems (using Win32 APIs).

66 char inbuffer[10];

67

68 fprintf(stderr, "pid # %i resume(r)/gdb(d)/exit(e)?\n", pid);

69 fflush(stderr);

70

72 while(read(fileno(stdin), inbuffer, 10) <= 0){

73 if(errno != EINTR){

74 fprintf(stderr, "Error detected %i\n", errno);

75 }

76 }

80 break;

81 case 'd':

82 snprintf(outbuffer, 100, "xterm -e gdb ./racket3m %d &", pid);

83 fprintf(stderr, "%s\n", outbuffer);

84 if(system(outbuffer))

85 fprintf(stderr, "system failed\n");

86 break;

87 case 'e':

SimulationBase.cs (git://github.com/aurora-sim/Aurora-Sim.git) C# · 604 lines ✨ Summary

This is a C# class that represents the main application of an HTTP server. It handles startup, shutdown, and configuration processes, including loading configurations, starting and stopping servers, and performing garbage collection. The class also includes methods for handling console commands and logging information to the console. It appears to be part of a larger web development framework or application.

331 {

332 //Draw the file on the console

333 PrintFileToConsole("startuplogo.txt");

334 //Run Startup Commands

335 if (!String.IsNullOrEmpty(m_startupCommandsFile))

348 /// </summary>

349 /// <param name="fileName">name of file to use as input to the console</param>

350 private void PrintFileToConsole(string fileName)

351 {

352 if (File.Exists(fileName))

racket-completion.bash (git://github.com/gmarceau/PLT.git) Bash · 213 lines ✨ Summary

This Bash code provides completion functionality for Racket and related commands, such as raco and gracket. It uses a combination of built-in functions like _filedir, _get_cword, and compgen to complete file names, options, and arguments based on the current command and word. The code is designed to work with Racket’s command-line interface and provides a way to quickly navigate and execute commands in the terminal.

121 if [ ${#_raco_cmds[@]} -eq 0 ]; then

122 # removing the empty string on the next line breaks things. such as my brain.

123 _raco_cmds=$( echo '' 'help' ; for x in `${_racket_cmd} -e '(begin (require raco/all-tools) (for ([(k v) (all-tools)]) (printf "~a\n" k)))'` ; do echo ${x} ; done )

124 fi

125 COMPREPLY=( $(compgen -W "${_raco_cmds}" -- ${cur}) )

173 if [ $COMP_CWORD -eq 1 ]; then

174 # removing the empty string on the next line breaks things. such as my brain.

175 _raco_cmds=$( echo '' 'help' ; for x in `${_racket_cmd} -e '(begin (require raco/all-tools) (for ([(k v) (all-tools)]) (printf "~a\n" k)))'` ; do echo ${x} ; done )

176 COMPREPLY=($(compgen -W "${_raco_cmds}" -- ${cur}))

177 elif [ $COMP_CWORD -ge 2 ]; then

s3c2410_udc.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 2055 lines ✨ Summary

This C code implements a USB gadget driver for Samsung’s Exynos SoCs, specifically the S3C2410 and S3C2440 processors. It provides a platform driver that manages the USB connection and allows devices to communicate with the host system. The code includes functions for probing, removing, suspending, and resuming the device, as well as registering and unregistering the driver.

117 }

118

119 len = scnprintf(printk_buf,

120 sizeof(printk_buf), "%1lu.%02d USB: ",

121 prevticks, invocation++);

122

123 va_start(args, fmt);

124 len = vscnprintf(printk_buf+len,

125 sizeof(printk_buf)-len, fmt, args);

126 va_end(args);

160 ep2_o_csr2 = udc_read(S3C2410_UDC_IN_CSR2_REG);

161

162 seq_printf(m, "FUNC_ADDR_REG : 0x%04X\n"

163 "PWR_REG : 0x%04X\n"

164 "EP_INT_REG : 0x%04X\n"

Profiler.php (git://github.com/symfony/symfony.git) PHP · 253 lines ✨ Summary

This is a Symfony package implementation of a profiler, which tracks and stores information about HTTP requests and responses. It allows for enabling/disabling the profiler, collecting data from responses, saving profiles to storage, and finding profiler tokens based on criteria such as IP addresses and URLs. The profiler also supports multiple collectors for different types of data collection.

231 {

232 if (!isset($this->collectors[$name])) {

233 throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));

234 }

235

CommandLine.java (http://mybatis.googlecode.com/svn/trunk/) Java · 0 lines ✨ Summary

This Java code is a command-line tool for managing MyBatis migrations, which are scripts that modify a database schema. It allows users to create, apply, and undo migrations, as well as view migration history and generate delta scripts. The tool accepts various commands and options, including shortcuts for common actions, and provides detailed usage instructions and error handling.

93 private void runCommand() {

94 printStream.println("------------------------------------------------------------------------");

95 printStream.printf("MyBatis Migrations - %s%n", command);

96 printStream.println("------------------------------------------------------------------------");

97

140 } finally {

141 printStream.println("------------------------------------------------------------------------");

142 printStream.printf("MyBatis Migrations %s%n", (exit < 0) ? "FAILURE" : "SUCCESS");

143 printStream.printf("Total time: %ss%n", ((System.currentTimeMillis() - start) / 1000));

144 printStream.printf("Finished at: %s%n", new Date());

145

146 final Runtime runtime = Runtime.getRuntime();

147 final int megaUnit = 1024 * 1024;

148 printStream.printf("Final Memory: %sM/%sM%n",

149 (runtime.totalMemory() - runtime.freeMemory()) / megaUnit,

150 runtime.totalMemory() / megaUnit);

example_inl.i (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 31 lines

25

26 void vector_print(Vector *v) {

27 printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z);

28 }

29 %}