PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
#include <ctype.h>
#include <debug.h>
#include <random.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syscall.h>
Go to the source code of this file.
Functions | |
static void | init_grammar (void) |
void | expand (int num, char **grammar[], char *location[], int handle) |
static void | usage (int ret_code, const char *message,...) PRINTF_FORMAT(2 |
int | main (int argc, char *argv[]) |
Variables | |
char * | start [] |
Insult.c. More... | |
char | startLoc [] = { 3, 0, 4, 7, 16 } |
char * | adj [] = { "3", "4", "2", ",", "1" } |
char | adjLoc [] = { 3, 0, 1, 2, 5 } |
char * | adj3 [] = { "3", "4" } |
char | adj3Loc [] = { 2, 0, 1, 2 } |
char * | adj1 [] |
char | adj1Loc [] |
char * | adj2 [] |
char | adj2Loc [] |
char * | name [] |
char | nameLoc [] = { 7, 0, 1, 6, 10, 16, 21, 23, 27 } |
char * | stuff [] |
char | stuffLoc [] = { 14, 0, 1, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 15, 17, 18 } |
char * | noun_and_prep [] |
char | noun_and_prepLoc [] |
char * | organics [] |
char | organicsLoc [] |
char * | body_parts [] |
char | body_partsLoc [] = { 6, 0, 1, 2, 3, 4, 5, 6 } |
char * | noun [] |
char | nounLoc [] = { 13, 0, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15 } |
char * | animal [] |
char | animalLoc [] = { 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } |
char * | good_verb [] |
char | good_verbLoc [] = { 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11 } |
char * | curse [] |
char | curseLoc [] = { 4, 0, 3, 7, 13, 20 } |
char * | afflictors [] |
char | afflictorsLoc [] = { 6, 0, 2, 4, 6, 8, 12, 16 } |
char * | quantity [] |
char | quantityLoc [] = { 10, 0, 4, 8, 11, 14, 15, 18, 22, 26, 32, 33 } |
char * | numbers [] |
char | numbersLoc [] = { 7, 0, 2, 4, 5, 7, 8, 10, 13 } |
char * | adv [] |
char | advLoc [] = { 8, 0, 1, 2, 3, 4, 11, 12, 18, 19 } |
char * | metaphor [] |
char | metaphorLoc [] = { 6, 0, 3, 5, 7, 9, 20, 23 } |
char * | force [] = { "force", "fury", "power", "rage" } |
char | forceLoc [] = { 4, 0, 1, 2, 3, 4 } |
char * | bad_action [] |
char | bad_actionLoc [] |
char * | beasties [] |
char | beastiesLoc [] |
char * | condition [] |
char | conditionLoc [] = { 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } |
char * | place [] |
char | placeLoc [] = { 5, 0, 3, 7, 11, 17, 20 } |
char * | relation [] |
char | relationLoc [] = { 6, 0, 1, 2, 3, 5, 7, 9 } |
char * | in_something [] |
char | in_somethingLoc [] = { 8, 0, 1, 3, 4, 5, 6, 8, 9, 10 } |
char * | bad_place [] |
char | bad_placeLoc [] = { 6, 0, 2, 3, 5, 7, 8, 9 } |
char ** | daGrammar [27] |
char * | daGLoc [27] |
void expand | ( | int | num, |
char ** | grammar[], | ||
char * | location[], | ||
int | handle | ||
) |
|
static |
Definition at line 177 of file insult.c.
References adj, adj1, adj1Loc, adj2, adj2Loc, adj3, adj3Loc, adjLoc, adv, advLoc, afflictors, afflictorsLoc, animal, animalLoc, bad_action, bad_actionLoc, bad_place, bad_placeLoc, beasties, beastiesLoc, body_parts, body_partsLoc, condition, conditionLoc, curse, curseLoc, daGLoc, daGrammar, force, forceLoc, good_verb, good_verbLoc, in_something, in_somethingLoc, metaphor, metaphorLoc, name, nameLoc, noun, noun_and_prep, noun_and_prepLoc, nounLoc, numbers, numbersLoc, organics, organicsLoc, place, placeLoc, quantity, quantityLoc, relation, relationLoc, start, startLoc, stuff, and stuffLoc.
Referenced by main().
int main | ( | int argc | , |
char * | argv[] | ||
) |
Definition at line 272 of file insult.c.
References atoi(), close(), create(), daGLoc, daGrammar, EXIT_FAILURE, EXIT_SUCCESS, expand(), hprintf(), init_grammar(), NULL, open(), printf(), random_init(), STDOUT_FILENO, strcmp(), and usage().
|
static |
char* adj[] = { "3", "4", "2", ",", "1" } |
Definition at line 18 of file insult.c.
Referenced by init_grammar().
char* adj1[] |
Definition at line 22 of file insult.c.
Referenced by init_grammar().
char adj1Loc[] |
Definition at line 32 of file insult.c.
Referenced by init_grammar().
char* adj2[] |
Definition at line 36 of file insult.c.
Referenced by init_grammar().
char adj2Loc[] |
Definition at line 44 of file insult.c.
Referenced by init_grammar().
char* adj3[] = { "3", "4" } |
Definition at line 20 of file insult.c.
Referenced by init_grammar().
char adj3Loc[] = { 2, 0, 1, 2 } |
Definition at line 21 of file insult.c.
Referenced by init_grammar().
char adjLoc[] = { 3, 0, 1, 2, 5 } |
Definition at line 19 of file insult.c.
Referenced by init_grammar().
char* adv[] |
Definition at line 115 of file insult.c.
Referenced by init_grammar().
char advLoc[] = { 8, 0, 1, 2, 3, 4, 11, 12, 18, 19 } |
Definition at line 120 of file insult.c.
Referenced by init_grammar().
char* afflictors[] |
Definition at line 99 of file insult.c.
Referenced by init_grammar().
char afflictorsLoc[] = { 6, 0, 2, 4, 6, 8, 12, 16 } |
Definition at line 103 of file insult.c.
Referenced by init_grammar().
char* animal[] |
Definition at line 84 of file insult.c.
Referenced by init_grammar().
char animalLoc[] = { 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } |
Definition at line 88 of file insult.c.
Referenced by init_grammar().
char* bad_action[] |
Definition at line 129 of file insult.c.
Referenced by init_grammar().
char bad_actionLoc[] |
Definition at line 137 of file insult.c.
Referenced by init_grammar().
char* bad_place[] |
Definition at line 168 of file insult.c.
Referenced by init_grammar().
char bad_placeLoc[] = { 6, 0, 2, 3, 5, 7, 8, 9 } |
Definition at line 172 of file insult.c.
Referenced by init_grammar().
char* beasties[] |
Definition at line 140 of file insult.c.
Referenced by init_grammar().
char beastiesLoc[] |
Definition at line 146 of file insult.c.
Referenced by init_grammar().
char* body_parts[] |
Definition at line 75 of file insult.c.
Referenced by init_grammar().
char body_partsLoc[] = { 6, 0, 1, 2, 3, 4, 5, 6 } |
Definition at line 78 of file insult.c.
Referenced by init_grammar().
char* condition[] |
Definition at line 148 of file insult.c.
Referenced by init_grammar().
char conditionLoc[] = { 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } |
Definition at line 152 of file insult.c.
Referenced by init_grammar().
char* curse[] |
Definition at line 94 of file insult.c.
Referenced by init_grammar().
char curseLoc[] = { 4, 0, 3, 7, 13, 20 } |
Definition at line 98 of file insult.c.
Referenced by init_grammar().
char* daGLoc[27] |
Definition at line 174 of file insult.c.
Referenced by init_grammar(), and main().
char** daGrammar[27] |
Definition at line 173 of file insult.c.
Referenced by init_grammar(), and main().
char* force[] = { "force", "fury", "power", "rage" } |
Definition at line 127 of file insult.c.
Referenced by init_grammar().
char forceLoc[] = { 4, 0, 1, 2, 3, 4 } |
Definition at line 128 of file insult.c.
Referenced by init_grammar().
char* good_verb[] |
Definition at line 89 of file insult.c.
Referenced by init_grammar().
char good_verbLoc[] = { 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11 } |
Definition at line 93 of file insult.c.
Referenced by init_grammar().
char* in_something[] |
Definition at line 163 of file insult.c.
Referenced by init_grammar().
char in_somethingLoc[] = { 8, 0, 1, 3, 4, 5, 6, 8, 9, 10 } |
Definition at line 167 of file insult.c.
Referenced by init_grammar().
char* metaphor[] |
Definition at line 121 of file insult.c.
Referenced by init_grammar().
char metaphorLoc[] = { 6, 0, 3, 5, 7, 9, 20, 23 } |
Definition at line 126 of file insult.c.
Referenced by init_grammar().
char* name[] |
Definition at line 47 of file insult.c.
Referenced by block_get_by_name(), block_register(), dir_add(), dir_lookup(), dir_readdir(), dir_remove(), do_remove(), filesys_create(), filesys_open(), filesys_remove(), found_partition(), fsutil_ls(), getcwd(), init_grammar(), init_pool(), init_thread(), intr_register_ext(), intr_register_int(), list_dir(), lookup(), main(), parse_options(), readdir(), register_handler(), run_actions(), run_test(), test_main(), test_mlfqs_fair(), test_sleep(), thread_create(), and wrap_open().
char nameLoc[] = { 7, 0, 1, 6, 10, 16, 21, 23, 27 } |
Definition at line 52 of file insult.c.
Referenced by init_grammar().
char* noun[] |
Definition at line 79 of file insult.c.
Referenced by init_grammar().
char* noun_and_prep[] |
Definition at line 59 of file insult.c.
Referenced by init_grammar().
char noun_and_prepLoc[] |
Definition at line 65 of file insult.c.
Referenced by init_grammar().
char nounLoc[] = { 13, 0, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15 } |
Definition at line 83 of file insult.c.
Referenced by init_grammar().
char* numbers[] |
Definition at line 110 of file insult.c.
Referenced by init_grammar().
char numbersLoc[] = { 7, 0, 2, 4, 5, 7, 8, 10, 13 } |
Definition at line 114 of file insult.c.
Referenced by init_grammar().
char* organics[] |
Definition at line 68 of file insult.c.
Referenced by init_grammar().
char organicsLoc[] |
Definition at line 73 of file insult.c.
Referenced by init_grammar().
char* place[] |
Definition at line 153 of file insult.c.
Referenced by init_grammar().
char placeLoc[] = { 5, 0, 3, 7, 11, 17, 20 } |
Definition at line 157 of file insult.c.
Referenced by init_grammar().
char* quantity[] |
Definition at line 104 of file insult.c.
Referenced by init_grammar().
char quantityLoc[] = { 10, 0, 4, 8, 11, 14, 15, 18, 22, 26, 32, 33 } |
Definition at line 109 of file insult.c.
Referenced by init_grammar().
char* relation[] |
Definition at line 158 of file insult.c.
Referenced by init_grammar().
char relationLoc[] = { 6, 0, 1, 2, 3, 5, 7, 9 } |
Definition at line 162 of file insult.c.
Referenced by init_grammar().
char* start[] |
This is a version of the famous CS 107 random sentence generator. I wrote a program that reads a grammar definition file and writes a C file containing that grammar as hard code static C strings. Thus the majority of the code below in machine generated and totally unreadable. The arrays created are specially designed to make generating the sentences as easy as possible.
Originally by Greg Hutchins, March 1998. Modified by Ben Pfaff for Pintos, Sept 2004.
Definition at line 13 of file insult.c.
Referenced by bitmap_all(), bitmap_any(), bitmap_contains(), bitmap_count(), bitmap_none(), bitmap_scan(), bitmap_scan_and_flip(), bitmap_set_multiple(), found_partition(), hex_dump(), init_grammar(), test_main(), timer_sleep(), and too_many_loops().
char startLoc[] = { 3, 0, 4, 7, 16 } |
Definition at line 17 of file insult.c.
Referenced by init_grammar().
char* stuff[] |
Definition at line 53 of file insult.c.
Referenced by init_grammar().
char stuffLoc[] = { 14, 0, 1, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 15, 17, 18 } |
Definition at line 58 of file insult.c.
Referenced by init_grammar().